import { data } from "react-router"; import { Link } from "react-router"; import { useTranslation } from "react-i18next"; import type { Route } from "./+types/explore"; import { FollowButton } from "~/components/FollowButton"; import { loadExplore } from "./explore.server"; export async function loader({ request }: Route.LoaderArgs) { return data(await loadExplore(request)); } export function meta(_args: Route.MetaArgs) { return [{ title: "Explore โ€” trails.cool" }]; } interface DecoratedRow { id: string; username: string; displayName: string | null; bio: string | null; followerCount: number; followState: { following: boolean; pending: boolean } | null; isSelf: boolean; isDemoUser: boolean; } function DirectoryRow({ row, isSignedIn }: { row: DecoratedRow; isSignedIn: boolean }) { const { t } = useTranslation("journal"); return (
  • {row.displayName ?? row.username} {row.isDemoUser && ( {t("demo.badge")} )}

    @{row.username} ยท {t("social.followers.count", { count: row.followerCount })}

    {row.bio &&

    {row.bio}

    }
    {isSignedIn && !row.isSelf && ( )}
  • ); } export default function Explore({ loaderData }: Route.ComponentProps) { const { isSignedIn, activeRecently, directory, page, totalPages, totalCount } = loaderData; const { t } = useTranslation("journal"); return (

    {t("explore.heading")}

    {activeRecently.length > 0 && (

    {t("explore.activeRecently.heading")}

    )}

    {t("explore.directory.heading")}

    {totalCount === 0 ? (

    {t("explore.empty")}

    ) : ( <> )}
    ); }