Skip to content

Commit 1d4b3ec

Browse files
committed
chore: add github link
1 parent e61ee9a commit 1d4b3ec

File tree

4 files changed

+37
-12
lines changed

4 files changed

+37
-12
lines changed

src/components/Layout/index.tsx

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
import { useRouter } from 'next/router'
22
import { ConfigProvider, Layout, App as AntdApp, theme as antdTheme, Avatar, Space, Button, Typography, Spin } from 'antd'
3-
import Icon, { MenuFoldOutlined, MenuUnfoldOutlined, ApiOutlined, BulbOutlined, SettingOutlined, MessageOutlined, ShoppingOutlined, ShareAltOutlined, ReadOutlined, RadiusSettingOutlined } from '@ant-design/icons'
3+
import Icon, {
4+
MenuFoldOutlined,
5+
MenuUnfoldOutlined,
6+
ApiOutlined,
7+
GithubOutlined,
8+
BulbOutlined,
9+
SettingOutlined,
10+
MessageOutlined,
11+
ShoppingOutlined,
12+
ShareAltOutlined,
13+
ReadOutlined,
14+
RadiusSettingOutlined,
15+
} from '@ant-design/icons'
416
const { Header, Sider, Content } = Layout
517
import React, { useEffect, useState } from 'react'
618
import { useSiteContext } from '@/contexts/site'
@@ -12,14 +24,16 @@ import IconLight from '@/assets/icons/light.svg'
1224
import IconDark from '@/assets/icons/dark.svg'
1325
import { tool } from '@/utils'
1426

27+
const {version: packageVersion, name: packageName} = require('@/../package.json')
28+
1529
// default colorPrimary
1630
export const colorPrimary = '#1677ff'
1731

1832
export default function LayoutBase(props: any) {
1933
const { token } = antdTheme.useToken()
2034
const { t } = useTranslation()
2135
const { title, theme, setTheme, event$ } = useSiteContext()
22-
const { surface: surfaceConfig, common: commonConfig } = useSettingContext()
36+
const { surface: surfaceConfig, common: commonConfig } = useSettingContext()
2337
const router = useRouter()
2438
const [colorBgContainer, setColorBgContainer] = useState(token.colorBgContainer)
2539
const [colorPrimary, setColorPrimary] = useState(token.colorPrimary)
@@ -76,8 +90,8 @@ export default function LayoutBase(props: any) {
7690
console.log('switchTheme', theme, newTheme)
7791
setTheme(newTheme)
7892
}
79-
useEffect(()=>{
80-
if(surfaceConfig?.colorPrimary){
93+
useEffect(() => {
94+
if (surfaceConfig?.colorPrimary) {
8195
let _colorPrimary = surfaceConfig?.colorPrimary
8296
setColorPrimary(_colorPrimary)
8397
}
@@ -146,6 +160,8 @@ export default function LayoutBase(props: any) {
146160
ghost={getActive(item.path) ? false : true}
147161
size={'large'}
148162
icon={item.icon}
163+
// @ts-ignore
164+
title={t(item.name)}
149165
style={{ border: getActive(item.path) ? undefined : 'none', color: getActive(item.path) ? item.iconColorActive : theme === 'dark' ? item.iconColor : '#555' }}
150166
>
151167
{collapsed ? '' : t(item.name)}
@@ -169,20 +185,13 @@ export default function LayoutBase(props: any) {
169185
onClick={() => {
170186
setHeadTitle(t('c.setting'))
171187
router.push('/setting')
172-
// // 设置弹窗
173-
// tool.showModal(<Setting></Setting>, {
174-
// title: t('c.setting'),
175-
// width: 600,
176-
// bodyStyle: { minHeight: 400 },
177-
// footer: null
178-
// })
179188
}}
180189
ghost={getActive('/setting') ? false : true}
181190
style={{ border: getActive('/setting') ? undefined : 'none', color: getActive('/setting') ? colorPrimary : theme === 'dark' ? iconColor : '#555' }}
182191
size={'large'}
183192
icon={<SettingOutlined style={{ color: theme === 'dark' ? iconColor : '#555' }} />}
184193
></Button>
185-
<Button
194+
{/* <Button
186195
onClick={() => {
187196
setCollapsed(!collapsed)
188197
// setSide(!side)
@@ -194,7 +203,20 @@ export default function LayoutBase(props: any) {
194203
className: 'trigger',
195204
style: { color: theme === 'dark' ? iconColor : '#555' },
196205
})}
206+
></Button> */}
207+
<Button
208+
onClick={() => {
209+
setHeadTitle(t('c.github'))
210+
window.open('https://github.com/zhpd/chatgpt-plus')
211+
}}
212+
ghost={getActive('/github') ? false : true}
213+
style={{ border: getActive('/github') ? undefined : 'none', color: getActive('/github') ? colorPrimary : theme === 'dark' ? iconColor : '#555' }}
214+
size={'large'}
215+
icon={<GithubOutlined style={{ color: theme === 'dark' ? iconColor : '#555' }} />}
197216
></Button>
217+
{packageVersion && <Typography.Paragraph type="secondary" style={{ color: theme === 'dark' ? iconColor : '#555', fontSize:'10px', marginBottom:0 }}>
218+
{'v'+packageVersion}
219+
</Typography.Paragraph>}
198220
</Space>
199221
</div>
200222
</Sider>

src/locales/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"store": "Store",
1111
"readme": "Readme",
1212
"setting": "Setting",
13+
"github": "Github",
1314
"open": "Open",
1415
"close": "Close",
1516
"delete": "Delete",

src/locales/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"store": "商店",
1313
"readme": "介绍",
1414
"setting": "设置",
15+
"github": "Github",
1516
"open": "开启",
1617
"close": "关闭",
1718
"delete": "删除",

src/locales/zh-TW.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"store": "商店",
1313
"readme": "說明",
1414
"setting": "設定",
15+
"github": "Github",
1516
"open": "開啟",
1617
"close": "關閉",
1718
"delete": "刪除",

0 commit comments

Comments
 (0)