From 58a73ff8bca0711c43ac355ff3f26c36cf80db8f Mon Sep 17 00:00:00 2001 From: Michael Pivato Date: Sun, 9 Jun 2024 12:14:06 +0930 Subject: [PATCH] Remove unnecessarily styling, fix file sorting --- src-tauri/src/main.rs | 4 +--- src/app/app.component.ts | 43 ++++++---------------------------------- src/styles.scss | 9 ++++++++- 3 files changed, 15 insertions(+), 41 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 4d65897..5726066 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -1,9 +1,7 @@ // Prevents additional console window on Windows in release, DO NOT REMOVE!! #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] -use std::any::Any; - -use tauri::{AboutMetadata, CustomMenuItem, Menu, MenuEntry, MenuItem, Submenu}; +use tauri::{AboutMetadata, CustomMenuItem, Menu, MenuItem, Submenu}; #[derive(Clone, serde::Serialize)] struct OpenFolderMessage {} diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 89da95e..4045cb9 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -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; } diff --git a/src/styles.scss b/src/styles.scss index ac94bab..591a754 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -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;