From 5f056308c22f7324d4bc6d2beca05d026066f7c3 Mon Sep 17 00:00:00 2001 From: Marcel <79279756+aofn@users.noreply.github.com> Date: Sat, 25 Nov 2023 18:40:40 +0100 Subject: [PATCH 1/5] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d95a3ac..10e2632 100644 --- a/README.md +++ b/README.md @@ -57,9 +57,9 @@ _Important: If you delete this file, all notes and tags of this project will be So far the application has only been tested on macOS Sonoma! -🍏 [Download for macOS](https://github.com/aofn/Ableton-Live-Manager/releases/download/app-v0.6.0/Ableton.Live.Manager_0.6.0_x64.dmg) +🍏 [Download for macOS](https://github.com/aofn/Ableton-Live-Manager/releases/download/app-v0.6.2b/Ableton.Live.Manager_0.6.2b_x64.dmg) -🪟 [Download for Windows](https://github.com/aofn/Ableton-Live-Manager/releases/download/app-v0.6.0/Ableton.Live.Manager_0.6.0_x64_en-US.msi) +🪟 [Download for Windows](https://github.com/aofn/Ableton-Live-Manager/releases/download/app-v0.6.2b/Ableton.Live.Manager_0.6.2b_x64_en-US.msi) You can find all releases here: https://github.com/aofn/Ableton-Live-Manager/releases/tag/app-v0.6.0 From 98efdd24bfb37a4bfe3f1783b7971241a72088f2 Mon Sep 17 00:00:00 2001 From: Marcel <79279756+aofn@users.noreply.github.com> Date: Sun, 3 Dec 2023 15:05:10 +0100 Subject: [PATCH 2/5] feat: add sort by functionality to sort projects by tags or by name. --- src/app/page.js | 44 ++++++++++++++++++++++++++++++++++- src/components/Notes.js | 8 +++---- src/components/ProjectItem.js | 23 +----------------- 3 files changed, 47 insertions(+), 28 deletions(-) diff --git a/src/app/page.js b/src/app/page.js index d3641cc..5f5035f 100644 --- a/src/app/page.js +++ b/src/app/page.js @@ -23,6 +23,7 @@ import { import { cn } from "@/lib/utils"; import { badgeVariants } from "@/components/ui/badge"; import "remixicon/fonts/remixicon.css"; +import _ from "lodash"; /** * Displays a progress bar while scanning the project directory. @@ -63,6 +64,7 @@ export default function Home() { const [config, setConfig] = useState({}); const [filterByTags, setFilterByTags] = useState([]); const [collapseAll, setCollapseAll] = useState(true); + const [sortMethod, setSortMethod] = useState([]); const { t } = useTranslation(); const colourStyles = { option: (styles, { data, isDisabled, isFocused, isSelected }) => ({ @@ -119,7 +121,6 @@ export default function Home() { entries.splice(i, 1); continue; } - if (entry.children) { for (let [i, child] of entry.children.entries()) { const isFile = await invoke("is_file", { path: child.path }).catch( @@ -127,6 +128,13 @@ export default function Home() { entry.children.splice(i, 1); }, ); + // look for existing alm.json file + if (child.path.endsWith("alm.json")) { + // add apm object to entry + const almFile = await readTextFile(child.path); + const almJson = JSON.parse(almFile); + entry.alm = almJson; + } if (child.path.endsWith(".als")) { setCurrentScanPath(child.name); @@ -162,6 +170,26 @@ export default function Home() { getConfig(); }, []); + // sort function to sort directoryEntries by tags within alm.tags key if alm key exists + const sortByTags = (a, b) => { + const aTags = a.alm?.tags ? Object.values(a.alm.tags) : []; + const bTags = b.alm?.tags ? Object.values(b.alm.tags) : []; + + const sortedATags = _.sortBy(aTags, ["value", "label"]); + const sortedBTags = _.sortBy(bTags, ["value", "label"]); + + const aTagsString = sortedATags.map((tag) => tag.value).join(""); + const bTagsString = sortedBTags.map((tag) => tag.value).join(""); + + // * -1 reverses order so tags are on top of list + return aTagsString.localeCompare(bTagsString) * -1; + }; + + // sort projects by name + const sortByName = (a, b) => { + return _.sortBy([a, b], ["name"]); + }; + if (displayProgress) return ( +