Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit fdffd7c

Browse files
authored
refactor: general cu workflow (radar & job) (#1182)
* refactor(job-workflow): editor for job publish re-org * refactor(job-workflow): wip * refactor(job-workflow): editor addon re-org * refactor(job-workflow): job detail page * refactor(job-workflow): update workflow * refactor(article-workflow): Archived UI * refactor(post-workflow): reprint update check * refactor(radar-workflow): read done * refactor(radar-workflow): create & update done * refactor(radar-workflow): adjust card link icon * fix(tag-setter): community arg error
1 parent 5446431 commit fdffd7c

File tree

75 files changed

+1656
-335
lines changed

Some content is hidden

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

75 files changed

+1656
-335
lines changed

server/routes.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,21 @@ router.route('/post/:id').get((req, res) => {
8989
return renderAndCache({ req, res, path: `/post/${id}` })
9090
})
9191

92+
// 工作页
93+
router.route('/job/:id').get((req, res) => {
94+
const { id } = req.params
95+
return renderAndCache({ req, res, path: `/job/${id}` })
96+
})
97+
9298
router.route('/blog/:id').get((req, res) => {
9399
const { id } = req.params
94100
return renderAndCache({ req, res, path: `/blog/${id}` })
95101
})
96102

103+
router.route('/radar/:id').get((req, res) => {
104+
const { id } = req.params
105+
return renderAndCache({ req, res, path: `/radar/${id}` })
106+
})
97107
// repo 帖子页
98108
// router.route('/:community/repo/:id').get((req, res) => {
99109
// return renderAndCache({ req, res, path: '/repo' })
@@ -109,12 +119,23 @@ router.route('/publish/post').get((req, res) => {
109119
return renderAndCache({ req, res, page: '/publish/post' })
110120
})
111121

112-
// 编辑新帖子
122+
// 编辑帖子
113123
router.route('/update/post/:id').get((req, res) => {
114124
const { id } = req.params
115125
return renderAndCache({ req, res, path: `/update/post/${id}` })
116126
})
117127

128+
// 创建新工作
129+
router.route('/publish/job').get((req, res) => {
130+
return renderAndCache({ req, res, page: '/publish/job' })
131+
})
132+
133+
// 编辑工作
134+
router.route('/update/job/:id').get((req, res) => {
135+
const { id } = req.params
136+
return renderAndCache({ req, res, path: `/update/job/${id}` })
137+
})
138+
118139
// 创建新博客
119140
router.route('/publish/blog').get((req, res) => {
120141
return renderAndCache({ req, res, page: '/publish/blog' })
@@ -136,6 +157,17 @@ router.route('/update/works/:id').get((req, res) => {
136157
return renderAndCache({ req, res, path: `/update/works/${id}` })
137158
})
138159

160+
// 创建新雷达
161+
router.route('/publish/radar').get((req, res) => {
162+
return renderAndCache({ req, res, page: '/publish/radar' })
163+
})
164+
165+
// 编辑雷达
166+
router.route('/update/radar/:id').get((req, res) => {
167+
const { id } = req.params
168+
return renderAndCache({ req, res, path: `/update/radar/${id}` })
169+
})
170+
139171
// 所有社区
140172
router.route('/explore').get((req, res) => res.redirect('/explore/pl'))
141173

src/containers/content/ArticleContent/DesktopView/PostLayout.tsx renamed to src/containers/content/ArticleContent/DesktopView/ArticleLayout.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { pluggedIn } from '@/utils/mobx'
1313
import { ArticleFooter, Comments } from '@/containers/dynamic'
1414
import ArticleSticker from '@/containers/tool/ArticleSticker'
1515
import ArtimentBody from '@/widgets/ArtimentBody'
16+
import Linker from '@/widgets/Linker'
1617

1718
import ViewportTracker from '@/widgets/ViewportTracker'
1819

@@ -25,7 +26,7 @@ import {
2526
SidebarWrapper,
2627
ArticleWrapper,
2728
CommentsWrapper,
28-
} from '../styles/desktop_view/post_layout'
29+
} from '../styles/desktop_view/article_layout'
2930

3031
import { useInit, checkAnchor } from '../logic'
3132

@@ -45,10 +46,10 @@ const ArticleContentContainer: FC<TProps> = ({
4546
}) => {
4647
useInit(store)
4748

48-
const { viewingArticle } = store
49+
const { viewingArticle: article } = store
4950
const ref = useRef()
5051

51-
if (!viewingArticle.id) return null
52+
if (!article.id) return null
5253

5354
return (
5455
<Wrapper testid={testid}>
@@ -59,7 +60,10 @@ const ArticleContentContainer: FC<TProps> = ({
5960
/>
6061
<MainWrapper metric={metric}>
6162
<ArticleWrapper ref={ref}>
62-
<ArtimentBody document={viewingArticle.document} />
63+
{!!article.linkAddr && (
64+
<Linker src={article.linkAddr} bottom={22} hint="原文:" />
65+
)}
66+
<ArtimentBody document={article.document} />
6367
<ArticleFooter metric={metric} />
6468
</ArticleWrapper>
6569

src/containers/content/ArticleContent/DesktopView/BlogLayout/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ const ArticleContentContainer: FC<TProps> = ({
3838
}) => {
3939
useInit(store)
4040

41-
const { viewingArticle, articleTab, blogRssInfoData } = store
42-
if (!viewingArticle.id) return null
41+
const { viewingArticle: article, articleTab, blogRssInfoData } = store
42+
if (!article.id) return null
43+
4344
if (articleTab === BLOG_TAB.FEEDS) {
4445
return (
4546
<Wrapper testid={testid}>
@@ -69,7 +70,7 @@ const ArticleContentContainer: FC<TProps> = ({
6970
return (
7071
<Wrapper testid={testid}>
7172
<InnerWrapper>
72-
<ArticleTab metric={metric} article={viewingArticle} />
73+
<ArticleTab metric={metric} article={article} />
7374
<SidebarWrapper>
7475
<ArticleSticker metric={metric} />
7576
</SidebarWrapper>

src/containers/content/ArticleContent/DesktopView/WorksLayout/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ const ArticleContentContainer: FC<TProps> = ({
3737
}) => {
3838
useInit(store)
3939

40-
const { viewingArticle, articleTab } = store
41-
if (!viewingArticle.id) return null
40+
const { viewingArticle: works, articleTab } = store
41+
if (!works.id) return null
4242

4343
if (articleTab === WORKS_TAB.TECHSTACKS) {
4444
return (
4545
<Wrapper testid={testid}>
4646
<InnerWrapper>
47-
<TechStackTab metric={metric} article={viewingArticle} />
47+
<TechStackTab metric={metric} article={works} />
4848
<SidebarWrapper>
4949
<ArticleSticker metric={metric} />
5050
</SidebarWrapper>
@@ -56,7 +56,7 @@ const ArticleContentContainer: FC<TProps> = ({
5656
return (
5757
<Wrapper testid={testid}>
5858
<InnerWrapper>
59-
<ArticleTab metric={metric} article={viewingArticle} />
59+
<ArticleTab metric={metric} article={works} />
6060
<SidebarWrapper>
6161
<ArticleSticker metric={metric} />
6262
</SidebarWrapper>

src/containers/content/ArticleContent/DesktopView/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { METRIC } from '@/constant'
22

3-
import PostLayout from './PostLayout'
3+
import ArticleLayout from './ArticleLayout'
44
import BlogLayout from './BlogLayout'
55
import WorksLayout from './WorksLayout'
66

@@ -15,7 +15,7 @@ const ArticleContent = (props) => {
1515
return <WorksLayout {...props} />
1616
}
1717
default: {
18-
return <PostLayout {...props} />
18+
return <ArticleLayout {...props} />
1919
}
2020
}
2121
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* JobLayout
3+
*/
4+
5+
import { FC, Fragment, memo } from 'react'
6+
7+
import type { TJob, TMetric } from '@/spec'
8+
import { METRIC } from '@/constant'
9+
import { buildLog } from '@/utils/logger'
10+
11+
import { SpaceGrow } from '@/widgets/Common'
12+
import ArticleBaseStats from '@/widgets/ArticleBaseStats'
13+
import ArticleBelongCommunity from '@/widgets/ArticleBelongCommunity'
14+
import DotDivider from '@/widgets/DotDivider'
15+
import ArchivedSign from '@/widgets/ArchivedSign'
16+
import ArticleMenu from '@/widgets/ArticleMenu'
17+
import ReadableDate from '@/widgets/ReadableDate'
18+
import Linker from '@/widgets/Linker'
19+
20+
import {
21+
Main,
22+
Header,
23+
PublishDateInfo,
24+
Title,
25+
BottomInfo,
26+
CommunityInfo,
27+
CompanyWrapper,
28+
LaptopIcon,
29+
CompanyName,
30+
} from '../styles/desktop_view/job_layout'
31+
32+
/* eslint-disable-next-line */
33+
const log = buildLog('C:ArticleDigest')
34+
35+
type TProps = {
36+
article: TJob
37+
metric?: TMetric
38+
}
39+
40+
const JobLayout: FC<TProps> = ({ metric = METRIC.ARTICLE, article }) => {
41+
return (
42+
<Fragment>
43+
<Main metric={metric}>
44+
<Header>
45+
<PublishDateInfo>
46+
<ReadableDate date={article.insertedAt} fmt="absolute" />
47+
</PublishDateInfo>
48+
{article.isArchived && (
49+
<Fragment>
50+
<DotDivider space={8} />
51+
<ArchivedSign date={article.archivedAt} />
52+
</Fragment>
53+
)}
54+
<SpaceGrow />
55+
<ArticleMenu article={article} />
56+
</Header>
57+
<Title>{article.title}</Title>
58+
<BottomInfo>
59+
<CompanyWrapper>
60+
<LaptopIcon />
61+
<CompanyName>{article.company}</CompanyName>
62+
<Linker src={article.companyLink} right={5} left={10} />
63+
</CompanyWrapper>
64+
<ArticleBaseStats article={article} />
65+
</BottomInfo>
66+
</Main>
67+
<CommunityInfo>
68+
<ArticleBelongCommunity article={article} />
69+
</CommunityInfo>
70+
</Fragment>
71+
)
72+
}
73+
74+
export default memo(JobLayout)

src/containers/digest/ArticleDigest/DesktopView/Layout.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { TArticle, TMetric, TThread } from '@/spec'
44
import { THREAD, METRIC } from '@/constant'
55

66
import PostLayout from './PostLayout'
7+
import JobLayout from './JobLayout'
78
import BlogLayout from './BlogLayout'
89
import WorksLayout from './WorksLayout'
910

@@ -25,6 +26,10 @@ const Layout: FC<TProps> = ({
2526
return <WorksLayout article={article} metric={metric} tab={tab} />
2627
}
2728

29+
case THREAD.JOB: {
30+
return <JobLayout article={article} metric={metric} />
31+
}
32+
2833
case THREAD.BLOG: {
2934
return <BlogLayout article={article} metric={metric} tab={tab} />
3035
}

src/containers/digest/ArticleDigest/DesktopView/PostLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import type { TPost, TMetric } from '@/spec'
88
import { METRIC } from '@/constant'
99
import { buildLog } from '@/utils/logger'
1010

11+
import { ArchivedSign } from '@/widgets/dynamic'
1112
import { SpaceGrow } from '@/widgets/Common'
1213
import ArticleBaseStats from '@/widgets/ArticleBaseStats'
1314
import ArticleBelongCommunity from '@/widgets/ArticleBelongCommunity'
1415
import DotDivider from '@/widgets/DotDivider'
15-
import ArchivedSign from '@/widgets/ArchivedSign'
1616
import ArticleMenu from '@/widgets/ArticleMenu'
1717
import ReadableDate from '@/widgets/ReadableDate'
1818

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import styled from 'styled-components'
2+
3+
import { theme } from '@/utils/themes'
4+
import css from '@/utils/css'
5+
6+
import LaptopSVG from '@/icons/Laptop'
7+
8+
export {
9+
Main,
10+
Header,
11+
PublishDateInfo,
12+
Title,
13+
BottomInfo,
14+
CommunityInfo,
15+
} from './post_layout'
16+
17+
export const CompanyWrapper = styled.div`
18+
${css.flex('align-center')};
19+
color: ${theme('thread.articleDigest')};
20+
`
21+
export const LaptopIcon = styled(LaptopSVG)`
22+
${css.size(16)};
23+
fill: ${theme('thread.articleDigest')};
24+
margin-right: 4px;
25+
`
26+
export const CompanyName = styled.div`
27+
font-size: 13px;
28+
color: ${theme('thread.articleTitle')};
29+
`

0 commit comments

Comments
 (0)