Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit ee19f18

Browse files
authored
chore: links texts (#1152)
* chore(header): links & tests * chore(footer): links & tests
1 parent f3a9227 commit ee19f18

File tree

10 files changed

+103
-85
lines changed

10 files changed

+103
-85
lines changed

src/components/Header/UserAccount.tsx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useAccount } from '@/stores/init'
77

88
import Tooltip from '@/components/Tooltip'
99
import Button from '@/components/Buttons/Button'
10+
import { Space } from '@/components/Common'
1011

1112
// import { onLogin, onLogout, previewAccount } from './logic'
1213

@@ -93,17 +94,15 @@ const UserAccount: FC = () => {
9394
</Wrapper>
9495
)}
9596

96-
<MembershipHint>
97-
{/* 升&nbsp;级- */}
98-
<Button
99-
size="tiny"
100-
type="primary"
101-
ghost
102-
onClick={() => router.push(`/${ROUTE.MEMBERSHIP}`)}
103-
>
104-
升&nbsp;级
105-
</Button>
106-
</MembershipHint>
97+
<Space left={12} />
98+
<Button
99+
size="tiny"
100+
type="primary"
101+
ghost
102+
onClick={() => router.push(`/${ROUTE.MEMBERSHIP}`)}
103+
>
104+
<MembershipHint>升舱</MembershipHint>
105+
</Button>
107106
</Fragment>
108107
)
109108
}

src/components/Header/styles/user_account.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,6 @@ export const DefaultUserIcon = styled(Img)`
7777
opacity: 0.5;
7878
`
7979
export const MembershipHint = styled.div`
80-
margin-left: 12px;
80+
letter-spacing: 2px;
81+
padding: 0 4px;
8182
`

src/components/Navigator/MorePanel/DesktopView.tsx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,41 @@ const MoreContent: FC = () => {
3232
</Main>
3333
<Desc>贴纸/冰箱贴/各种奇奇怪怪。。</Desc>
3434
</Entry> */}
35+
<Entry>
36+
<Main>
37+
<Logo src={`${ICON}/menu/lifebuoy.png`} />
38+
<Link href={`/${ROUTE.SUPPORT_US}`} passHref>
39+
<Title>
40+
支持我们
41+
<Wip>help</Wip>
42+
</Title>
43+
</Link>
44+
</Main>
45+
<Desc>帮助我们一起将社区维持下去</Desc>
46+
</Entry>
3547
<Entry>
3648
<Main>
3749
<Logo src={`${ICON}/menu/hot.svg`} />
3850
<Link href={`/${ROUTE.TRENDING}`} passHref>
39-
<Title>热门</Title>
51+
<Title>趋势讨论</Title>
4052
</Link>
4153
</Main>
42-
<Desc>各社区近期热门内容</Desc>
54+
<Desc>站内外近期热门讨论</Desc>
4355
</Entry>
4456
<Entry>
4557
<Main>
4658
<Logo src={`${ICON}/menu/makers.svg`} />
47-
<Title>创作者社区</Title>
59+
<Title>Makers</Title>
4860
</Main>
49-
<Desc>经验交流,开发者访谈</Desc>
61+
<Desc>创作者经验交流,开发者访谈</Desc>
5062
</Entry>
5163
<Link href={`/${ROUTE.RECIPES}`} passHref>
5264
<Entry>
5365
<Main>
5466
<Logo src={`${ICON}/menu/snippets.svg`} />
55-
<Title>代码片段</Title>
67+
<Title>创建子社区</Title>
5668
</Main>
57-
<Desc>各语言实用 Snippets,小技巧</Desc>
69+
<Desc>在 CP 上创建一个子社区</Desc>
5870
</Entry>
5971
</Link>
6072
<Entry>
@@ -71,17 +83,7 @@ const MoreContent: FC = () => {
7183
<ChartLogo src={`${ICON}/menu/chart.svg`} />
7284
<Title offset="8px">社区统计</Title>
7385
</Main>
74-
<Desc>各社区各项统计数据</Desc>
75-
</Entry>
76-
77-
<Entry>
78-
<Main>
79-
<Logo src={`${ICON}/menu/ear.svg`} />
80-
<Link href={`/${ROUTE.MEMBERSHIP}`} passHref>
81-
<Title>建议与反馈</Title>
82-
</Link>
83-
</Main>
84-
<Desc>关于社区的任何问题或建议</Desc>
86+
<Desc>社区各项统计数据</Desc>
8587
</Entry>
8688
</BodyWrapper>
8789
<Footer />

src/components/Navigator/MorePanel/Footer.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,32 @@ import {
1010
Wrapper,
1111
Entry,
1212
Logo,
13-
SupportLogo,
1413
Main,
1514
Title,
1615
Desc,
17-
Notice,
1816
} from '../styles/more_panel/footer'
1917

2018
const MoreContent: FC = () => {
2119
return (
2220
<Wrapper>
2321
<Entry>
24-
<Link href={`/${ROUTE.SUPPORT_US}`} passHref>
22+
<Link href={`/${GITHUB}`} passHref>
2523
<Main>
26-
<SupportLogo src={`${ICON}/menu/lifebuoy.png`} noLazy />
27-
<Title>支持我们</Title>
24+
<Logo src={`${ICON}/menu/github.svg`} />
25+
<Title>Open Source</Title>
2826
</Main>
2927
</Link>
30-
<Desc>帮助我们一起将社区维持下去</Desc>
31-
<Notice>Help</Notice>
28+
<Desc>本站全部代码开源在 Github 上,欢迎参与</Desc>
3229
</Entry>
30+
3331
<Entry>
34-
<Link href={`/${GITHUB}`} passHref>
32+
<Link href={`/${ROUTE.MEMBERSHIP}`} passHref>
3533
<Main>
36-
<Logo src={`${ICON}/menu/github.svg`} />
37-
<Title>Open Source</Title>
34+
<Logo src={`${ICON}/menu/ear.svg`} noLazy />
35+
<Title>建议与反馈</Title>
3836
</Main>
3937
</Link>
40-
<Desc>本站全部代码开源在 Github 上,欢迎参与</Desc>
38+
<Desc>关于本站的任何吐槽,建议,反馈。</Desc>
4139
</Entry>
4240
</Wrapper>
4341
)

src/components/Navigator/styles/more_panel/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Img from '@/Img'
66

77
export const Wrapper = styled.div<{ mobile?: boolean }>`
88
${css.flexColumn('align-center')};
9-
width: ${({ mobile }) => (!mobile ? '455px' : '100%')};
9+
width: ${({ mobile }) => (!mobile ? '430px' : '100%')};
1010
min-height: 300px;
1111
margin-top: 0;
1212
`
@@ -17,7 +17,7 @@ export const BodyWrapper = styled.div`
1717
`
1818
export const Entry = styled.div<{ mobile?: boolean }>`
1919
${css.flexColumn('align-start')};
20-
width: ${({ mobile }) => (!mobile ? '225px' : '48%')};
20+
width: ${({ mobile }) => (!mobile ? '210px' : '48%')};
2121
height: 75px;
2222
padding-left: 20px;
2323
@@ -69,11 +69,11 @@ export const Desc = styled.div`
6969
margin-left: 28px;
7070
`
7171
export const Wip = styled.div`
72-
color: #007372;
72+
color: #398a89;
7373
border: 1px solid;
7474
border-color: #007372;
7575
margin-left: 10px;
7676
font-size: 10px;
77-
padding: 0 2px;
77+
padding: 0 4px;
7878
border-radius: 4px;
7979
`

src/containers/unit/Footer/DesktopView/HomeView.tsx

Lines changed: 29 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useTheme } from 'styled-components'
44
import type { TThemeMap, TC11NLayout, TMetric } from '@/spec'
55
import { GITHUB, API_SERVER_ADDR, ISSUE_ADDR, BUILD_VERSION } from '@/config'
66
import { ROUTE } from '@/constant'
7+
import { siteBirthDay } from '@/utils/helper'
78

89
import TopInfo from './TopInfo'
910
import BottomInfo from './BottomInfo'
@@ -54,43 +55,35 @@ const HomeView: FC<TProps> = ({ metric, layout }) => {
5455
来一杯
5556
</LinkItem>
5657
<LinkItem href={`${ROUTE.SUPPORT_US}`} {...linkColors}>
57-
活动
58+
小聚
5859
</LinkItem>
5960
<LinkItem href={`${ROUTE.SUPPORT_US}`} {...linkColors}>
60-
工作
61-
</LinkItem>
62-
<LinkItem href={`${ROUTE.SUPPORT_US}`} {...linkColors}>
63-
更多 ..
61+
Makers
6462
</LinkItem>
6563
</Body>
6664
</Column>
6765

6866
<Column>
69-
<Title>会员</Title>
67+
<Title>使用指南</Title>
7068
<Body>
7169
<LinkItem href={`${ROUTE.MEMBERSHIP}`} {...linkColors}>
72-
志愿者
70+
发帖须知
7371
</LinkItem>
7472
<LinkItem href={`${ROUTE.MEMBERSHIP}`} {...linkColors}>
75-
成为会员
73+
会员福利
7674
</LinkItem>
7775
<LinkItem href={`${ROUTE.MEMBERSHIP}`} {...linkColors}>
78-
打赏支持
76+
隐私说明
77+
</LinkItem>
78+
<LinkItem href={`${ROUTE.MEMBERSHIP}`} {...linkColors}>
79+
反馈&nbsp;&amp;&nbsp;建议
80+
</LinkItem>
81+
<LinkItem href={`${ROUTE.MEMBERSHIP}`} {...linkColors}>
82+
加入我们
83+
</LinkItem>
84+
<LinkItem href={`${ROUTE.MEMBERSHIP}`} {...linkColors}>
85+
免责声明
7986
</LinkItem>
80-
</Body>
81-
82-
<br />
83-
<Title>商务</Title>
84-
<Body>
85-
<Item as="span" normal>
86-
投放广告
87-
</Item>
88-
<Item as="span" normal>
89-
赞助商
90-
</Item>
91-
{/* <LinkItem href={`${ROUTE.SUPPORT_US}`} {...linkColors}>
92-
支持我们
93-
</LinkItem> */}
9487
</Body>
9588
</Column>
9689

@@ -109,7 +102,7 @@ const HomeView: FC<TProps> = ({ metric, layout }) => {
109102
<LinkItem href={`${API_SERVER_ADDR}`} {...linkColors}>
110103
API
111104
</LinkItem>
112-
<LinkItem href={`${GITHUB}`} {...linkColors}>
105+
<LinkItem href={`${API_SERVER_ADDR}`} {...linkColors}>
113106
Github
114107
</LinkItem>
115108
</Body>
@@ -119,7 +112,10 @@ const HomeView: FC<TProps> = ({ metric, layout }) => {
119112
<Title>网站状态</Title>
120113
<Body>
121114
<Item as="span" normal>
122-
建造纪元: {BUILD_VERSION}
115+
版本: {BUILD_VERSION}
116+
</Item>
117+
<Item as="span" normal>
118+
年龄: {siteBirthDay('2019/02/01')}
123119
</Item>
124120
</Body>
125121
<br />
@@ -132,25 +128,22 @@ const HomeView: FC<TProps> = ({ metric, layout }) => {
132128
在线人数: --
133129
</Item>
134130
<Item as="span" normal>
135-
小黑屋: --
131+
黑洞: --
136132
</Item>
137133
</Body>
138134
</Column>
139135

140136
<Column>
141-
<Title>支持</Title>
137+
<Title>Brand</Title>
142138
<Body>
143-
<LinkItem href="/home/post/1" {...linkColors}>
144-
违规举报
145-
</LinkItem>
146-
<LinkItem href="/cps-support/posts" {...linkColors}>
147-
反馈与建议
139+
<LinkItem href={`${ROUTE.MEMBERSHIP}`} {...linkColors}>
140+
价值观
148141
</LinkItem>
149-
<LinkItem href={`${ISSUE_ADDR}`} {...linkColors}>
150-
帮助中心
142+
<LinkItem href={`${ROUTE.MEMBERSHIP}`} {...linkColors}>
143+
名词解释
151144
</LinkItem>
152-
<LinkItem href={`${ROUTE.SUPPORT_US}`} {...linkColors}>
153-
内容订阅
145+
<LinkItem href={`${ROUTE.MEMBERSHIP}`} {...linkColors}>
146+
Logo &amp; 资源
154147
</LinkItem>
155148
</Body>
156149
<br />

src/containers/unit/Footer/DesktopView/TopInfo/HomeCommunity.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ const HomeCommunity: FC<TProps> = ({ title = 'oderPlanets' }) => {
2020
</InfoBar>
2121
<SiteTitle>{title}</SiteTitle>
2222
<Linker>关于</Linker>
23-
<Linker>创建社区</Linker>
24-
<Linker>加入我们</Linker>
23+
<Linker>支持我们</Linker>
2524
<Linker>特别感谢</Linker>
26-
<Linker>Github</Linker>
25+
<Linker>反馈 &amp; 建议</Linker>
2726
<Linker>访问统计</Linker>
2827
</Wrapper>
2928
)

src/containers/unit/Footer/styles/desktop_view/top_info/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const SiteTitle = styled.div`
3131
font-size: 18px;
3232
font-weight: bold;
3333
margin-left: 4px;
34-
margin-right: 56px;
34+
margin-right: 52px;
3535
letter-spacing: 1px;
3636
`
3737
export const ArrowDividerIcon = styled(Img)`

src/containers/unit/Header/DesktopView/CommunityView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
*/
66

7-
import React, { FC, useEffect } from 'react'
7+
import { FC, useEffect } from 'react'
88
import dynamic from 'next/dynamic'
99

1010
import type { TMetric } from '@/spec'

utils/helper.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,3 +384,29 @@ export const openShareWindow = (
384384

385385
Global.open(targetUrl, '_blank', 'height=500, width=600')
386386
}
387+
388+
// https://stackoverflow.com/a/2627482/4050784
389+
export const daysBetween = (date1, date2) => {
390+
// The number of milliseconds in one day
391+
const ONE_DAY = 1000 * 60 * 60 * 24
392+
393+
// Calculate the difference in milliseconds
394+
const differenceMs = Math.abs(date1 - date2)
395+
396+
// Convert back to days and return
397+
return Math.round(differenceMs / ONE_DAY)
398+
}
399+
400+
// birthday is a Date
401+
const calculateAge = (birthday) => {
402+
const ageDifMs = Date.now() - birthday.getTime()
403+
const ageDate = new Date(ageDifMs) // miliseconds from epoch
404+
return Math.abs(ageDate.getUTCFullYear() - 1970)
405+
}
406+
407+
export const siteBirthDay = (birthday: string): string => {
408+
const year = calculateAge(new Date(birthday))
409+
const days = daysBetween(new Date(birthday), Date.now()) - 365 * year
410+
411+
return `${year}${days}天`
412+
}

0 commit comments

Comments
 (0)