From 774ccf75fbad15eb1c6e5c41a84cd2e923b66a66 Mon Sep 17 00:00:00 2001 From: Arthur DANJOU Date: Mon, 4 Sep 2023 00:03:30 +0200 Subject: [PATCH] Improve talents and lint code --- src/composables/useTalents.ts | 2 + src/pages/talents.vue | 66 +++++++++++++++++------------- src/pages/writing/[slug].vue | 9 ++-- src/server/trpc/routers/talents.ts | 8 ++-- src/store/talents.ts | 4 +- 5 files changed, 51 insertions(+), 38 deletions(-) diff --git a/src/composables/useTalents.ts b/src/composables/useTalents.ts index ad5406f..28ebb78 100644 --- a/src/composables/useTalents.ts +++ b/src/composables/useTalents.ts @@ -7,6 +7,7 @@ export async function useTalents() { const { data: talents, refresh: refreshTalents, + pending, } = await useAsyncData('talents:talents', async () => await $trpc.talents.getTalents.query({ favorite: isFavorite.value, category: getCategory.value })) async function switchCategory(category: string) { @@ -29,5 +30,6 @@ export async function useTalents() { isFavorite, switchCategory, toggleFavorite, + pending, } } diff --git a/src/pages/talents.vue b/src/pages/talents.vue index dca3725..2c0116a 100644 --- a/src/pages/talents.vue +++ b/src/pages/talents.vue @@ -3,8 +3,8 @@ useHead({ title: 'Discover new talents • Arthur Danjou', }) -const categories = ref>([{ label: 'All', slug: 'all' }]) -const { getCategories, talents, isFavorite, toggleFavorite, switchCategory } = await useTalents() +const categories = ref>([{ label: 'All', slug: 'all' }]) +const { getCategories, talents, isFavorite, toggleFavorite, switchCategory, pending } = await useTalents() getCategories.value?.forEach(category => categories.value.push({ label: category.name, slug: category.slug })) @@ -45,7 +45,9 @@ function getColor() { @@ -69,8 +71,8 @@ function getColor() { -
-
+
+
-
-

-
- - -
-

- {{ talent.name }} -

- - - -
-
-

-

- {{ talent.work }} -

+
+

+
+ + +
+

+ {{ talent.name }} +

+ + + +
+
+

+

+ {{ talent.work }} +

@@ -113,12 +115,18 @@ function getColor() {

-

- There are no talents for this category. Maybe soon... -

-

- The talents are loading... -

+
+
+ +

There are no talents for this category. Maybe soon...

+
+
+
+
+ +

The talents are loading...

+
+
diff --git a/src/pages/writing/[slug].vue b/src/pages/writing/[slug].vue index 3f459d8..7a21de2 100644 --- a/src/pages/writing/[slug].vue +++ b/src/pages/writing/[slug].vue @@ -89,9 +89,12 @@ async function handleLike() { :value="postContent" />