From 8ea33c56b972f0b548990536017cd08edd90748c Mon Sep 17 00:00:00 2001 From: Nick Kosarev Date: Wed, 18 Dec 2024 17:20:55 +0000 Subject: [PATCH] feat: simple shop page --- apps/telegram-game/auto-imports.d.ts | 1 + apps/telegram-game/components.d.ts | 4 ++ apps/telegram-game/public/coin-small.png | Bin 0 -> 475 bytes apps/telegram-game/public/coin.png | Bin 0 -> 691 bytes apps/telegram-game/public/coupon-small.png | Bin 0 -> 553 bytes .../src/components/ActiveCard.vue | 15 ++++ apps/telegram-game/src/components/Button.vue | 15 ++++ .../components/CharacterActivationBlock.vue | 28 ++++++++ apps/telegram-game/src/components/Game.vue | 4 +- .../src/components/GameNavigator.vue | 4 +- apps/telegram-game/src/components/Modal.vue | 26 +++---- .../src/components/SectionHeader.vue | 9 +++ .../src/composables/useCharacters.ts | 8 +++ .../src/composables/useTelegramProfile.ts | 21 +++--- .../telegram-game/src/views/InventoryView.vue | 16 ++--- apps/telegram-game/src/views/QuestView.vue | 5 +- apps/telegram-game/src/views/ShopView.vue | 66 +++++++++++++++++- .../index.get.ts} | 6 +- .../character/[characterId]/activate.get.ts | 37 ++++++++++ .../{[id].get.ts => [profileId]/index.get.ts} | 0 .../server/api/telegram/profile/index.post.ts | 27 ------- 21 files changed, 219 insertions(+), 73 deletions(-) create mode 100644 apps/telegram-game/public/coin-small.png create mode 100644 apps/telegram-game/public/coin.png create mode 100644 apps/telegram-game/public/coupon-small.png create mode 100644 apps/telegram-game/src/components/ActiveCard.vue create mode 100644 apps/telegram-game/src/components/Button.vue create mode 100644 apps/telegram-game/src/components/CharacterActivationBlock.vue create mode 100644 apps/telegram-game/src/components/SectionHeader.vue create mode 100644 apps/telegram-game/src/composables/useCharacters.ts rename apps/website/server/api/telegram/{[telegramId].get.ts => [telegramId]/index.get.ts} (88%) create mode 100644 apps/website/server/api/telegram/profile/[profileId]/character/[characterId]/activate.get.ts rename apps/website/server/api/telegram/profile/{[id].get.ts => [profileId]/index.get.ts} (100%) delete mode 100644 apps/website/server/api/telegram/profile/index.post.ts diff --git a/apps/telegram-game/auto-imports.d.ts b/apps/telegram-game/auto-imports.d.ts index cbe017f8..42dcc681 100644 --- a/apps/telegram-game/auto-imports.d.ts +++ b/apps/telegram-game/auto-imports.d.ts @@ -62,6 +62,7 @@ declare global { const unref: typeof import('vue')['unref'] const useAttrs: typeof import('vue')['useAttrs'] const useBackButton: typeof import('./src/composables/useBackButton')['useBackButton'] + const useCharacters: typeof import('./src/composables/useCharacters')['useCharacters'] const useCssModule: typeof import('vue')['useCssModule'] const useCssVars: typeof import('vue')['useCssVars'] const useId: typeof import('vue')['useId'] diff --git a/apps/telegram-game/components.d.ts b/apps/telegram-game/components.d.ts index dfb0235c..6acec0c2 100644 --- a/apps/telegram-game/components.d.ts +++ b/apps/telegram-game/components.d.ts @@ -7,6 +7,9 @@ export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { + ActiveCard: typeof import('./src/components/ActiveCard.vue')['default'] + Button: typeof import('./src/components/Button.vue')['default'] + CharacterActivationBlock: typeof import('./src/components/CharacterActivationBlock.vue')['default'] ComingSoon: typeof import('./src/components/ComingSoon.vue')['default'] Game: typeof import('./src/components/Game.vue')['default'] GameNavigator: typeof import('./src/components/GameNavigator.vue')['default'] @@ -15,5 +18,6 @@ declare module 'vue' { PageContainer: typeof import('./src/components/PageContainer.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] + SectionHeader: typeof import('./src/components/SectionHeader.vue')['default'] } } diff --git a/apps/telegram-game/public/coin-small.png b/apps/telegram-game/public/coin-small.png new file mode 100644 index 0000000000000000000000000000000000000000..ebfe6273a349fa3ebb8a56959ad561671cf4ba60 GIT binary patch literal 475 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D%zr+T_LhE&XX zJA0!Sv!g)U_nx`m%EX+wbUzCvHp%i6?c0{IdCtyx!rHV%=#TW zbC#zuFIyT?wZ>MlhII+!76vI(eWTBhS8slJCFj7`if%;}y} zKIiV;i+%0AH_Cqk)R5$R!c!uQ?X>^S%)P5@awyyZTr?P!E0WxsXw_!`75{f^F)@Pm#T!dnSNgJmWmq|LyY<&hAlxD*QaxdY5{Iu|8)! rVV9ND$aSW-L z^Y)IR7jvM9!$rxh-FxS@PH;M%?>Lp_F%+;dq$3ko?bQu}s{7(gc3M`ysBY20bk7&L z1>a=;8l1dqKdE-#|9$S5o;L}ybIpeF0T07D z1_H#T|NImF?)m-VKkFutzR&Id{{8PzM-6vLh8X$UgBd$-OP*C_8 zhAj*xzW*5IKd=7Fmnk39KX?7!jD2=>A=j7p{gbm(cbU(a#t_9Y%SGyQ=wjK=Yq$Nk ze_9;zMKXbH0qcU3R~dzFSv}Zjtyoy~-}lkJ*?d!%DE;CwV7|a~f#p2oEvv*#3)e?i zYA5}8@T~R7^4Z1r-cO$QTj*kXgJgqP!?I6S4VyRHDSZ6)hUc}RO5nF^p?CX*YuRQn zW-w+HWj{+@&u=3BuIX30vYmQ>)a2BB>-n2=d?zG=Y}VYv_u{SnL<`$^m5&#%adrBy zliTz5c>4M{+e?2{7M*7>X3%BueOcP@<&OOObCY)z|MW>(&FpoI$AQ}+xI$JS>h)(s zeZ}6N0Z^sAziJ#_%y{l`zOt{3Z^LIs9+3XtU3?MNU%vCpKHmBIrk%s;wZC@BK%MSZ zYo{Q+mpwNA%e{HiUKk$$n|q+DVZWLF?>Fn=B0u&y+&#AEEjI_)OMBj5wMu`__rDq( a=Jih>b@)ycm5Kz$J%gvKpUXO@geCw!=<-bf literal 0 HcmV?d00001 diff --git a/apps/telegram-game/src/components/ActiveCard.vue b/apps/telegram-game/src/components/ActiveCard.vue new file mode 100644 index 00000000..0674f5d3 --- /dev/null +++ b/apps/telegram-game/src/components/ActiveCard.vue @@ -0,0 +1,15 @@ + + + diff --git a/apps/telegram-game/src/components/Button.vue b/apps/telegram-game/src/components/Button.vue new file mode 100644 index 00000000..7094d679 --- /dev/null +++ b/apps/telegram-game/src/components/Button.vue @@ -0,0 +1,15 @@ + + + diff --git a/apps/telegram-game/src/components/CharacterActivationBlock.vue b/apps/telegram-game/src/components/CharacterActivationBlock.vue new file mode 100644 index 00000000..b9a3d71d --- /dev/null +++ b/apps/telegram-game/src/components/CharacterActivationBlock.vue @@ -0,0 +1,28 @@ + + + diff --git a/apps/telegram-game/src/components/Game.vue b/apps/telegram-game/src/components/Game.vue index 1dff86bd..07c8e2aa 100644 --- a/apps/telegram-game/src/components/Game.vue +++ b/apps/telegram-game/src/components/Game.vue @@ -7,9 +7,9 @@
-
+
avatar -

+

{{ profile?.energy }}

diff --git a/apps/telegram-game/src/components/GameNavigator.vue b/apps/telegram-game/src/components/GameNavigator.vue index f932aa09..5956c70a 100644 --- a/apps/telegram-game/src/components/GameNavigator.vue +++ b/apps/telegram-game/src/components/GameNavigator.vue @@ -1,5 +1,5 @@