Skip to content

Commit

Permalink
Fix session page
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo930021 committed Mar 31, 2024
1 parent c9b6a3d commit 1d350c5
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit"
},
"eslint.validate": [
"typescript",
Expand Down Expand Up @@ -51,4 +51,4 @@
"src/services/language",
"src/services/language/languages"
]
}
}
36 changes: 36 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions scripts/pre-build/generateSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,19 @@ function genResult (talks, rooms, speakers) {
}

const resSessions = talks.results.map((s :any) => {
const getLocaleTagId = (locale: string) => {
if (locale === 'zh-hant') return 'zh-tw'
if (locale === 'ja-jp') return 'ja-JP'
return locale
}

return {
id: s.code,
type: resSessionTypes.find((t :any) => s.track?.['zh-tw'] === t.zh.name || s.track?.en === t.en.name).id,
room: s.slot.room?.en || s.slot.room?.['zh-tw'],
start: s.slot.start,
end: s.slot.end,
language: getLanguage(s.content_locale),
language: getLanguage(getLocaleTagId(s.content_locale)),
zh: {
title: s.title,
description: getAnswer(s, SESSION_ZH_DESCRIPTION_ID, s.abstract || '')
Expand All @@ -172,7 +178,7 @@ function genResult (talks, rooms, speakers) {
description: getAnswer(s, SESSION_EN_DESCRIPTION_ID, s.abstract || '')
},
speakers: s.speakers.map(ss => ss.code),
tags: [s.content_locale].concat(s.answers.find(a => a.question.id === SESSION_TAGS_ID) !== undefined ? [s.answers.find(a => a.question.id === SESSION_TAGS_ID).options[0].answer.en] : []),
tags: [getLocaleTagId(s.content_locale)].concat(s.answers.find(a => a.question.id === SESSION_TAGS_ID) !== undefined ? [s.answers.find(a => a.question.id === SESSION_TAGS_ID).options[0].answer.en] : []),
co_write: getAnswer(s, SESSION_CO_WRITE_ID, null),
qa: getAnswer(s, SESSION_QA_ID, null),
slide: getAnswer(s, SESSION_SLIDE_ID, null),
Expand Down

0 comments on commit 1d350c5

Please sign in to comment.