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

Commit 80429b0

Browse files
authored
refactor(works): rename works route (#1263)
1 parent 9194143 commit 80429b0

File tree

6 files changed

+8
-11
lines changed

6 files changed

+8
-11
lines changed

config/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"SITE_URL_SHORT": "https://coderplanets.com",
5454
"GITHUB": "https://github.com/coderplanets",
5555
"GITHUB_WEB_ADDR": "https://github.com/coderplanets/coderplanets_web",
56-
"ABOUT_LINK": "/works/5",
56+
"ABOUT_LINK": "/w/5",
5757
"ISSUE_ADDR": "https://github.com/coderplanets/coderplanets_web/issues",
5858
"MENTION_USER_ADDR": "https://coderplanets.com/users/",
5959
"//--- contact configs ---//": "",
File renamed without changes.

src/pages/gallery.tsx renamed to src/pages/works.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const getServerSideProps = async (context) => {
7171
}
7272
}
7373

74-
const GalleryPage = (props) => {
74+
const WorksPage = (props) => {
7575
const store = useStore(props)
7676
const seoConfig = worksSEO()
7777

@@ -84,4 +84,4 @@ const GalleryPage = (props) => {
8484
)
8585
}
8686

87-
export default GalleryPage
87+
export default WorksPage

src/widgets/Cards/WorksCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { isMobile } from 'react-device-detect'
1111

1212
import type { TWorks } from '@/spec'
1313
import { ICON, ICON_CMD } from '@/config'
14-
import { THREAD } from '@/constant'
14+
import { ROUTE } from '@/constant'
1515

1616
import { cutRest } from '@/utils/helper'
1717
import { buildLog } from '@/utils/logger'
@@ -81,7 +81,7 @@ const WorksCard: FC<TProps> = ({
8181
{preview ? (
8282
<PreviewName as="div">{title || '--'}</PreviewName>
8383
) : (
84-
<Link href={`/${THREAD.WORKS}/${id}`} passHref>
84+
<Link href={`/${ROUTE.W}/${id}`} passHref prefetch={false}>
8585
<Name>{title || '--'}</Name>
8686
</Link>
8787
)}

src/widgets/Navigator/MainEntries/DesktopView.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@ const DesktopView: FC<TProps> = ({ type }) => {
2929
</SiteLink>
3030
</Link>
3131
<DotDivider space={splitMargin} />
32-
<Link href={`/${ROUTE.GALLERY}`} passHref>
33-
<SiteLink
34-
active={mainPath === ROUTE.GALLERY}
35-
testid="header-works-link"
36-
>
32+
<Link href={`/${ROUTE.WORKS}`} passHref>
33+
<SiteLink active={mainPath === ROUTE.WORKS} testid="header-works-link">
3734
作品
3835
</SiteLink>
3936
</Link>

utils/constant/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ export const NON_COMMUNITY_ROUTE = {
33
MEETUPS: 'meetups',
44
HAVE_A_DRINK: 'have-a-drink',
55
COOL_GUIDE: 'cool-guide',
6+
W: 'w',
67
WORKS: 'works',
78
PLAZA: 'plaza',
8-
GALLERY: 'gallery',
99
TRENDING: 'trending',
1010
TOPICS: 'topics',
1111
SPONSOR: 'sponsor',

0 commit comments

Comments
 (0)