diff --git a/src/App.tsx b/src/App.tsx index c661b21..42799df 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -25,41 +25,44 @@ export default function App() { - - - - - - }> - } /> - } /> - } /> - } - /> - } /> - } /> - } /> - } /> - } /> - + + + + + + }> + } /> + } /> + } /> + } + /> + } + /> + } /> + } /> + } /> + } /> + - {adminEnabled ? ( - AdminRouteTree() - ) : ( - } - /> - )} + {adminEnabled ? ( + AdminRouteTree() + ) : ( + } + /> + )} - } /> - - - - - + } /> + + + + + diff --git a/src/components/BackToTop.tsx b/src/components/BackToTop.tsx index 99afa8f..26e4475 100644 --- a/src/components/BackToTop.tsx +++ b/src/components/BackToTop.tsx @@ -30,9 +30,7 @@ export function BackToTop() { animate={{ opacity: 1, scale: 1, y: 0 }} exit={{ opacity: 0, scale: 0.8, y: 8 }} transition={{ type: "spring", stiffness: 380, damping: 26 }} - onClick={() => - window.scrollTo({ top: 0, behavior: "smooth" }) - } + onClick={() => window.scrollTo({ top: 0, behavior: "smooth" })} className="fixed bottom-[94px] right-4 z-30 flex h-11 w-11 items-center justify-center rounded-full bg-ark-gold text-black shadow-lg shadow-black/40 outline-none transition hover:bg-ark-gold2 active:scale-95 focus-visible:ring-2 focus-visible:ring-ark-gold/80 focus-visible:ring-offset-2 focus-visible:ring-offset-ark-bg md:bottom-8 md:right-8" aria-label={t("backToTop")} title={t("backToTop")} diff --git a/src/components/messageStream/MessageStream.tsx b/src/components/messageStream/MessageStream.tsx index 39ff232..42091bc 100644 --- a/src/components/messageStream/MessageStream.tsx +++ b/src/components/messageStream/MessageStream.tsx @@ -71,8 +71,9 @@ export function MessageStream({ scope }: MessageStreamProps) { // When arriving with a `#post-` hash (e.g. from a recommended card), // scroll to that bubble — loading more pages until it shows up — then give // it a brief highlight so the user can see where they landed. - const targetPostId = - hash.startsWith("#post-") ? hash.slice("#post-".length) : ""; + const targetPostId = hash.startsWith("#post-") + ? hash.slice("#post-".length) + : ""; const handledTargetRef = useRef(""); useEffect(() => { diff --git a/src/layouts/PublicLayout.tsx b/src/layouts/PublicLayout.tsx index bbda386..ae96daa 100644 --- a/src/layouts/PublicLayout.tsx +++ b/src/layouts/PublicLayout.tsx @@ -1,12 +1,7 @@ import { ChevronDown, Menu, Search as SearchIcon, X } from "lucide-react"; import { AnimatePresence, m } from "framer-motion"; import { useEffect, useRef, useState } from "react"; -import { - Link, - useLocation, - useNavigate, - useOutlet, -} from "react-router-dom"; +import { Link, useLocation, useNavigate, useOutlet } from "react-router-dom"; import { pageTransition } from "../motion"; import { ArkLogoMark } from "../components/ArkLogoMark"; import { BackToTop } from "../components/BackToTop"; diff --git a/src/pages/Categories/index.tsx b/src/pages/Categories/index.tsx index 4327e24..bd902b9 100644 --- a/src/pages/Categories/index.tsx +++ b/src/pages/Categories/index.tsx @@ -80,10 +80,7 @@ export function CategoriesPage() { {isLoading ? Array.from({ length: 14 }).map((_, i) => ( - + )) : cats.map((category, index) => ( - - - - - - - - {categoryPages.map((page, pageIndex) => ( - - {page.map((c) => ( - - - - {cleanCategoryDisplayName(c.name)} - - - ))} - - ))} + + + - {categoryPages.length > 1 ? ( + - {categoryPages.map((_, index) => ( + {categoryPages.map((page, pageIndex) => ( + + {page.map((c) => ( + + + + {cleanCategoryDisplayName(c.name)} + + + ))} + + ))} + + + {categoryPages.length > 1 ? ( + + {categoryPages.map((_, index) => ( + { + const row = categoryRowRef.current; + if (!row) return; + row.scrollTo({ + left: row.clientWidth * index, + behavior: "smooth", + }); + setActiveCategoryPage(index); + }} + className={`h-1.5 rounded-full transition-all ${ + activeCategoryPage === index + ? "w-6 bg-ark-gold" + : "w-1.5 bg-[#7C7C7C]" + }`} + /> + ))} + + ) : null} + + + + {figmaOrderedCategories.map((c, index) => ( + + + + + {cleanCategoryDisplayName(c.name)} + + + + ))} + + + + + + + + + + + + {rec.map((r, index) => ( + + + + + + ))} + + + {Array.from({ length: recommendedDotCount }).map((_, index) => ( { - const row = categoryRowRef.current; + const row = recRowRef.current; if (!row) return; + const maxScroll = Math.max( + 0, + row.scrollWidth - row.clientWidth, + ); row.scrollTo({ - left: row.clientWidth * index, + left: + recommendedDotCount === 1 + ? 0 + : (maxScroll * index) / (recommendedDotCount - 1), behavior: "smooth", }); - setActiveCategoryPage(index); }} className={`h-1.5 rounded-full transition-all ${ - activeCategoryPage === index + activeRecommendedDot === index ? "w-6 bg-ark-gold" : "w-1.5 bg-[#7C7C7C]" }`} /> ))} - ) : null} - - - - {figmaOrderedCategories.map((c, index) => ( - - - - - {cleanCategoryDisplayName(c.name)} - - - - ))} - - + {canScrollRec ? ( + <> + scrollRec(-1)} + className="absolute left-0 top-[45%] hidden h-9 w-9 -translate-y-1/2 items-center justify-center rounded-lg border border-ark-line bg-[#292a31]/95 text-neutral-200 shadow-lg backdrop-blur transition hover:border-ark-gold hover:text-ark-gold md:flex" + aria-label="Previous recommendations" + > + + + scrollRec(1)} + className="absolute right-0 top-[45%] hidden h-9 w-9 -translate-y-1/2 items-center justify-center rounded-lg border border-ark-line bg-[#292a31]/95 text-neutral-200 shadow-lg backdrop-blur transition hover:border-ark-gold hover:text-ark-gold md:flex" + aria-label="Next recommendations" + > + + + > + ) : null} + + - - - - - - - {rec.map((r, index) => ( - - - - - - ))} - - - {Array.from({ length: recommendedDotCount }).map((_, index) => ( - { - const row = recRowRef.current; - if (!row) return; - const maxScroll = Math.max( - 0, - row.scrollWidth - row.clientWidth, - ); - row.scrollTo({ - left: - recommendedDotCount === 1 - ? 0 - : (maxScroll * index) / (recommendedDotCount - 1), - behavior: "smooth", - }); - }} - className={`h-1.5 rounded-full transition-all ${ - activeRecommendedDot === index - ? "w-6 bg-ark-gold" - : "w-1.5 bg-[#7C7C7C]" - }`} - /> - ))} - - {canScrollRec ? ( - <> - scrollRec(-1)} - className="absolute left-0 top-[45%] hidden h-9 w-9 -translate-y-1/2 items-center justify-center rounded-lg border border-ark-line bg-[#292a31]/95 text-neutral-200 shadow-lg backdrop-blur transition hover:border-ark-gold hover:text-ark-gold md:flex" - aria-label="Previous recommendations" - > - - - scrollRec(1)} - className="absolute right-0 top-[45%] hidden h-9 w-9 -translate-y-1/2 items-center justify-center rounded-lg border border-ark-line bg-[#292a31]/95 text-neutral-200 shadow-lg backdrop-blur transition hover:border-ark-gold hover:text-ark-gold md:flex" - aria-label="Next recommendations" - > - - - > - ) : null} - - - - - - - - - - - {latestPosts.slice(0, 5).map((post) => ( - - ))} - - - - {latest.map((r) => ( - - - - ))} - {Array.from({ length: latestPlaceholderCount }).map((_, index) => ( - - - - ))} - - {canScrollLatest ? ( - <> - scrollLatest(-1)} - className="absolute left-0 top-[45%] hidden h-9 w-9 -translate-y-1/2 items-center justify-center rounded-lg border border-ark-line bg-[#292a31]/95 text-neutral-200 shadow-lg backdrop-blur transition hover:border-ark-gold hover:text-ark-gold md:flex" - aria-label="Previous latest updates" - > - - - scrollLatest(1)} - className="absolute right-0 top-[45%] hidden h-9 w-9 -translate-y-1/2 items-center justify-center rounded-lg border border-ark-line bg-[#292a31]/95 text-neutral-200 shadow-lg backdrop-blur transition hover:border-ark-gold hover:text-ark-gold md:flex" - aria-label="Next latest updates" - > - - - > - ) : null} - - - - - {hasPopular ? ( - - + - {popularPosts.slice(0, 5).map((post) => ( + {latestPosts.slice(0, 5).map((post) => ( ))} - - {popular.map((r) => ( - - ))} - {Array.from({ length: popularPlaceholderCount }).map((_, index) => ( - - ))} + + + {latest.map((r) => ( + + + + ))} + {Array.from({ length: latestPlaceholderCount }).map( + (_, index) => ( + + + + ), + )} + + {canScrollLatest ? ( + <> + scrollLatest(-1)} + className="absolute left-0 top-[45%] hidden h-9 w-9 -translate-y-1/2 items-center justify-center rounded-lg border border-ark-line bg-[#292a31]/95 text-neutral-200 shadow-lg backdrop-blur transition hover:border-ark-gold hover:text-ark-gold md:flex" + aria-label="Previous latest updates" + > + + + scrollLatest(1)} + className="absolute right-0 top-[45%] hidden h-9 w-9 -translate-y-1/2 items-center justify-center rounded-lg border border-ark-line bg-[#292a31]/95 text-neutral-200 shadow-lg backdrop-blur transition hover:border-ark-gold hover:text-ark-gold md:flex" + aria-label="Next latest updates" + > + + + > + ) : null} + + + {hasPopular ? ( + + + + + + + {popularPosts.slice(0, 5).map((post) => ( + + ))} + + + {popular.map((r) => ( + + ))} + {Array.from({ length: popularPlaceholderCount }).map( + (_, index) => ( + + ), + )} + + ) : null}