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

chore: home page alert #1370

Merged
merged 2 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified deploy/production/web.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coderplanets_web",
"version": "1.0.4",
"version": "1.0.5",
"license": "Apache License 2.0",
"scripts": {
"dev": "cross-env NODE_ENV=dev next dev",
Expand Down
75 changes: 5 additions & 70 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,87 +2,22 @@
this page is for /explore
*/
import { Provider } from 'mobx-react'
import { clone } from 'ramda'
import { METRIC } from '@/constant'

import { PAGE_SIZE } from '@/config'
import {
ssrBaseStates,
ssrFetchPrepare,
ssrGetParam,
refreshIfneed,
exploreSEO,
ssrError,
} from '@/utils'
import { exploreSEO } from '@/utils'

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

import GlobalLayout from '@/containers/layout/GlobalLayout'
import ExploreContent from '@/containers/content/ExploreContent'

import { P } from '@/schemas'

const loader = async (context, opt = {}) => {
const { gqClient, userHasLogin } = ssrFetchPrepare(context, opt)

const category = ssrGetParam(context, 'nc_path')
const page = ssrGetParam(context, 'page')

const filter = {
page: 1,
size: PAGE_SIZE.M,
}

const communitiesFilter = clone(filter)
// @ts-ignore
if (category) communitiesFilter.category = category
if (page) communitiesFilter.page = parseInt(page, 10)

const sessionState = gqClient.request(P.sessionState)
const pagedCommunities = gqClient.request(P.pagedCommunities, {
filter: communitiesFilter,
userHasLogin,
})
const pagedCategories = gqClient.request(P.pagedCategories, { filter })

const subscribedCommunities = gqClient.request(P.subscribedCommunities, {
filter: {
page: 1,
size: 30,
},
})

return {
...(await sessionState),
...(await pagedCategories),
...(await pagedCommunities),
...(await subscribedCommunities),
}
}

export const getServerSideProps = async (context) => {
let resp
try {
resp = await loader(context)
const { sessionState } = resp

refreshIfneed(sessionState, '/explore', context)
} catch (e) {
console.log('#### error from server: ', e)
return ssrError(context, 'fetch', 500)
}

const { pagedCategories, pagedCommunities } = resp

const initProps = {
...ssrBaseStates(resp),
exploreContent: {
pagedCommunities,
pagedCategories,
return {
redirect: {
permanent: false,
destination: '/home',
},
}

return { props: { errorCode: null, ...initProps } }
}

const ExplorePage = (props) => {
Expand Down
11 changes: 8 additions & 3 deletions src/widgets/BannerNotify/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ type TProps = {
bg: TColorName
}

const DETAIL_TEXT =
'本站即将迁移到 Groupher.com, 为中小产品团队提供社区反馈服务,如果你对此有兴趣,欢迎加 v(mydearxym) 详聊。'

const BannerNotify: FC<TProps> = ({
testid = 'banner-notify',
metric,
Expand All @@ -46,18 +49,20 @@ const BannerNotify: FC<TProps> = ({
>
<Row>
<NotifyIcon />
<Desc>我们将在 10 月发布新的版本,敬请期待。</Desc>
<Desc>网站改版迁移中,服务暂不可用。</Desc>
</Row>

<Row>
{layout === BANNER_NOTIFY_LAYOUT.DEFAULT ? (
<Fragment>
<LinkBtn bg={bg}>查看详情</LinkBtn>
<LinkBtn onClick={() => alert(DETAIL_TEXT)} bg={bg}>
查看详情
</LinkBtn>
<CrossIcon />
</Fragment>
) : (
<Fragment>
<LinkText>查看详情</LinkText>
<LinkText onClick={() => alert(DETAIL_TEXT)}>查看详情</LinkText>
<ArrowIcon />
</Fragment>
)}
Expand Down