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(community-tag-setter): rewrite with cool UX#1141
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
16 commits Select commitHold shift + click to select a range
7b99afd
chore: wip
mydearxymd4c802d
feat: a archived sign concept
mydearxym09ad660
feat: basic article menu concept
mydearxym55c361f
refactor: re-org with spec
mydearxym4b0e930
refactor: switch view wip
mydearxym193a79f
chore: wip
mydearxym56ccb44
refactor: community setter wip
mydearxymab05f30
chore: wip
mydearxym83c518e
chore: adjust debouce fn & NoticeBar style
mydearxym384da09
chore: adjust height for laptop
mydearxym46c473d
refactor: search workflow done
mydearxymb261e21
refactor: community setter wip
mydearxym284213c
refactor: mv toggleCommunity logic to store
mydearxyma535c83
refactor: wip
mydearxym41dd4b8
chore: tags adjust
mydearxyma2410a2
refactor: trigger workflow
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
1 change: 1 addition & 0 deletionsjsconfig.json
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
21 changes: 21 additions & 0 deletionssrc/components/ArchivedSign/DetailPanel.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 Button from '@/components/Buttons/Button' | ||
import { Wrapper, Title, Text, LinksWrapper } from './styles/detail_panel' | ||
const DetailPanel: FC = () => { | ||
return ( | ||
<Wrapper> | ||
<Title>本帖已于 2020年11月5日 存档</Title> | ||
<Text>存档后无法编辑,删除及评论。</Text> | ||
<LinksWrapper> | ||
<Button size="tiny" ghost noBorder> | ||
什么是存档? | ||
</Button> | ||
</LinksWrapper> | ||
</Wrapper> | ||
) | ||
} | ||
export default memo(DetailPanel) |
34 changes: 34 additions & 0 deletionssrc/components/ArchivedSign/RealArchivedSign.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,34 @@ | ||
/* | ||
* | ||
* ArchivedSign | ||
* | ||
*/ | ||
import { FC, memo } from 'react' | ||
import { ICON } from '@/config' | ||
import { buildLog } from '@/utils/logger' | ||
import Tooltip from '@/components/Tooltip' | ||
import DetailPanel from './DetailPanel' | ||
import { Wrapper, SignIcon, Text } from './styles' | ||
/* eslint-disable-next-line */ | ||
const log = buildLog('c:ArchivedSign:index') | ||
type TProps = { | ||
testid?: string | ||
} | ||
const ArchivedSign: FC<TProps> = ({ testid = 'archived-sign' }) => { | ||
return ( | ||
<Tooltip placement="bottom-start" content={<DetailPanel />} delay={500}> | ||
<Wrapper testid={testid}> | ||
<SignIcon src={`${ICON}/article/archived.svg`} /> | ||
<Text>已存档</Text> | ||
</Wrapper> | ||
</Tooltip> | ||
) | ||
} | ||
export default memo(ArchivedSign) |
20 changes: 20 additions & 0 deletionssrc/components/ArchivedSign/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* ArchivedSign | ||
*/ | ||
import { FC, memo } from 'react' | ||
import dynamic from 'next/dynamic' | ||
type TProps = { | ||
testid?: string | ||
} | ||
const RealArchivedSign = dynamic(() => import('./RealArchivedSign'), { | ||
ssr: false, | ||
}) | ||
const ArchivedSign: FC<TProps> = ({ testid = 'archived-sign' }) => { | ||
return <RealArchivedSign testid={testid} /> | ||
} | ||
export default memo(ArchivedSign) |
27 changes: 27 additions & 0 deletionssrc/components/ArchivedSign/styles/detail_panel.ts
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,27 @@ | ||
import styled from 'styled-components' | ||
import { theme } from '@/utils/themes' | ||
import css from '@/utils/css' | ||
export const Wrapper = styled.div` | ||
${css.flexColumn()}; | ||
width: 200px; | ||
/* border: 1px solid; | ||
border-color: #00424f; | ||
padding: 0 8px; | ||
border-radius: 4px; */ | ||
` | ||
export const Title = styled.div` | ||
color: ${theme('thread.articleTitle')}; | ||
font-size: 13px; | ||
` | ||
export const Text = styled.div` | ||
color: ${theme('thread.articleDigest')}; | ||
margin-top: 4px; | ||
font-size: 13px; | ||
` | ||
export const LinksWrapper = styled.div` | ||
${css.flex('justify-start')}; | ||
margin-top: 15px; | ||
margin-left: -3px; | ||
` |
35 changes: 35 additions & 0 deletionssrc/components/ArchivedSign/styles/index.ts
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,35 @@ | ||
import styled from 'styled-components' | ||
import type { TTestable } from '@/spec' | ||
import Img from '@/Img' | ||
import { theme } from '@/utils/themes' | ||
import css from '@/utils/css' | ||
export const Wrapper = styled.div.attrs(({ testid }: TTestable) => ({ | ||
'data-test-id': testid, | ||
}))<TTestable>` | ||
${css.flex('align-center')}; | ||
border: 1px solid; | ||
border-color: #00424f; | ||
padding: 0 8px; | ||
border-radius: 4px; | ||
cursor: default; | ||
` | ||
export const SignIcon = styled(Img)` | ||
${css.size(12)}; | ||
fill: ${theme('thread.articleDigest')}; | ||
margin-right: 5px; | ||
${Wrapper}:hover & { | ||
fill: ${theme('thread.articleTitle')}; | ||
} | ||
` | ||
export const Text = styled.div` | ||
color: ${theme('thread.articleDigest')}; | ||
font-size: 12px; | ||
${Wrapper}:hover & { | ||
color: ${theme('thread.articleTitle')}; | ||
} | ||
` |
4 changes: 2 additions & 2 deletions.../tool/CommunitySetter/tests/index.test.ts → ...mponents/ArchivedSign/tests/index.test.ts
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
25 changes: 0 additions & 25 deletionssrc/components/ArticleActionsPanel/CommunitySetterOption.js
This file was deleted.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
9 changes: 0 additions & 9 deletionssrc/components/ArticleActionsPanel/index.js
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
86 changes: 86 additions & 0 deletionssrc/components/ArticleMenu/RealArticleMenu.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,86 @@ | ||
/* | ||
* | ||
* ArticleMenu | ||
* | ||
*/ | ||
import { FC, memo } from 'react' | ||
import { ICON } from '@/config' | ||
import { EVENT } from '@/constant' | ||
import { moveToCommunity, mirrorToCommunity, setTag } from '@/utils/helper' | ||
import MenuButton from '@/components/Buttons/MenuButton' | ||
import { Wrapper, MoreIcon } from './styles' | ||
type TProps = { | ||
testid?: string | ||
} | ||
const menuOptions = [ | ||
{ | ||
key: 'edit', | ||
icon: `${ICON}/edit/publish-pen.svg`, | ||
title: '编辑', | ||
}, | ||
{ | ||
key: 'edit-histor', | ||
icon: `${ICON}/edit/publish-pen.svg`, | ||
title: '修改记录', | ||
}, | ||
] | ||
const extraOptions = [ | ||
{ | ||
key: 'delete', | ||
icon: `${ICON}/shape/delete.svg`, | ||
title: '删除', | ||
}, | ||
{ | ||
key: EVENT.MIRROR_TO_COMMUNITY, | ||
icon: `${ICON}/article/community-mirror.svg`, | ||
title: '镜像到社区', | ||
}, | ||
{ | ||
key: EVENT.MOVE_TO_COMMUNITY, | ||
icon: `${ICON}/article/community-move.svg`, | ||
title: '移动到社区', | ||
}, | ||
] | ||
const hendleSelect = (key) => { | ||
switch (key) { | ||
case EVENT.MOVE_TO_COMMUNITY: { | ||
return moveToCommunity() | ||
} | ||
case EVENT.MIRROR_TO_COMMUNITY: { | ||
return mirrorToCommunity() | ||
} | ||
case EVENT.SET_TAG: { | ||
return setTag() | ||
} | ||
default: { | ||
// eslint-disable-next-line no-useless-return | ||
return | ||
} | ||
} | ||
// moveToCommunity | ||
} | ||
const ArticleMenu: FC<TProps> = ({ testid = 'archived-sign' }) => { | ||
return ( | ||
<MenuButton | ||
options={menuOptions} | ||
extraOptions={extraOptions} | ||
placement="bottom-end" | ||
onClick={hendleSelect} | ||
> | ||
<Wrapper testid={testid}> | ||
<MoreIcon src={`${ICON}/shape/more.svg`} /> | ||
</Wrapper> | ||
</MenuButton> | ||
) | ||
} | ||
export default memo(ArticleMenu) |
22 changes: 22 additions & 0 deletionssrc/components/ArticleMenu/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* ArticleMenu | ||
*/ | ||
import { FC, memo } from 'react' | ||
import dynamic from 'next/dynamic' | ||
// import RealArticleMenu from './RealArticleMenu' | ||
type TProps = { | ||
testid?: string | ||
} | ||
const RealArticleMenu = dynamic(() => import('./RealArticleMenu'), { | ||
ssr: false, | ||
}) | ||
const ArticleMenu: FC<TProps> = ({ testid = 'artile-menu' }) => { | ||
return <RealArticleMenu testid={testid} /> | ||
} | ||
export default memo(ArticleMenu) |
21 changes: 21 additions & 0 deletionssrc/components/ArticleMenu/styles/index.ts
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 styled from 'styled-components' | ||
import type { TTestable } from '@/spec' | ||
import Img from '@/Img' | ||
import { theme } from '@/utils/themes' | ||
import css from '@/utils/css' | ||
export const Wrapper = styled.div.attrs(({ testid }: TTestable) => ({ | ||
'data-test-id': testid, | ||
}))<TTestable>`` | ||
export const MoreIcon = styled(Img)` | ||
${css.size(18)}; | ||
fill: ${theme('thread.articleDigest')}; | ||
&:hover { | ||
fill: ${theme('thread.articleTitle')}; | ||
cursor: pointer; | ||
} | ||
` |
10 changes: 10 additions & 0 deletionssrc/components/ArticleMenu/tests/index.test.ts
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,10 @@ | ||
// import React from 'react' | ||
// import { shallow } from 'enzyme' | ||
// import ArticleMenu from '../index' | ||
describe('TODO <ArticleMenu />', () => { | ||
it('Expect to have unit tests specified', () => { | ||
expect(true).toEqual(true) | ||
}) | ||
}) |
2 changes: 1 addition & 1 deletionsrc/components/CustomScroller/HorizontalScroller.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.