first fixes

This commit is contained in:
Lokowitz
2025-05-17 18:17:22 +00:00
parent 731ec1da69
commit eff812eaa8
27 changed files with 80 additions and 114 deletions

View File

@@ -89,11 +89,8 @@ export default function SitesTable({ resources, orgId }: ResourcesTableProps) {
.catch((e) => {
toast({
variant: "destructive",
title: "Failed to toggle resource",
description: formatAxiosError(
e,
"An error occurred while updating the resource"
)
title: t('resourcesErrorUpdate'),
description: formatAxiosError(e, t('resourcesErrorUpdateDescription'))
});
});
}

View File

@@ -67,8 +67,6 @@ import {
import { SwitchInput } from "@app/components/SwitchInput";
import { useTranslations } from "next-intl";
const t = useTranslations();
const GeneralFormSchema = z
.object({
subdomain: z.string().optional(),
@@ -91,7 +89,7 @@ const GeneralFormSchema = z
return true;
},
{
message: t('proxyErrorInvalidPort'),
message: "Invalid port number",
path: ["proxyPort"]
}
)
@@ -103,7 +101,7 @@ const GeneralFormSchema = z
return true;
},
{
message: t('subdomainErrorInvalid'),
message: "Invalid subdomain",
path: ["subdomain"]
}
);
@@ -121,6 +119,7 @@ export default function GeneralForm() {
const { resource, updateResource } = useResourceContext();
const { org } = useOrgContext();
const router = useRouter();
const t = useTranslations();
const { env } = useEnvContext();
@@ -178,10 +177,7 @@ export default function GeneralForm() {
toast({
variant: "destructive",
title: t('domainErrorFetch'),
description: formatAxiosError(
e,
t('domainErrorFetchDescription')
)
description: formatAxiosError(e, t('domainErrorFetchDescription'))
});
});
@@ -220,10 +216,7 @@ export default function GeneralForm() {
toast({
variant: "destructive",
title: t('resourceErrorUpdate'),
description: formatAxiosError(
e,
t('resourceErrorUpdateDescription')
)
description: formatAxiosError(e, t('resourceErrorUpdateDescription'))
});
});
@@ -259,9 +252,7 @@ export default function GeneralForm() {
toast({
variant: "destructive",
title: t('resourceErrorTransfer'),
description: formatAxiosError(
e,
t('resourceErrorTransferDescription')
description: formatAxiosError(e, t('resourceErrorTransferDescription')
)
});
});

View File

@@ -93,8 +93,6 @@ type LocalTarget = Omit<
"protocol"
>;
const t = useTranslations();
const proxySettingsSchema = z.object({
setHostHeader: z
.string()
@@ -107,7 +105,7 @@ const proxySettingsSchema = z.object({
return true;
},
{
message: t('proxyErrorInvalidHeader')
message: "Invalid custom Host Header value. Use domain name format, or save empty to unset custom Host Header."
}
)
});
@@ -125,7 +123,7 @@ const tlsSettingsSchema = z.object({
return true;
},
{
message: t('proxyErrorTls')
message: "Invalid TLS Server Name. Use domain name format, or save empty to remove the TLS Server Name."
}
)
});
@@ -138,6 +136,7 @@ export default function ReverseProxyTargets(props: {
params: Promise<{ resourceId: number }>;
}) {
const params = use(props.params);
const t = useTranslations();
const { resource, updateResource } = useResourceContext();

View File

@@ -10,7 +10,6 @@ import { GetOrgResponse } from "@server/routers/org";
import OrgProvider from "@app/providers/OrgProvider";
import ResourcesSplashCard from "./ResourcesSplashCard";
import { getTranslations } from 'next-intl/server';
import { useTranslations } from "next-intl";
type ResourcesPageProps = {
params: Promise<{ orgId: string }>;
@@ -20,6 +19,8 @@ export const dynamic = "force-dynamic";
export default async function ResourcesPage(props: ResourcesPageProps) {
const params = await props.params;
const t = await getTranslations();
let resources: ListResourcesResponse["resources"] = [];
try {
const res = await internal.get<AxiosResponse<ListResourcesResponse>>(
@@ -47,8 +48,6 @@ export default async function ResourcesPage(props: ResourcesPageProps) {
redirect(`/${params.orgId}/settings/resources`);
}
const t = useTranslations();
const resourceRows: ResourceRow[] = resources.map((resource) => {
return {
id: resource.resourceId,