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

Commit f253992

Browse files
authored
feat(help-center): useful/useless concept UX (#1020)
1 parent 0433ead commit f253992

File tree

18 files changed

+400
-95
lines changed

18 files changed

+400
-95
lines changed

src/containers/content/HelpCenterContent/Cover.js

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import React from 'react'
2+
3+
import LinksCard from '@/components/LinksCard'
4+
5+
import type { TCommunity } from '@/spec'
6+
import type { THelpArticle, TVisibles } from './spec'
7+
8+
import Footer from './Footer'
9+
10+
import { Wrapper, ContentWrapper } from './styles/cover'
11+
import { gotoDetail } from './logic'
12+
13+
type TProps = {
14+
items: THelpArticle[]
15+
community: TCommunity
16+
visibles: TVisibles
17+
}
18+
19+
const Cover: React.FC<TProps> = ({ items, community, visibles }) => {
20+
return (
21+
<Wrapper>
22+
<ContentWrapper>
23+
<LinksCard
24+
title="常见问题"
25+
items={items}
26+
onSelect={(item: THelpArticle) => gotoDetail(item)}
27+
/>
28+
<LinksCard
29+
title="常见问题"
30+
items={items}
31+
onSelect={(item) => gotoDetail(item)}
32+
/>
33+
<LinksCard
34+
title="常见问题"
35+
items={items}
36+
onSelect={(item) => gotoDetail(item)}
37+
/>
38+
<LinksCard
39+
title="常见问题"
40+
items={items}
41+
onSelect={(item) => gotoDetail(item)}
42+
/>
43+
<LinksCard
44+
title="常见问题"
45+
items={items}
46+
onSelect={(item) => gotoDetail(item)}
47+
/>
48+
</ContentWrapper>
49+
<Footer community={community} visibles={visibles} />
50+
</Wrapper>
51+
)
52+
}
53+
54+
export default Cover

src/containers/content/HelpCenterContent/Detail.js

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React from 'react'
2+
3+
import CollapseMenu from '@/components/CollapseMenu'
4+
5+
import type { TCommunity, TVisibles } from './spec'
6+
import Footer from './Footer'
7+
8+
import {
9+
Wrapper,
10+
ContentWrapper,
11+
ArticleWrapper,
12+
MenuWrapper,
13+
} from './styles/detail'
14+
15+
type TProps = {
16+
community: TCommunity
17+
visibles: TVisibles
18+
}
19+
20+
const Detail: React.FC<TProps> = ({ community, visibles }) => {
21+
return (
22+
<Wrapper>
23+
<ContentWrapper>
24+
<ArticleWrapper>帮助详情</ArticleWrapper>
25+
<Footer community={community} visibles={visibles} />
26+
</ContentWrapper>
27+
<MenuWrapper>
28+
<CollapseMenu />
29+
</MenuWrapper>
30+
</Wrapper>
31+
)
32+
}
33+
34+
export default Detail
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React from 'react'
2+
3+
import type { TCommunity } from '@/spec'
4+
5+
import {
6+
Wrapper,
7+
Title,
8+
ContactsWrapper,
9+
PostLink,
10+
ContactItem,
11+
} from '../styles/footer/help_info'
12+
13+
type TProps = {
14+
community: TCommunity
15+
}
16+
17+
const HelpInfo: React.FC<TProps> = ({ community }) => {
18+
return (
19+
<Wrapper>
20+
<Title>当前问答都解决不了我的问题?</Title>
21+
<div>
22+
您可以在 {community.title} 社区{' '}
23+
<PostLink href={`/${community.raw}/posts`}>[发帖询问]</PostLink>
24+
,或通过官方渠道联系我们:
25+
</div>
26+
<ContactsWrapper>
27+
<ContactItem>邮箱: xx@gmail.com</ContactItem>
28+
<ContactItem>微信: mydearxym</ContactItem>
29+
</ContactsWrapper>
30+
</Wrapper>
31+
)
32+
}
33+
34+
export default HelpInfo
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import React from 'react'
2+
3+
import type { TVisibles } from '../spec'
4+
5+
import { ICON } from '@/config'
6+
7+
import {
8+
Wrapper,
9+
Title,
10+
BoxWrapper,
11+
Button,
12+
UsefulIcon,
13+
UsefulText,
14+
CryIcon,
15+
UselessWrapper,
16+
UselessButton,
17+
UselessText,
18+
} from '../styles/footer/reaction'
19+
20+
import { usefulOnClick, uselessOnClick } from '../logic'
21+
22+
type TProps = {
23+
visibles: TVisibles
24+
}
25+
26+
const Reaction: React.FC<TProps> = ({ visibles }) => {
27+
const { uselessClicked } = visibles
28+
return (
29+
<Wrapper>
30+
<Title>这些信息是否有用?</Title>
31+
<BoxWrapper>
32+
<Button onClick={usefulOnClick}>
33+
<UsefulIcon src={`${ICON}/useful-color.svg`} />
34+
<UsefulText>有用</UsefulText>
35+
</Button>
36+
<UselessWrapper>
37+
<UselessButton active={uselessClicked} onClick={uselessOnClick}>
38+
<CryIcon src={`${ICON}/shape/cry.svg`} active={uselessClicked} />
39+
</UselessButton>
40+
<UselessText>没有帮助</UselessText>
41+
</UselessWrapper>
42+
</BoxWrapper>
43+
</Wrapper>
44+
)
45+
}
46+
47+
export default Reaction
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React from 'react'
2+
3+
import type { TCommunity } from '@/spec'
4+
import type { TVisibles } from '../spec'
5+
6+
import Reaction from './Reaction'
7+
import HelpInfo from './HelpInfo'
8+
9+
import { Wrapper } from '../styles/footer'
10+
11+
type TProps = {
12+
community: TCommunity
13+
visibles: TVisibles
14+
}
15+
16+
const Footer: React.FC<TProps> = ({ community, visibles }) => {
17+
const { showHelpInfo, showReaction } = visibles
18+
return (
19+
<Wrapper>
20+
{showReaction && <Reaction visibles={visibles} />}
21+
{showHelpInfo && <HelpInfo community={community} />}
22+
</Wrapper>
23+
)
24+
}
25+
26+
export default Footer

src/containers/content/HelpCenterContent/index.tsx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ import { useInit } from './logic'
2525
/* eslint-disable-next-line */
2626
const log = buildLog('C:HelpCenterContent')
2727

28+
const items = [
29+
{
30+
id: '0',
31+
title: '这是一个什么社区?',
32+
},
33+
{
34+
id: '1',
35+
title: 'Wix Bookings: Tips for Marketing',
36+
},
37+
{
38+
id: '2',
39+
title: '在哪里可以下载到 iOS 版本的安装包?',
40+
},
41+
{
42+
id: '3',
43+
title: '后续会有更多的作品吗',
44+
},
45+
]
46+
2847
type TProps = {
2948
helpCenterContent?: TStore
3049
testid?: string
@@ -37,13 +56,17 @@ const HelpCenterContentContainer: React.FC<TProps> = ({
3756
metric = METRIC.HELP_CENTER,
3857
}) => {
3958
useInit(store)
40-
const { view, curCommunity } = store
59+
const { view, curCommunity, visibles } = store
4160

4261
return (
4362
<Wrapper testid={testid}>
4463
<Digest metric={metric} community={curCommunity} />
4564
<ContentWrapper metric={metric}>
46-
{view === VIEW.COVER ? <Cover /> : <Detail />}
65+
{view === VIEW.COVER ? (
66+
<Cover items={items} community={curCommunity} visibles={visibles} />
67+
) : (
68+
<Detail community={curCommunity} visibles={visibles} />
69+
)}
4770
</ContentWrapper>
4871
</Wrapper>
4972
)

src/containers/content/HelpCenterContent/logic.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useEffect } from 'react'
33

44
import { buildLog } from '@/utils'
55

6+
import type { THelpArticle } from './spec'
67
import type { TStore } from './store'
78
import { VIEW } from './constant'
89

@@ -16,10 +17,25 @@ const log = buildLog('L:HelpCenterContent')
1617
/**
1718
* goto detail help-center article
1819
*/
19-
export const gotoDetail = (): void => {
20+
export const gotoDetail = (article: THelpArticle): void => {
21+
log('goto: ', article)
2022
store?.mark({ view: VIEW.DETAIL })
2123
}
2224

25+
/**
26+
* useful button on click
27+
*/
28+
export const usefulOnClick = (): void => {
29+
store?.mark({ uselessClicked: false })
30+
}
31+
32+
/**
33+
* uesless button on click
34+
*/
35+
export const uselessOnClick = (): void => {
36+
store?.mark({ uselessClicked: true })
37+
}
38+
2339
// ###############################
2440
// init & uninit handlers
2541
// ###############################
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export type { TCommunity } from '@/spec'
2+
3+
export type THelpArticle = {
4+
id: string
5+
title: string
6+
}
7+
8+
export type TVisibles = {
9+
showReaction: boolean
10+
showHelpInfo: boolean
11+
uselessClicked: boolean
12+
}

0 commit comments

Comments
 (0)