feat: add club news to header navigation
This commit is contained in:
@@ -7,7 +7,7 @@ const t = (key: string) => i18n.global.t(key)
|
|||||||
const escape = (value: string) => value.replace(/[&<>"']/g, char => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[char]!)
|
const escape = (value: string) => value.replace(/[&<>"']/g, char => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[char]!)
|
||||||
const text = (key: string) => `<span data-i18n="${key}">${escape(t(key))}</span>`
|
const text = (key: string) => `<span data-i18n="${key}">${escape(t(key))}</span>`
|
||||||
const navigation = [
|
const navigation = [
|
||||||
['mirrors', '/'], ['news', '/announcements'], ['status', '/status'],
|
['mirrors', '/'], ['news', '/announcements'], ['clubNews', 'https://www.itouc.cn/news/'], ['status', '/status'],
|
||||||
['feedback', 'https://git.itouc.cn/ITStudio_OUC/OUCMirror-WebUI/issues'],
|
['feedback', 'https://git.itouc.cn/ITStudio_OUC/OUCMirror-WebUI/issues'],
|
||||||
].map(([key, href]) => `<a class="nav-link${key === 'mirrors' ? ' active' : ''}" href="${href}">${text(`common.nav.${key}`)}</a>`).join('')
|
].map(([key, href]) => `<a class="nav-link${key === 'mirrors' ? ' active' : ''}" href="${href}">${text(`common.nav.${key}`)}</a>`).join('')
|
||||||
const languages = Object.entries(directoryMessages).map(([locale, messages]) => `<button class="language-option" data-locale="${locale}" lang="${locale}">${escape(messages.common.languageName)}</button>`).join('')
|
const languages = Object.entries(directoryMessages).map(([locale, messages]) => `<button class="language-option" data-locale="${locale}" lang="${locale}">${escape(messages.common.languageName)}</button>`).join('')
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ const isHelpPage = help.active
|
|||||||
const navigation = [
|
const navigation = [
|
||||||
{ key: 'mirrors', href: '/', active: !isStatusPage && !isAdminPage && !isAnnouncementsPage },
|
{ key: 'mirrors', href: '/', active: !isStatusPage && !isAdminPage && !isAnnouncementsPage },
|
||||||
{ key: 'news', href: '/announcements', active: isAnnouncementsPage },
|
{ key: 'news', href: '/announcements', active: isAnnouncementsPage },
|
||||||
|
{ key: 'clubNews', href: 'https://www.itouc.cn/news/', active: false },
|
||||||
{ key: 'status', href: '/status', active: isStatusPage },
|
{ key: 'status', href: '/status', active: isStatusPage },
|
||||||
{ key: 'feedback', href: 'https://git.itouc.cn/ITStudio_OUC/OUCMirror-WebUI/issues', active: false },
|
{ key: 'feedback', href: 'https://git.itouc.cn/ITStudio_OUC/OUCMirror-WebUI/issues', active: false },
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export default {
|
|||||||
"nav": {
|
"nav": {
|
||||||
"mirrors": "Mirrors",
|
"mirrors": "Mirrors",
|
||||||
"news": "Announcements",
|
"news": "Announcements",
|
||||||
|
"clubNews": "Club News",
|
||||||
"status": "Status",
|
"status": "Status",
|
||||||
"feedback": "ISSUE"
|
"feedback": "ISSUE"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export default {
|
|||||||
"nav": {
|
"nav": {
|
||||||
"mirrors": "镜像列表",
|
"mirrors": "镜像列表",
|
||||||
"news": "公告",
|
"news": "公告",
|
||||||
|
"clubNews": "社团新闻",
|
||||||
"status": "站点状态",
|
"status": "站点状态",
|
||||||
"feedback": "问题反馈"
|
"feedback": "问题反馈"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user