Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
aofn committed Dec 11, 2023
2 parents 0357c15 + 72527f5 commit 37fc68e
Show file tree
Hide file tree
Showing 23 changed files with 52 additions and 52 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file modified src-tauri/icons/128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square107x107Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square142x142Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square150x150Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square284x284Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square30x30Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square310x310Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square44x44Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square71x71Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/Square89x89Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/ableton-peroject-manager-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src-tauri/icons/icon.icns
Binary file not shown.
Binary file modified src-tauri/icons/icon.ico
Binary file not shown.
Binary file modified src-tauri/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 43 additions & 1 deletion src/app/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 }) => ({
Expand Down Expand Up @@ -119,14 +121,20 @@ 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(
() => {
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);
Expand Down Expand Up @@ -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 (
<ProgressBar
Expand Down Expand Up @@ -205,6 +233,19 @@ export default function Home() {
placeholder={t("Filter by tag")}
options={config.tags ? Object.values(config.tags) : []}
/>
<Select
onChange={setSortMethod}
value={sortMethod}
className="my-react-select-container rounded-none border-0 basic-multi-select m-1 min-w-[180px] w-200"
classNames={reactSelectClassNames}
classNamePrefix="my-react-select"
styles={colourStyles}
placeholder={t("Sort by")}
options={[
{ value: "name", label: "Name" },
{ value: "tags", label: "Tags" },
]}
/>
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
Expand All @@ -227,6 +268,7 @@ export default function Home() {
.filter((entry) =>
entry.name.toLowerCase().includes(filterInput.toLowerCase()),
)
.sort(sortMethod.value === "name" ? sortByName : sortByTags)
.map((entry) => {
return (
<ProjectItem
Expand Down
10 changes: 1 addition & 9 deletions src/components/Editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,13 @@ import "./styles.scss";
import { Color } from "@tiptap/extension-color";
import ListItem from "@tiptap/extension-list-item";
import TextStyle from "@tiptap/extension-text-style";
import {
BubbleMenu,
EditorContent,
EditorProvider,
FloatingMenu,
useCurrentEditor,
useEditor,
} from "@tiptap/react";
import { EditorProvider, useCurrentEditor } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
import React from "react";
import { Button } from "@/components/ui/button";

import Placeholder from "@tiptap/extension-placeholder";
import { Image } from "@tiptap/extension-image";
import { LoadingSpinner } from "@/components/ui/loading-spinner";

//@TODO Headlines not working for some reason.
const EditorButton = ({
Expand Down
13 changes: 5 additions & 8 deletions src/components/Notes.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
"use client";

import { useTranslation } from "react-i18next";
import React, { useEffect, useState } from "react";
import Editor from "@/components/Editor/Editor";
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import { writeTextFile } from "@tauri-apps/api/fs";

const Notes = ({ projectDirectory, projectNotesPath, almFile, setAlmFile }) => {
const { t } = useTranslation();
const [notes, setNotes] = useState({});
const Notes = ({ projectDirectory, almFile, setAlmFile }) => {
const [notes, setNotes] = useState(almFile?.notes || "");
const [loading, setLoading] = useState(false);

useEffect(() => {
Expand All @@ -20,16 +18,15 @@ const Notes = ({ projectDirectory, projectNotesPath, almFile, setAlmFile }) => {
}
setLoading(false);
};
if (projectNotesPath && isMounted) getNotes();
if (almFile && isMounted) getNotes();

return () => {
isMounted = false;
};
}, [projectNotesPath, almFile]);
}, [almFile]);

const onSave = async (editedNote) => {
// if no changes have been made we don't want to do anything
console.log(editedNote);
if (editedNote === notes) return;
setNotes(editedNote);
const copyAlm = { ...almFile };
Expand All @@ -47,7 +44,7 @@ const Notes = ({ projectDirectory, projectNotesPath, almFile, setAlmFile }) => {
<LoadingSpinner />
) : (
<>
<Editor onSave={onSave} content={almFile.notes} />
<Editor onSave={onSave} content={notes} />
</>
)}
</>
Expand Down
31 changes: 1 addition & 30 deletions src/components/ProjectItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { useTranslation } from "react-i18next";

import { Separator } from "@/components/ui/separator";
import FolderView from "@/components/FolderView";
import { readTextFile } from "@tauri-apps/api/fs";
import { Tags } from "@/components/Tags";
import { RightColumn } from "@/components/RightColumn";
import {
Expand Down Expand Up @@ -43,13 +42,11 @@ export default function ProjectItem({
filterByTags,
config,
setConfig,
setProjectDirectory,
setFilterByTags,
collapseAll,
}) {
const [openDetails, setOpenDetails] = useState(false);
const { t } = useTranslation();
const [projectNotesPath, setProjectNotesPath] = useState("");
const [almFile, setAlmFile] = useState({});
const [isAccordionOpen, setIsAccordionOpen] = useState("open");

Expand All @@ -59,27 +56,7 @@ export default function ProjectItem({

useEffect(() => {
if (project) {
// search for notes and alm.json within project folder
if (project.children) {
const notes = project.children.filter((child) =>
child.name.endsWith(".md"),
);
if (notes.length > 0) setProjectNotesPath(notes[0].path);
}
const getAlmFile = async () => {
console.log("reading alm file");
const readFile = await readTextFile(project.path + "/alm.json").catch(
(error) => {
if (!error.includes("os error 2")) {
console.log(error);
}
},
);

if (!readFile) return;
setAlmFile(JSON.parse(readFile));
};
getAlmFile();
setAlmFile(project.alm);
}
}, [project]);

Expand Down Expand Up @@ -169,20 +146,14 @@ export default function ProjectItem({
<FolderView
project={project}
almFile={almFile}
setAlmFile={setAlmFile}
projectNotesPath={projectNotesPath}
handleOpenProject={handleOpenProject}
openDetails={openDetails}
setOpenDetails={setOpenDetails}
setProjectDirectory={setProjectDirectory}
/>
<RightColumn
openDetails={openDetails}
name={project.name}
almFile={almFile}
setAlmFile={setAlmFile}
projectDirectory={project.path}
projectNotesPath={projectNotesPath}
setOpenDetails={setOpenDetails}
/>
</section>
Expand Down
2 changes: 0 additions & 2 deletions src/components/RightColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import Notes from "@/components/Notes";
*/
export const RightColumn = ({
projectDirectory,
projectNotesPath,
name,
openDetails,
setOpenDetails,
Expand All @@ -39,7 +38,6 @@ export const RightColumn = ({
) : (
<Notes
projectDirectory={projectDirectory}
projectNotesPath={projectNotesPath}
almFile={almFile}
setAlmFile={setAlmFile}
/>
Expand Down

0 comments on commit 37fc68e

Please sign in to comment.