From 83ffb7f34f308203c3f30fbf74574bba5aed12ca Mon Sep 17 00:00:00 2001 From: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com> Date: Mon, 27 Jan 2025 11:15:09 +1030 Subject: [PATCH] squash: AdenMGB collection design & backend work Update index.post.ts to implement saving collections functionality Update index.get.ts to verify if collection exists and if user can access it Update index.delete.ts to ask questions and not be so nonchalant Update entry.post.ts Update entry.delete.ts to do it better Update index.vue to add functionality to the add to library button + fidgit with image Update index.vue to also add add to library functionality, but no fidget :( Update entry.post.ts to infact not remove it Update index.ts Update index.vue to manage collections from store page Update index.ts to restrut for ahhhh Update index.vue too add collection control to carosel Update index.vue fix minor issue Update index.vue to fix dropdown modal bug Create library.vue for page layout Create index.vue for library game details pane Create index.vue for viewing collections pane Create DeleteCollectionModal.vue component Create CreateCollectionModal.vue component Update AddLibraryButton.vue with dropdown :D Update index.vue to use new components Update index.vue for more components :O Update entry.post.ts to not not return success, it'll figure it out Update entry.delete.ts to not return... --- server/components/AddLibraryButton.vue | 143 ++-- server/components/CreateCollectionModal.vue | 118 ++++ server/components/DeleteCollectionModal.vue | 88 +++ server/pages/library.vue | 153 +++++ .../pages/library/collection/[id]/index.vue | 119 ++++ server/pages/library/game/[id]/index.vue | 258 ++++++++ server/pages/library/index.vue | 620 ++++++++++++++++++ server/pages/store/[id]/index.vue | 140 +++- server/pages/store/index.vue | 190 +++++- .../api/v1/collection/[id]/entry.delete.ts | 19 +- .../api/v1/collection/[id]/entry.post.ts | 21 +- .../api/v1/collection/[id]/index.delete.ts | 28 +- .../api/v1/collection/[id]/index.get.ts | 16 + .../api/v1/collection/default/entry.post.ts | 15 +- server/server/api/v1/collection/index.post.ts | 5 +- server/server/internal/userlibrary/index.ts | 8 +- 16 files changed, 1844 insertions(+), 97 deletions(-) create mode 100644 server/components/CreateCollectionModal.vue create mode 100644 server/components/DeleteCollectionModal.vue create mode 100644 server/pages/library.vue create mode 100644 server/pages/library/collection/[id]/index.vue create mode 100644 server/pages/library/game/[id]/index.vue create mode 100644 server/pages/library/index.vue diff --git a/server/components/AddLibraryButton.vue b/server/components/AddLibraryButton.vue index 3b822f89..da865621 100644 --- a/server/components/AddLibraryButton.vue +++ b/server/components/AddLibraryButton.vue @@ -1,23 +1,34 @@ - + - Add to Library - + {{ isProcessing + ? 'Processing...' + : isInLibrary + ? 'Remove from Library' + : 'Add to Library' + }} + - - - - - - + + + + + + - - - - + + Collections + + No custom collections available + + + Account settings + {{ collection.name }} + + - - Support + - - - License - - - - - Sign out - - - + + Add to new collection + + @@ -90,6 +77,28 @@ diff --git a/server/components/CreateCollectionModal.vue b/server/components/CreateCollectionModal.vue new file mode 100644 index 00000000..bfbc8e8c --- /dev/null +++ b/server/components/CreateCollectionModal.vue @@ -0,0 +1,118 @@ + + + + + + + + + + + + + Create Collection + + + + + + + + Cancel + + + Create + + + + + + + + + + + diff --git a/server/components/DeleteCollectionModal.vue b/server/components/DeleteCollectionModal.vue new file mode 100644 index 00000000..41673a81 --- /dev/null +++ b/server/components/DeleteCollectionModal.vue @@ -0,0 +1,88 @@ + + + + + + + + + + + + + Delete Collection + + + + Are you sure you want to delete "{{ collection?.name }}"? This action cannot be undone. + + + + + Cancel + + + Delete + + + + + + + + + + + diff --git a/server/pages/library.vue b/server/pages/library.vue new file mode 100644 index 00000000..6539456a --- /dev/null +++ b/server/pages/library.vue @@ -0,0 +1,153 @@ + + + + + + + Your Library + + + + + + + + + + + + + + + {{ game.mName }} + + + + + + + + No games in library + + + + + + + + + + + + + + diff --git a/server/pages/library/collection/[id]/index.vue b/server/pages/library/collection/[id]/index.vue new file mode 100644 index 00000000..88c5bc6a --- /dev/null +++ b/server/pages/library/collection/[id]/index.vue @@ -0,0 +1,119 @@ + + + + + + + Back to Collections + + + + {{ collection?.name }} + + + {{ collection?.entries?.length || 0 }} games + + + + + + + + + + + + + + + + + {{ entry.game.mName }} + + + {{ entry.game.mShortDescription }} + + + + + + + + + + + + + + + + diff --git a/server/pages/library/game/[id]/index.vue b/server/pages/library/game/[id]/index.vue new file mode 100644 index 00000000..a28c2a0f --- /dev/null +++ b/server/pages/library/game/[id]/index.vue @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + Back to Collections + + + + + + + + {{ game.mName }} + + + {{ game.mShortDescription }} + + + + + Open in Launcher + + + + Add to Collection + + + + View in Store + + + + + + + + + + + + + + + + + + + + + + + + Add to Collection + + + + + {{ collection.name }} + + {{ collection._count?.entries || 0 }} games + + + + + + No collections available. Create one first! + + + + + + Close + + + + + + + + + + + + + diff --git a/server/pages/library/index.vue b/server/pages/library/index.vue new file mode 100644 index 00000000..a58343d4 --- /dev/null +++ b/server/pages/library/index.vue @@ -0,0 +1,620 @@ + + + + + + + Your Library + + + + + + + + + + + + + + + {{ game.mName }} + + + + + + + + No games in library + + + + + + + + + + + + + + + + + + + + + Back to Collections + + + + + + + + {{ selectedGame.mName }} + + + {{ selectedGame.mShortDescription }} + + + + + Open in Launcher + + + + Add to Collection + + + + View in Store + + + + + + + + + + + + + Back to Collections + + + + {{ selectedCollection.name }} + + + {{ selectedCollection.entries?.length || 0 }} games + + + + + + + + + + + + + + + + + {{ game.mName }} + + + {{ game.mShortDescription }} + + + + + + + + + + + + + + + Your Collections + + + Organize your games into collections for easy access. + + + + + + + + + + {{ collection.name }} + + + {{ collection._count?.entries || 0 }} games + + + + + + + + + + + + + + + + Create Collection + + + + Add a new collection to organize your games + + + + + + + + + + + + + + + + + + + + Create New Collection + + + + + + + Cancel + + + Create + + + + + + + + + + + + + + + + + + + + Delete Collection + + + + Are you sure you want to delete "{{ collectionToDelete?.name }}"? This action cannot be undone. + + + + + Cancel + + + Delete + + + + + + + + + + + + + + + + + + + + + + Add to Collection + + + + + {{ collection.name }} + + {{ collection._count?.entries || 0 }} games + + + + + + No collections available. Create one first! + + + + + + Close + + + + + + + + + + + + + diff --git a/server/pages/store/[id]/index.vue b/server/pages/store/[id]/index.vue index 37a76ee6..2b4f91e3 100644 --- a/server/pages/store/[id]/index.vue +++ b/server/pages/store/[id]/index.vue @@ -30,13 +30,18 @@ class="transition-all duration-300 hover:scale-105 hover:rotate-[-1deg] w-64 h-auto rounded" :src="useObject(game.mCoverId)" /> - - Add to Library - - + + + + + + + + +
+ Are you sure you want to delete "{{ collection?.name }}"? This action cannot be undone. +
+ {{ game.mName }} +
+ No games in library +
+ {{ collection?.entries?.length || 0 }} games +
+ {{ entry.game.mShortDescription }} +
+ {{ game.mShortDescription }} +
+ No collections available. Create one first! +
+ {{ selectedGame.mShortDescription }} +
+ {{ selectedCollection.entries?.length || 0 }} games +
+ Organize your games into collections for easy access. +
+ {{ collection._count?.entries || 0 }} games +
+ Add a new collection to organize your games +
+ Are you sure you want to delete "{{ collectionToDelete?.name }}"? This action cannot be undone. +