-
Notifications
You must be signed in to change notification settings - Fork 4
議程資訊頁面 #105
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
Draft
mirumodapon
wants to merge
12
commits into
feat/session-ui
Choose a base branch
from
feat/session-popup
base: feat/session-ui
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
議程資訊頁面 #105
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2a05c71
feat(ui): add CpSessionInfoCard component
mirumodapon 020dff9
fix(ui): correct styling issues in CpSessionInfoCard components
mirumodapon 34eecd7
fix(ui): add hyperlink for co-write in CpSessionInfoCard component
mirumodapon 05d0956
feat: add session page and router configuration for session navigation
mirumodapon 572fd74
fix(ui): remove text-justify class from description in CpSessionInfoC…
mirumodapon 0a0f83f
fix(ui): replace plain text with MDC component for description and sp…
mirumodapon f26bc3b
fix(ui): remove background color and backdrop blur from session popup…
mirumodapon 5494e99
fix(ui): enhance accessibility for session popup by adding aria attri…
mirumodapon 97df115
fix(router): refactor session path check for scroll behavior
mirumodapon 369b89d
fix(ui): refactor keydown event handling in session popup
mirumodapon aa4e743
fix(router): update session close navigation to use locale-aware path
mirumodapon ba018d4
fix(session): add prerendering for session routes
mirumodapon 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| <script setup lang="ts"> | ||
| import { computed } from 'vue' | ||
| import { useI18n } from 'vue-i18n' | ||
|
|
||
| const props = defineProps<{ | ||
| title: string | ||
| time: string | ||
| speakers: { | ||
| id?: string | ||
| name: string | ||
| bio: string | ||
| avatar?: string | ||
| }[] | ||
| room: string | ||
| coWrite?: string | ||
| tags: string[] | ||
| description: string | ||
| }>() | ||
|
|
||
| const { t } = useI18n() | ||
|
|
||
| const speakerNames = computed(() => | ||
| props.speakers.map((s) => s.name).join(', '), | ||
| ) | ||
| </script> | ||
|
|
||
| <template> | ||
| <article class="p-6 bg-white flex flex-col gap-3"> | ||
| <header> | ||
| <h1 class="text-2xl text-primary-400 leading-tight font-bold mb-4"> | ||
| {{ title }} | ||
| </h1> | ||
| <table class="border-separate border-spacing-4"> | ||
| <tbody> | ||
| <tr class="border-none"> | ||
| <td class="text-gray-400"> | ||
| <Icon name="tabler:clock" /> | ||
| {{ t("time") }} | ||
| </td> | ||
| <td class="text-gray-700"> | ||
| {{ time }} | ||
| </td> | ||
| </tr> | ||
| <tr class="border-none"> | ||
| <td class="text-gray-400"> | ||
| <Icon name="tabler:user" /> | ||
| {{ t("speaker") }} | ||
| </td> | ||
| <td class="text-gray-700"> | ||
| {{ speakerNames }} | ||
| </td> | ||
| </tr> | ||
| <tr class="border-none"> | ||
| <td class="text-gray-400"> | ||
| <Icon name="tabler:map-pin" /> | ||
| {{ t("room") }} | ||
| </td> | ||
| <td class="text-gray-700"> | ||
| {{ room }} | ||
| </td> | ||
| </tr> | ||
| <tr class="border-none"> | ||
| <td class="text-gray-400"> | ||
| <Icon name="tabler:file-text" /> | ||
| {{ t("co-write") }} | ||
| </td> | ||
| <td class="text-gray-700"> | ||
| <a | ||
| v-if="coWrite?.startsWith('http')" | ||
| class="underline cursor-pointer" | ||
| :href="coWrite" | ||
| >{{ coWrite }}</a> | ||
| <span | ||
| v-else | ||
| >{{ coWrite }}</span> | ||
| </td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| <div | ||
| class="mt-5 pb-3 border-b border-gray-200 flex flex-wrap gap-2" | ||
| > | ||
| <span | ||
| v-for="tag in tags" | ||
| :key="tag" | ||
| class="text-xs text-primary-700 font-medium px-3 py-1 rounded-full bg-primary-100" | ||
| > | ||
| {{ tag }} | ||
| </span> | ||
| </div> | ||
| </header> | ||
| <section> | ||
| <h2 class="text-lg text-primary-400 font-bold my-3"> | ||
| {{ t("abstract") }} | ||
| </h2> | ||
| <div | ||
| class="text-gray-700 leading-relaxed whitespace-pre-wrap" | ||
| > | ||
| <MDC :value="description" /> | ||
| </div> | ||
| </section> | ||
| <section> | ||
| <h2 class="text-lg text-primary-400 font-bold my-2"> | ||
| {{ t("speaker") }} | ||
| </h2> | ||
| <div class="flex flex-col gap-6"> | ||
| <div | ||
| v-for="speaker in speakers" | ||
| :key="speaker.name" | ||
| class="flex flex-col gap-4" | ||
| > | ||
| <div class="flex gap-4 items-center"> | ||
| <div | ||
| class="border-2 border-primary-100 rounded-full bg-gray-100 flex-shrink-0 h-16 w-16 overflow-hidden" | ||
| > | ||
| <img | ||
| v-if="speaker.avatar" | ||
| :alt="speaker.name" | ||
| class="h-full w-full object-cover" | ||
| :src="speaker.avatar" | ||
| > | ||
| <div | ||
| v-else | ||
| class="text-gray-400 flex h-full w-full items-center justify-center" | ||
| > | ||
| <Icon | ||
| class="h-8 w-8" | ||
| name="tabler:user" | ||
| /> | ||
| </div> | ||
| </div> | ||
| <div> | ||
| <h3 class="text-lg text-gray-700 font-bold"> | ||
| {{ speaker.name }} | ||
| </h3> | ||
| </div> | ||
| </div> | ||
| <div | ||
| class="text-sm text-gray-700 leading-relaxed whitespace-pre-wrap" | ||
| > | ||
| <MDC :value="speaker.bio" /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </section> | ||
| </article> | ||
| </template> | ||
|
|
||
| <i18n lang="yaml"> | ||
| en: | ||
| abstract: Abstract | ||
| co-write: Co-write | ||
| room: Room | ||
| speaker: Speaker | ||
| time: time | ||
| zh: | ||
| abstract: 摘要 | ||
| room: 位置 | ||
| speaker: 講者 | ||
| time: 時間 | ||
| co-write: 共筆 | ||
| </i18n> |
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,102 @@ | ||
| <script setup lang="ts"> | ||
| import type { SessionDetail } from '#shared/types/session' | ||
| import CpSessionInfoCard from '~/components/feature/CpSessionInfoCard.vue' | ||
|
|
||
| const { locale } = useI18n() | ||
| const route = useRoute() | ||
| const router = useRouter() | ||
| const localePath = useLocalePath() | ||
|
|
||
| const { data } = await useFetch<SessionDetail>(`/api/session/${route.params.id}`) | ||
|
|
||
| const localeKey = computed(() => locale.value === 'zh' ? 'zh' : 'en') | ||
|
|
||
| const sessionInfo = computed(() => { | ||
| if (!data.value) { | ||
| return null | ||
| } | ||
|
|
||
| const content = data.value[localeKey.value] | ||
| const room = locale.value === 'zh' | ||
| ? (data.value.room?.['zh-hans'] || data.value.room?.en || '') | ||
| : (data.value.room?.en || data.value.room?.['zh-hans'] || '') | ||
|
|
||
| return { | ||
| coWrite: data.value.co_write ?? undefined, | ||
| description: content.describe, | ||
| room, | ||
| speakers: data.value.speakers.map((speaker) => ({ | ||
| id: speaker.id, | ||
| avatar: speaker.avatar ?? undefined, | ||
| bio: speaker[localeKey.value].bio, | ||
| name: speaker[localeKey.value].name, | ||
| })), | ||
| tags: data.value.tags, | ||
| time: `${data.value.start?.slice(11, 16) ?? ''} ~ ${data.value.end?.slice(11, 16) ?? ''}`, | ||
| title: content.title, | ||
| } | ||
| }) | ||
|
|
||
| function close() { | ||
| router.push(localePath('/session')) | ||
| } | ||
|
|
||
| function onKeydown(e: KeyboardEvent) { | ||
| if (e.key === 'Escape') { | ||
| close() | ||
| } | ||
| } | ||
|
|
||
| onMounted(() => { | ||
| document.body.style.overflow = 'hidden' | ||
| window.addEventListener('keydown', onKeydown) | ||
| }) | ||
|
|
||
| onUnmounted(() => { | ||
| document.body.style.overflow = '' | ||
| window.removeEventListener('keydown', onKeydown) | ||
| }) | ||
| </script> | ||
|
|
||
| <template> | ||
| <div | ||
| :aria-label="sessionInfo?.title" | ||
| aria-modal="true" | ||
| class="bg-black/50 inset-0 fixed z-50" | ||
| role="dialog" | ||
| @click.self="close" | ||
| > | ||
| <div class="bg-white flex flex-row-reverse h-full w-120 right-0 top-0 fixed"> | ||
| <div> | ||
| <!-- AD --> | ||
| </div> | ||
|
|
||
| <div class="p-3 h-full overflow-y-auto"> | ||
| <div class="flex top-0 justify-end sticky z-10"> | ||
| <button | ||
| aria-label="close" | ||
| class="text-gray-500 rounded-full flex h-8 w-8 transition-colors items-center justify-center hover:bg-gray-100" | ||
| type="button" | ||
| @click="close" | ||
| > | ||
| <Icon | ||
| class="h-4 w-4" | ||
| name="tabler:x" | ||
| /> | ||
| </button> | ||
|
mirumodapon marked this conversation as resolved.
|
||
| </div> | ||
|
|
||
| <CpSessionInfoCard | ||
| v-if="sessionInfo" | ||
| :co-write="sessionInfo.coWrite" | ||
| :description="sessionInfo.description" | ||
| :room="sessionInfo.room" | ||
| :speakers="sessionInfo.speakers" | ||
| :tags="sessionInfo.tags" | ||
| :time="sessionInfo.time" | ||
| :title="sessionInfo.title" | ||
| /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </template> | ||
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,19 @@ | ||
| import type { RouterConfig } from '@nuxt/schema' | ||
|
|
||
| const SESSION_PATH_RE = /^\/(?:[^/]+\/)?session(?:\/|$)/ | ||
|
|
||
| export default { | ||
| scrollBehavior(to, from, savedPosition) { | ||
| if (savedPosition) { | ||
| return savedPosition | ||
| } | ||
|
|
||
| const isSessionPath = (path: string) => SESSION_PATH_RE.test(path) | ||
|
|
||
| if (isSessionPath(to.path) && isSessionPath(from.path)) { | ||
| return false | ||
| } | ||
|
|
||
| return { top: 0 } | ||
| }, | ||
| } satisfies RouterConfig |
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.
Uh oh!
There was an error while loading. Please reload this page.