diff --git a/components/core/header/HomeIcon.vue b/components/core/header/HomeIcon.vue
index 91d67bc17c..5e3d3392cd 100644
--- a/components/core/header/HomeIcon.vue
+++ b/components/core/header/HomeIcon.vue
@@ -26,6 +26,6 @@ export default {
diff --git a/components/core/header/locale-switch/LocaleSwitch.vue b/components/core/header/locale-switch/LocaleSwitch.vue
index 84db5ed9f7..ae0268fa84 100644
--- a/components/core/header/locale-switch/LocaleSwitch.vue
+++ b/components/core/header/locale-switch/LocaleSwitch.vue
@@ -49,6 +49,6 @@ export default {
@apply font-bold;
}
.core-localeSwitch:hover {
- color: #c386ae;
+ @apply text-pink-700;
}
diff --git a/components/core/header/nav-bar/NavBar.vue b/components/core/header/nav-bar/NavBar.vue
index ce584f7bbc..b47299ff2d 100644
--- a/components/core/header/nav-bar/NavBar.vue
+++ b/components/core/header/nav-bar/NavBar.vue
@@ -144,11 +144,11 @@ export default {
}
.core-navBarItem:hover {
- @apply text-pink-500;
+ @apply text-pink-700;
}
.core-navBarItem.--active,
.core-navBarItem.--active .options-menu {
- @apply text-pink-500;
+ @apply text-pink-700;
}
diff --git a/nuxt.config.js b/nuxt.config.js
index 8f9c8e1883..e68785ba3f 100644
--- a/nuxt.config.js
+++ b/nuxt.config.js
@@ -1,3 +1,5 @@
+import axios from 'axios'
+
const DEFAULT_BASE_URL = 'http://staging.pycon.tw/prs'
const DEFAULT_ROUTER_BASE = '/2022/'
const DEFAULT_BUILD_TARGET = 'static'
@@ -11,7 +13,64 @@ export default {
},
// Target (https://go.nuxtjs.dev/config-target)
target: process.env.BUILD_TARGET || DEFAULT_BUILD_TARGET,
-
+ generate: {
+ dir: DEFAULT_ROUTER_BASE.replace(/\/+/g, ''),
+ async routes() {
+ const config = {
+ headers: {
+ authorization: `Token ${process.env.AUTH_TOKEN}`,
+ },
+ }
+ const talks = await axios.get(
+ `${DEFAULT_BASE_URL}/api/events/speeches/?event_types=talk,sponsored`,
+ config,
+ )
+ const tutorials = await axios.get(
+ `${DEFAULT_BASE_URL}/api/events/speeches/?event_types=tutorial`,
+ config,
+ )
+ const getAllDetailTalks = async () => {
+ const data = await Promise.all(
+ talks.data.map(async (talk) => {
+ return await axios
+ .get(
+ `${DEFAULT_BASE_URL}/api/events/speeches/${talk.event_type}/${talk.id}/`,
+ config,
+ )
+ .then((response) => response.data)
+ }),
+ )
+ return data
+ }
+ const getAllDetailTutorials = async () => {
+ const data = await Promise.all(
+ tutorials.data.map(async (tutorial) => {
+ return await axios
+ .get(
+ `${DEFAULT_BASE_URL}/api/events/speeches/${tutorial.event_type}/${tutorial.id}/`,
+ config,
+ )
+ .then((response) => response.data)
+ }),
+ )
+ return data
+ }
+ const detailTalks = await getAllDetailTalks()
+ const detailTutorials = await getAllDetailTutorials()
+
+ const routes = [
+ ...detailTalks.map((talk) => ({
+ route: `/conference/${talk.event_type}/${talk.id}`,
+ payload: talk,
+ })),
+ ...detailTutorials.map((tutorial) => ({
+ route: `/conference/${tutorial.event_type}/${tutorial.id}`,
+ payload: tutorial,
+ })),
+ ]
+ return routes
+ },
+ },
// Re-route for GitHub Pages to serve with /assets
router: {
base: process.env.ROUTER_BASE || DEFAULT_ROUTER_BASE,
diff --git a/package.json b/package.json
index 4cb5eb1b2e..3e99ab579b 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,7 @@
"@nuxt/http": "^0.6.2",
"@nuxtjs/markdownit": "^2.0.0",
"@tailwindcss/aspect-ratio": "^0.2.1",
+ "axios": "^0.27.2",
"core-js": "^3.6.5",
"dayjs": "^1.10.6",
"nuxt": "^2.15.3",
diff --git a/pages/conference/_eventType/_id.vue b/pages/conference/_eventType/_id.vue
index 3a737aba64..977fc1aa86 100644
--- a/pages/conference/_eventType/_id.vue
+++ b/pages/conference/_eventType/_id.vue
@@ -152,8 +152,6 @@