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

Commit dcc6aed

Browse files
authored
refactor(post): publish/update workflow redesign (#1168)
* refactor(workflow): query target community & fix mobx-react issue * refactor(workflow): create route adjust * refactor(publish-post): wip * refactor(workflow): naming & new favicon * refactor(workflow): wip * chore(workflow): ts spec * chore(workflow): basic publish done * refactor(publish-post): re-org route system * refactor(workflow): update post wip * refactor(workflow): update post with real data * refactor(workflow): general TagsList wip * refactor(workflow): use common viewingArticle as update article * refactor(article-editor): publish after behaviors * refactor(article-editor): add counter & improve editor inline style * refactor(article-editor): extract submit button & re-org tagsetter wip * refactor(TagSetter): add canActOnSeleted opt * refactor(TagSetter): wip * fix(Modal): close logic, esc hint style * refactor(CommunityTagSetter): re-org * refactor(CommunityTagSetter): type issue * chore(type): add TInput type * refactor(publish): communityBadege change community logic * refactor: community setter logo * refactor(community-card): add slash for raw * chore: account-solid svg back-in * refactor(taglist): setter style adjust & re-org * refactor(word-counter): add TSpace to WordCounter * refactor(community-tag-setter): debug with real data & re-org * refactor(tag-setter): basic workflow * refactor: enhance publish after & tag, and style
1 parent f30ec85 commit dcc6aed

File tree

123 files changed

+1973
-958
lines changed

Some content is hidden

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

123 files changed

+1973
-958
lines changed

.eslintignore

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

package-lock.json

Lines changed: 129 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
},
4242
"dependencies": {
4343
"@babel/core": "^7.13.14",
44-
"@groupher/react-editor": "^1.1.26",
44+
"@groupher/react-editor": "^1.1.28",
4545
"@next/bundle-analyzer": "^9.4.4",
4646
"@sentry/browser": "5.17.0",
4747
"@sentry/node": "5.17.0",
@@ -112,6 +112,7 @@
112112
"resize-observer-polyfill": "^1.5.1",
113113
"response-time": "^2.3.2",
114114
"rxjs": "6.2.2",
115+
"sanitize-html": "^2.5.2",
115116
"scroll-into-view-if-needed": "1.5.0",
116117
"sentry-testkit": "^2.1.0",
117118
"store": "^2.0.12",

public/favicon.ico

-4.58 KB
Binary file not shown.

server/helper.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const renderAndCache = ({ req, res, path }) => {
99
// do not cache in dev mode
1010
if (dev) {
1111
const pagePath = path || req.path
12+
console.log('# pagePath: ', pagePath)
1213
return app.render(req, res, pagePath, {
1314
...req.query,
1415
...req.params,

server/routes.js

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* eslint-disable @typescript-eslint/no-var-requires */
22

33
const router = require('express').Router()
4-
const R = require('ramda')
54

65
const app = require('./app')
76
const { renderAndCache } = require('./helper')
@@ -22,7 +21,7 @@ router.route('/oauth/').get((req, res) => renderAndCache({ req, res }))
2221
// 将首页重定向到 HOME_PAGE
2322
router
2423
.route('/')
25-
.get((req, res) => renderAndCache({ req, res, path: '/community' }))
24+
.get((req, res) => renderAndCache({ req, res, path: '/index' }))
2625

2726
// 来一杯
2827
router.route('/have-a-drink/:slug?').get((req, res) => {
@@ -85,7 +84,8 @@ router.route('/user/:userId').get((req, res) => {
8584

8685
// 帖子页
8786
router.route('/post/:id').get((req, res) => {
88-
return renderAndCache({ req, res, path: '/post' })
87+
const { id } = req.params
88+
return renderAndCache({ req, res, path: `/post/${id}` })
8989
})
9090

9191
// job 帖子页
@@ -99,28 +99,34 @@ router.route('/:community/video/:id').get((req, res) => {
9999
})
100100

101101
// repo 帖子页
102-
router.route('/:community/repo/:id').get((req, res) => {
103-
return renderAndCache({ req, res, path: '/repo' })
104-
})
102+
// router.route('/:community/repo/:id').get((req, res) => {
103+
// return renderAndCache({ req, res, path: '/repo' })
104+
// })
105105

106106
// 创建新社区
107-
router.route('/create/community').get((req, res) => {
108-
return renderAndCache({ req, res, page: '/create/community' })
107+
router.route('/publish/community').get((req, res) => {
108+
return renderAndCache({ req, res, page: '/publish/community' })
109+
})
110+
111+
// 创建新帖子
112+
router.route('/publish/post').get((req, res) => {
113+
return renderAndCache({ req, res, page: '/publish/post' })
109114
})
110115

111-
// 创建新内容
112-
router.route('/create/article').get((req, res) => {
113-
return renderAndCache({ req, res, page: '/create/article' })
116+
// 编辑新帖子
117+
router.route('/update/post/:id').get((req, res) => {
118+
const { id } = req.params
119+
return renderAndCache({ req, res, path: `/update/post/${id}` })
114120
})
115121

116122
// 创建新博客
117-
router.route('/create/blog').get((req, res) => {
118-
return renderAndCache({ req, res, page: '/create/blog' })
123+
router.route('/publish/blog').get((req, res) => {
124+
return renderAndCache({ req, res, page: '/publish/blog' })
119125
})
120126

121127
// 创建新作品
122-
router.route('/create/works').get((req, res) => {
123-
return renderAndCache({ req, res, page: '/create/works' })
128+
router.route('/publish/works').get((req, res) => {
129+
return renderAndCache({ req, res, page: '/publish/works' })
124130
})
125131

126132
// 所有社区
@@ -137,16 +143,7 @@ router.route('/:community/help-center').get((req, res) => {
137143

138144
// 社区主页
139145
router.route('/:community/:thread').get((req, res) => {
140-
if (
141-
R.has('preview', req.query) &&
142-
R.has('id', req.query) &&
143-
R.has('community', req.query)
144-
) {
145-
const { community, preview, id } = req.query
146-
return res.redirect(`/${community}/${preview}/${id}`)
147-
}
148-
149-
return renderAndCache({ req, res, path: '/community' })
146+
return renderAndCache({ req, res, path: '/index' })
150147
})
151148

152149
router.route('*').get((req, res) => handle(req, res))

src/components/ArticleCard/Header.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { TJob, TRadar } from '@/spec'
44
import { ICON } from '@/config'
55
import { THREAD } from '@/constant'
66
import { cutRest } from '@/utils/helper'
7-
import InlineTags from '@/components/InlineTags'
7+
import TagsList from '@/components/TagsList'
88
import { Br } from '@/components/Common'
99

1010
import type { TProps as TIndex } from './index'
@@ -33,7 +33,7 @@ const Header: FC<TIndex> = ({ data, thread }) => {
3333
<Br top={4} />
3434
<Title>{cutRest(title, 100)}</Title>
3535
<Br top={6} />
36-
<InlineTags items={articleTags} mLeft={0} size="medium" />
36+
<TagsList items={articleTags} mLeft={0} size="medium" />
3737
</Wrapper>
3838
)
3939
}
@@ -43,7 +43,7 @@ const Header: FC<TIndex> = ({ data, thread }) => {
4343

4444
return (
4545
<Wrapper>
46-
<InlineTags items={articleTags} mLeft={0} size="medium" />
46+
<TagsList items={articleTags} mLeft={0} size="medium" />
4747
<Br top={10} />
4848
<Title>
4949
<ExtraInfo>

src/components/ArticleEditToolbar/CopyrightSelector.js

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

src/components/ArticleEditToolbar/index.js

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

src/components/ArticleEditToolbar/styles/copyright_selector.ts

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

0 commit comments

Comments
 (0)