diff --git a/apps/web/app/components/namecard/CreationProcess.vue b/apps/web/app/components/namecard/CreationProcess.vue index 6ae739e1..d7551d46 100644 --- a/apps/web/app/components/namecard/CreationProcess.vue +++ b/apps/web/app/components/namecard/CreationProcess.vue @@ -18,7 +18,7 @@ const { color } = useColor() }" class="title" > - {{ t('namecard.creation-process.title') }} + {{ t('namecard.creation_process.title') }}
    +
    {{ t(`namecard.creation_status.${statusKey}`) }}
    diff --git a/apps/web/app/components/namecard/ImageUploader.vue b/apps/web/app/components/namecard/ImageUploader.vue index 9e690fd1..17e254c9 100644 --- a/apps/web/app/components/namecard/ImageUploader.vue +++ b/apps/web/app/components/namecard/ImageUploader.vue @@ -1,25 +1,216 @@ - + diff --git a/apps/web/app/composables/useAuth.ts b/apps/web/app/composables/useAuth.ts index 89d4e9f8..cd54f17e 100644 --- a/apps/web/app/composables/useAuth.ts +++ b/apps/web/app/composables/useAuth.ts @@ -30,9 +30,5 @@ export function useAuth() { return data.user } - const authUserId = getUser().then(user => { - return user.id - }).catch(()=> null) - - return { signIn, signOut, authUserId } + return { signIn, signOut, getUser } } diff --git a/apps/web/app/composables/useLocale.ts b/apps/web/app/composables/useLocale.ts index 36aa476d..b41a7197 100644 --- a/apps/web/app/composables/useLocale.ts +++ b/apps/web/app/composables/useLocale.ts @@ -35,6 +35,7 @@ export function useLocale(path: Path) { .with('namecard_process_3', () => `/${locale.value}/namecard_process_3`) .with('namecard_process_4', () => `/${locale.value}/namecard_process_4`) .with('namecard_process_alert', () => `/${locale.value}/namecard_process_alert`) + .with('namecard_annotation_order_number', () => `/${locale.value}/namecard_annotation_order_number`) .exhaustive(), ) diff --git a/apps/web/app/composables/useNamecard.ts b/apps/web/app/composables/useNamecard.ts new file mode 100644 index 00000000..25035ec0 --- /dev/null +++ b/apps/web/app/composables/useNamecard.ts @@ -0,0 +1,49 @@ +import { computed } from 'vue' +import { useSupabase, useAsyncData, useAuth } from '#imports' +import type { Status } from '~/components/namecard/CreationStatus.vue' +import type { Attendee } from '@vuejs-jp/model' + + +export async function useNamecard(userId?:string) { + const { fetchAttendeeDataByUserId } = useSupabase() + const { getUser } = useAuth() + + const { data: authUserId } = await useAsyncData('authUserId', async () => { + return (await getUser()).id + }) + + const { data: attendeeByUserId } = await useAsyncData('attendeeByUserId', async () => { + return await fetchAttendeeDataByUserId('attendees', authUserId.value ?? userId ?? '') + }) + + const userData = computed(() => { + return attendeeByUserId.value?.data?.[0] + }) + + const statusKey = computed(() => { + // TODO テーブルのどの箇所を参照して全ステータスを判定する? + if (userData.value?.activated_at) { + return 'inquiry_in_progress' + } else { + return 'not_created' + } + }) + + const attendee = computed(() => { + // TODO time 系は空文字じゃない方が良い。supabase側で設定できるのか、フロント側でnew Date使うのか? + return { + id: userData.value?.id ?? '', + user_id: userData.value?.user_id ?? '', + activated_at: userData.value?.activated_at ?? '', + created_at: userData.value?.created_at ?? '', + updated_at: userData.value?.updated_at ?? '', + display_name: userData.value?.display_name ?? '', + email: userData.value?.email ?? '', + provider: userData.value?.provider ?? '', + avatar_url: userData.value?.avatar_url ?? '', + role: userData.value?.role ?? '', + receipt_id: userData.value?.receipt_id ?? '', + } + }) + return { authUserId, userData, statusKey, attendee } +} \ No newline at end of file diff --git a/apps/web/app/composables/useSupabase.ts b/apps/web/app/composables/useSupabase.ts index 0d950576..17dba754 100644 --- a/apps/web/app/composables/useSupabase.ts +++ b/apps/web/app/composables/useSupabase.ts @@ -23,6 +23,10 @@ export function useSupabase() { return await client.from(table).select().eq('role', role) } + async function fetchAttendeeDataByUserId(table: Extract, userId:string) { + return await client.from(table).select().eq('user_id', userId) + } + async function upsertSpeaker(table: Extract, target: FormSpeaker) { const targetData = { ...target } @@ -65,6 +69,7 @@ export function useSupabase() { return { fetchData, fetchAttendeeData, + fetchAttendeeDataByUserId, upsertSpeaker, upsertSponsor, upsertJob, diff --git a/apps/web/app/content/en/namecard_annotation_order_number.md b/apps/web/app/content/en/namecard_annotation_order_number.md new file mode 100644 index 00000000..3e1ab5da --- /dev/null +++ b/apps/web/app/content/en/namecard_annotation_order_number.md @@ -0,0 +1 @@ +\* The order number can be found in the [receipt data](https://help-attendee.peatix.com/ja-JP/support/solutions/articles/44001821741) included in the email sent by Peatix when you purchase a ticket. diff --git a/apps/web/app/content/ja/namecard_annotation_order_number.md b/apps/web/app/content/ja/namecard_annotation_order_number.md new file mode 100644 index 00000000..cd5bca1f --- /dev/null +++ b/apps/web/app/content/ja/namecard_annotation_order_number.md @@ -0,0 +1 @@ +※注文番号は、チケット購入時にPeatixから送信されるメール内に含まれる[領収データ](https://help-attendee.peatix.com/ja-JP/support/solutions/articles/44001821741)から確認できます。 diff --git a/apps/web/app/lang/en.json b/apps/web/app/lang/en.json index a42e2a31..b60fa4ca 100644 --- a/apps/web/app/lang/en.json +++ b/apps/web/app/lang/en.json @@ -6,6 +6,9 @@ "not_found": "The page you are looking for cannot be found.", "prefix_year": "", "suffix_year": "2024", + "invite_vue_fes": "Would you like to join Vue Fes Japan 2024 as well?", + "share_namecard": "Let's share this name card on social media!", + "official_site": "Vue Fes Japan Official Website", "top_page": { "latest_information": "Get the latest information on our official social media", "date": "October 19th, 2024", @@ -128,8 +131,11 @@ "title_edit": "Create/Edit Name Card", "edit": "Edit", "login": "Login", - "namecard-samples-alt": "Name card samples", - "creation-process": { + "dialog_message": "To create a name card, you need to purchase a ticket in advance. After purchasing your ticket, log in using one of the following social accounts and register the necessary information.", + "namecard_samples_alt": "Name card samples", + "complete_message": "We will now verify your order number. You can check the status of the order number verification on the name card page. Please ensure that the verification is successfully completed before the editing deadline.", + "lets_share": "Share your created name card on social media!", + "creation_process": { "title": "Name Card Creation Process" }, "creation_status": { @@ -143,10 +149,13 @@ "label_avatar": "アバター/Avatar", "label_order_number": "Order Number", "annotation_name": "Up to 12 full-width characters (24 half-width characters)", - "annotation_order_number": "* The order number can be found in the receipt data included in the email sent by Peatix when you purchase a ticket.", + "annotation_avatar": "* Upload a square image (aspect ratio 1:1) for your avatar.", "placeholder_order_number": "Please enter the order number", "submit": "Submit", - "registrationCompleted": "The name card information has been successfully registered!" + "registrationCompleted": "The name card information has been successfully registered!", + "drag_and_drop": "Drag & drop a file", + "or": "or", + "select_file": "Select a file" } } } diff --git a/apps/web/app/lang/ja.json b/apps/web/app/lang/ja.json index f585daad..0bb0b8af 100644 --- a/apps/web/app/lang/ja.json +++ b/apps/web/app/lang/ja.json @@ -6,6 +6,9 @@ "not_found": "お探しのページが見つかりません。", "prefix_year": "2024", "suffix_year": "", + "invite_vue_fes": "あなたもVue Fes Japan 2024に参加しませんか?", + "share_namecard": "このネームカードをSNSでシェアしよう!", + "official_site": "Vue Fes Japan 2024公式サイト", "day_of_week": { "sunday": "日", "monday": "月", @@ -146,25 +149,31 @@ "title_edit": "ネームカード作成・編集", "edit": "編集する", "login": "ログインする", - "namecard-samples-alt": "ネームカードのサンプル", - "creation-process": { + "dialog_message": "ネームカードを作成するには、あらかじめチケットの購入が必要です。チケット購入後、以下のいずれかのソーシャルアカウントからログインし、必要な情報をご登録ください。", + "namecard_samples_alt": "ネームカードのサンプル", + "complete_message": "これから注文番号の照合を行います。注文番号照合の状況はネームカードページのステータスで確認できます。編集期限前に照合が正常に完了したことを確認してください。", + "lets_share": "作成したネームカードをSNSでシェアしよう!", + "creation_process": { "title": "ネームカード作成の流れ" }, "creation_status": { "not_created": "未作成", "inquiry_in_progress": "注文番号照会中", "inquiry_failed": "注文番号照会失敗", - "inquiry_completed": "注文番号照合完了" + "inquiry_completed": "注文番号照会完了" }, "form": { "label_name": "お名前/Name", "label_avatar": "アバター/Avatar", "label_order_number": "注文番号", "annotation_name": "※全角12文字(半角24文字)まで", - "annotation_order_number": "※注文番号は、チケット購入時にPeatixから送信されるメール内に含まれる領収データから確認できます。", + "annotation_avatar": "※アバターは正方形(比率1:1)の画像をアップロードしてください。", "placeholder_order_number": "注文番号を入力してください", "submit": "確定する", - "registrationCompleted": "ネームカードの情報登録が完了しました!" + "registrationCompleted": "ネームカードの情報登録が完了しました!", + "drag_and_drop": "ファイルをドラッグ&ドロップ", + "or": "または", + "select_file": "ファイルを選択" } } } diff --git a/apps/web/app/pages/namecard/[id]/edit/complete.vue b/apps/web/app/pages/namecard/[id]/edit/complete.vue index db749b16..c1cda55e 100644 --- a/apps/web/app/pages/namecard/[id]/edit/complete.vue +++ b/apps/web/app/pages/namecard/[id]/edit/complete.vue @@ -1,28 +1,85 @@ + diff --git a/apps/web/app/pages/namecard/[id]/edit/index.vue b/apps/web/app/pages/namecard/[id]/edit/index.vue index 14ad459a..9c0db553 100644 --- a/apps/web/app/pages/namecard/[id]/edit/index.vue +++ b/apps/web/app/pages/namecard/[id]/edit/index.vue @@ -1,82 +1,130 @@