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.

feat(community-tag-setter): rewrite with cool UX#1141

Merged
mydearxym merged 16 commits intodevfromcommunity-tag-setter
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
16 commits
Select commitHold shift + click to select a range
7b99afd
chore: wip
mydearxymAug 9, 2021
d4c802d
feat: a archived sign concept
mydearxymAug 10, 2021
09ad660
feat: basic article menu concept
mydearxymAug 10, 2021
55c361f
refactor: re-org with spec
mydearxymAug 10, 2021
4b0e930
refactor: switch view wip
mydearxymAug 10, 2021
193a79f
chore: wip
mydearxymAug 10, 2021
56ccb44
refactor: community setter wip
mydearxymAug 10, 2021
ab05f30
chore: wip
mydearxymAug 10, 2021
83c518e
chore: adjust debouce fn & NoticeBar style
mydearxymAug 10, 2021
384da09
chore: adjust height for laptop
mydearxymAug 10, 2021
46c473d
refactor: search workflow done
mydearxymAug 11, 2021
b261e21
refactor: community setter wip
mydearxymAug 11, 2021
284213c
refactor: mv toggleCommunity logic to store
mydearxymAug 11, 2021
a535c83
refactor: wip
mydearxymAug 11, 2021
41dd4b8
chore: tags adjust
mydearxymAug 11, 2021
a2410a2
refactor: trigger workflow
mydearxymAug 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionsjsconfig.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,7 @@
"@/config": ["config"],
"@/stores/*": ["src/stores/*"],
"@/model": ["src/stores/SharedModel"],
"@/model*": ["src/stores/SharedModel/*"],
"@/utils": ["utils"],
"@/utils/*": ["utils/*"],
"@/schemas": ["src/schemas"],
Expand Down
21 changes: 21 additions & 0 deletionssrc/components/ArchivedSign/DetailPanel.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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')};
}
`
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
// import React from 'react'
// import { shallow } from 'enzyme'

// importCommunitySetter from '../index'
// importArchivedSign from '../index'

describe('TODO <CommunitySetter />', () => {
describe('TODO <ArchivedSign />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(true)
})
Expand Down
25 changes: 0 additions & 25 deletionssrc/components/ArticleActionsPanel/CommunitySetterOption.js
View file
Open in desktop

This file was deleted.

9 changes: 0 additions & 9 deletionssrc/components/ArticleActionsPanel/index.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ import { buildLog } from '@/utils/logger'
import PinOption from './PinOption'
import RefineOption from './RefineOption'
import EditOption from './EditOption'
import CommunitySetterOption from './CommunitySetterOption'
import DeleteOption from './DeleteOption'

import { Wrapper } from './styles'
Expand All@@ -32,7 +31,6 @@ const ArticleActionsPanel = ({
onUnsetRefined,
onEdit,
onDelete,
onCommunitySet,
}) => {
return (
<Wrapper>
Expand All@@ -58,11 +56,6 @@ const ArticleActionsPanel = ({
thread={thread}
/>

<CommunitySetterOption
passport={`${thread}.community.set`}
onCommunitySet={onCommunitySet}
/>

<DeleteOption
passport="owner"
ownerId={data.author?.id}
Expand DownExpand Up@@ -96,7 +89,6 @@ ArticleActionsPanel.propTypes = {
onUndoPin: T.func,
onSetRefined: T.func,
onUnsetRefined: T.func,
onCommunitySet: T.func,
}

ArticleActionsPanel.defaultProps = {
Expand All@@ -107,7 +99,6 @@ ArticleActionsPanel.defaultProps = {
onUndoPin: log,
onSetRefined: log,
onUnsetRefined: log,
onCommunitySet: T.func,
}

export default React.memo(ArticleActionsPanel)
86 changes: 86 additions & 0 deletionssrc/components/ArticleMenu/RealArticleMenu.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -82,7 +82,7 @@ const HorizontalScroller: FC<TProps> = ({
onEnter={handleHideLeftShadow}
onLeave={handleShowLeftShadow}
/>
{children}
<div>{children}</div>
<Waypoint
horizontal
onEnter={handleHideRightShadow}
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp