Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: timeline add empty state

shuai155c9b57c330
diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml
index d49bfb96..e9b98f40 100644
--- a/i18n/en_US.yaml
+++ b/i18n/en_US.yaml
@@ -1215,3 +1215,4 @@ ui:
type: Type
by: By
comment: Comment
+ no_data: "We couldn't find anything."
diff --git a/ui/src/pages/Timeline/index.tsx b/ui/src/pages/Timeline/index.tsx
index dd27ebd9..8c592a56 100644
--- a/ui/src/pages/Timeline/index.tsx
+++ b/ui/src/pages/Timeline/index.tsx
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next';
import { loggedUserInfoStore } from '@/stores';
import { useTimelineData } from '@/services';
-import { PageTitle } from '@/components';
+import { PageTitle, Empty } from '@/components';
import HistoryItem from './components/Item';
@@ -15,7 +15,7 @@ const Index: FC = () => {
const { is_admin } = loggedUserInfoStore((state) => state.user);
const [showVotes, setShowVotes] = useState(false);
- const { data: timelineData } = useTimelineData({
+ const { data: timelineData, isLoading } = useTimelineData({
object_id: tid || aid || qid,
show_vote: showVotes,
});
@@ -91,6 +91,9 @@ const Index: FC = () => {
})}
</tbody>
</Table>
+ {!isLoading && Number(timelineData?.timeline?.length) <= 0 && (
+ <Empty>{t('no_data')}</Empty>
+ )}
</Col>
</Row>
</Container>