Remove unnecessarily styling, fix file sorting

This commit is contained in:
Michael Pivato
2024-06-09 12:14:06 +09:30
parent ecdd4f7080
commit 58a73ff8bc
3 changed files with 15 additions and 41 deletions

View File

@@ -1,11 +1,5 @@
import { CommonModule } from '@angular/common';
import {
ChangeDetectorRef,
Component,
OnDestroy,
OnInit,
signal,
} from '@angular/core';
import { Component, signal } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatSidenavModule } from '@angular/material/sidenav';
import { RouterOutlet } from '@angular/router';
@@ -86,37 +80,12 @@ export class AppComponent {
return {
isDirectory: entry.children != null,
name: entry.name || '',
children: entry.children?.map((entry) =>
this.mapEntry(entry, splitNumbers)
),
children: entry.children
?.sort(this.sortFiles(splitNumbers))
.map((entry) => this.mapEntry(entry, splitNumbers)),
};
}
private sortFiles =
(splitNumbers: RegExp) => (a: FileEntry, b: FileEntry) => {
return a.name?.localeCompare(b.name ?? '') ?? 0;
// if (!a.name) {
// return -1;
// }
// if (!b.name) {
// return 1;
// }
// const aSplit = splitNumbers.exec(a.name);
// const bSplit = splitNumbers.exec(b.name);
// if (!aSplit) {
// return -1;
// }
// if (!bSplit) {
// return 1;
// }
// for (
// let i = 0;
// i < (aSplit.length > bSplit.length ? bSplit.length : aSplit.length);
// i++
// ) {}
// // TODO: Alternative is to iterate through characters in the strings to find numbers, if there isn't a number then return
// // locale compare?
// // TODO: finish this
// return 0;
};
private sortFiles = (splitNumbers: RegExp) => (a: FileEntry, b: FileEntry) =>
a.name?.localeCompare(b.name ?? '') ?? 0;
}

View File

@@ -10,7 +10,13 @@
}
html {
@include mat.all-component-themes(theme.$rose-theme);
@include mat.core-theme(theme.$rose-theme);
@include mat.toolbar-theme(theme.$rose-theme);
@include mat.button-theme(theme.$rose-theme);
@include mat.tree-theme(theme.$rose-theme);
@include mat.sidenav-theme(theme.$rose-theme);
@include mat.icon-theme(theme.$rose-theme);
@include mat.form-field-theme(theme.$rose-theme);
@include custom-colours(theme.$rose-theme);
}
@@ -20,6 +26,7 @@ body {
}
body {
margin: 0;
font-family: "Roboto";
--mat-tree-node-min-height: 24px;
--mat-tree-node-text-size: 14px;
--mdc-icon-button-state-layer-size: 24px;