From 31f39aa25782f694a93fd3551650b3a54836f189 Mon Sep 17 00:00:00 2001 From: Suyi Date: Thu, 6 Jan 2022 04:21:11 +0800 Subject: [PATCH 1/3] feat: update about page --- src/page/about/index.tsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/page/about/index.tsx b/src/page/about/index.tsx index 42011fc..f4a76a9 100644 --- a/src/page/about/index.tsx +++ b/src/page/about/index.tsx @@ -4,25 +4,33 @@ import Markdown from '@/component/Markdown'; const content = ` ## 关于 -- CNode 社区为国内最大最具影响力的 Node.js 开源技术社区,致力于 Node.js 的技术研究。 +CNode 社区为国内最大最具影响力的 Node.js 开源技术社区,致力于 Node.js 的技术研究。 -- CNode 社区由一批热爱 Node.js 技术的工程师发起,目前已经吸引了互联网各个公司的专业技术人员加入,我们非常欢迎更多对 Node.js 感兴趣的朋友。 +CNode 社区由一批热爱 Node.js 技术的工程师发起,目前已经吸引了互联网各个公司的专业技术人员加入,我们非常欢迎更多对 Node.js 感兴趣的朋友。 -- CNode 的 SLA 保证是,一个9,即 90.000000%。 +CNode 的 SLA 保证是,一个9,即 90.000000%。 社区目前由 [@alsotang](http://cnodejs.org/user/alsotang) 在维护,有问题请联系:[https://github.com/alsotang](https://github.com/alsotang) 请关注我们的官方微博:[http://weibo.com/cnodejs](http://weibo.com/cnodejs) + ## 客户端 -- 客户端由 [@soliury](https://cnodejs.org/user/soliury) 开发维护。 +客户端由 [@soliury](https://cnodejs.org/user/soliury) 开发维护。 -- 源码地址: [https://github.com/soliury/noder-react-native](https://github.com/soliury/noder-react-native) 。 +源码地址: [https://github.com/soliury/noder-react-native](https://github.com/soliury/noder-react-native) 。 立即体验 CNode 客户端,直接扫描页面右侧二维码。 另,安卓用户同时可选择:[https://github.com/TakWolf/CNode-Material-Design](https://github.com/TakWolf/CNode-Material-Design) ,这是 Java 原生开发的安卓客户端。 + + +## 贡献者 + +> egg-cnode + +[![contributors](https://ergatejs.implements.io/badges/contributors/cnodejs/egg-cnode.svg?owner=cnodejs&repo=egg-cnode&type=svg&width=1232&size=64&padding=8)](https://github.com/cnodejs/egg-cnode/graphs/contributors) `; const AboutPage: React.FC = (props) => { From 85cfaceb98444236cfd6d2f8a5fa5956c95a9a09 Mon Sep 17 00:00:00 2001 From: Suyi Date: Thu, 6 Jan 2022 04:21:57 +0800 Subject: [PATCH 2/3] feat: update title length limit --- src/page/topic/create/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/page/topic/create/index.tsx b/src/page/topic/create/index.tsx index 5ab332d..c0161ae 100644 --- a/src/page/topic/create/index.tsx +++ b/src/page/topic/create/index.tsx @@ -55,7 +55,7 @@ const CreateTopic: React.FC = (props) => { From fa48f94ab052a80d93c6c4ff6e32315952221227 Mon Sep 17 00:00:00 2001 From: Suyi Date: Thu, 6 Jan 2022 04:22:27 +0800 Subject: [PATCH 3/3] refactor: split component --- .../CommentForm/index.tsx} | 0 .../component/CommentList/index.less | 0 .../component/CommentList/index.tsx | 8 +++++- src/component/MessageList/index.tsx | 27 +++++++++---------- src/component/TopicList/index.tsx | 20 +++++++------- src/page/topic/detail.tsx | 10 +++---- 6 files changed, 33 insertions(+), 32 deletions(-) rename src/{page/topic/component/CommentForm.tsx => component/CommentForm/index.tsx} (100%) rename src/{page/topic => }/component/CommentList/index.less (100%) rename src/{page/topic => }/component/CommentList/index.tsx (91%) diff --git a/src/page/topic/component/CommentForm.tsx b/src/component/CommentForm/index.tsx similarity index 100% rename from src/page/topic/component/CommentForm.tsx rename to src/component/CommentForm/index.tsx diff --git a/src/page/topic/component/CommentList/index.less b/src/component/CommentList/index.less similarity index 100% rename from src/page/topic/component/CommentList/index.less rename to src/component/CommentList/index.less diff --git a/src/page/topic/component/CommentList/index.tsx b/src/component/CommentList/index.tsx similarity index 91% rename from src/page/topic/component/CommentList/index.tsx rename to src/component/CommentList/index.tsx index 9400cd6..f1fc184 100644 --- a/src/page/topic/component/CommentList/index.tsx +++ b/src/component/CommentList/index.tsx @@ -1,5 +1,6 @@ import React, { Fragment } from 'react'; import dayjs from 'dayjs'; +import { Link } from 'umi'; import Markdown from '@/component/Markdown'; import { Comment, Avatar, Divider } from 'antd'; @@ -38,6 +39,7 @@ const CommentList: React.FC = (props) => { data: Node; }> = ({ data }) => { const { id, author, content, create_at, children } = data; + const { loginname, avatar_url } = author; return ( @@ -63,7 +65,11 @@ const CommentList: React.FC = (props) => { datetime={ {dayjs(create_at).format('YYYY-MM-DD hh:mm:ss')} } - avatar={} + avatar={ + + + + } content={
diff --git a/src/component/MessageList/index.tsx b/src/component/MessageList/index.tsx index d7faf22..5418f99 100644 --- a/src/component/MessageList/index.tsx +++ b/src/component/MessageList/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; import dayjs from 'dayjs'; -import { useHistory } from 'umi'; +import { useHistory, Link } from 'umi'; import { Space, Avatar, Tag } from 'antd'; import { ListToolBarProps } from '@ant-design/pro-table'; import ProList, { ProListMetas } from '@ant-design/pro-list'; @@ -10,14 +10,13 @@ import { MESSAGE_TYPE_MAP, MessageType } from '@/constants'; import * as styles from './index.less'; const MessageList: React.FC = ({ dataSource, loading, toolbar }) => { - const history = useHistory(); - const metas: ProListMetas = { avatar: { dataIndex: 'author.avatar_url', render: (_, entity: MessageModel) => { const { type: _type, author } = entity; const type = MESSAGE_TYPE_MAP[_type as MessageType]; + const { loginname, avatar_url } = author; return ( @@ -26,10 +25,12 @@ const MessageList: React.FC = ({ dataSource, loading, toolbar }) => { width: '200px', }} > - - - {author.loginname} - + + + + {loginname} + +
{type.name} @@ -41,7 +42,10 @@ const MessageList: React.FC = ({ dataSource, loading, toolbar }) => { dataIndex: 'title', valueType: 'text', render: (_, entity: MessageModel) => { - return entity.topic.title; + const { + topic: { id, title }, + } = entity; + return {title}; }, }, actions: { @@ -60,13 +64,6 @@ const MessageList: React.FC = ({ dataSource, loading, toolbar }) => { metas={metas} className={styles.list} toolbar={toolbar} - onRow={(record: MessageModel) => { - return { - onClick: () => { - history.push(`/topic/${record.topic.id}`); - }, - }; - }} /> ); }; diff --git a/src/component/TopicList/index.tsx b/src/component/TopicList/index.tsx index ce6ee7e..6dfaa6c 100644 --- a/src/component/TopicList/index.tsx +++ b/src/component/TopicList/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; import dayjs from 'dayjs'; -import { useHistory } from 'umi'; +import { Link } from 'umi'; import { Space, Avatar, Tag } from 'antd'; import { ListToolBarProps } from '@ant-design/pro-table'; import ProList, { ProListMetas } from '@ant-design/pro-list'; @@ -10,8 +10,6 @@ import { TABS_MAP, TabType } from '@/constants'; import * as styles from './index.less'; const TopicList: React.FC = ({ dataSource, loading, toolbar }) => { - const history = useHistory(); - const metas: ProListMetas = { avatar: { dataIndex: 'author.avatar_url', @@ -19,6 +17,7 @@ const TopicList: React.FC = ({ dataSource, loading, toolbar }) => { const { tab: _tab, author, reply_count, visit_count, top } = entity; const category = TABS_MAP[_tab as TabType]; + const { loginname, avatar_url } = author; const renderReplyVisit = () => typeof visit_count === 'number' && ( @@ -41,7 +40,9 @@ const TopicList: React.FC = ({ dataSource, loading, toolbar }) => { return ( - + + + {renderReplyVisit()} {top ? ( 置顶 @@ -55,6 +56,10 @@ const TopicList: React.FC = ({ dataSource, loading, toolbar }) => { title: { dataIndex: 'title', valueType: 'text', + render: (_, entity: TopicModel) => { + const { id, title } = entity; + return {title}; + }, }, actions: { render: (_, entity: TopicModel) => { @@ -73,13 +78,6 @@ const TopicList: React.FC = ({ dataSource, loading, toolbar }) => { metas={metas} className={styles.list} toolbar={toolbar} - onRow={(record) => { - return { - onClick: () => { - history.push(`/topic/${record.id}`); - }, - }; - }} /> ); }; diff --git a/src/page/topic/detail.tsx b/src/page/topic/detail.tsx index bb3aad0..4066dd1 100644 --- a/src/page/topic/detail.tsx +++ b/src/page/topic/detail.tsx @@ -5,12 +5,12 @@ import { useRequest } from 'ahooks'; import { PageHeader, Divider } from 'antd'; import * as API from '@/service/topic'; -import SubTitle from './component/SubTitle'; import Markdown from '@/component/Markdown'; -import CommentForm from './component/CommentForm'; -import CommentList from './component/CommentList'; +import CommentList from '@/component/CommentList'; +import CommentForm from '@/component/CommentForm'; +import SubTitle from './component/SubTitle'; -const TopicDetail: React.FC> = (props) => { +const TopicDetailPage: React.FC> = (props) => { const params: Record = useParams(); const topicId = params?.id; @@ -174,6 +174,6 @@ const TopicDetail: React.FC> = (props) => { ); }; -export default TopicDetail; +export default TopicDetailPage; interface Props {}