diff --git a/Foxnouns.Frontend/app/lib/request.server.ts b/Foxnouns.Frontend/app/lib/request.server.ts index 562666d..7da3e84 100644 --- a/Foxnouns.Frontend/app/lib/request.server.ts +++ b/Foxnouns.Frontend/app/lib/request.server.ts @@ -1,5 +1,5 @@ import { parse as parseCookie, serialize as serializeCookie } from "cookie"; -import { API_BASE, INTERNAL_API_BASE } from "~/env.server"; +import { INTERNAL_API_BASE } from "~/env.server"; import { ApiError, ErrorCode } from "./api/error"; import { tokenCookieName } from "~/lib/utils"; @@ -16,7 +16,7 @@ export async function baseRequest( path: string, params: RequestParams = {}, ): Promise { - const base = params.isInternal ? INTERNAL_API_BASE + "/internal" : API_BASE + "/v2"; + const base = params.isInternal ? INTERNAL_API_BASE + "/internal" : INTERNAL_API_BASE + "/v2"; const url = `${base}${path}`; const resp = await fetch(url, { diff --git a/Foxnouns.Frontend/app/routes/settings._index/route.tsx b/Foxnouns.Frontend/app/routes/settings._index/route.tsx index 5b90851..88655fc 100644 --- a/Foxnouns.Frontend/app/routes/settings._index/route.tsx +++ b/Foxnouns.Frontend/app/routes/settings._index/route.tsx @@ -1,6 +1,13 @@ import { Button, Form, InputGroup, Table } from "react-bootstrap"; import { useTranslation } from "react-i18next"; -import { Form as RemixForm, useActionData, useFetcher, useRouteLoaderData } from "@remix-run/react"; +import { + Form as RemixForm, + Link, + Outlet, + useActionData, + useFetcher, + useRouteLoaderData, +} from "@remix-run/react"; import { loader as settingsLoader } from "../settings/route"; import { loader as rootLoader } from "../../root"; import { DateTime } from "luxon"; @@ -43,12 +50,12 @@ export default function SettingsIndex() { const actionData = useActionData(); const { meta } = useRouteLoaderData("root")!; const { t } = useTranslation(); - const fetcher = useFetcher(); const createdAt = idTimestamp(user.id); return ( <> +
@@ -81,11 +88,10 @@ export default function SettingsIndex() {

{t("settings.general.log-out-everywhere")}

{t("settings.general.log-out-everywhere-hint")}

- - - + {/* @ts-expect-error as=Link */} +

{t("settings.general.table-header")}

diff --git a/Foxnouns.Frontend/app/routes/settings.auth/route.tsx b/Foxnouns.Frontend/app/routes/settings.auth/route.tsx index 22d2fcd..a8ca303 100644 --- a/Foxnouns.Frontend/app/routes/settings.auth/route.tsx +++ b/Foxnouns.Frontend/app/routes/settings.auth/route.tsx @@ -44,7 +44,7 @@ function EmailSettings({ user }: { user: MeUser }) { )} {emails.length < 3 && (

- {/* @ts-expect-error using as=Link causes an error here, even though it runs completely fine */} + {/* @ts-expect-error as=Link */} + {/* @ts-expect-error as=Link */} + + + + + ); +} diff --git a/Foxnouns.Frontend/app/routes/settings/route.tsx b/Foxnouns.Frontend/app/routes/settings/route.tsx index 3ef35fd..9d8247a 100644 --- a/Foxnouns.Frontend/app/routes/settings/route.tsx +++ b/Foxnouns.Frontend/app/routes/settings/route.tsx @@ -30,30 +30,35 @@ export default function SettingsLayout() { const { t } = useTranslation(); const { pathname } = useLocation(); + const isActive = (matches: string[] | string, startsWith: boolean = false) => + startsWith + ? typeof matches === "string" + ? pathname.startsWith(matches) + : matches.some((m) => pathname.startsWith(m)) + : typeof matches === "string" + ? matches === pathname + : matches.includes(pathname); + return ( <>

diff --git a/Foxnouns.Frontend/public/locales/en.json b/Foxnouns.Frontend/public/locales/en.json index 5a25098..c834e95 100644 --- a/Foxnouns.Frontend/public/locales/en.json +++ b/Foxnouns.Frontend/public/locales/en.json @@ -105,7 +105,8 @@ "member-list-hidden": "Member list hidden?", "custom-preferences": "Custom preferences", "role": "Account role", - "username-update-error": "Could not update your username as the new username is invalid:\n{{message}}" + "username-update-error": "Could not update your username as the new username is invalid:\n{{message}}", + "log-out-everywhere-confirm": "Are you sure you want to log out everywhere?\nPlease double check your authentication methods before doing so, as it might lock you out of your account." }, "auth": { "title": "Authentication",