diff --git a/src/components/TopicList/TopicList.tsx b/src/components/TopicList/TopicList.tsx index 1ecea68..bb2cd45 100644 --- a/src/components/TopicList/TopicList.tsx +++ b/src/components/TopicList/TopicList.tsx @@ -3,7 +3,7 @@ import { css } from 'emotion' import { List } from '@material-ui/core' -import TopicListItem from './TopicListItem' +import TopicListItem, { Place } from './TopicListItem' import { ITopic } from '@cc98/api' @@ -13,7 +13,7 @@ const list = css` interface Props { topics: ITopic[] - place?: 'inboard' | 'newtopic' | 'usercenter' | 'follow' | 'search' + place: Place } const TopicList: React.FunctionComponent = ({ topics, place }) => ( diff --git a/src/components/TopicList/TopicListItem.tsx b/src/components/TopicList/TopicListItem.tsx index f3a6fdf..2b7349c 100644 --- a/src/components/TopicList/TopicListItem.tsx +++ b/src/components/TopicList/TopicListItem.tsx @@ -13,10 +13,12 @@ const Item = styled(ListItem)` display: flex; justify-content: space-between; align-items: flex-end; + width: 100%; ` const TitleArea = styled.div` max-width: 80%; + flex-grow: 1; ` const InfoArea = styled.div` @@ -42,6 +44,7 @@ const SubTitle = styled(Typography)` const Info = SubTitle /** + * 布局: * title info1 * subtitle info2 */ @@ -73,9 +76,11 @@ export const TopicItem: React.FunctionComponent = ({ ) +export type Place = 'inboard' | 'newtopic' | 'usercenter' | 'follow' | 'search' | 'hot' + interface Props { data: ITopic - place?: 'inboard' | 'newtopic' | 'usercenter' | 'follow' | 'search' + place: Place } export default ({ data, place }: Props) => { @@ -98,9 +103,15 @@ export default ({ data, place }: Props) => { subtitle = boardName break + case 'hot': + if (!boardName) { + getBoardName() + } + info1 = boardName + break + case 'newtopic': info1 = dayjs(data.time).fromNow() - case 'follow': case 'search': if (!boardName) { @@ -110,7 +121,6 @@ export default ({ data, place }: Props) => { break // case 'inboard': - // case undefined: } return ( diff --git a/src/components/TopicList/index.tsx b/src/components/TopicList/index.tsx index 2127947..2bf9120 100644 --- a/src/components/TopicList/index.tsx +++ b/src/components/TopicList/index.tsx @@ -4,6 +4,7 @@ import useInfList, { Service as InfService } from '@/hooks/useInfList' import useFetcher, { Service as FinService } from '@/hooks/useFetcher' import TopicList from './TopicList' +import { Place } from './TopicListItem' import InfiniteList from '@/components/InfiniteList' import LoadingCircle from '@/components/LoadingCircle' @@ -12,8 +13,7 @@ import { ITopic } from '@cc98/api' interface InfProps { service: InfService - // TODO: remove - place?: 'inboard' | 'newtopic' | 'usercenter' | 'follow' | 'search' + place: Place } const InfTopicList: React.FunctionComponent = ({ service, place }) => { @@ -30,7 +30,7 @@ const InfTopicList: React.FunctionComponent = ({ service, place }) => interface FinProps { service: FinService noLoading?: boolean - place?: 'inboard' | 'newtopic' | 'usercenter' | 'follow' | 'search' + place: Place } const FinTopicList: React.FunctionComponent = ({ service, noLoading, place }) => { diff --git a/src/pages/Board/index.tsx b/src/pages/Board/index.tsx index 139677c..afb3ab0 100644 --- a/src/pages/Board/index.tsx +++ b/src/pages/Board/index.tsx @@ -60,7 +60,7 @@ export default ({ id }: Props) => { - getTopTopics(id)} place="inboard" /> + getTopTopics(id)} place="inboard" noLoading /> { {current === 'day' && } - {current === 'week' && } - {current === 'month' && } - {current === 'history' && } + {current === 'week' && } + {current === 'month' && } + {current === 'history' && } ) } diff --git a/src/version.ts b/src/version.ts index 02e031c..36c9cc2 100644 --- a/src/version.ts +++ b/src/version.ts @@ -2,4 +2,4 @@ * 版本号 */ -export default 'v0.14.11-alpha' +export default 'v0.14.12-alpha' diff --git a/tsconfig.json b/tsconfig.json index 111c434..ea7b08c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,6 +5,7 @@ "allowJs": false, "target": "es6", "jsx": "preserve", + "noEmitOnError": true, "sourceMap": false, "baseUrl": "./", "rootDir": "src",