From eea8f82bf929e455ec2a97952103e417a96b7f6e 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... --- components/AddLibraryButton.vue | 143 ++-- components/CreateCollectionModal.vue | 118 ++++ components/DeleteCollectionModal.vue | 88 +++ pages/library.vue | 153 +++++ pages/library/collection/[id]/index.vue | 119 ++++ pages/library/game/[id]/index.vue | 258 ++++++++ pages/library/index.vue | 620 ++++++++++++++++++ pages/store/[id]/index.vue | 140 +++- pages/store/index.vue | 190 +++++- server/api/v1/collection/[id]/entry.delete.ts | 19 +- server/api/v1/collection/[id]/entry.post.ts | 21 +- server/api/v1/collection/[id]/index.delete.ts | 28 +- server/api/v1/collection/[id]/index.get.ts | 16 + .../api/v1/collection/default/entry.post.ts | 15 +- server/api/v1/collection/index.post.ts | 5 +- server/internal/userlibrary/index.ts | 8 +- 16 files changed, 1844 insertions(+), 97 deletions(-) create mode 100644 components/CreateCollectionModal.vue create mode 100644 components/DeleteCollectionModal.vue create mode 100644 pages/library.vue create mode 100644 pages/library/collection/[id]/index.vue create mode 100644 pages/library/game/[id]/index.vue create mode 100644 pages/library/index.vue diff --git a/components/AddLibraryButton.vue b/components/AddLibraryButton.vue index 3b822f8..da86562 100644 --- a/components/AddLibraryButton.vue +++ b/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/components/CreateCollectionModal.vue b/components/CreateCollectionModal.vue new file mode 100644 index 0000000..bfbc8e8 --- /dev/null +++ b/components/CreateCollectionModal.vue @@ -0,0 +1,118 @@ + + + + + + + + + + + + + Create Collection + + + + + + + + Cancel + + + Create + + + + + + + + + + + diff --git a/components/DeleteCollectionModal.vue b/components/DeleteCollectionModal.vue new file mode 100644 index 0000000..41673a8 --- /dev/null +++ b/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/pages/library.vue b/pages/library.vue new file mode 100644 index 0000000..6539456 --- /dev/null +++ b/pages/library.vue @@ -0,0 +1,153 @@ + + + + + + + Your Library + + + + + + + + + + + + + + + {{ game.mName }} + + + + + + + + No games in library + + + + + + + + + + + + + + diff --git a/pages/library/collection/[id]/index.vue b/pages/library/collection/[id]/index.vue new file mode 100644 index 0000000..88c5bc6 --- /dev/null +++ b/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/pages/library/game/[id]/index.vue b/pages/library/game/[id]/index.vue new file mode 100644 index 0000000..a28c2a0 --- /dev/null +++ b/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/pages/library/index.vue b/pages/library/index.vue new file mode 100644 index 0000000..a58343d --- /dev/null +++ b/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/pages/store/[id]/index.vue b/pages/store/[id]/index.vue index 37a76ee..2b4f91e 100644 --- a/pages/store/[id]/index.vue +++ b/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. +