import { data } from "react-router"; import { Link } from "react-router"; import { useTranslation } from "react-i18next"; import type { Route } from "./+types/feed"; import { ClientDate } from "~/components/ClientDate"; import { ClientMap } from "~/components/ClientMap"; import { loadFeed } from "./feed.server"; export async function loader({ request }: Route.LoaderArgs) { return data(await loadFeed(request)); } export function meta({ data: loaderData }: Route.MetaArgs) { const view = loaderData?.view ?? "followed"; const title = view === "public" ? "Public — trails.cool" : "Following — trails.cool"; return [{ title }]; } function ToggleLink({ to, active, label, }: { to: string; active: boolean; label: string; }) { return ( {label} ); } export default function Feed({ loaderData }: Route.ComponentProps) { const { view, activities } = loaderData; const { t } = useTranslation("journal"); const heading = view === "public" ? t("social.feed.public.heading") : t("social.feed.heading"); const emptyMessage = view === "public" ? t("social.feed.public.empty") : t("social.feed.empty"); return (

{heading}

{activities.length === 0 ? (

{emptyMessage}

{view === "followed" && ( {t("social.feed.seePublic")} )} {view === "followed" && ( {t("social.feed.followRemote")} )}
) : ( )}
); }