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

Commit 285243b

Browse files
authored
chore: home page alert (#1370)
* feat: add alert text & adjust home page * chore(version): bump to 1.0.5
1 parent 8107442 commit 285243b

File tree

4 files changed

+14
-74
lines changed

4 files changed

+14
-74
lines changed

deploy/production/web.tar.gz

-30.3 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "coderplanets_web",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"license": "Apache License 2.0",
55
"scripts": {
66
"dev": "cross-env NODE_ENV=dev next dev",

src/pages/index.tsx

Lines changed: 5 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,87 +2,22 @@
22
this page is for /explore
33
*/
44
import { Provider } from 'mobx-react'
5-
import { clone } from 'ramda'
65
import { METRIC } from '@/constant'
76

8-
import { PAGE_SIZE } from '@/config'
9-
import {
10-
ssrBaseStates,
11-
ssrFetchPrepare,
12-
ssrGetParam,
13-
refreshIfneed,
14-
exploreSEO,
15-
ssrError,
16-
} from '@/utils'
7+
import { exploreSEO } from '@/utils'
178

189
import { useStore } from '@/stores/init'
1910

2011
import GlobalLayout from '@/containers/layout/GlobalLayout'
2112
import ExploreContent from '@/containers/content/ExploreContent'
2213

23-
import { P } from '@/schemas'
24-
25-
const loader = async (context, opt = {}) => {
26-
const { gqClient, userHasLogin } = ssrFetchPrepare(context, opt)
27-
28-
const category = ssrGetParam(context, 'nc_path')
29-
const page = ssrGetParam(context, 'page')
30-
31-
const filter = {
32-
page: 1,
33-
size: PAGE_SIZE.M,
34-
}
35-
36-
const communitiesFilter = clone(filter)
37-
// @ts-ignore
38-
if (category) communitiesFilter.category = category
39-
if (page) communitiesFilter.page = parseInt(page, 10)
40-
41-
const sessionState = gqClient.request(P.sessionState)
42-
const pagedCommunities = gqClient.request(P.pagedCommunities, {
43-
filter: communitiesFilter,
44-
userHasLogin,
45-
})
46-
const pagedCategories = gqClient.request(P.pagedCategories, { filter })
47-
48-
const subscribedCommunities = gqClient.request(P.subscribedCommunities, {
49-
filter: {
50-
page: 1,
51-
size: 30,
52-
},
53-
})
54-
55-
return {
56-
...(await sessionState),
57-
...(await pagedCategories),
58-
...(await pagedCommunities),
59-
...(await subscribedCommunities),
60-
}
61-
}
62-
6314
export const getServerSideProps = async (context) => {
64-
let resp
65-
try {
66-
resp = await loader(context)
67-
const { sessionState } = resp
68-
69-
refreshIfneed(sessionState, '/explore', context)
70-
} catch (e) {
71-
console.log('#### error from server: ', e)
72-
return ssrError(context, 'fetch', 500)
73-
}
74-
75-
const { pagedCategories, pagedCommunities } = resp
76-
77-
const initProps = {
78-
...ssrBaseStates(resp),
79-
exploreContent: {
80-
pagedCommunities,
81-
pagedCategories,
15+
return {
16+
redirect: {
17+
permanent: false,
18+
destination: '/home',
8219
},
8320
}
84-
85-
return { props: { errorCode: null, ...initProps } }
8621
}
8722

8823
const ExplorePage = (props) => {

src/widgets/BannerNotify/index.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ type TProps = {
3232
bg: TColorName
3333
}
3434

35+
const DETAIL_TEXT =
36+
'本站即将迁移到 Groupher.com, 为中小产品团队提供社区反馈服务,如果你对此有兴趣,欢迎加 v(mydearxym) 详聊。'
37+
3538
const BannerNotify: FC<TProps> = ({
3639
testid = 'banner-notify',
3740
metric,
@@ -46,18 +49,20 @@ const BannerNotify: FC<TProps> = ({
4649
>
4750
<Row>
4851
<NotifyIcon />
49-
<Desc>我们将在 10 月发布新的版本,敬请期待</Desc>
52+
<Desc>网站改版迁移中,服务暂不可用</Desc>
5053
</Row>
5154

5255
<Row>
5356
{layout === BANNER_NOTIFY_LAYOUT.DEFAULT ? (
5457
<Fragment>
55-
<LinkBtn bg={bg}>查看详情</LinkBtn>
58+
<LinkBtn onClick={() => alert(DETAIL_TEXT)} bg={bg}>
59+
查看详情
60+
</LinkBtn>
5661
<CrossIcon />
5762
</Fragment>
5863
) : (
5964
<Fragment>
60-
<LinkText>查看详情</LinkText>
65+
<LinkText onClick={() => alert(DETAIL_TEXT)}>查看详情</LinkText>
6166
<ArrowIcon />
6267
</Fragment>
6368
)}

0 commit comments

Comments
 (0)