Merge branch 'feat/ui-0.5.0' into 'test'

fix: timeline add empty state

See merge request opensource/answer!275
This commit is contained in:
Li Shuailing 2022-11-24 03:47:30 +00:00
commit 6a15b5bbb9
2 changed files with 6 additions and 2 deletions

View File

@ -1231,3 +1231,4 @@ ui:
type: Type
by: By
comment: Comment
no_data: "We couldn't find anything."

View File

@ -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>