Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit4e1a890

Browse files
authored
feat(community-tag-setter): rewrite with cool UX (#1141)
* chore: wip* feat: a archived sign concept* feat: basic article menu concept* refactor: re-org with spec* refactor: switch view wip* chore: wip* refactor: community setter wip* chore: wip* chore: adjust debouce fn & NoticeBar style* chore: adjust height for laptop* refactor: search workflow done* refactor: community setter wip* refactor: mv toggleCommunity logic to store* refactor: wip* chore: tags adjust* refactor: trigger workflow
1 parente6e7aaf commit4e1a890

File tree

90 files changed

+2010
-653
lines changed

Some content is hidden

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

90 files changed

+2010
-653
lines changed

‎jsconfig.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"@/config": ["config"],
1414
"@/stores/*": ["src/stores/*"],
1515
"@/model": ["src/stores/SharedModel"],
16+
"@/model*": ["src/stores/SharedModel/*"],
1617
"@/utils": ["utils"],
1718
"@/utils/*": ["utils/*"],
1819
"@/schemas": ["src/schemas"],
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import{FC,memo}from'react'
2+
3+
importButtonfrom'@/components/Buttons/Button'
4+
import{Wrapper,Title,Text,LinksWrapper}from'./styles/detail_panel'
5+
6+
constDetailPanel:FC=()=>{
7+
return(
8+
<Wrapper>
9+
<Title>本帖已于 2020年11月5日 存档</Title>
10+
<Text>存档后无法编辑,删除及评论。</Text>
11+
12+
<LinksWrapper>
13+
<Buttonsize="tiny"ghostnoBorder>
14+
什么是存档?
15+
</Button>
16+
</LinksWrapper>
17+
</Wrapper>
18+
)
19+
}
20+
21+
exportdefaultmemo(DetailPanel)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
*
3+
* ArchivedSign
4+
*
5+
*/
6+
7+
import{FC,memo}from'react'
8+
9+
import{ICON}from'@/config'
10+
import{buildLog}from'@/utils/logger'
11+
importTooltipfrom'@/components/Tooltip'
12+
13+
importDetailPanelfrom'./DetailPanel'
14+
import{Wrapper,SignIcon,Text}from'./styles'
15+
16+
/* eslint-disable-next-line */
17+
constlog=buildLog('c:ArchivedSign:index')
18+
19+
typeTProps={
20+
testid?:string
21+
}
22+
23+
constArchivedSign:FC<TProps>=({ testid='archived-sign'})=>{
24+
return(
25+
<Tooltipplacement="bottom-start"content={<DetailPanel/>}delay={500}>
26+
<Wrappertestid={testid}>
27+
<SignIconsrc={`${ICON}/article/archived.svg`}/>
28+
<Text>已存档</Text>
29+
</Wrapper>
30+
</Tooltip>
31+
)
32+
}
33+
34+
exportdefaultmemo(ArchivedSign)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* ArchivedSign
3+
*/
4+
5+
import{FC,memo}from'react'
6+
importdynamicfrom'next/dynamic'
7+
8+
typeTProps={
9+
testid?:string
10+
}
11+
12+
constRealArchivedSign=dynamic(()=>import('./RealArchivedSign'),{
13+
ssr:false,
14+
})
15+
16+
constArchivedSign:FC<TProps>=({ testid='archived-sign'})=>{
17+
return<RealArchivedSigntestid={testid}/>
18+
}
19+
20+
exportdefaultmemo(ArchivedSign)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
importstyledfrom'styled-components'
2+
3+
import{theme}from'@/utils/themes'
4+
importcssfrom'@/utils/css'
5+
6+
exportconstWrapper=styled.div`
7+
${css.flexColumn()};
8+
width: 200px;
9+
/* border: 1px solid;
10+
border-color: #00424f;
11+
padding: 0 8px;
12+
border-radius: 4px; */
13+
`
14+
exportconstTitle=styled.div`
15+
color:${theme('thread.articleTitle')};
16+
font-size: 13px;
17+
`
18+
exportconstText=styled.div`
19+
color:${theme('thread.articleDigest')};
20+
margin-top: 4px;
21+
font-size: 13px;
22+
`
23+
exportconstLinksWrapper=styled.div`
24+
${css.flex('justify-start')};
25+
margin-top: 15px;
26+
margin-left: -3px;
27+
`
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
importstyledfrom'styled-components'
2+
3+
importtype{TTestable}from'@/spec'
4+
5+
importImgfrom'@/Img'
6+
import{theme}from'@/utils/themes'
7+
importcssfrom'@/utils/css'
8+
9+
exportconstWrapper=styled.div.attrs(({ testid}:TTestable)=>({
10+
'data-test-id':testid,
11+
}))<TTestable>`
12+
${css.flex('align-center')};
13+
border: 1px solid;
14+
border-color: #00424f;
15+
padding: 0 8px;
16+
border-radius: 4px;
17+
cursor: default;
18+
`
19+
exportconstSignIcon=styled(Img)`
20+
${css.size(12)};
21+
fill:${theme('thread.articleDigest')};
22+
margin-right: 5px;
23+
24+
${Wrapper}:hover & {
25+
fill:${theme('thread.articleTitle')};
26+
}
27+
`
28+
exportconstText=styled.div`
29+
color:${theme('thread.articleDigest')};
30+
font-size: 12px;
31+
32+
${Wrapper}:hover & {
33+
color:${theme('thread.articleTitle')};
34+
}
35+
`

‎src/containers/tool/CommunitySetter/tests/index.test.ts‎renamed to ‎src/components/ArchivedSign/tests/index.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// import React from 'react'
22
// import { shallow } from 'enzyme'
33

4-
// importCommunitySetter from '../index'
4+
// importArchivedSign from '../index'
55

6-
describe('TODO <CommunitySetter />',()=>{
6+
describe('TODO <ArchivedSign />',()=>{
77
it('Expect to have unit tests specified',()=>{
88
expect(true).toEqual(true)
99
})

‎src/components/ArticleActionsPanel/CommunitySetterOption.js‎

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

‎src/components/ArticleActionsPanel/index.js‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { buildLog } from '@/utils/logger'
1414
importPinOptionfrom'./PinOption'
1515
importRefineOptionfrom'./RefineOption'
1616
importEditOptionfrom'./EditOption'
17-
importCommunitySetterOptionfrom'./CommunitySetterOption'
1817
importDeleteOptionfrom'./DeleteOption'
1918

2019
import{Wrapper}from'./styles'
@@ -32,7 +31,6 @@ const ArticleActionsPanel = ({
3231
onUnsetRefined,
3332
onEdit,
3433
onDelete,
35-
onCommunitySet,
3634
})=>{
3735
return(
3836
<Wrapper>
@@ -58,11 +56,6 @@ const ArticleActionsPanel = ({
5856
thread={thread}
5957
/>
6058

61-
<CommunitySetterOption
62-
passport={`${thread}.community.set`}
63-
onCommunitySet={onCommunitySet}
64-
/>
65-
6659
<DeleteOption
6760
passport="owner"
6861
ownerId={data.author?.id}
@@ -96,7 +89,6 @@ ArticleActionsPanel.propTypes = {
9689
onUndoPin:T.func,
9790
onSetRefined:T.func,
9891
onUnsetRefined:T.func,
99-
onCommunitySet:T.func,
10092
}
10193

10294
ArticleActionsPanel.defaultProps={
@@ -107,7 +99,6 @@ ArticleActionsPanel.defaultProps = {
10799
onUndoPin:log,
108100
onSetRefined:log,
109101
onUnsetRefined:log,
110-
onCommunitySet:T.func,
111102
}
112103

113104
exportdefaultReact.memo(ArticleActionsPanel)
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
*
3+
* ArticleMenu
4+
*
5+
*/
6+
7+
import{FC,memo}from'react'
8+
9+
import{ICON}from'@/config'
10+
import{EVENT}from'@/constant'
11+
12+
import{moveToCommunity,mirrorToCommunity,setTag}from'@/utils/helper'
13+
importMenuButtonfrom'@/components/Buttons/MenuButton'
14+
15+
import{Wrapper,MoreIcon}from'./styles'
16+
17+
typeTProps={
18+
testid?:string
19+
}
20+
21+
constmenuOptions=[
22+
{
23+
key:'edit',
24+
icon:`${ICON}/edit/publish-pen.svg`,
25+
title:'编辑',
26+
},
27+
{
28+
key:'edit-histor',
29+
icon:`${ICON}/edit/publish-pen.svg`,
30+
title:'修改记录',
31+
},
32+
]
33+
34+
constextraOptions=[
35+
{
36+
key:'delete',
37+
icon:`${ICON}/shape/delete.svg`,
38+
title:'删除',
39+
},
40+
{
41+
key:EVENT.MIRROR_TO_COMMUNITY,
42+
icon:`${ICON}/article/community-mirror.svg`,
43+
title:'镜像到社区',
44+
},
45+
{
46+
key:EVENT.MOVE_TO_COMMUNITY,
47+
icon:`${ICON}/article/community-move.svg`,
48+
title:'移动到社区',
49+
},
50+
]
51+
52+
consthendleSelect=(key)=>{
53+
switch(key){
54+
caseEVENT.MOVE_TO_COMMUNITY:{
55+
returnmoveToCommunity()
56+
}
57+
caseEVENT.MIRROR_TO_COMMUNITY:{
58+
returnmirrorToCommunity()
59+
}
60+
caseEVENT.SET_TAG:{
61+
returnsetTag()
62+
}
63+
default:{
64+
// eslint-disable-next-line no-useless-return
65+
return
66+
}
67+
}
68+
// moveToCommunity
69+
}
70+
71+
constArticleMenu:FC<TProps>=({ testid='archived-sign'})=>{
72+
return(
73+
<MenuButton
74+
options={menuOptions}
75+
extraOptions={extraOptions}
76+
placement="bottom-end"
77+
onClick={hendleSelect}
78+
>
79+
<Wrappertestid={testid}>
80+
<MoreIconsrc={`${ICON}/shape/more.svg`}/>
81+
</Wrapper>
82+
</MenuButton>
83+
)
84+
}
85+
86+
exportdefaultmemo(ArticleMenu)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp