diff --git a/frontend/src/routes/content.tsx b/frontend/src/routes/content.tsx index 313bd2f..905aee6 100644 --- a/frontend/src/routes/content.tsx +++ b/frontend/src/routes/content.tsx @@ -1,5 +1,6 @@ import React, {useEffect, useState} from "react"; -import {Layout, Spin, Flex} from "antd"; +import {Layout, Spin, Flex, Result } from "antd"; +import { SmileOutlined } from '@ant-design/icons'; import Post from "../components/post"; import {Comments} from "../components/comment"; import {PostImmutable} from "../declarations/feed/feed"; @@ -39,38 +40,69 @@ export const Content = React.memo((props: { contents?: PostImmutable[] }) => { getAllCommentProfiles() }, [postItem]) - return <> - - {onLoading && - - } - {!onLoading && contents && contents.map((v, k) => { - return - })} - - - {postItem ? !commentLoading ? postItem.comment.map((v, k) => { - return - }) : - - : <>} - - + if(contents !== undefined && contents?.length > 0) { + return <> + + {onLoading && + + } + {!onLoading && contents && contents.map((v, k) => { + return + })} + + + {postItem ? !commentLoading ? postItem.comment.map((v, k) => { + return + }) : + + : <>} + + + } else { + return ( + <> + + } + title="There Is No Feed !" + subTitle="Please Follow SomeOne To Get Feed Or Refresh The Website" + style={{ + backgroundColor: 'white' + }} + /> + + + + + ) + } }) diff --git a/frontend/src/routes/explore.tsx b/frontend/src/routes/explore.tsx index 910b833..3ec862a 100644 --- a/frontend/src/routes/explore.tsx +++ b/frontend/src/routes/explore.tsx @@ -20,35 +20,5 @@ export default function Explore() { fetch() }, []) - if(contents.length > 0) { - return - } else { - return ( - <> - - } - title="There Is No Feed !" - subTitle="Please Refresh The Website" - style={{ - backgroundColor: 'white' - }} - /> - - - - ) - } + return } diff --git a/frontend/src/routes/home.tsx b/frontend/src/routes/home.tsx index 86e610a..f4f0b4a 100644 --- a/frontend/src/routes/home.tsx +++ b/frontend/src/routes/home.tsx @@ -1,45 +1,10 @@ import React from "react"; import {Content} from "./content"; import {useAllDataStore} from "../redux"; -import { useAuth } from "../utils/useAuth"; -import { SmileOutlined } from '@ant-design/icons'; -import { Layout, Result } from 'antd'; + export const Home = React.memo(() => { const {allFeed} = useAllDataStore() - - if(allFeed?.length === 0 || allFeed === undefined) { - return ( - <> - - } - title="There Is No Feed !" - subTitle="Please Follow SomeOne To Get Feed" - style={{ - backgroundColor: 'white' - }} - /> - - - - - - ) - } else { - return - }; + return })