This repository was archived by the owner on Nov 8, 2022. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork37
feat(dashboard): widgets UI/UX#1354
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
6 commits Select commitHold shift + click to select a range
41fd0c5
refactor(dashboard): extract basic shape
mydearxymf2925c2
refactor(dashboard): adjust codebase
mydearxym5b745b0
feat(dashboard): basic widgets UI
mydearxyme900c48
feat(dashboard): adjust widgets store
mydearxymf20e22b
feat(dashboard): enhance widgets settings items
mydearxym3b49e85
feat(dashboard): clean up
mydearxymFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
6 changes: 3 additions & 3 deletionssrc/containers/thread/DashboardThread/Tags/ThreadSelector.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletionssrc/containers/thread/DashboardThread/UI/BannerLayout.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletionssrc/containers/thread/DashboardThread/UI/BannerNotifyLayout.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
9 changes: 3 additions & 6 deletionssrc/containers/thread/DashboardThread/UI/ChangelogLayout.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletionssrc/containers/thread/DashboardThread/UI/PostListLayout.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
133 changes: 133 additions & 0 deletionssrc/containers/thread/DashboardThread/Widgets/BaseSetting.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
import { FC, memo } from 'react' | ||
import { includes, reject, clone } from 'ramda' | ||
import { THREAD } from '@/constant' | ||
import ColorSelector from '@/widgets/ColorSelector' | ||
import { SpaceGrow, Br } from '@/widgets/Common' | ||
import ToggleSwitch from '@/widgets/Buttons/ToggleSwitch' | ||
import type { TWidgetsSettings, TTouched } from '../spec' | ||
import { SETTING_FIELD } from '../constant' | ||
import SectionLabel from '../SectionLabel' | ||
import SavingBar from '../SavingBar' | ||
import { | ||
Wrapper, | ||
Label, | ||
TheColor, | ||
ThreadsWrapper, | ||
Section, | ||
Header, | ||
ThreadTitle, | ||
Desc, | ||
} from '../styles/widgets/base_setting' | ||
import { edit } from '../logic' | ||
import { TThread } from '@/spec' | ||
type TProps = { | ||
touched: TTouched | ||
settings: TWidgetsSettings | ||
} | ||
const BaseSetting: FC<TProps> = ({ settings, touched }) => { | ||
const { widgetsPrimaryColor: primaryColor, widgetsThreads, saving } = settings | ||
const threadOnChange = (checked: boolean, thread: TThread): void => { | ||
const newThreads = checked | ||
? [...widgetsThreads, thread] | ||
: reject((t) => t === thread, clone(widgetsThreads)) | ||
edit(newThreads, 'widgetsThreads') | ||
} | ||
return ( | ||
<Wrapper> | ||
<SectionLabel | ||
title="组件主题色" | ||
desc="默认与当前社区设置的主题色相一致。" | ||
/> | ||
<SavingBar | ||
isTouched={touched.widgetsPrimaryColor} | ||
field={SETTING_FIELD.WIDGETS_PRIMARY_COLOR} | ||
loading={saving} | ||
> | ||
<Label color={primaryColor}> | ||
<ColorSelector | ||
activeColor={primaryColor} | ||
onChange={(color) => edit(color, 'widgetsPrimaryColor')} | ||
placement="right" | ||
offset={[-1, 15]} | ||
> | ||
<TheColor color={primaryColor} /> | ||
</ColorSelector> | ||
</Label> | ||
</SavingBar> | ||
<Br top={35} /> | ||
<SectionLabel | ||
title="展示板块" | ||
desc="被勾选的板块会在组件中以 Tab 形式展示相关内容,展示样式与‘社区板块’中的设置保持一致" | ||
/> | ||
<ThreadsWrapper> | ||
<Section> | ||
<Header> | ||
<ThreadTitle>讨论</ThreadTitle> | ||
<SpaceGrow /> | ||
<ToggleSwitch | ||
checked={includes(THREAD.POST, widgetsThreads)} | ||
onChange={(checked) => threadOnChange(checked, THREAD.POST)} | ||
/> | ||
</Header> | ||
<Desc>社区内全部帖子列表</Desc> | ||
</Section> | ||
<Section> | ||
<Header> | ||
<ThreadTitle>看板</ThreadTitle> | ||
<SpaceGrow /> | ||
<ToggleSwitch | ||
checked={includes(THREAD.KANBAN, widgetsThreads)} | ||
onChange={(checked) => threadOnChange(checked, THREAD.KANBAN)} | ||
/> | ||
</Header> | ||
<Desc>社区内看板内容,包含GTD标签</Desc> | ||
</Section> | ||
<Section> | ||
<Header> | ||
<ThreadTitle>更新日志</ThreadTitle> | ||
<SpaceGrow /> | ||
<ToggleSwitch | ||
checked={includes(THREAD.CHANGELOG, widgetsThreads)} | ||
onChange={(checked) => threadOnChange(checked, THREAD.CHANGELOG)} | ||
/> | ||
</Header> | ||
<Desc>最新版本以及历史发布版本</Desc> | ||
</Section> | ||
<Section> | ||
<Header> | ||
<ThreadTitle>帮助台</ThreadTitle> | ||
<SpaceGrow /> | ||
<ToggleSwitch | ||
checked={includes(THREAD.HELP, widgetsThreads)} | ||
onChange={(checked) => threadOnChange(checked, THREAD.HELP)} | ||
/> | ||
</Header> | ||
<Desc>常见问题与帮助中心文档</Desc> | ||
</Section> | ||
</ThreadsWrapper> | ||
<Br top={touched.widgetsThreads ? 20 : 70} /> | ||
<SavingBar | ||
isTouched={touched.widgetsThreads} | ||
field={SETTING_FIELD.WIDGETS_THREADS} | ||
loading={saving} | ||
bottom={40} | ||
/> | ||
</Wrapper> | ||
) | ||
} | ||
export default memo(BaseSetting) |
21 changes: 21 additions & 0 deletionssrc/containers/thread/DashboardThread/Widgets/CodeArea.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { FC, memo } from 'react' | ||
import CopyButton from '@/widgets/Buttons/CopyButton' | ||
import { Wrapper, CopyBtnWrapper } from '../styles/widgets/code_area' | ||
const CodeArea: FC = () => { | ||
const id = 'your-id' | ||
const value = `<script async src="https://groupher.com/xxx" id="${id}" data-token="yyy" data-width="normal" />` | ||
return ( | ||
<Wrapper> | ||
{value} | ||
<CopyBtnWrapper> | ||
<CopyButton value={value} /> | ||
</CopyBtnWrapper> | ||
</Wrapper> | ||
) | ||
} | ||
export default memo(CodeArea) |
117 changes: 113 additions & 4 deletionssrc/containers/thread/DashboardThread/Widgets/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.