mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-20 06:01:03 -05:00
* Initial * Faster user page * Remove redundant function * Favorite badge sorting * Upgrade deps * Simplify entry.server * Bun tests initial * Update package.json npm -> bun * Update README * Type safe translations again * Don't load streams info for finalized tournaments * Translations as an object * More unit test work * Convert match.server.test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * Test & all done * Working cf * Bun GA try * No cache * spacing * spacing 2 * Add SQL logging * Remove NR * Hmm * Hmm 2 * Interesting * SKALOP_SYSTEM_MESSAGE_URL * . * . * ? * . * ? * Server.ts adjust * Downgrade Tldraw * E2E test fix * Fix lint
28 lines
665 B
TypeScript
28 lines
665 B
TypeScript
import { useActionData } from "@remix-run/react";
|
|
import { useTranslation } from "react-i18next";
|
|
import type { Namespace } from "~/modules/i18n/resources.server";
|
|
|
|
export function FormErrors({
|
|
namespace,
|
|
}: {
|
|
namespace: Namespace;
|
|
}) {
|
|
const { t } = useTranslation(["common", namespace]);
|
|
const actionData = useActionData<{ errors?: string[] }>();
|
|
|
|
if (!actionData?.errors || actionData.errors.length === 0) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<div className="form-errors">
|
|
<h4>{t("common:forms.errors.title")}:</h4>
|
|
<ol>
|
|
{actionData.errors.map((error) => (
|
|
<li key={error}>{t(`${namespace}:${error}` as any)}</li>
|
|
))}
|
|
</ol>
|
|
</div>
|
|
);
|
|
}
|