diff --git a/.vitepress/config/zh_tw.ts b/.vitepress/config/zh_tw.ts index 4d757ff2..f980fb37 100644 --- a/.vitepress/config/zh_tw.ts +++ b/.vitepress/config/zh_tw.ts @@ -8,6 +8,7 @@ export const zh_tw = defineConfig({ { text: '首頁', link: '/' }, { text: '年會資訊', link: '/event' }, { text: '關於我們', link: '/about' }, + { text: '會場狀態', link: '/room' }, ], sidebar: {}, socialLinks: [ diff --git a/.vitepress/theme/style.css b/.vitepress/theme/style.css index b8463b5a..71b92180 100644 --- a/.vitepress/theme/style.css +++ b/.vitepress/theme/style.css @@ -68,6 +68,11 @@ --vp-c-danger-2: var(--vp-c-red-2); --vp-c-danger-3: var(--vp-c-red-3); --vp-c-danger-soft: var(--vp-c-red-soft); + + --vp-c-success-1: var(--vp-c-green-1); + --vp-c-success-2: var(--vp-c-green-2); + --vp-c-success-3: var(--vp-c-green-3); + --vp-c-success-soft: var(--vp-c-green-soft); } /** diff --git a/content/zh_tw/room/Room.vue b/content/zh_tw/room/Room.vue new file mode 100644 index 00000000..94f449ba --- /dev/null +++ b/content/zh_tw/room/Room.vue @@ -0,0 +1,306 @@ + + + + + 現在時間:{{ formatTime(currentTime) }} + + + 會議室 + + + 議程軌 + + + 教室狀態 + + + 議程 + + + + + {{ session.room }} + + + {{ session.type ? session_types[session.type] : session.type }} + + + {{ getStatusText(session.course, crowd[session.room]) }} + + + 今日議程已結束 + {{ session.course }} + + + + + + + + diff --git a/content/zh_tw/room/Status.vue b/content/zh_tw/room/Status.vue new file mode 100644 index 00000000..09d89ec6 --- /dev/null +++ b/content/zh_tw/room/Status.vue @@ -0,0 +1,79 @@ + + + + + + + + {{ formatTime(props.data.start) }} + + + {{ props.data.title }} + + + {{ formatTime(props.data.end) }} + + + + + + diff --git a/content/zh_tw/room/index.md b/content/zh_tw/room/index.md new file mode 100644 index 00000000..a15f4d1b --- /dev/null +++ b/content/zh_tw/room/index.md @@ -0,0 +1,5 @@ +--- +aside: false +--- + + diff --git a/loaders/room.data.ts b/loaders/room.data.ts new file mode 100644 index 00000000..a872e1c1 --- /dev/null +++ b/loaders/room.data.ts @@ -0,0 +1,106 @@ +import { defineLoader } from 'vitepress' + +interface Session { + id: string + type: string + room: string + start: string + end: string + language: string + zh: { + title: string + description: string + } + en: { + title: string + description: string + } + speakers: string[] + tags: string[] + co_write: string + qa: null + slide: null + record: null + uri: string +} + +interface SessionType { + id: string + zh: { + name: string + } + en: { + name: string + } +} + +interface Speaker { + id: string + avatar: string + zh: { + name: string + bio: string + } + en: { + name: string + bio: string + } +} + +interface Room { + id: string + zh: { + name: string + } + en: { + name: string + } +} + +interface Tag { + id: string + zh: { + name: string + } + en: { + name: string + } +} + +interface Data { + sessions: Session[] + speakers: Speaker[] + session_types: SessionType[] + rooms: Room[] + tags: Tag[] +} + +interface RoomData { + sessions: Record + rooms: string[] + session_types: Record +} + +export default defineLoader({ + async load(): Promise { + const res = await fetch('https://coscup.org/2024/json/session.json') + const data: Data = await res.json() + + const session_types: Record = data.session_types.reduce((acc: Record, item: SessionType) => { + acc[item.id] = item.zh.name + return acc + }, {}) + const unsorted_rooms = new Set(data.sessions.map((session: Session) => session.room)) + const rooms = [...unsorted_rooms].sort((a, b) => a.localeCompare(b)) + const sessions: Record = rooms.reduce((acc: Record, item) => { + acc[item] = data.sessions.filter((session: Session) => session.room === item).sort((a: Session, b: Session) => new Date(a.start).getTime() - new Date(b.start).getTime()) + return acc + }, {}) + + return { + sessions, + rooms, + session_types, + } + }, +})
現在時間:{{ formatTime(currentTime) }}
+ {{ formatTime(props.data.start) }} +
+ {{ props.data.title }} +
+ {{ formatTime(props.data.end) }} +