From 6e30e4d689a96ed8d7d00f9d73d153b5d65c59bc Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Fri, 4 Aug 2023 17:54:21 +0200 Subject: [PATCH 01/21] Fixed missing settings --- app/auth/signup/page.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/auth/signup/page.tsx b/app/auth/signup/page.tsx index 089fbb5..0816cd9 100644 --- a/app/auth/signup/page.tsx +++ b/app/auth/signup/page.tsx @@ -21,7 +21,7 @@ import { DEFAULT_INSTANCE } from "@/constants/settings"; import Logo from "@/components/Logo"; import { useNavbar } from "@/hooks/navbar"; -import { useSession } from "@/hooks/auth"; +import { defaultState, useSession } from "@/hooks/auth"; import styles from "@/styles/Pages/LoginPage.module.css"; @@ -266,6 +266,7 @@ export default function Register() { jwt: res.jwt, user: user.my_user!.local_user_view, site: user, + settings: defaultState.settings }, }); From b69b7a0db4f4e82641a501200603a69e29165f48 Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Fri, 4 Aug 2023 21:40:25 +0200 Subject: [PATCH 02/21] Added settings, moved a lot to nextui --- app/auth/login/page.tsx | 123 ++++--- app/auth/signup/page.tsx | 393 ++++++++------------- app/globals.css | 28 +- app/layout.tsx | 2 +- app/page.tsx | 1 + app/settings/page.tsx | 3 + components/Comments.tsx | 1 - components/Navbar/LeftSideMenu.tsx | 1 - components/Navbar/SearchOverlay.tsx | 37 +- components/PageComponents/FeedPage.tsx | 6 +- components/PageComponents/SettingsPage.tsx | 87 ++++- components/Post.tsx | 24 +- components/PostList.tsx | 4 +- components/ui/InboxCard.tsx | 1 - hooks/auth.tsx | 31 +- utils/authFunctions.ts | 1 - 16 files changed, 386 insertions(+), 357 deletions(-) diff --git a/app/auth/login/page.tsx b/app/auth/login/page.tsx index 7de1bc0..c43fd36 100644 --- a/app/auth/login/page.tsx +++ b/app/auth/login/page.tsx @@ -1,7 +1,7 @@ "use client"; import { GetSiteResponse, PersonView } from "lemmy-js-client"; -import { FormEvent, useState, useEffect } from "react"; +import { FormEvent, useState, useEffect, useMemo } from "react"; import { useRouter } from "next/navigation"; import Link from "next/link"; import { motion } from "framer-motion"; @@ -38,7 +38,9 @@ export default function Login() { const [inputFocus, setInputFocus] = useState(false); const [users, setUsers] = useState([]); const [selectedUser, setSelectedUser] = useState(null); + const [loginError, setLoginError] = useState(false); + const [errorMessage, setErrorMessage] = useState(""); const [isPasswordVisible, setIsPasswordVisible] = useState(false); @@ -74,6 +76,14 @@ export default function Login() { }); }, [selectedUser]); + const validateHostname = (value: string) => value.match(/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}$/i); + + const instanceValid = useMemo(() => { + if (form.instance === "") return undefined; + + return validateHostname(form.instance) ? "valid" : "invalid"; + }, [form.instance]); + const handleSubmit = async (e: FormEvent) => { try { e.preventDefault(); @@ -134,7 +144,9 @@ export default function Login() { } catch (e: any) { setLoading(false); setLoginError(true); - console.error(e.message); + va.track("login_error", { instance: form.instance, error: e.message }) + console.error("Got error message:",e.message); + setErrorMessage(`${e.message}`) } }; @@ -146,6 +158,7 @@ export default function Login() { }; useEffect(() => { + setSelectedUser(null); const timer = setTimeout(async () => { if (form.username.length > 0) await searchUsers(form.username); }, 250); @@ -179,55 +192,54 @@ export default function Login() {
handleSubmit(e)} className={`${styles.loginWrapper} text-neutral-900 dark:text-neutral-100 `}> - setForm({ ...form, username: e.currentTarget.value })} - endContent={ - - } - /> - {users?.length > 0 && !selectedUser && ( -
- {users.map((user, i) => ( -
setSelectedUser(user)} - key={i} - className="flex cursor-pointer flex-row items-center gap-3 border-neutral-700 dark:border-b dark:pb-4" - > - -
- - {user.person.display_name || user.person.name} - - - @{new URL(user.person.actor_id).hostname} - +
+ setForm({ ...form, username: e.currentTarget.value })} + endContent={ + + } + /> + {users?.length > 0 && !selectedUser && ( +
+ {users.map((user, i) => ( +
setSelectedUser(user)} + key={i} + className="flex cursor-pointer flex-row items-center gap-3 border-neutral-700 dark:border-b dark:pb-4" + > + +
+ + {user.person.display_name || user.person.name} + + + @{new URL(user.person.actor_id).hostname} + +
-
- ))} -
- )} + ))} +
+ )} +
0 ? "success" : "primary"} + errorMessage={instanceValid === "invalid" && "Please enter a valid Instance"} + validationState={instanceValid} + defaultValue={form.instance || ""} onChange={(e) => setForm({ ...form, instance: e.currentTarget.value })} /> @@ -268,6 +283,12 @@ export default function Login() { onChange={(e) => setForm({ ...form, totp: e.currentTarget.value })} /> + {loginError && ( +
+ {errorMessage} +
+ ) + } + } + /> + + Show NSFW Content + Save login + Temporary login is not support currently. + } + /> + + + Show NSFW Content + Save login + Temporary login is not support currently. + + setForm({ ...form, instance: e.currentTarget.value })} + />
@@ -710,16 +619,15 @@ export default function Register() { alt="" /> -
- - - setForm({ ...form, captcha: e.target.value }) - } - type="text" - /> -
+ setForm({ ...form, captcha: e.currentTarget.value })} + />
@@ -736,6 +644,7 @@ export default function Register() {
+ {/* Signup complete */} {signupComplete && ( - + diff --git a/app/page.tsx b/app/page.tsx index 1eadc0b..56e78fd 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -90,6 +90,7 @@ export default async function Home() { instance={instance} jwt={currentAccount?.jwt} siteResponse={siteResponse} + currentAccount={currentAccount} /> ); diff --git a/app/settings/page.tsx b/app/settings/page.tsx index 5ccfc05..89a3083 100644 --- a/app/settings/page.tsx +++ b/app/settings/page.tsx @@ -25,7 +25,10 @@ export default async function Settings() { Modern Compact + +
Use system theme
+ diff --git a/components/Comments.tsx b/components/Comments.tsx index b9545e5..dd52698 100644 --- a/components/Comments.tsx +++ b/components/Comments.tsx @@ -167,7 +167,6 @@ export default function Comments({ useEffect(() => { if (commentResponse) { - console.log("Comment response mode", commentResponse); setReplyCommet(commentResponse.comment_view); setCommentsData({ comments: [commentResponse.comment_view] }); return; diff --git a/components/Navbar/LeftSideMenu.tsx b/components/Navbar/LeftSideMenu.tsx index de03705..965b6fd 100644 --- a/components/Navbar/LeftSideMenu.tsx +++ b/components/Navbar/LeftSideMenu.tsx @@ -45,7 +45,6 @@ export default function LeftSideMenu({ const handleLoadMore = async (page: number) => { const data = await listCommunities({ page: page, auth: session.currentAccount?.jwt, type_: "Subscribed", sort: "Active" }, session.currentAccount?.instance); - console.log(data); if(typeof data == "boolean" || data?.communities?.length == 0) { setHasMore(false); return diff --git a/components/Navbar/SearchOverlay.tsx b/components/Navbar/SearchOverlay.tsx index 4bb5140..6936533 100644 --- a/components/Navbar/SearchOverlay.tsx +++ b/components/Navbar/SearchOverlay.tsx @@ -8,6 +8,7 @@ import { useEffect, useState, FormEvent, useRef } from "react"; import { disablePageScroll, enablePageScroll } from "scroll-lock"; import { getTrendingCommunities, getTrendingTopics } from "@/utils/lemmy"; import InfiniteScroll from "react-infinite-scroller"; +import { Tabs, Tab } from "@nextui-org/react"; import { useSession } from "@/hooks/auth"; @@ -169,6 +170,15 @@ function TrendingTopic({ ); } +function TabContent({ text, icon } : { text: string, icon: string }) { + return ( +
+ {icon} + {text} +
+ ) +} + export default function SearchOverlay({ handleCloseSearchOverlay, }: { @@ -217,7 +227,7 @@ export default function SearchOverlay({ // Update input value when user stops typing useEffect(() => { - if(searchLoading) return console.log("Not realoading, still loading results."); + if(searchLoading) return console.warn("Not realoading, still loading results."); if (currentSearch?.length == 0) return setIsSearching(false); const timer = setTimeout(async () => { if (currentSearch.length == 0) return; @@ -242,7 +252,6 @@ export default function SearchOverlay({ }; const search = async ({ searchParams }: { searchParams: Search }): Promise => { - console.log("Searching page:", searchParams.page) setSearchLoading(true); try { // add a signature to the object to make typescript happy @@ -276,7 +285,6 @@ export default function SearchOverlay({ const handleLoadMore = async () => { if(!hasMore) return; - console.log("Loading more from page", currentPage); const data = await search({ searchParams: { page: currentPage, @@ -284,7 +292,6 @@ export default function SearchOverlay({ auth: session?.currentAccount?.jwt || undefined }}) - console.log(currentPage, data); if(!data) return; @@ -310,7 +317,6 @@ export default function SearchOverlay({ break; } - console.log("isEmpty", isEmpty, currentCategory); if(isEmpty) setHasMore(false); @@ -406,18 +412,27 @@ export default function SearchOverlay({ {isSearching && ( <> -
- setCurrentCategory(option.label as "Posts" | "Communities" | "Users")} - /> +
+ + setCurrentCategory(key as "Posts" | "Communities" | "Users")} + > + }> + }> + }> + +
+ +
} className="flex flex-col gap-2 relative h-fit" diff --git a/components/PageComponents/FeedPage.tsx b/components/PageComponents/FeedPage.tsx index 59aaf88..0a3fc62 100644 --- a/components/PageComponents/FeedPage.tsx +++ b/components/PageComponents/FeedPage.tsx @@ -10,12 +10,15 @@ import PostList from "../PostList"; import RenderMarkdown from "../ui/RenderMarkdown"; import SiteInfoCard from "../SiteInfoCard"; +import { Account } from "@/utils/authFunctions"; + export default function FeedPage({ fetchParams, initPosts, instance, jwt, siteResponse, + currentAccount }: { fetchParams?: { type_?: ListingType; @@ -31,10 +34,11 @@ export default function FeedPage({ instance: string; jwt?: string; siteResponse: GetSiteResponse | null; + currentAccount?: Account; }) { return (
- +
diff --git a/components/PageComponents/SettingsPage.tsx b/components/PageComponents/SettingsPage.tsx index 6dc3210..e560abe 100644 --- a/components/PageComponents/SettingsPage.tsx +++ b/components/PageComponents/SettingsPage.tsx @@ -1,4 +1,11 @@ +"use client" + +import { Switch, cn, Checkbox } from "@nextui-org/react"; + + import { Account } from "@/utils/authFunctions"; +import React, { useEffect } from "react"; +import { Settings, useSession } from "@/hooks/auth"; function Section({ children, title }: { children: any; title: string }) { return ( @@ -18,16 +25,88 @@ export default function SettingsPage({ }: { currentAccount: Account; }) { + + const { session, setSession } = useSession() + const [settings, setSettings] = React.useState(currentAccount.settings || {} as Settings) + + useEffect(() => { + if (currentAccount) { + setSession(prevValue => { return { ...prevValue, settings: settings } }) + } + }, [settings, currentAccount, setSession]) + return ( <>
-
- Modern - Compact + +
+ +
+ +
+
+
+
+
+ + Modern + setSettings(prevValue => { return { ...prevValue, cardType: isSelected ? "modern" : "compact"}})} /> +
+ +
+ +
+
+
+
+
+
+ + Compact + setSettings(prevValue => { return { ...prevValue, cardType: isSelected ? "compact" : "modern"}})} /> +
-
Use system theme
+ + + setSettings({ ...settings, useSystemTheme: value })} + classNames={{ + base: cn( + "inline-flex flex-row-reverse w-full max-w-md items-center", + "justify-between cursor-pointer rounded-lg gap-2 px-4" + ), + }} + > +
+

Use System theme

+
+
+ + light_mode
} + endContent={
dark_mode
} + isDisabled={settings.useSystemTheme || false} + defaultSelected={settings.theme === "dark" || false} + isSelected={settings.theme === "dark" || false} + onValueChange={(value) => setSettings({ ...settings, theme: value ? "dark" : "light" })} + classNames={{ + base: cn( + "inline-flex flex-row-reverse w-full max-w-md items-center", + "justify-between cursor-pointer rounded-lg gap-2 px-4" + ), + }} + > +
+

Dark mode

+
+ + + +
diff --git a/components/Post.tsx b/components/Post.tsx index 8479e95..1821583 100644 --- a/components/Post.tsx +++ b/components/Post.tsx @@ -1,6 +1,7 @@ import Image from "next/image"; import { PostView } from "lemmy-js-client"; import Link from "next/link"; +import { AnimatePresence, motion } from "framer-motion"; import Username from "./User/Username"; import Vote from "./Vote"; @@ -20,14 +21,14 @@ export default function Post({ instance, auth, postInstance, - style="card" + style="modern" }: { post: PostView; onClick?: () => void; instance?: string; auth?: string; postInstance?: string; - style?: "card" | "compact" + style?: "modern" | "compact" }) { if (!post) throw new Error("Post is undefined"); @@ -39,17 +40,20 @@ export default function Post({ //const postUrl = `https://${baseUrl}/post/${post.post.id}`; const postUrl = `/post/${post.post.id}?instance=${ - postInstance || DEFAULT_INSTANCE + postInstance || new URL(DEFAULT_INSTANCE).host }&preload=true`; switch(style) { - case "card": + case "modern": return ( <> -
@@ -258,17 +262,19 @@ export default function Post({
-
+
); case "compact": return ( <> -
@@ -401,7 +407,7 @@ export default function Post({ )}
-
+ ); } diff --git a/components/PostList.tsx b/components/PostList.tsx index 6b94e70..390c8e1 100644 --- a/components/PostList.tsx +++ b/components/PostList.tsx @@ -25,6 +25,7 @@ export default function PostList({ fetchParams = { limit: DEFAULT_POST_LIMIT, page: 1 }, initPosts, setCurrentPost = () => null, + style="modern" }: { fetchParams?: { type_?: ListingType; @@ -38,6 +39,7 @@ export default function PostList({ }; initPosts?: PostView[]; setCurrentPost?: Function; + style: "modern" | "compact"; }) { const { session } = useSession(); const { navbar, setNavbar } = useNavbar(); @@ -148,7 +150,7 @@ export default function PostList({ auth={session.currentAccount?.jwt} key={index} postInstance={new URL(post.post.ap_id).host} - style="card" + style={style} /> ); })} diff --git a/components/ui/InboxCard.tsx b/components/ui/InboxCard.tsx index 68d1627..2e296ae 100644 --- a/components/ui/InboxCard.tsx +++ b/components/ui/InboxCard.tsx @@ -54,7 +54,6 @@ export default function InboxCard({ useEffect(() => { if (loading || !auth || !instance) return; if (!isPostComment) { - console.log(reply); setLoading(true); const path = reply.comment.path.split("."); const parentId = parseInt(path[path.length - 2]); diff --git a/hooks/auth.tsx b/hooks/auth.tsx index cbfa3a4..ed7adab 100644 --- a/hooks/auth.tsx +++ b/hooks/auth.tsx @@ -17,7 +17,9 @@ import { import { DEFAULT_INSTANCE } from "@/constants/settings"; export interface Settings { - theme: "light" | "dark"; + theme: "light" | "dark" | "system"; + cardType: "modern" | "compact"; + useSystemTheme: boolean; showNSFW: boolean; showBotAccounts: boolean; showAvatars: boolean; @@ -39,6 +41,8 @@ export const defaultState: SessionState = { isLoggedIn: false, settings: { theme: "dark", + cardType: "modern", + useSystemTheme: true, showNSFW: true, showBotAccounts: true, showAvatars: true, @@ -55,12 +59,23 @@ const SessionContext = createContext({ setSession: () => {}, }); -export function setTheme(theme: "light" | "dark") { - if (theme === "dark") { +export function setTheme(theme: "light" | "dark" | "system", useSystemTheme?: boolean) { + if (theme === "dark" && !useSystemTheme) { document.getElementsByTagName("html")[0].classList.add("dark"); - } else { + return "dark"; + } else if (theme === "light" && !useSystemTheme) { document.getElementsByTagName("html")[0].classList.remove("dark"); + return "light"; + } else if (useSystemTheme) { + if (window.matchMedia("(prefers-color-scheme: dark)").matches) { + document.getElementsByTagName("html")[0].classList.add("dark"); + return "dark"; + } else { + document.getElementsByTagName("html")[0].classList.remove("dark"); + return "light"; + } } + return "dark"; } export const SessionContextProvider = ({ children }: { children: any }) => { @@ -150,15 +165,18 @@ export const SessionContextProvider = ({ children }: { children: any }) => { // This can update on runtime useEffect(() => { - console.log("Updating session settings", session.settings.theme) - setTheme(session.settings.theme) + const newTheme = setTheme(session.settings.theme, session.settings.useSystemTheme) // Also takes system theme into account + if(newTheme !== session.settings.theme) { + setSession({ ...session, settings: { ...session.settings, theme: newTheme } }); + } // update account settings in cookie const currentAccount = session.currentAccount; if (currentAccount) { if(currentAccount.settings == session.settings) return; currentAccount.settings = session.settings; + currentAccount.settings.theme = newTheme; updateCurrentAccount(currentAccount, session, setSession); } @@ -169,7 +187,6 @@ export const SessionContextProvider = ({ children }: { children: any }) => { if (typeof window === "undefined") return; const browserTheme = window.matchMedia("(prefers-color-scheme: dark)"); browserTheme.addEventListener("change", (e) => { - console.log("Changed device theme to", e.matches ? "dark" : "light") if (e.matches) { setSession({ ...session, settings: { ...session.settings, theme: "dark" } }); } else { diff --git a/utils/authFunctions.ts b/utils/authFunctions.ts index d26db42..aa9ff06 100644 --- a/utils/authFunctions.ts +++ b/utils/authFunctions.ts @@ -526,7 +526,6 @@ export const updateAccount = (updatedAccount: Account) => { } export const updateCurrentAccount = (updatedAccount: Account, session: SessionState, setSession: Dispatch>) => { - console.log("Updating account:", updatedAccount.settings.theme) const currentAccount = getCurrentAccount(); if (currentAccount) { updateAccount(updatedAccount); From c86fd44cca3912d803ce396445b3e3b00e6ee89f Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Fri, 4 Aug 2023 21:52:13 +0200 Subject: [PATCH 03/21] Fixed animations --- components/Post.tsx | 13 +++++-------- components/PostList.tsx | 29 +++++++++++++++++++---------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/components/Post.tsx b/components/Post.tsx index 1821583..63b2d18 100644 --- a/components/Post.tsx +++ b/components/Post.tsx @@ -51,9 +51,9 @@ export default function Post({ className={`card ${styles.wrapper} items-start justify-start `} key={post.post.id} id={`${post.post.id.toString()}@${baseUrl}`} - initial={{ opacity: 0, y: 10 }} - animate={{ opacity: 1, y: 0 }} - exit={{ opacity: 0, y: -10 }} + initial={{ opacity: 0, y: 0 }} + animate={{ opacity: 1, y: 0, transition: { bounce: 0 } }} + exit={{ opacity: 0, y: 0}} >
@@ -269,12 +269,9 @@ export default function Post({ case "compact": return ( <> -
@@ -407,7 +404,7 @@ export default function Post({ )}
- +
); } diff --git a/components/PostList.tsx b/components/PostList.tsx index 390c8e1..ebbcb30 100644 --- a/components/PostList.tsx +++ b/components/PostList.tsx @@ -3,7 +3,7 @@ import { useState, useEffect, cache } from "react"; import { CommunityId, ListingType, PostView, SortType } from "lemmy-js-client"; import InfiniteScroll from "react-infinite-scroller"; -import { motion } from "framer-motion"; +import { AnimatePresence, motion } from "framer-motion"; import va from "@vercel/analytics" import { useSession } from "@/hooks/auth"; @@ -143,15 +143,24 @@ export default function PostList({ > {posts.map((post: PostView, index: number) => { return ( - handleClickPost(post)} - post={post} - instance={session.currentAccount?.instance} - auth={session.currentAccount?.jwt} - key={index} - postInstance={new URL(post.post.ap_id).host} - style={style} - /> + + + handleClickPost(post)} + post={post} + instance={session.currentAccount?.instance} + auth={session.currentAccount?.jwt} + key={index} + postInstance={new URL(post.post.ap_id).host} + style={session.settings.cardType || style || "modern"} + /> + + ); })} From aa58bc5b47ed115e74630854b099833dd7598946 Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Fri, 4 Aug 2023 21:54:42 +0200 Subject: [PATCH 04/21] Fixed style being required --- components/PostList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/PostList.tsx b/components/PostList.tsx index ebbcb30..3652399 100644 --- a/components/PostList.tsx +++ b/components/PostList.tsx @@ -39,7 +39,7 @@ export default function PostList({ }; initPosts?: PostView[]; setCurrentPost?: Function; - style: "modern" | "compact"; + style?: "modern" | "compact"; }) { const { session } = useSession(); const { navbar, setNavbar } = useNavbar(); From 175d0d40fc03d55069ad122dc904e37cb099bc56 Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Fri, 4 Aug 2023 21:54:50 +0200 Subject: [PATCH 05/21] Fixed sortsWrapper --- components/PageComponents/CommunityPage.tsx | 2 +- components/PageComponents/UserPage.tsx | 2 +- styles/Pages/UserPage.module.css | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/PageComponents/CommunityPage.tsx b/components/PageComponents/CommunityPage.tsx index a5cae9d..f0db669 100644 --- a/components/PageComponents/CommunityPage.tsx +++ b/components/PageComponents/CommunityPage.tsx @@ -187,7 +187,7 @@ export default function CommunityPage({
-
+
setCurrentSort(newSort as SortType)} /> diff --git a/components/PageComponents/UserPage.tsx b/components/PageComponents/UserPage.tsx index c9e9368..0a3a8cb 100644 --- a/components/PageComponents/UserPage.tsx +++ b/components/PageComponents/UserPage.tsx @@ -246,7 +246,7 @@ export default function UserPage({
-
+
setSort(newSort as SortType)} /> diff --git a/styles/Pages/UserPage.module.css b/styles/Pages/UserPage.module.css index f2c4d95..d07ffa6 100644 --- a/styles/Pages/UserPage.module.css +++ b/styles/Pages/UserPage.module.css @@ -70,8 +70,8 @@ } .sortsWrapper { - @apply flex flex-row flex-wrap items-center justify-center bg-neutral-200 px-28 py-4 - dark:bg-neutral-900 dark:text-neutral-300 + @apply flex flex-row flex-wrap items-center justify-center px-28 py-4 + max-md:p-6 w-full; } From 2fb49dd97073766522e656ddc69e4cec17af7177 Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Fri, 4 Aug 2023 22:00:15 +0200 Subject: [PATCH 06/21] Fixed community page --- components/PageComponents/CommunityPage.tsx | 37 +++++++++++------- styles/Pages/CommunityPage.module.css | 43 --------------------- 2 files changed, 23 insertions(+), 57 deletions(-) diff --git a/components/PageComponents/CommunityPage.tsx b/components/PageComponents/CommunityPage.tsx index f0db669..82ec913 100644 --- a/components/PageComponents/CommunityPage.tsx +++ b/components/PageComponents/CommunityPage.tsx @@ -80,7 +80,9 @@ export default function CommunityPage({ return ( <> -
+
-
+
subscribe()} - className={`${styles.subscribeButton}`} + className={`rounded-lg bg-fuchsia-200 p-4 + font-medium text-fuchsia-950`} > {subscribeLoading ? ( @@ -138,20 +145,23 @@ export default function CommunityPage({
Community Description @@ -187,19 +197,18 @@ export default function CommunityPage({
-
+
setCurrentSort(newSort as SortType)} /> - -
- view_day -
Date: Fri, 4 Aug 2023 22:01:39 +0200 Subject: [PATCH 07/21] Fixed newPost --- app/post/new/page.tsx | 12 ++++++++++-- styles/Pages/NewPost.module.css | 8 -------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/post/new/page.tsx b/app/post/new/page.tsx index 859ac25..0c9490c 100644 --- a/app/post/new/page.tsx +++ b/app/post/new/page.tsx @@ -277,7 +277,11 @@ export default function New() { } type="text" placeholder="An interesting title" - className={`${styles.input}`} + className={`w-full rounded-lg bg-transparent + p-2 text-3xl font-bold + underline decoration-fuchsia-500 outline-none + dark:text-neutral-100 + max-sm:text-2xl`} />
@@ -419,7 +423,11 @@ export default function New() { } type="text" placeholder="An interesting title" - className={`${styles.input}`} + className={`w-full rounded-lg bg-transparent + p-2 text-3xl font-bold + underline decoration-fuchsia-500 outline-none + dark:text-neutral-100 + max-sm:text-2xl`} />
diff --git a/styles/Pages/NewPost.module.css b/styles/Pages/NewPost.module.css index a3ae4c0..9020175 100644 --- a/styles/Pages/NewPost.module.css +++ b/styles/Pages/NewPost.module.css @@ -6,14 +6,6 @@ transform: translateX(-50%); } -.input { - @apply w-full rounded-lg bg-transparent - p-2 text-3xl font-bold - underline decoration-fuchsia-500 outline-none - dark:text-neutral-100 - max-sm:text-2xl; -} - .textarea { @apply w-full bg-transparent outline-none max-sm:text-sm; } From 7163cf29d1a46b1343934a9d65f2e11945121c35 Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Fri, 4 Aug 2023 22:02:50 +0200 Subject: [PATCH 08/21] Fixed modern post being motion div --- components/Post.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/components/Post.tsx b/components/Post.tsx index 63b2d18..8b99e0e 100644 --- a/components/Post.tsx +++ b/components/Post.tsx @@ -47,13 +47,10 @@ export default function Post({ case "modern": return ( <> -
@@ -262,7 +259,7 @@ export default function Post({
- +
); From c0a7100feac65b4848fc087d9515b83bc7414276 Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Fri, 4 Aug 2023 22:10:27 +0200 Subject: [PATCH 09/21] Fixed comments --- components/Comments.tsx | 15 +++++++++------ components/User/Username.tsx | 5 +++-- styles/Comment.module.css | 10 +++++++--- styles/User/Username.module.css | 1 - 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/components/Comments.tsx b/components/Comments.tsx index dd52698..7ee46fb 100644 --- a/components/Comments.tsx +++ b/components/Comments.tsx @@ -299,12 +299,15 @@ export default function Comments({
- {commentsData?.comments?.length > 0 && ( - setCurrentCommentSort(sort as CommentSortType)} - /> - )} +
+ {commentsData?.comments?.length > 0 && ( + setCurrentCommentSort(sort as CommentSortType)} + /> + )} +
+ {/* Comments */} {commentResponse ? ( diff --git a/components/User/Username.tsx b/components/User/Username.tsx index 9e09761..f4cfcc4 100644 --- a/components/User/Username.tsx +++ b/components/User/Username.tsx @@ -35,10 +35,11 @@ export default function Username({ className={`${styles.userimage} ${ user.avatar ? "" : "p-1/2 object-contain" } `} + style={{ height: "20px", width: "20px" }} src={user.avatar || DEFAULT_AVATAR} alt={user.name} - height={25} - width={25} + height={20} + width={20} /> diff --git a/styles/Comment.module.css b/styles/Comment.module.css index 93ca7c3..486e315 100644 --- a/styles/Comment.module.css +++ b/styles/Comment.module.css @@ -32,7 +32,7 @@ cursor: pointer; z-index: 10; pointer-events: all; - width: 1.5rem; + width: 1.25rem; } .chainlineLine { @@ -52,11 +52,15 @@ .commentText { @apply h-full w-full max-w-fit overflow-hidden - pl-1 pt-1 font-normal max-sm:max-h-full max-sm:max-w-full - text-sm max-sm:text-xs + pl-1 font-normal max-sm:max-h-full max-sm:max-w-full + text-sm max-sm:text-xs flex ; } +.commentText p:first-of-type { + @apply mt-0; +} + .commentInteractions { @apply flex w-fit flex-row gap-4; user-select: none; diff --git a/styles/User/Username.module.css b/styles/User/Username.module.css index 1b16a71..73d2d87 100644 --- a/styles/User/Username.module.css +++ b/styles/User/Username.module.css @@ -12,7 +12,6 @@ @apply rounded-full; overflow: hidden; object-fit: cover; - height: 10px; width: 10px; } .hovercatcher { From 55f7c7b2d2430212f5aaf74eae10c10def051804 Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Fri, 4 Aug 2023 22:13:11 +0200 Subject: [PATCH 10/21] Fixed not rendering images --- components/PageComponents/PostPage.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/PageComponents/PostPage.tsx b/components/PageComponents/PostPage.tsx index 02cded0..761e7e9 100644 --- a/components/PageComponents/PostPage.tsx +++ b/components/PageComponents/PostPage.tsx @@ -54,6 +54,7 @@ export default function PostPage({ const pathname = window.location.pathname.split("?")[0]; history.replaceState({}, "", pathname); } + console.log(postData); setNavbar({ ...navbar!, showSort: false, @@ -133,9 +134,10 @@ export default function PostPage({
+ {/* Display Media e.g. Image, Video, Gif */} {postData?.post?.url && - postData?.post?.url?.endsWith(".html") && ( + !postData?.post?.url?.endsWith(".html") && (
{postData.post.url} {postData?.post?.url && ( From 186309f06c033218bf04928f900a6406b58036fa Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Fri, 4 Aug 2023 22:14:50 +0200 Subject: [PATCH 11/21] Improved URL preview --- components/PageComponents/PostPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/PageComponents/PostPage.tsx b/components/PageComponents/PostPage.tsx index 761e7e9..ea22b66 100644 --- a/components/PageComponents/PostPage.tsx +++ b/components/PageComponents/PostPage.tsx @@ -139,10 +139,10 @@ export default function PostPage({ {postData?.post?.url && !postData?.post?.url?.endsWith(".html") && (
- {postData.post.url} {postData?.post?.url && ( )} + {new URL(postData.post.url).host}
)} From 9e8ce0d85021f3e622934e5a849e694c8605f464 Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Fri, 4 Aug 2023 23:08:21 +0200 Subject: [PATCH 12/21] Improved Siteinfo --- components/Navbar/SiteInfo.tsx | 78 +++++++++++++++++++++++++++++++--- components/SiteInfoCard.tsx | 15 +------ components/ui/Snack.tsx | 15 +++++++ 3 files changed, 88 insertions(+), 20 deletions(-) create mode 100644 components/ui/Snack.tsx diff --git a/components/Navbar/SiteInfo.tsx b/components/Navbar/SiteInfo.tsx index 1c0fe18..5785c46 100644 --- a/components/Navbar/SiteInfo.tsx +++ b/components/Navbar/SiteInfo.tsx @@ -5,6 +5,11 @@ import { disablePageScroll, enablePageScroll } from "scroll-lock"; import RenderMarkdown from "../ui/RenderMarkdown"; import { useEffect } from "react"; +import Username from "../User/Username"; +import Snack from "../ui/Snack"; + +import { FormatNumber } from "@/utils/helpers"; + export default function SiteInfo({ siteResponse, close, @@ -21,6 +26,9 @@ export default function SiteInfo({ close(); }; + const site = siteResponse?.site_view.site; + const counts = siteResponse?.site_view.counts; + return ( <> -
-

{new URL(siteResponse.site_view.site.actor_id).host}

- -
- +
+
+

{new URL(site.actor_id).host}

+ {site?.description} + {site.banner && ( + + )} +
+ +
+ {counts?.users && ( + + )} + {counts?.communities && ( + + )} + {counts?.posts && ( + + )} + {counts?.posts && ( + + )} +
+ +
+ + Instance Admins + +
+ {siteResponse.admins.map((admin) => ( + + ))} +
+
+ +
+ + Instance Sidebar + + +
+
); diff --git a/components/SiteInfoCard.tsx b/components/SiteInfoCard.tsx index 9d51597..78a0fa9 100644 --- a/components/SiteInfoCard.tsx +++ b/components/SiteInfoCard.tsx @@ -4,20 +4,7 @@ import RenderMarkdown from "./ui/RenderMarkdown"; import { FormatNumber } from "@/utils/helpers"; import Username from "./User/Username"; - -function Snack({ text, icon }: { text?: string; icon?: string }) { - return ( -
- - {icon} - - {text} -
- ); -} +import Snack from "./ui/Snack"; export default function SiteInfoCard({ siteResponse, diff --git a/components/ui/Snack.tsx b/components/ui/Snack.tsx new file mode 100644 index 0000000..46880b3 --- /dev/null +++ b/components/ui/Snack.tsx @@ -0,0 +1,15 @@ + +export default function Snack({ text, icon }: { text?: string; icon?: string }) { + return ( +
+ + {icon} + + {text} +
+ ); + } + \ No newline at end of file From 44fae8dd59a7a67ad8bce1dc86e769d0b3bd0017 Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Sat, 5 Aug 2023 00:19:03 +0200 Subject: [PATCH 13/21] Added auto mode --- components/Post.tsx | 198 ++++++++++++++++++++++------------------ components/PostList.tsx | 9 +- hooks/auth.tsx | 2 +- styles/post.module.css | 5 - 4 files changed, 116 insertions(+), 98 deletions(-) diff --git a/components/Post.tsx b/components/Post.tsx index 8b99e0e..2067ea9 100644 --- a/components/Post.tsx +++ b/components/Post.tsx @@ -48,7 +48,7 @@ export default function Post({ return ( <>
@@ -143,7 +143,9 @@ export default function Post({ href={postUrl} shallow target="_blank" - className={`${styles.contentOverlay}`} + className={`${styles.contentOverlay} bg-gradient-to-b + from-neutral-50/30 to-neutral-50/90 + dark:from-neutral-900/50 dark:to-neutral-900/90`} style={{ display: hasMedia ? "none" : "block" }} > )} @@ -266,93 +268,127 @@ export default function Post({ case "compact": return ( <> -
-
-
-
-
+
-
- {post?.community?.icon && ( - - - - )} - - - {post.community.name} - - - - @ - {new URL(post.post.ap_id).host} - - - +
+ {post?.community?.icon && ( + + + + )} + + + {post.community.name} + -
+ + @ + {new URL(post.post.ap_id).host} + + + -
-
- -
-
- -
+
-
-
+ +
+ +
+ +
+ + + {post.post.nsfw && ( + <> +
+ + NSFW + + + )} + +
+ + {(post.post.featured_local || post.post.featured_community) && ( + + push_pin + + )} + +
+ +
+ +
+ + +
{post.post.name}
+ + + {/* Display Body if post has body and is not a Link */} + {post?.post?.body && !( post?.post?.embed_title || post?.post?.url?.endsWith(".html")) && ( + <> +
+
+
- - {(post.post.featured_local || post.post.featured_community) && ( - - push_pin - - )} + + )} + -
+
+ {/* Display Image */} + {post.post.thumbnail_url && ( +
-

{post.post.name}

+ - - {post?.post?.nsfw && ( - - NSFW - - )} +
+ )} +
-
- -
+
@@ -380,26 +416,6 @@ export default function Post({ more_horiz
-
-
- -
- {/* Display Image */} - {post.post.thumbnail_url && ( - - - - )}
diff --git a/components/PostList.tsx b/components/PostList.tsx index 3652399..a8227fe 100644 --- a/components/PostList.tsx +++ b/components/PostList.tsx @@ -124,6 +124,13 @@ export default function PostList({ setCurrentPage(currentPage + 1); }; + const isTextPost = (post: PostView) => { + if(post.post.url) return false; + if(post.post.thumbnail_url) return false; + if(post.post.embed_video_url) return false; + return true; + } + return ( diff --git a/hooks/auth.tsx b/hooks/auth.tsx index ed7adab..ec308e0 100644 --- a/hooks/auth.tsx +++ b/hooks/auth.tsx @@ -18,7 +18,7 @@ import { DEFAULT_INSTANCE } from "@/constants/settings"; export interface Settings { theme: "light" | "dark" | "system"; - cardType: "modern" | "compact"; + cardType: "modern" | "compact" | "auto"; useSystemTheme: boolean; showNSFW: boolean; showBotAccounts: boolean; diff --git a/styles/post.module.css b/styles/post.module.css index 2bcd50c..89c0024 100644 --- a/styles/post.module.css +++ b/styles/post.module.css @@ -1,8 +1,6 @@ .wrapper { @apply max-w-2xl w-full; display: flex; - flex-direction: row; - gap: 15px; } .rightSide { @@ -117,9 +115,6 @@ z-index: 2; height: 100%; width: 100%; - @apply bg-gradient-to-b - from-neutral-50/30 to-neutral-50/90 - dark:from-neutral-900/50 dark:to-neutral-900/90; } .image { From 95bd48eec2973ab247141d4647c203b33b902ae9 Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Sat, 5 Aug 2023 00:19:19 +0200 Subject: [PATCH 14/21] Added auto & improved design --- components/PageComponents/SettingsPage.tsx | 42 +++++++++++++++++----- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/components/PageComponents/SettingsPage.tsx b/components/PageComponents/SettingsPage.tsx index e560abe..a21eca1 100644 --- a/components/PageComponents/SettingsPage.tsx +++ b/components/PageComponents/SettingsPage.tsx @@ -45,27 +45,53 @@ export default function SettingsPage({
-
+
+ + + setSettings(prevValue => { return { ...prevValue, cardType: isSelected ? "modern" : "modern"}})}> + Modern + +
+ +
- Modern - setSettings(prevValue => { return { ...prevValue, cardType: isSelected ? "modern" : "compact"}})} /> + + + setSettings(prevValue => { return { ...prevValue, cardType: isSelected ? "auto" : "auto"}})}> + Auto +
+
-
+
+ - Compact - setSettings(prevValue => { return { ...prevValue, cardType: isSelected ? "compact" : "modern"}})} /> + setSettings(prevValue => { return { ...prevValue, cardType: isSelected ? "compact" : "compact"}})}> + Compact +
From 06edc4ec322b88038f124bb8a9eb33e26e09ce23 Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Sat, 5 Aug 2023 00:29:22 +0200 Subject: [PATCH 15/21] Removed unused prop --- components/PageComponents/FeedPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/PageComponents/FeedPage.tsx b/components/PageComponents/FeedPage.tsx index 0a3fc62..5b6d38b 100644 --- a/components/PageComponents/FeedPage.tsx +++ b/components/PageComponents/FeedPage.tsx @@ -38,7 +38,7 @@ export default function FeedPage({ }) { return (
- +
From 7d9609454b719da8c61da1b9951a40e93c5ef041 Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Sat, 5 Aug 2023 15:23:24 +0200 Subject: [PATCH 16/21] Added light mode colors change --- tailwind.config.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tailwind.config.js b/tailwind.config.js index 52ca931..0765d6d 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -37,7 +37,14 @@ module.exports = { colors: { primary: { DEFAULT: "#d946ef", - } + }, + } + }, + light: { + colors: { + primary: { + DEFAULT: "#d946ef" + }, } } } From 1009b43931fa061a9eeb99b30952466dd2709d66 Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Sat, 5 Aug 2023 15:23:37 +0200 Subject: [PATCH 17/21] Added instance blocking --- components/PageComponents/SettingsPage.tsx | 66 ++++++++++++++++++++-- components/PostList.tsx | 4 +- hooks/auth.tsx | 2 + 3 files changed, 67 insertions(+), 5 deletions(-) diff --git a/components/PageComponents/SettingsPage.tsx b/components/PageComponents/SettingsPage.tsx index a21eca1..006f08c 100644 --- a/components/PageComponents/SettingsPage.tsx +++ b/components/PageComponents/SettingsPage.tsx @@ -1,6 +1,7 @@ "use client" -import { Switch, cn, Checkbox } from "@nextui-org/react"; +import { Switch, cn, Checkbox, Input, Card, Button, CardBody, CardHeader, CardFooter } from "@nextui-org/react"; +import { AnimatePresence, motion } from "framer-motion"; import { Account } from "@/utils/authFunctions"; @@ -12,7 +13,7 @@ function Section({ children, title }: { children: any; title: string }) { <>
{title} -
+
{children}
@@ -29,15 +30,27 @@ export default function SettingsPage({ const { session, setSession } = useSession() const [settings, setSettings] = React.useState(currentAccount.settings || {} as Settings) + const [instanceForm, setInstanceForm] = React.useState(""); + useEffect(() => { if (currentAccount) { setSession(prevValue => { return { ...prevValue, settings: settings } }) } }, [settings, currentAccount, setSession]) + const handleBlockInstance = () => { + setInstanceForm("") + setSession(prevVal => { return { ...prevVal, settings: { ...prevVal.settings, blockedInstances: [ ...prevVal.settings.blockedInstances, instanceForm ] } }}) + } + + const handleRemoveInstanceBlock = (instance: string) => { + setSession(prevVal => { return { ...prevVal, settings: { ...prevVal.settings, blockedInstances: [ ...prevVal.settings.blockedInstances.filter((i) => i !== instance) ] } }} ) + } + return ( <>
+
@@ -103,7 +116,7 @@ export default function SettingsPage({ classNames={{ base: cn( "inline-flex flex-row-reverse w-full max-w-md items-center", - "justify-between cursor-pointer rounded-lg gap-2 px-4" + "justify-between cursor-pointer rounded-lg gap-2 px-4 w-full max-w-full" ), }} > @@ -122,7 +135,7 @@ export default function SettingsPage({ classNames={{ base: cn( "inline-flex flex-row-reverse w-full max-w-md items-center", - "justify-between cursor-pointer rounded-lg gap-2 px-4" + "justify-between cursor-pointer rounded-lg gap-2 px-4 max-w-full" ), }} > @@ -136,6 +149,51 @@ export default function SettingsPage({
+
+ + + + info + Instance Blocking + + + You can block whole instances on Nemmy. What this does is it hide any post from an instance which is in the block list. + + + + +
+ Add an Instance to the block list + newVal && setInstanceForm(newVal)} + variant="bordered" label="Instance URL" labelPlacement="inside" + endContent={} + /> +
+ + + Your blocked Instances + + + {session.settings.blockedInstances?.map((instance: string, index: number) => ( + + {instance} + + + ))} + + {((!session.settings.blockedInstances) || session.settings.blockedInstances?.length == 0) && + You have no blocked Instances + } + + + +
+
Small
diff --git a/components/PostList.tsx b/components/PostList.tsx index a8227fe..1aa71e6 100644 --- a/components/PostList.tsx +++ b/components/PostList.tsx @@ -148,7 +148,9 @@ export default function PostList({ className={`${styles.postList} pb-10`} key={"postList"} > - {posts.map((post: PostView, index: number) => { + {posts + .filter((post) => !(session.settings.blockedInstances.includes(new URL(post.post.ap_id).host))) + .map((post: PostView, index: number) => { return ( Date: Sat, 5 Aug 2023 15:25:29 +0200 Subject: [PATCH 18/21] Fixed too small community icon --- components/Post.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/components/Post.tsx b/components/Post.tsx index 2067ea9..a991e66 100644 --- a/components/Post.tsx +++ b/components/Post.tsx @@ -66,6 +66,7 @@ export default function Post({ }`} target="_blank" className={`${styles.communityImage}`} + style={{ width: "50px", height: "50px" }} > {post?.community?.icon ? ( Date: Sat, 5 Aug 2023 15:34:00 +0200 Subject: [PATCH 19/21] Removed back text --- components/Navbar.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/components/Navbar.tsx b/components/Navbar.tsx index e996996..a1d914d 100644 --- a/components/Navbar.tsx +++ b/components/Navbar.tsx @@ -242,7 +242,6 @@ export default function Navbar() { onClick={() => router.back()} > arrow_back - Back
)} From b7f5a8caca7da6659d207e488bcca1c8f4ba4171 Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Sat, 5 Aug 2023 15:34:13 +0200 Subject: [PATCH 20/21] Added showCommunity prop --- components/Post.tsx | 31 +++++++++++++++++++++++++------ components/PostList.tsx | 5 ++++- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/components/Post.tsx b/components/Post.tsx index a991e66..3089cff 100644 --- a/components/Post.tsx +++ b/components/Post.tsx @@ -21,14 +21,16 @@ export default function Post({ instance, auth, postInstance, - style="modern" + style="modern", + showCommunity=true }: { post: PostView; onClick?: () => void; instance?: string; auth?: string; postInstance?: string; - style?: "modern" | "compact" + style?: "modern" | "compact", + showCommunity?: boolean; }) { if (!post) throw new Error("Post is undefined"); @@ -60,6 +62,8 @@ export default function Post({
+ + {showCommunity && (
)} + )}
+ {showCommunity && ( + <> {post.community.name} + @ {new URL(post.post.ap_id).host} - + + )}
@@ -276,7 +285,8 @@ export default function Post({
- {post?.community?.icon && ( + + {post?.community?.icon && showCommunity && ( )} + + {showCommunity && + <>
+ + } @@ -352,7 +367,9 @@ export default function Post({ shallow className="h-full w-full flex flex-col items-start justify-start relative" > -
{post.post.name}
+
+ {post.post.name} +
{/* Display Body if post has body and is not a Link */} @@ -389,7 +406,8 @@ export default function Post({ )}
-
+
+
@@ -417,6 +435,7 @@ export default function Post({ more_horiz
+
diff --git a/components/PostList.tsx b/components/PostList.tsx index 1aa71e6..e63a19a 100644 --- a/components/PostList.tsx +++ b/components/PostList.tsx @@ -25,7 +25,8 @@ export default function PostList({ fetchParams = { limit: DEFAULT_POST_LIMIT, page: 1 }, initPosts, setCurrentPost = () => null, - style="modern" + style="modern", // modern or compact + showCommunity = true, }: { fetchParams?: { type_?: ListingType; @@ -40,6 +41,7 @@ export default function PostList({ initPosts?: PostView[]; setCurrentPost?: Function; style?: "modern" | "compact"; + showCommunity?: boolean; }) { const { session } = useSession(); const { navbar, setNavbar } = useNavbar(); @@ -167,6 +169,7 @@ export default function PostList({ key={index} postInstance={new URL(post.post.ap_id).host} style={session.settings.cardType !== "auto" ? session.settings.cardType : isTextPost(post) ? "compact" : "modern"} + showCommunity={showCommunity} /> From 312105bd4fcc50693287c9312f02500cf8bb535a Mon Sep 17 00:00:00 2001 From: Manuel <58395553+cr4yfish@users.noreply.github.com> Date: Sat, 5 Aug 2023 15:34:30 +0200 Subject: [PATCH 21/21] Added title & using new showCommunity prop --- components/PageComponents/CommunityPage.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/PageComponents/CommunityPage.tsx b/components/PageComponents/CommunityPage.tsx index 82ec913..cddfb8b 100644 --- a/components/PageComponents/CommunityPage.tsx +++ b/components/PageComponents/CommunityPage.tsx @@ -46,7 +46,7 @@ export default function CommunityPage({ showSearch: true, showUser: true, showback: true, - titleOverride: "", + titleOverride: `c/${communityData.community_view.community.title}`, }); }, []); @@ -208,13 +208,14 @@ export default function CommunityPage({