From 2d0120d4c7263b4207180530db8782496e24ecc6 Mon Sep 17 00:00:00 2001 From: mehm8128 Date: Mon, 7 Aug 2023 17:47:39 +0900 Subject: [PATCH 1/3] =?UTF-8?q?event=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=AE?= =?UTF-8?q?=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Event/EventHostItem.vue | 33 ++++++ src/pages/Event.vue | 155 +++++++++++++++++++++++-- 2 files changed, 177 insertions(+), 11 deletions(-) create mode 100644 src/components/Event/EventHostItem.vue diff --git a/src/components/Event/EventHostItem.vue b/src/components/Event/EventHostItem.vue new file mode 100644 index 00000000..d951d953 --- /dev/null +++ b/src/components/Event/EventHostItem.vue @@ -0,0 +1,33 @@ + + + + + diff --git a/src/pages/Event.vue b/src/pages/Event.vue index 9f8cf792..43122a1a 100644 --- a/src/pages/Event.vue +++ b/src/pages/Event.vue @@ -1,15 +1,148 @@ - + + + + + From de9ea1aefe7b28a5964be7925c2c32f9cfca650c Mon Sep 17 00:00:00 2001 From: mehm8128 Date: Thu, 17 Aug 2023 21:04:46 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E3=83=88=EF=BC=8D=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=82=92=E4=BD=BF=E3=81=86=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Event.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/Event.vue b/src/pages/Event.vue index 43122a1a..3e2022ec 100644 --- a/src/pages/Event.vue +++ b/src/pages/Event.vue @@ -10,8 +10,10 @@ import { getDisplayDuration } from '/@/lib/date' import useParam from '/@/use/param' import { useDataFetcher } from '/@/use/fetcher' import { ref } from 'vue' +import { useToast } from 'vue-toastification' const router = useRouter() +const toast = useToast() const eventId = useParam('id') const { data: event } = useDataFetcher(() => @@ -28,12 +30,10 @@ const updateEvent = async () => { eventLevel: eventLevel.value } await apis.editEvent(eventId.value, requestData) - //eslint-disable-next-line no-console - console.log('更新しました') // todo:トーストとかに変えたい + toast.success('イベント情報を更新しました') router.push(`/events/${eventId.value}`) } catch { - //eslint-disable-next-line no-console - console.log('更新に失敗しました') + toast.error('イベント情報の更新に失敗しました') } isSending.value = false } From aca84bc95d7a24b740f93c05849ddb94847894be Mon Sep 17 00:00:00 2001 From: mehm8128 Date: Fri, 15 Sep 2023 23:42:18 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E3=83=A9=E3=82=B8=E3=82=AA=E3=83=9C?= =?UTF-8?q?=E3=82=BF=E3=83=B3=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UI/RadioButton.vue | 89 +++++++++++++++++++++++++++++++ src/consts/eventLevel.ts | 45 ++++++++++++++++ src/pages/Event.vue | 39 ++++++++++++-- 3 files changed, 170 insertions(+), 3 deletions(-) create mode 100644 src/components/UI/RadioButton.vue create mode 100644 src/consts/eventLevel.ts diff --git a/src/components/UI/RadioButton.vue b/src/components/UI/RadioButton.vue new file mode 100644 index 00000000..4e9ce965 --- /dev/null +++ b/src/components/UI/RadioButton.vue @@ -0,0 +1,89 @@ + + + + + diff --git a/src/consts/eventLevel.ts b/src/consts/eventLevel.ts new file mode 100644 index 00000000..d9fe92da --- /dev/null +++ b/src/consts/eventLevel.ts @@ -0,0 +1,45 @@ +import { EventLevel } from '/@/lib/apis' + +interface EventLevelDetail { + label: string + value: string + description: string +} + +type EventLevelMap = Map + +export const eventLevels: EventLevelMap = new Map([ + [ + EventLevel.Public, + { + label: '公開', + value: 'public', + description: 'ポートフォリオにて公開します' + } + ], + [ + EventLevel.Anonymous, + { + label: '匿名公開', + value: 'anonymous', + description: '企画者の名前を伏せて、ポートフォリオにて公開します' + } + ], + [ + EventLevel.Private, + { + label: '非公開', + value: 'private', + description: 'ポートフォリオにて公開しません' + } + ] +]) + +export const getEventLevelFromValue = ( + value: string +): EventLevel | undefined => { + const entry = Array.from(eventLevels).find( + ([, service]) => service.value === value + ) + return entry?.[0] +} diff --git a/src/pages/Event.vue b/src/pages/Event.vue index 3e2022ec..4a7b2f75 100644 --- a/src/pages/Event.vue +++ b/src/pages/Event.vue @@ -11,6 +11,8 @@ import useParam from '/@/use/param' import { useDataFetcher } from '/@/use/fetcher' import { ref } from 'vue' import { useToast } from 'vue-toastification' +import RadioButton from '/@/components/UI/RadioButton.vue' +import { eventLevels, getEventLevelFromValue } from '/@/consts/eventLevel' const router = useRouter() const toast = useToast() @@ -20,14 +22,16 @@ const { data: event } = useDataFetcher(() => apis.getEvent(eventId.value) ) -const eventLevel = ref(event.value?.eventLevel ?? 0) +const eventLevel = ref( + eventLevels.get(event.value?.eventLevel ?? 0)?.value ?? 'public' +) const isSending = ref(false) const updateEvent = async () => { isSending.value = true try { const requestData: EditEventRequest = { - eventLevel: eventLevel.value + eventLevel: getEventLevelFromValue(eventLevel.value) } await apis.editEvent(eventId.value, requestData) toast.success('イベント情報を更新しました') @@ -83,7 +87,29 @@ const updateEvent = async () => { /> - +
+

公開設定

+
+ + + +
+
@@ -140,6 +166,13 @@ const updateEvent = async () => { .contestLink { color: $color-text; } +.radioButtons { + display: flex; + flex-direction: column; + padding: 0.5rem; + gap: 1.25rem; + width: 60%; +} .buttonContainer { display: flex; justify-content: flex-end;