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

Commit 9e19e36

Browse files
authored
feat: blog workflow (#1172)
* refactor(blog-editor): wip * refactor(blog-editor): step 2 done * refactor(global): rename components -> widgets * refactor(blog): list item styles * refactor(blog): detail page & re-org widgets * refactor(blog): detail page wip * refactor(blog-page): tab switch & import re-org * refactor(blog): content tab with realdata * refactor(blog): update rss author * refactor(blog): update rss author done
1 parent 742570e commit 9e19e36

File tree

1,214 files changed

+2958
-1646
lines changed

Some content is hidden

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

1,214 files changed

+2958
-1646
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ next-env.d.ts
99
*.jpeg
1010
*.txt
1111
*.md
12-
*.ico
12+
*.ico
13+
*.hbs

.eslintrc.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121
alias: {
2222
'@/config': 'config',
2323
'@/containers': 'src/containers',
24-
'@/components': 'src/components',
24+
'@/widgets': 'src/widgets',
2525
'@/services': 'src/services',
2626
'@/constant': 'utils/constant',
2727
'@/hooks': 'src/hooks',
@@ -30,9 +30,9 @@ module.exports = {
3030
'@/model': 'src/stores/Model',
3131
'@/utils': 'utils',
3232
'@/schemas': 'src/schemas',
33-
'@/Img': 'src/components/Img',
34-
'@/SvgIcons': 'src/components/SvgIcons',
35-
'@/icons': 'src/components/Icons',
33+
'@/Img': 'src/widgets/Img',
34+
'@/SvgIcons': 'src/widgets/SvgIcons',
35+
'@/icons': 'src/widgets/Icons',
3636
'@/i18n': 'i18n',
3737
'@/spec': 'src/spec',
3838
},

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.hbs

docs/architecture/convention.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ based on [babel-resolver][https://github.com/tleunen/babel-plugin-module-resolve
3636
```js
3737
"alias": {
3838
"@/containers":"./src/containers",
39-
"@/components":"./src/components",
39+
"@/widgets":"./src/widgets",
4040
"@/config":"./src/config",
4141
"@/stores":"./src/stores",
4242
"@/schemas":"./src/containers/schemas",
4343
"@/utils":"./src/utils",
44-
"@/Img": "./src/components/Img",
45-
"@/SvgIcons": "./src/components/SvgIcons"
44+
"@/Img": "./src/widgets/Img",
45+
"@/SvgIcons": "./src/widgets/SvgIcons"
4646
}
4747
```
4848

@@ -52,7 +52,7 @@ we can easily import files like:
5252
import { ISSUE_WEB } from '@/config'
5353
import { pluggedIn, buildLog } from '@/utils'
5454

55-
import ArticleEditFooter from '@/components/ArticleEditFooter'
55+
import ArticleEditFooter from '@/widgets/ArticleEditFooter'
5656
...
5757
```
5858

@@ -73,9 +73,9 @@ Import { pluggedIn, buildLog, ROUTE, THREAD } from '@/utils'
7373
// 3. import global containers
7474
Import TagsBar from '@/containers/unit/TagsBar'
7575
// 4. import global components
76-
Import Maybe from '@/components/Maybe'
77-
Import PagedContents from '@/components/PagedContents'
78-
Import ContentFilter from '@/components/ContentFilter'
76+
Import Maybe from '@/widgets/Maybe'
77+
Import PagedContents from '@/widgets/PagedContents'
78+
Import ContentFilter from '@/widgets/ContentFilter'
7979

8080
// 5. import local components
8181
Import CityList from './CityList'

docs/architecture/convention.zh-CN.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ Doramon 为网站提供类似于 [alfred](https://www.alfredapp.com/) 的功能,
3636
```js
3737
"alias": {
3838
"@/containers":"./src/containers",
39-
"@/components":"./src/components",
39+
"@/widgets":"./src/widgets",
4040
"@/config":"./src/config",
4141
"@/stores":"./src/stores",
4242
"@/schemas":"./src/containers/schemas",
4343
"@/utils":"./src/utils",
44-
"@/Img": "./src/components/Img",
45-
"@/SvgIcons": "./src/components/SvgIcons"
44+
"@/Img": "./src/widgets/Img",
45+
"@/SvgIcons": "./src/widgets/SvgIcons"
4646
}
4747
```
4848

@@ -52,7 +52,7 @@ Doramon 为网站提供类似于 [alfred](https://www.alfredapp.com/) 的功能,
5252
import { ISSUE_WEB } from '@/config'
5353
import { pluggedIn, buildLog } from '@/utils'
5454

55-
import ArticleEditFooter from '@/components/ArticleEditFooter'
55+
import ArticleEditFooter from '@/widgets/ArticleEditFooter'
5656
...
5757
```
5858

@@ -72,9 +72,9 @@ import { pluggedIn, buildLog, ROUTE, THREAD } from '@/utils'
7272
// 3. import global containers
7373
import TagsBar from '@/containers/unit/TagsBar'
7474
// 4. import global components
75-
import Maybe from '@/components/Maybe'
76-
import PagedContents from '@/components/PagedContents'
77-
import ContentFilter from '@/components/ContentFilter'
75+
import Maybe from '@/widgets/Maybe'
76+
import PagedContents from '@/widgets/PagedContents'
77+
import ContentFilter from '@/widgets/ContentFilter'
7878

7979
// 5. import local components
8080
import CityList from './CityList'

jsconfig.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"baseUrl": ".",
44
"paths": {
55
"@/containers/*": ["src/containers/*"],
6-
"@/components/*": ["src/components/*"],
6+
"@/widgets/*": ["src/widgets/*"],
77
"@/services": ["src/services"],
88
"@/services/*": ["src/services/*"],
99
"@/constant": ["utils/constant"],
@@ -17,9 +17,9 @@
1717
"@/utils": ["utils"],
1818
"@/utils/*": ["utils/*"],
1919
"@/schemas": ["src/schemas"],
20-
"@/Img": ["src/components/Img"],
21-
"@/SvgIcons/*": ["src/components/SvgIcons/*"],
22-
"@/icons/*": ["src/components/icons/*"],
20+
"@/Img": ["src/widgets/Img"],
21+
"@/SvgIcons/*": ["src/widgets/SvgIcons/*"],
22+
"@/icons/*": ["src/widgets/icons/*"],
2323
"@/i18n": ["i18n"]
2424
}
2525
},

server/routes.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,9 @@ router.route('/post/:id').get((req, res) => {
8888
return renderAndCache({ req, res, path: `/post/${id}` })
8989
})
9090

91-
// job 帖子页
92-
router.route('/:community/job/:id').get((req, res) => {
93-
return renderAndCache({ req, res, path: '/job' })
94-
})
95-
96-
// video 帖子页
97-
router.route('/:community/video/:id').get((req, res) => {
98-
return renderAndCache({ req, res, path: '/video' })
91+
router.route('/blog/:id').get((req, res) => {
92+
const { id } = req.params
93+
return renderAndCache({ req, res, path: `/blog/${id}` })
9994
})
10095

10196
// repo 帖子页
@@ -124,6 +119,11 @@ router.route('/publish/blog').get((req, res) => {
124119
return renderAndCache({ req, res, page: '/publish/blog' })
125120
})
126121

122+
// 编辑 rss 作者
123+
router.route('/update/rss').get((req, res) => {
124+
return renderAndCache({ req, res, path: '/update/rss' })
125+
})
126+
127127
// 创建新作品
128128
router.route('/publish/works').get((req, res) => {
129129
return renderAndCache({ req, res, page: '/publish/works' })

src/components/BlogItem/DesktopView/Header.tsx

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/components/BlogItem/styles/desktop_view/header.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/components/PagedArticles/dynamic.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
*
3+
* general ArticleContent for Post, Job, Blog, Radar ..
4+
*
5+
*/
6+
7+
import { FC, useRef, Fragment } from 'react'
8+
9+
import type { TBlog, TMetric } from '@/spec'
10+
import { buildLog } from '@/utils/logger'
11+
12+
import { ArticleFooter, Comments } from '@/containers/dynamic'
13+
import ArtimentBody from '@/widgets/ArtimentBody'
14+
15+
import ViewportTracker from '@/widgets/ViewportTracker'
16+
17+
import {
18+
MainWrapper,
19+
ArticleWrapper,
20+
CommentsWrapper,
21+
} from '../../styles/desktop_view/blog_layout/article_tab'
22+
23+
import { checkAnchor } from '../../logic'
24+
25+
/* eslint-disable-next-line */
26+
const log = buildLog('C:BlogContent')
27+
28+
type TProps = {
29+
metric: TMetric
30+
article: TBlog
31+
}
32+
33+
const ArticleTab: FC<TProps> = ({ metric, article }) => {
34+
const ref = useRef()
35+
36+
return (
37+
<Fragment>
38+
<ViewportTracker
39+
onEnter={() => checkAnchor(ref?.current)}
40+
onLeave={() => checkAnchor(ref?.current)}
41+
/>
42+
<MainWrapper metric={metric}>
43+
<ArticleWrapper ref={ref}>
44+
<ArtimentBody document={article.document} />
45+
<ArticleFooter metric={metric} />
46+
</ArticleWrapper>
47+
48+
<ViewportTracker
49+
onEnter={() => checkAnchor(ref?.current)}
50+
onLeave={() => checkAnchor(ref?.current)}
51+
/>
52+
<CommentsWrapper>
53+
<Comments />
54+
</CommentsWrapper>
55+
</MainWrapper>
56+
</Fragment>
57+
)
58+
}
59+
60+
export default ArticleTab

0 commit comments

Comments
 (0)