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

Commit 102fb4d

Browse files
authored
refactor(discovery): ts & renaming (#1153)
* chore: test adjust & js -> ts * chore: explore naming
1 parent 41e3d59 commit 102fb4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+413
-386
lines changed

cypress/integration/discovery/layout.spec.js renamed to cypress/integration/explore/layout.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//
2-
describe('discovery page: ', () => {
2+
describe('explore page: ', () => {
33
// beforeEach(() => {
44
before(() => {
5-
cy.visit('/discovery')
5+
cy.visit('/explore')
66
})
77

88
it('basic layout', () => {
@@ -13,13 +13,13 @@ describe('discovery page: ', () => {
1313

1414
// cy.id('sidebar').should('be.visible')
1515

16-
cy.id('discovery-banner').should('be.visible')
16+
cy.id('explore-banner').should('be.visible')
1717
// cypress can not load dynamic Footer
1818
// cy.id('footer').should('be.visible')
1919
})
2020

2121
it('discovery link should be highlight', () => {
22-
cy.id('header-discovery-link')
22+
cy.id('header-explore-link')
2323
.should('not.have.css', 'background', 'transparent')
2424
.and('have.css', 'padding', '5px 6px')
2525
})

server/routes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ router.route('/create/works').get((req, res) => {
113113
})
114114

115115
// 所有社区
116-
router.route('/discovery').get((req, res) => res.redirect('/discovery/pl'))
116+
router.route('/explore').get((req, res) => res.redirect('/explore/pl'))
117117

118-
router.route('/discovery/:category').get((req, res) => {
119-
return renderAndCache({ req, res, path: '/discovery' })
118+
router.route('/explore/:category').get((req, res) => {
119+
return renderAndCache({ req, res, path: '/explore' })
120120
})
121121

122122
// 帮助中心

size-limit.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"maxSize": "280 kB"
1010
},
1111
{
12-
"path": ".next/server/pages/discovery.js",
12+
"path": ".next/server/pages/explore.js",
1313
"maxSize": "280 kB"
1414
},
1515
{

src/components/Header/DesktopView/CommunityLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const AddOns = dynamic(() => import('../AddOns'), { ssr: false })
3030

3131
const hasNoBorder = (metric: TMetric): boolean =>
3232
contains(metric, [
33-
METRIC.DISCOVERY,
33+
METRIC.EXPLORE,
3434
METRIC.SPONSOR,
3535
METRIC.SUPPORT_US,
3636
METRIC.SUBSCRIBE,

src/components/Header/DesktopView/GeneralLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const AddOns = dynamic(() => import('../AddOns'), { ssr: false })
2929

3030
const hasNoBorder = (metric: TMetric): boolean =>
3131
contains(metric, [
32-
METRIC.DISCOVERY,
32+
METRIC.EXPLORE,
3333
METRIC.SPONSOR,
3434
METRIC.SUPPORT_US,
3535
METRIC.SUBSCRIBE,

src/components/Header/DesktopView/WorksLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const AddOns = dynamic(() => import('../AddOns'), { ssr: false })
2929

3030
const hasNoBorder = (metric: TMetric): boolean =>
3131
contains(metric, [
32-
METRIC.DISCOVERY,
32+
METRIC.EXPLORE,
3333
METRIC.SPONSOR,
3434
METRIC.SUPPORT_US,
3535
METRIC.SUBSCRIBE,

src/components/Navigator/MainEntries/DesktopView.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ const DesktopView: FC<TProps> = ({ type }) => {
2222

2323
return (
2424
<Wrapper type={type}>
25-
<Link href={`/${ROUTE.DISCOVERY}`} passHref>
25+
<Link href={`/${ROUTE.EXPLORE}`} passHref>
2626
<SiteLink
27-
active={mainPath === ROUTE.DISCOVERY}
28-
testid="header-discovery-link"
27+
active={mainPath === ROUTE.EXPLORE}
28+
testid="header-explore-link"
2929
>
3030
发现
3131
</SiteLink>

src/components/Navigator/MorePanel/MobileView.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,35 @@ const items = [
2020
icon: `${ICON}/route/light.svg`,
2121
title: '作品集市',
2222
desc: '作品,产品的跳蚤集市',
23-
href: `/${ROUTE.DISCOVERY}`,
23+
href: `/${ROUTE.EXPLORE}`,
2424
raw: 11,
2525
},
2626
{
2727
icon: `${ICON}/route/cool-guide.svg`,
2828
title: '酷导航',
2929
desc: '发现有意思的东西',
30-
href: `/${ROUTE.DISCOVERY}`,
30+
href: `/${ROUTE.EXPLORE}`,
3131
raw: 12,
3232
},
3333
{
3434
icon: `${ICON}/route/job.svg`,
3535
title: '工作',
3636
desc: '找工作?来这里看看',
37-
href: `/${ROUTE.DISCOVERY}`,
37+
href: `/${ROUTE.EXPLORE}`,
3838
raw: 13,
3939
},
4040
{
4141
icon: `${ICON}/route/cup.svg`,
4242
title: '来一杯',
4343
desc: '渴了累了来一杯?',
44-
href: `/${ROUTE.DISCOVERY}`,
44+
href: `/${ROUTE.EXPLORE}`,
4545
raw: 14,
4646
},
4747
{
4848
icon: `${ICON}/route/meetup.svg`,
4949
title: '活动',
5050
desc: '来线下和同行聊聊?',
51-
href: `/${ROUTE.DISCOVERY}`,
51+
href: `/${ROUTE.EXPLORE}`,
5252
raw: 15,
5353
},
5454
{

src/containers/content/CommunitiesContent/store.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* DiscoveryContentStore store
2+
* ExploreContentStore store
33
*
44
*/
55

@@ -11,7 +11,7 @@ import { markStates, toJS } from '@/utils/mobx'
1111
import { Trans } from '@/utils/i18n'
1212
import { PagedCommunities, PagedCategories, emptyPagiData } from '@/model'
1313

14-
const DiscoveryContentStore = T.model('DiscoveryContentStore', {
14+
const ExploreContentStore = T.model('ExploreContentStore', {
1515
// current active sidbar menu id
1616
activeCatalogId: T.maybeNull(T.string),
1717
pagedCommunities: T.optional(PagedCommunities, emptyPagiData),
@@ -121,11 +121,11 @@ const DiscoveryContentStore = T.model('DiscoveryContentStore', {
121121
},
122122
addSubscribedCommunity(community) {
123123
self.root.account.addSubscribedCommunity(community)
124-
self.root.discoveryContent.toggleSubscribe(community)
124+
self.root.exploreContent.toggleSubscribe(community)
125125
},
126126
removeSubscribedCommunity(community) {
127127
self.root.account.removeSubscribedCommunity(community)
128-
self.root.discoveryContent.toggleSubscribe(community)
128+
self.root.exploreContent.toggleSubscribe(community)
129129
},
130130
markRoute(query) {
131131
self.root.markRoute(query)
@@ -135,4 +135,4 @@ const DiscoveryContentStore = T.model('DiscoveryContentStore', {
135135
},
136136
}))
137137

138-
export default DiscoveryContentStore
138+
export default ExploreContentStore

src/containers/content/DiscoveryContent/CommunityCard.js

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)