Add tag posts view and comment counts
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// v1的时候就连统计信息也5秒获取一次,不妥,所以改成逻辑触发刷新
|
||||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
makeStyles,
|
||||
tokens,
|
||||
@@ -99,6 +100,7 @@ const Widgets: React.FC = () => {
|
||||
const styles = useStyles();
|
||||
const { toasterId, refreshTrigger, staticsRefreshTrigger } = useLayout();
|
||||
const { dispatchToast } = useToastController(toasterId);
|
||||
const navigate = useNavigate();
|
||||
const [isApiOnline, setIsApiOnline] = useState<boolean | null>(null);
|
||||
const [statics, setStatics] = useState<StaticsData | null>(null);
|
||||
const [topics, setTopics] = useState<HotTopicItem[]>([]);
|
||||
@@ -238,7 +240,13 @@ const Widgets: React.FC = () => {
|
||||
) : (
|
||||
topics.map((topic, index) => (
|
||||
<React.Fragment key={`${topic.name}-${index}`}>
|
||||
<div className={styles.topicRow}>
|
||||
<div
|
||||
className={styles.topicRow}
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={() =>
|
||||
navigate(`/tag/#${encodeURIComponent(topic.name)}`)
|
||||
}
|
||||
>
|
||||
<Text className={styles.topicName}>#{topic.name}</Text>
|
||||
<Text className={styles.topicCount}>{topic.count}个投稿</Text>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user