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.

Commitef03f8f

Browse files
authored
refactor(dashboard): touched dot for sidebar & re-org (#1347)
* refactor: re-org with ts* refactor: adjust color
1 parenta63505f commitef03f8f

File tree

12 files changed

+308
-190
lines changed

12 files changed

+308
-190
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import{FC,memo}from'react'
2+
3+
import{Wrapper}from'../styles/alias'
4+
5+
typeTProps={
6+
testid?:string
7+
}
8+
9+
constAlias:FC<TProps>=({ testid='alias'})=>{
10+
return(
11+
<Wrapper>
12+
<div>Widgets</div>
13+
</Wrapper>
14+
)
15+
}
16+
17+
exportdefaultmemo(Alias)

‎src/containers/thread/DashboardThread/Sidebar.tsx‎

Lines changed: 0 additions & 121 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import{FC,memo,Fragment}from'react'
2+
3+
importtype{TTab,TMenuGroup,TTouched}from'../spec'
4+
5+
import{Folder,Item,Title,TouchedDot}from'../styles/sidebar/group'
6+
import{tabOnChange}from'../logic'
7+
8+
typeTProps={
9+
group:TMenuGroup
10+
curTab:TTab
11+
touched:TTouched
12+
}
13+
14+
constGroup:FC<TProps>=({ group, curTab, touched})=>{
15+
return(
16+
<Fragmentkey={group.title}>
17+
<Folder>
18+
{group.icon}
19+
<Title>{group.title}</Title>
20+
</Folder>
21+
{group.children.map((item)=>(
22+
<Item
23+
key={item.raw}
24+
$active={item.raw===curTab}
25+
onClick={()=>tabOnChange(item.raw)}
26+
>
27+
{touched[item.raw]&&<TouchedDot/>}
28+
{item.title}
29+
</Item>
30+
))}
31+
</Fragment>
32+
)
33+
}
34+
35+
exportdefaultmemo(Group)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import{FC,memo,Fragment}from'react'
2+
import{keys}from'ramda'
3+
4+
import{Br}from'@/widgets/Common'
5+
importStickyfrom'@/widgets/Sticky'
6+
7+
import{MENU}from'../constant'
8+
importtype{TTab,TTouched,TMenuGroup}from'../spec'
9+
10+
importGroupfrom'./Group'
11+
12+
import{Wrapper}from'../styles/sidebar'
13+
14+
typeTProps={
15+
curTab:TTab
16+
touched:TTouched
17+
}
18+
19+
constSidebar:FC<TProps>=({ curTab, touched})=>{
20+
constgroupKeys=keys(MENU)
21+
22+
return(
23+
<Wrapper>
24+
<StickyoffsetTop={30}>
25+
{groupKeys.map((key)=>(
26+
<Fragmentkey={key}>
27+
<Group
28+
group={MENU[key]asTMenuGroup}
29+
curTab={curTab}
30+
touched={touched}
31+
/>
32+
<Brtop={30}/>
33+
</Fragment>
34+
))}
35+
</Sticky>
36+
</Wrapper>
37+
)
38+
}
39+
40+
exportdefaultmemo(Sidebar)

‎src/containers/thread/DashboardThread/constant.ts‎

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
importtype{SnakeUpperCase}from'@/spec'
2+
3+
importtype{TTab,TSettingField}from'./spec'
4+
5+
import{Icon}from'./styles/sidebar'
6+
7+
exportconstTAB={
8+
OVERVIEW:'overview',
9+
// basic-info
10+
BASIC_INFO:'basic_info',
11+
UI:'ui',
12+
THREADS:'threads',
13+
ALIAS:'alias',
14+
DOMAIN:'domain',
15+
// analysis
16+
// --
17+
// contents
18+
TAGS:'tags',
19+
POST:'post',
20+
KANBAN:'kanban',
21+
CHANGELOG:'changelog',
22+
HELP:'help',
23+
BLACKHOUSE:'blackhouse',
24+
// integrates
25+
THIRD_PART:'third_part',
26+
ADMINS:'admins',
27+
WIDGETS:'widgets',
28+
}asRecord<Uppercase<TTab>,TTab>
29+
30+
exportconstSETTING_FIELD={
31+
PRIMARY_COLOR:'primaryColor',
32+
POST_LAYOUT:'postLayout',
33+
BANNER_LAYOUT:'bannerLayout',
34+
CHANGELOG_LAYOUT:'changelogLayout',
35+
TAG:'tag',
36+
}asRecord<SnakeUpperCase<TSettingField>,TSettingField>
37+
38+
exportconstMENU={
39+
BASIC:{
40+
title:'基础设置',
41+
icon:<Icon.Basic/>,
42+
children:[
43+
{
44+
title:'关于社区',
45+
raw:TAB.BASIC_INFO,
46+
},
47+
{
48+
title:'外观布局',
49+
raw:TAB.UI,
50+
},
51+
{
52+
title:'社区板块',
53+
raw:TAB.THREADS,
54+
},
55+
{
56+
title:'别名',
57+
raw:TAB.ALIAS,
58+
},
59+
{
60+
title:'管理员',
61+
raw:TAB.ADMINS,
62+
},
63+
],
64+
},
65+
ANALYSIS:{
66+
title:'统计分析',
67+
icon:<Icon.Analysis/>,
68+
children:[],
69+
},
70+
MANAGEMENT:{
71+
title:'内容管理',
72+
icon:<Icon.Management/>,
73+
children:[
74+
{
75+
title:'标签',
76+
raw:TAB.TAGS,
77+
},
78+
{
79+
title:'帖子',
80+
raw:TAB.POST,
81+
},
82+
{
83+
title:'看板',
84+
raw:TAB.KANBAN,
85+
},
86+
{
87+
title:'更新日志',
88+
raw:TAB.CHANGELOG,
89+
},
90+
{
91+
title:'帮助台',
92+
raw:TAB.HELP,
93+
},
94+
{
95+
title:'小黑屋',
96+
raw:TAB.BLACKHOUSE,
97+
},
98+
],
99+
},
100+
101+
INTEGRATE:{
102+
title:'绑定即成',
103+
icon:<Icon.Bind/>,
104+
children:[
105+
{
106+
title:'域名',
107+
raw:TAB.DOMAIN,
108+
},
109+
{
110+
title:'外部应用',
111+
raw:TAB.THIRD_PART,
112+
},
113+
{
114+
title:'网站组件',
115+
raw:TAB.WIDGETS,
116+
},
117+
],
118+
},
119+
}

‎src/containers/thread/DashboardThread/index.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { useInit } from './logic' /* eslint-disable-next-line */
1818
// basic
1919
importBasicInfofrom'./BasicInfo'
2020
importUIfrom'./UI'
21+
importAliasfrom'./Alias'
2122
importAdminfrom'./Admin'
2223
importThreadsfrom'./Threads'
2324
importTagsfrom'./Tags'
@@ -43,10 +44,11 @@ const DashboardThreadContainer: FC<TProps> = ({
4344

4445
return(
4546
<Wrappertestid={testid}>
46-
<SidebarcurTab={curTab}/>
47+
<SidebarcurTab={curTab}touched={touched}/>
4748
<MainWrapper>
4849
{curTab===TAB.BASIC_INFO&&<BasicInfo/>}
4950
{curTab===TAB.UI&&<UIsettings={uiSettings}touched={touched}/>}
51+
{curTab===TAB.ALIAS&&<Alias/>}
5052
{curTab===TAB.ADMINS&&<Admin/>}
5153
{curTab===TAB.THREADS&&<Threads/>}
5254
{curTab===TAB.TAGS&&<Tagssettings={tagSettings}/>}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp