diff --git a/components/GameCarousel.vue b/components/GameCarousel.vue index 14ab80e..202707c 100644 --- a/components/GameCarousel.vue +++ b/components/GameCarousel.vue @@ -31,11 +31,8 @@ diff --git a/components/Store/SmallBento.vue b/components/Store/SmallBento.vue new file mode 100644 index 0000000..8848314 --- /dev/null +++ b/components/Store/SmallBento.vue @@ -0,0 +1,120 @@ + + + + + + {{ props.title }} + + + + + {{ $t("chars.arrow") }} + + + + + + + + + + + + + + + + {{ source[0].mName }} + + + + {{ source[0].mShortDescription }} + + + + + + + + + + + + + + {{ source[1].mName }} + + + + {{ source[1].mShortDescription }} + + + + + + + + + + + + + + {{ source[2].mName }} + + + + {{ source[2].mShortDescription }} + + + + + + + + + + {{ $t("chars.arrow") }} + + + + + + + + diff --git a/components/Store/SmallCarousel.vue b/components/Store/SmallCarousel.vue new file mode 100644 index 0000000..48eca08 --- /dev/null +++ b/components/Store/SmallCarousel.vue @@ -0,0 +1,28 @@ + + + + {{ props.title }} + + + + + {{ $t("chars.arrow") }} + + + + + + + + + + diff --git a/components/Store/SmallFocused.vue b/components/Store/SmallFocused.vue new file mode 100644 index 0000000..c111521 --- /dev/null +++ b/components/Store/SmallFocused.vue @@ -0,0 +1,70 @@ + + + + + + + + + + + + {{ source.mName }} + + {{ source.mShortDescription }} + + + + + + {{ $t("chars.arrow") }} + + + + + + + + + + + + + {{ $t("store.noGame") }} + + + + + + {{ $t("chars.arrow") }} + + + + + + + + + diff --git a/composables/store.ts b/composables/store.ts new file mode 100644 index 0000000..9231eef --- /dev/null +++ b/composables/store.ts @@ -0,0 +1,42 @@ +import type { SerializeObject } from "nitropack"; +import type { Company, Game } from "~/prisma/client"; +import type { StoreComponentSource } from "~/server/internal/store/types"; + +export type StoreRenderableItem = SerializeObject; + +const internalSourceCache: Map = + new Map(); +const internalGameCache: Map = new Map(); + +async function unpackSource( + source: typeof StoreComponentSource.infer, + amount?: number, +): Promise> { + const gameIds = internalSourceCache.get(source)!.slice(0, amount); + const games = gameIds.map((e) => internalGameCache.get(e)!); + return games; +} +export async function useStoreSource( + source: typeof StoreComponentSource.infer, + amount?: number, +): Promise> { + if (internalSourceCache.has(source)) { + return unpackSource(source, amount); + } + + const results = (await $dropFetch("/api/v1/store/source", { + query: { + ...source, + amount, + }, + })) as Array; + + const gameIds = []; + for (const result of results) { + gameIds.push(result.id); + internalGameCache.set(result.id, result); + } + internalSourceCache.set(source, gameIds); + + return unpackSource(source, amount); +} diff --git a/i18n/locales/en_us.json b/i18n/locales/en_us.json index c7f9bda..939680e 100644 --- a/i18n/locales/en_us.json +++ b/i18n/locales/en_us.json @@ -467,6 +467,7 @@ "settings": "Settings", "store": { "commingSoon": "coming soon", + "explore": "Explore {arrow}", "exploreMore": "Explore more {arrow}", "images": "Game Images", "lookAt": "Check it out", diff --git a/package.json b/package.json index 2fb2212..e993237 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "jdenticon": "^3.3.0", "luxon": "^3.6.1", "micromark": "^4.0.1", - "nuxt": "^3.17.4", + "nuxt": "^3.17.5", "nuxt-security": "2.2.0", "prisma": "^6.7.0", "sanitize-filename": "^1.6.3", diff --git a/pages/store/index.vue b/pages/store/index.vue index b9c1f80..6596204 100644 --- a/pages/store/index.vue +++ b/pages/store/index.vue @@ -1,115 +1,18 @@ - - - - - - - - - - {{ $t("store.recentlyAdded") }} - - - {{ game.mName }} - - - {{ game.mShortDescription }} - - - - {{ $t("store.lookAt") }} - - - - - - - + - - - - - - - {{ $t("store.noGame") }} - - - - - - - {{ $t("store.recentlyReleased") }} - - - - - {{ $t("chars.arrow") }} - - - - - - - - - - - - {{ $t("store.recentlyUpdated") }} - - - - - {{ $t("chars.arrow") }} - - - - - - - + + +
+ {{ source[0].mShortDescription }} +
+ {{ source[1].mShortDescription }} +
+ {{ source[2].mShortDescription }} +
+ {{ source.mShortDescription }} +
- {{ game.mShortDescription }} -