From 8520b255a3574791a72f9ed11c70aa2b0fc84587 Mon Sep 17 00:00:00 2001 From: Aden Lindsay Date: Sat, 15 Feb 2025 16:41:32 +1030 Subject: [PATCH] style(library): Re-designed Library UI with new features --- components/GameStatusButton.vue | 28 +-- components/LibrarySearch.vue | 137 ++++++++++++++ pages/library.vue | 81 ++------ pages/library/[id]/index.vue | 323 ++++++++++++++++++++++++++++---- pages/library/index.vue | 23 ++- src-tauri/src/games/library.rs | 1 + types.ts | 1 + 7 files changed, 483 insertions(+), 111 deletions(-) create mode 100644 components/LibrarySearch.vue diff --git a/components/GameStatusButton.vue b/components/GameStatusButton.vue index d9722d2..3646850 100644 --- a/components/GameStatusButton.vue +++ b/components/GameStatusButton.vue @@ -12,7 +12,8 @@
@@ -25,10 +26,11 @@ class="absolute right-0 z-50 mt-2 w-32 origin-top-right rounded-md bg-zinc-900 shadow-lg ring-1 ring-zinc-100/5 focus:outline-none">
- +
@@ -63,14 +65,14 @@ const emit = defineEmits<{ const showDropdown = computed(() => props.status.type === GameStatusEnum.Installed || props.status.type === GameStatusEnum.SetupRequired); const styles: { [key in GameStatusEnum]: string } = { - [GameStatusEnum.Remote]: "bg-blue-600 text-white hover:bg-blue-500 focus-visible:outline-blue-600", - [GameStatusEnum.Queued]: "bg-zinc-800 text-white hover:bg-zinc-700 focus-visible:outline-zinc-700", - [GameStatusEnum.Downloading]: "bg-zinc-800 text-white hover:bg-zinc-700 focus-visible:outline-zinc-700", - [GameStatusEnum.SetupRequired]: "bg-yellow-600 text-white hover:bg-yellow-500 focus-visible:outline-yellow-600", - [GameStatusEnum.Installed]: "bg-green-600 text-white hover:bg-green-500 focus-visible:outline-green-600", - [GameStatusEnum.Updating]: "bg-zinc-800 text-white hover:bg-zinc-700 focus-visible:outline-zinc-700", - [GameStatusEnum.Uninstalling]: "bg-zinc-800 text-white hover:bg-zinc-700 focus-visible:outline-zinc-700", - [GameStatusEnum.Running]: "bg-zinc-800 text-white focus-visible:outline-zinc-700" + [GameStatusEnum.Remote]: "bg-blue-600 text-white hover:bg-blue-500 focus-visible:outline-blue-600 hover:bg-blue-500", + [GameStatusEnum.Queued]: "bg-zinc-800 text-white hover:bg-zinc-700 focus-visible:outline-zinc-700 hover:bg-zinc-700", + [GameStatusEnum.Downloading]: "bg-zinc-800 text-white hover:bg-zinc-700 focus-visible:outline-zinc-700 hover:bg-zinc-700", + [GameStatusEnum.SetupRequired]: "bg-yellow-600 text-white hover:bg-yellow-500 focus-visible:outline-yellow-600 hover:bg-yellow-500", + [GameStatusEnum.Installed]: "bg-green-600 text-white hover:bg-green-500 focus-visible:outline-green-600 hover:bg-green-500", + [GameStatusEnum.Updating]: "bg-zinc-800 text-white hover:bg-zinc-700 focus-visible:outline-zinc-700 hover:bg-zinc-700", + [GameStatusEnum.Uninstalling]: "bg-zinc-800 text-white hover:bg-zinc-700 focus-visible:outline-zinc-700 hover:bg-zinc-700", + [GameStatusEnum.Running]: "bg-zinc-800 text-white hover:bg-zinc-700 focus-visible:outline-zinc-700 hover:bg-zinc-700" }; const buttonNames: { [key in GameStatusEnum]: string } = { diff --git a/components/LibrarySearch.vue b/components/LibrarySearch.vue new file mode 100644 index 0000000..b437804 --- /dev/null +++ b/components/LibrarySearch.vue @@ -0,0 +1,137 @@ + + + + + \ No newline at end of file diff --git a/pages/library.vue b/pages/library.vue index ab5079a..e0abafb 100644 --- a/pages/library.vue +++ b/pages/library.vue @@ -1,78 +1,35 @@ -async function calculateGames(): Promise { - try { - return await invoke("fetch_library"); - } - catch(e) { - libraryDownloadError = true; - return new Array(); - } + diff --git a/pages/library/[id]/index.vue b/pages/library/[id]/index.vue index 539ec61..4d094ae 100644 --- a/pages/library/[id]/index.vue +++ b/pages/library/[id]/index.vue @@ -1,41 +1,169 @@ + + +
+
+ + + + + + + + + +
+

+ {{ currentImageIndex + 1 }} / {{ mediaUrls.length }} +

+
+
+
+
+ + diff --git a/pages/library/index.vue b/pages/library/index.vue index dd245b6..e95d9dc 100644 --- a/pages/library/index.vue +++ b/pages/library/index.vue @@ -1,9 +1,24 @@ - \ No newline at end of file +
+
+
+
+ +
+
+

Select a game

+

Choose a game from your library to view details

+
+
+
+
+ + \ No newline at end of file diff --git a/src-tauri/src/games/library.rs b/src-tauri/src/games/library.rs index b2f2fe2..4eda534 100644 --- a/src-tauri/src/games/library.rs +++ b/src-tauri/src/games/library.rs @@ -36,6 +36,7 @@ pub struct Game { m_banner_id: String, m_cover_id: String, m_image_library: Vec, + m_image_carousel: Vec, } #[derive(serde::Serialize, Clone)] pub struct GameUpdateEvent { diff --git a/types.ts b/types.ts index 60a5b23..0533cfd 100644 --- a/types.ts +++ b/types.ts @@ -34,6 +34,7 @@ export type Game = { mBannerId: string; mCoverId: string; mImageLibrary: string[]; + mImageCarousel: string[]; }; export enum AppStatus {