Skip to content

Commit

Permalink
✨ Sort by name descending
Browse files Browse the repository at this point in the history
  • Loading branch information
vassbo committed Dec 5, 2024
1 parent 6d717f6 commit 7f01a53
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions public/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,7 @@
"sort": {
"sort_by": "Sort by",
"name": "Name",
"name_des": "Name Descending",
"date": "Date",
"size": "Size",
"type": "Type",
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/components/context/loadItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,11 @@ function sortItems(items: ContextMenuItem[], id: "projects" | "shows") {

items = [
{ id: "name", label: "sort.name", icon: "text", enabled: type === "name" },
{ id: "name_des", label: "sort.name_des", icon: "text", enabled: type === "name_des" },
{ id: "created", label: "info.created", icon: "calendar", enabled: type === "created" },
{ id: "modified", label: "info.modified", icon: "calendar", enabled: type === "modified" },
]
if (id === "shows") {
items.push({ id: "modified", label: "info.modified", icon: "calendar", enabled: type === "modified" })
items.push({ id: "used", label: "info.used", icon: "calendar", enabled: type === "used" })

// WIP load used metadata values...
Expand Down
1 change: 1 addition & 0 deletions src/frontend/components/helpers/show.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export function updateShowsList(shows: Shows) {
} else {
// sort by name
sortedShows = sortByNameAndNumber(showsList)
if (sortType === "name_des") sortedShows = sortedShows.reverse()
}

let filteredShows: ShowList[] = removeValues(sortedShows, "private", true)
Expand Down
5 changes: 5 additions & 0 deletions src/frontend/components/show/Projects.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
if (sortType === "created") {
sortedFolders = sortedFolders.sort((a, b) => (b.created || 0) - (a.created || 0))
sortedProjects = sortedProjects.sort((a, b) => (b.created || 0) - (a.created || 0))
} else if (sortType === "modified") {
sortedProjects = sortedProjects.sort((a, b) => (b.modified || 0) - (a.modified || 0))
} else if (sortType === "name_des") {
sortedFolders = sortedFolders.reverse()
sortedProjects = sortedProjects.reverse()
}
tree = [...sortedFolders, ...sortedProjects]
Expand Down

0 comments on commit 7f01a53

Please sign in to comment.