-
Notifications
You must be signed in to change notification settings - Fork 1
(PC) Feature/creation namecard #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a9d38ff
feat: update data retrieval method for attendees
genj11 c93ae83
style: style: adjust styles in CreationStatus
genj11 a26b44d
feat: refactor: atendee information retrieval into a composable
genj11 5b8e6b0
feat: add i18n support for the login dialog
genj11 d9ef28a
feat: implement completion page
genj11 5bd68e3
feat(namecard): roughly create form input and completion screens
genj11 06d890c
feat: update ImageUploader component
genj11 c80fefb
:feat(namecard) add share page
genj11 7a6456d
enhance(namecard): UI implementation for the edit page
genj11 b4f7eba
Merge branch 'main' into feature/creation-namecard
jiyuujin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,216 @@ | ||
<script setup lang="ts"> | ||
import { useTypography } from '@vuejs-jp/composable' | ||
import { useI18n } from '#i18n' | ||
import { onMounted, ref } from 'vue' | ||
import { useColor, useTypography } from '@vuejs-jp/composable' | ||
|
||
type Props = { | ||
label: string | ||
interface DragDropProps { | ||
fileAccept: string | ||
} | ||
defineProps<Props>() | ||
|
||
defineProps<DragDropProps>() | ||
const isDragEnter = ref(false) | ||
|
||
const emit = defineEmits<{ | ||
'check-files': [e: Event, value: File[]] | ||
}>() | ||
|
||
const fileName = ref<string | null>() | ||
|
||
const { t } = useI18n() | ||
const onDropFile = (e: DragEvent) => { | ||
e.preventDefault() | ||
if (e.dataTransfer?.files) { | ||
fileName.value = e.dataTransfer.files[0].name | ||
emit('check-files', e, Array.from(e.dataTransfer.files)) | ||
} | ||
} | ||
|
||
function handleCloseButton(e: Event) { | ||
fileName.value = null | ||
emit('check-files', e, []) | ||
} | ||
|
||
const onFileInputChange = (event: Event) => { | ||
event.preventDefault() | ||
const { target } = event | ||
if (!(target instanceof HTMLInputElement)) return | ||
|
||
if (target.files) { | ||
fileName.value = target.files[0].name | ||
emit('check-files', event, Array.from(target.files)) | ||
} | ||
} | ||
|
||
const { color: updateColor } = useColor() | ||
const { fontWeight, fontSize } = useTypography() | ||
|
||
onMounted(() => { | ||
window.ondrop = (e) => { | ||
e.preventDefault() | ||
} | ||
window.ondragover = (e) => { | ||
e.preventDefault() | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<!-- TODO 画像アップローダーのブラッシュアップ --> | ||
<VFDragDropArea | ||
<label | ||
for="fileupload" | ||
class="drag-drop-area-root" | ||
:style="{ | ||
fontSize: fontSize('body/300'), | ||
fontWeight: fontWeight('heading/100'), | ||
fontSize: fontSize('heading/100'), | ||
color: updateColor('vue-green/200'), | ||
}" | ||
> | ||
{{ label }} | ||
<VFCssResetButton class="select-button" /> | ||
</VFDragDropArea> | ||
{{ t('namecard.form.label_avatar') }} | ||
<div v-if="fileName" class="file-name-area"> | ||
<p class="file-name">{{ fileName }}</p> | ||
<VFIconButton | ||
class="icon-close" | ||
color="vue-blue" | ||
name="close" | ||
can-hover | ||
@click="handleCloseButton" | ||
/> | ||
</div> | ||
<button | ||
v-else | ||
draggable="true" | ||
class="drag-drop-area" | ||
:class="{ '-isDragEnter': isDragEnter }" | ||
@dragenter="() => (isDragEnter = true)" | ||
@dragleave="() => (isDragEnter = false)" | ||
@dragover.prevent | ||
@drop.prevent="onDropFile" | ||
> | ||
<div class="message-area"> | ||
<p | ||
class="label" | ||
:style="{ | ||
fontSize: fontSize('body/400'), | ||
fontWeight: fontWeight('heading/200'), | ||
color: updateColor('vue-blue'), | ||
}" | ||
> | ||
{{ t('namecard.form.drag_and_drop') }} | ||
</p> | ||
<p | ||
class="label or" | ||
:style="{ | ||
fontSize: fontSize('body/200'), | ||
fontWeight: fontWeight('body/300'), | ||
color: updateColor('vue-blue'), | ||
}" | ||
> | ||
{{ t('namecard.form.or') }} | ||
</p> | ||
</div> | ||
<input | ||
id="fileUpload" | ||
class="select-button" | ||
type="file" | ||
name="avatar" | ||
:accept="fileAccept" | ||
@change="onFileInputChange" | ||
/> | ||
</button> | ||
<p | ||
class="annotation" | ||
:style="{ | ||
fontSize: fontSize('body/300'), | ||
fontWeight: fontWeight('body/300'), | ||
color: updateColor('vue-blue'), | ||
}" | ||
> | ||
{{ t('namecard.form.annotation_avatar') }} | ||
</p> | ||
<!-- TODO エラー制御 | ||
<Typography v-if="errorMessage" variant="body/200" color="sangosyo/200">{{ | ||
errorMessage | ||
}}</Typography> --> | ||
</label> | ||
</template> | ||
|
||
<style scoped></style> | ||
<style scoped> | ||
@import url('~/assets/media.css'); | ||
|
||
.drag-drop-area-root { | ||
display: inline-block; | ||
} | ||
.drag-drop-area { | ||
width: 100%; | ||
margin: calc(var(--unit) * 1.5) auto; | ||
border: 1px solid #e1e1e1; | ||
border-radius: 6px; | ||
background-color: #fff; | ||
color: var(--color-vue-blue); | ||
} | ||
.drag-drop-area:hover { | ||
transition: 0.2s; | ||
box-shadow: 0 2px 10px rgba(53, 73, 94, 14%); | ||
} | ||
.file-name-area { | ||
width: 100%; | ||
margin: calc(var(--unit) * 1.5) auto; | ||
border: 1px solid #e1e1e1; | ||
border-radius: 6px; | ||
background: #c6cacf40; | ||
color: var(--color-vue-blue); | ||
padding: calc(var(--unit) * 3); | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
.file-name { | ||
flex-grow: 1; | ||
text-align: center; | ||
} | ||
.icon-close { | ||
display: inline-block; | ||
text-align: right; | ||
height: 22px; | ||
} | ||
.message-area { | ||
display: inline-flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
height: var(--height-input-area); | ||
width: 100%; | ||
padding: calc(var(--unit) * 3) calc(var(--unit) * 3) 0; | ||
text-align: center; | ||
} | ||
.label { | ||
margin-bottom: calc(var(--unit) * 1.5); | ||
} | ||
#fileUpload { | ||
font-size: 0; | ||
} | ||
::file-selector-button { | ||
--height-button: 50px; | ||
|
||
display: inline-flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
font-size: var(--font-size-body400); | ||
font-weight: 700; | ||
color: var(--color-vue-blue); | ||
background-color: var(--color-white); | ||
|
||
height: var(--height-button); | ||
padding: 0 43px; | ||
margin: 0 auto calc(var(--unit) * 3); | ||
border: 2px solid var(--color-vue-blue); | ||
border-radius: var(--height-button); | ||
cursor: pointer; | ||
} | ||
::file-selector-button:hover { | ||
transition: 0.2s; | ||
color: var(--color-white); | ||
background-color: var(--color-vue-blue); | ||
box-shadow: 0 2px 10px rgba(53, 73, 94, 14%); | ||
} | ||
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Status>(() => { | ||
// TODO テーブルのどの箇所を参照して全ステータスを判定する? | ||
if (userData.value?.activated_at) { | ||
return 'inquiry_in_progress' | ||
} else { | ||
return 'not_created' | ||
} | ||
}) | ||
|
||
const attendee = computed<Attendee>(() => { | ||
// 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 } | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
既存のものは使えなかったんですかね