mirror of
https://github.com/fosrl/pangolin.git
synced 2025-07-02 01:54:53 +02:00
center code in email
This commit is contained in:
parent
da6cc09961
commit
b96be3b649
5 changed files with 50 additions and 6 deletions
|
@ -2,7 +2,7 @@ import React from "react";
|
|||
|
||||
export default function CopyCodeBox({ text }: { text: string }) {
|
||||
return (
|
||||
<div className="flex items-center justify-center rounded-lg bg-neutral-100 p-2">
|
||||
<div className="text-center rounded-lg bg-neutral-100 p-2">
|
||||
<span className="text-2xl font-mono text-neutral-600 tracking-wide">
|
||||
{text}
|
||||
</span>
|
||||
|
|
|
@ -59,6 +59,9 @@ export default function GeneralPage() {
|
|||
const { toast } = useToast();
|
||||
const api = createApiClient(useEnvContext());
|
||||
|
||||
const [loadingDelete, setLoadingDelete] = useState(false);
|
||||
const [loadingSave, setLoadingSave] = useState(false);
|
||||
|
||||
const form = useForm<GeneralFormValues>({
|
||||
resolver: zodResolver(GeneralFormSchema),
|
||||
defaultValues: {
|
||||
|
@ -68,10 +71,17 @@ export default function GeneralPage() {
|
|||
});
|
||||
|
||||
async function deleteOrg() {
|
||||
setLoadingDelete(true);
|
||||
try {
|
||||
const res = await api.delete<AxiosResponse<DeleteOrgResponse>>(
|
||||
`/org/${org?.org.orgId}`
|
||||
);
|
||||
|
||||
toast({
|
||||
title: "Organization deleted",
|
||||
description: "The organization and its data has been deleted."
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
pickNewOrgAndNavigate();
|
||||
}
|
||||
|
@ -85,6 +95,8 @@ export default function GeneralPage() {
|
|||
"An error occurred while deleting the org."
|
||||
)
|
||||
});
|
||||
} finally {
|
||||
setLoadingDelete(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,10 +128,19 @@ export default function GeneralPage() {
|
|||
}
|
||||
|
||||
async function onSubmit(data: GeneralFormValues) {
|
||||
setLoadingSave(true);
|
||||
await api
|
||||
.post(`/org/${org?.org.orgId}`, {
|
||||
name: data.name
|
||||
})
|
||||
.then(() => {
|
||||
toast({
|
||||
title: "Organization updated",
|
||||
description: "The organization has been updated."
|
||||
});
|
||||
|
||||
router.refresh();
|
||||
})
|
||||
.catch((e) => {
|
||||
toast({
|
||||
variant: "destructive",
|
||||
|
@ -129,6 +150,9 @@ export default function GeneralPage() {
|
|||
"An error occurred while updating the org."
|
||||
)
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
setLoadingSave(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -201,7 +225,12 @@ export default function GeneralPage() {
|
|||
</SettingsSectionBody>
|
||||
|
||||
<SettingsSectionFooter>
|
||||
<Button type="submit" form="org-settings-form">
|
||||
<Button
|
||||
type="submit"
|
||||
form="org-settings-form"
|
||||
loading={loadingSave}
|
||||
disabled={loadingSave}
|
||||
>
|
||||
Save Settings
|
||||
</Button>
|
||||
</SettingsSectionFooter>
|
||||
|
@ -224,6 +253,8 @@ export default function GeneralPage() {
|
|||
variant="destructive"
|
||||
onClick={() => setIsDeleteModalOpen(true)}
|
||||
className="flex items-center gap-2"
|
||||
loading={loadingDelete}
|
||||
disabled={loadingDelete}
|
||||
>
|
||||
Delete Organization Data
|
||||
</Button>
|
||||
|
|
|
@ -736,6 +736,7 @@ export default function ResourceAuthenticationPage() {
|
|||
onClick={saveWhitelist}
|
||||
form="whitelist-form"
|
||||
loading={loadingSaveWhitelist}
|
||||
disabled={loadingSaveWhitelist}
|
||||
>
|
||||
Save Whitelist
|
||||
</Button>
|
||||
|
|
|
@ -30,6 +30,7 @@ import {
|
|||
import { formatAxiosError } from "@app/lib/api";
|
||||
import { createApiClient } from "@app/lib/api";
|
||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||
import { useState } from "react";
|
||||
|
||||
const GeneralFormSchema = z.object({
|
||||
name: z.string()
|
||||
|
@ -43,6 +44,8 @@ export default function GeneralPage() {
|
|||
|
||||
const api = createApiClient(useEnvContext());
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const form = useForm<GeneralFormValues>({
|
||||
|
@ -54,6 +57,8 @@ export default function GeneralPage() {
|
|||
});
|
||||
|
||||
async function onSubmit(data: GeneralFormValues) {
|
||||
setLoading(true);
|
||||
|
||||
await api
|
||||
.post(`/site/${site?.siteId}`, {
|
||||
name: data.name
|
||||
|
@ -71,6 +76,8 @@ export default function GeneralPage() {
|
|||
|
||||
updateSite({ name: data.name });
|
||||
|
||||
setLoading(false);
|
||||
|
||||
router.refresh();
|
||||
}
|
||||
|
||||
|
@ -117,7 +124,12 @@ export default function GeneralPage() {
|
|||
</SettingsSectionBody>
|
||||
|
||||
<SettingsSectionFooter>
|
||||
<Button type="submit" form="general-settings-form">
|
||||
<Button
|
||||
type="submit"
|
||||
form="general-settings-form"
|
||||
loading={loading}
|
||||
disabled={loading}
|
||||
>
|
||||
Save Settings
|
||||
</Button>
|
||||
</SettingsSectionFooter>
|
||||
|
|
|
@ -86,15 +86,15 @@ export default function InviteStatusCard({
|
|||
router.push("/");
|
||||
}}
|
||||
>
|
||||
Go home
|
||||
Go Home
|
||||
</Button>
|
||||
);
|
||||
} else if (type === "wrong_user") {
|
||||
return (
|
||||
<Button onClick={goToLogin}>Log in as different user</Button>
|
||||
<Button onClick={goToLogin}>Log In as a Different User</Button>
|
||||
);
|
||||
} else if (type === "user_does_not_exist") {
|
||||
return <Button onClick={goToSignup}>Create an account</Button>;
|
||||
return <Button onClick={goToSignup}>Create an Account</Button>;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue