diff --git a/src/components/CodeBlockContent/index.tsx b/src/components/CodeBlockContent/index.tsx index e69755c..331059e 100644 --- a/src/components/CodeBlockContent/index.tsx +++ b/src/components/CodeBlockContent/index.tsx @@ -42,6 +42,17 @@ const ContentBlockContent: FunctionComponent = ({ cont 'a': { color: 'blue', textDecoration: 'underline' + }, + 'img': { + display: 'block', + width: '50%', + maxWidth: '100%', + height: '350px', + mt: '25px', + borderRadius: '8px', + '@media (max-width: 600px)': { + width: '100%', + } } }} /> diff --git a/src/components/FollowCard/index.tsx b/src/components/FollowCard/index.tsx index c2160b1..3c3be8c 100644 --- a/src/components/FollowCard/index.tsx +++ b/src/components/FollowCard/index.tsx @@ -26,7 +26,7 @@ const FollowCard: FunctionComponent = () => { const { createFollowUserMutation } = useCreateFollowUser() const { createOnFollowUserMutation } = useCreateOnFollowUser(); - const handleFollowUnfollow = (userId: string, following: boolean) => { + const handleFollowUnfollow = (userId: string, following: boolean) => { if (following) { createOnFollowUserMutation.mutate(userId) } else { @@ -36,72 +36,84 @@ const FollowCard: FunctionComponent = () => { return ( - - People to follow - + {isLoading && ( + + + + )} - - {isLoading && ( - - - - )} - {people && people?.map((person: any, index: number) => ( - - - - - + {people && ( + <> + + People to follow + - - - {person?.fullname} - - {truncate(person?.bio, 25)} - - + + {people?.map((person: any, index: number) => ( + + + + + - {user && ( - - )} + + + {person?.fullname} + + {truncate(person?.bio, 25)} + + + + {user && ( + + )} - {!user && ( - - - - )} - - ))} + {!user && ( + + + + )} + + ))} - - - See more suggestions - - - + + + See more suggestions + + + + + )} ) } diff --git a/src/components/Footer/index.tsx b/src/components/Footer/index.tsx index 4c83928..506d26a 100644 --- a/src/components/Footer/index.tsx +++ b/src/components/Footer/index.tsx @@ -138,7 +138,7 @@ const Footer: FunctionComponent = () => { - © 2024 Learn Hub. All right reserved. Made in Nigeria. + © 2024 Learn Hub. All right reserved. Made in 🇳🇬. diff --git a/src/pages/Articles/components/ArticleActionButtons.tsx b/src/pages/Articles/components/ArticleActionButtons.tsx index f4c6855..c6d0a96 100644 --- a/src/pages/Articles/components/ArticleActionButtons.tsx +++ b/src/pages/Articles/components/ArticleActionButtons.tsx @@ -19,7 +19,7 @@ const ArticleActionButtons: FunctionComponent = ({ <> = ({ const { handleFileUpload, loading: imageUploadLoading } = useImageUpload({ onSuccess: (data) => { setThumbnail(data?.data?.imageUploadUrl) + console.log(data?.data?.imageUploadUrl); + }, }); @@ -65,6 +67,7 @@ const ArticleForm: FunctionComponent = ({ setContent('') setTitle('') + setThumbnail('') }; useEffect(() => { diff --git a/src/pages/Articles/index.tsx b/src/pages/Articles/index.tsx index 2d8cd2c..700f497 100644 --- a/src/pages/Articles/index.tsx +++ b/src/pages/Articles/index.tsx @@ -127,11 +127,11 @@ const Articles: FunctionComponent = () => { display={"flex"} alignItems={"flex-start"} justifyContent={"space-between"} - flexDir={{ base: "column", md: "row" }} + flexDir={{ base: "column", lg: "row" }} gap={5} my={"3rem"} > - + {isLoading && } {articles && isSuccess && articles?.map((page: any, pageIndex: number) => ( @@ -181,7 +181,7 @@ const Articles: FunctionComponent = () => { )} - + {/* */} diff --git a/src/pages/Articles/show/index.tsx b/src/pages/Articles/show/index.tsx index 872f2b3..3eff8c7 100644 --- a/src/pages/Articles/show/index.tsx +++ b/src/pages/Articles/show/index.tsx @@ -54,11 +54,11 @@ const ShowArticle: FunctionComponent = () => { @@ -70,7 +70,7 @@ const ShowArticle: FunctionComponent = () => { /> - + = ({ setTabIndex }) => { } } - const handleFollowUnfollow = (userId: string, following: boolean) => { + const handleFollowUnfollow = (userId: string, following: boolean) => { if (following) { createOnFollowUserMutation.mutate(userId) } else { @@ -66,9 +66,9 @@ const Following: FunctionComponent = ({ setTabIndex }) => { authorUsername={article?.author?.username} isLoggedIn={!!user} is_saved={article?.is_saved} - is_following={article?.author?.is_following} - followUser={() => handleFollowUnfollow(article?.author?.id, article?.author?.is_following)} - saveUnsavedArticle={() => handleSaveUnsavedArticle(article?.id, article?.is_saved)} + is_following={article?.is_following} + followUser={() => handleFollowUnfollow(article?.author?.id, article?.is_following)} + saveUnsavedArticle={() => handleSaveUnsavedArticle(article?.id, article?.is_saved)} /> ))} diff --git a/src/pages/Search/index.tsx b/src/pages/Search/index.tsx index 54c37ea..4db52e7 100644 --- a/src/pages/Search/index.tsx +++ b/src/pages/Search/index.tsx @@ -13,11 +13,7 @@ import { colors } from '../../colors' const Search: FunctionComponent = () => { const [searchQuery, setSearchQuery] = useState('') - const [searchArr, setSearchArr] = useState({ - users: [], - articles: [], - threads: [] - }); + const [searchArr, setSearchArr] = useState({ users: [], articles: [], threads: [] }); const [value] = useDebounce(searchQuery, 1000); const { @@ -49,11 +45,7 @@ const Search: FunctionComponent = () => { setSearchQuery(value); if (value?.length === 0) { // Clear the search results if input is cleared - setSearchArr({ - users: [], - articles: [], - threads: [] - }); + setSearchArr({ users: [], articles: [], threads: [] }); } } @@ -67,11 +59,7 @@ const Search: FunctionComponent = () => { }); } else { // Clear the search results when the search term is empty - setSearchArr({ - users: [], - articles: [], - threads: [], - }); + setSearchArr({ users: [], articles: [], threads: [] }); } }, [usersData, articlesData, threadsData, value]); @@ -96,7 +84,8 @@ const Search: FunctionComponent = () => { - {searchQuery?.length === 0 && ( + {searchQuery?.length === 0 ? ( + // Show "Waiting for search" when input is empty { justifyContent="center" alignItems="center" height="100%" - py="20px"> + py="20px" + > Waiting for search. - { bg={"#fafafa"} /> + ) : ( + // Show loading spinner or search results + <> + {(isLoadingUser || isLoadingArticles || isLoadingThreads) ? ( + + + + ) : ( + // Show "Nothing found" when no results are found + searchArr?.users?.length === 0 && + searchArr?.articles?.length === 0 && + searchArr?.threads?.length === 0 && ( + + Nothing found with that search. + + + + ) + )} + )} {isLoadingUser && isLoadingArticles && isLoadingThreads && ( diff --git a/src/pages/Threads/index.tsx b/src/pages/Threads/index.tsx index 67a741e..917e5ef 100644 --- a/src/pages/Threads/index.tsx +++ b/src/pages/Threads/index.tsx @@ -123,9 +123,9 @@ const Threads: FunctionComponent = () => { - + {/* - + */} {/* diff --git a/src/pages/Threads/show/index.tsx b/src/pages/Threads/show/index.tsx index a0d4fc3..5189976 100644 --- a/src/pages/Threads/show/index.tsx +++ b/src/pages/Threads/show/index.tsx @@ -82,9 +82,9 @@ const ShowThread: FunctionComponent = () => { - + {/* - + */} {/* diff --git a/src/pages/Users/Profile/index.tsx b/src/pages/Users/Profile/index.tsx index 8ddd82a..ec0aaee 100644 --- a/src/pages/Users/Profile/index.tsx +++ b/src/pages/Users/Profile/index.tsx @@ -78,7 +78,9 @@ const Profile: FunctionComponent = () => { {user?.data?.fullname} {user?.data?.profile_headlines} {user?.data?.state}, {user?.data?.country} - {user?.data?.followers} followers - {user?.data?.followings} following + + {`${user?.data?.followers} ${user?.data?.followers! > 1 ? 'Followers' : 'Follower'}`} - {user?.data?.followings} following + { {userData?.fullname} - {userData?.followers} {userData?.followers === 1 ? 'Follower' : 'Followers'} + {/* // Display follower count with correct pluralization */} + {`${userData?.followers} ${userData?.followers! > 1 ? 'Followers' : 'Follower'}`}