"use client"; import * as React from "react"; import { useRouter } from "next/navigation"; import { updateOrganization } from "@/actions/account"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Field, Hint, Label } from "@/components/ui/label"; import { Alert } from "@/components/ui/alert"; export function OrganizationForm({ name, softLimitUsd, hardLimitUsd, canEdit }: { name: string; softLimitUsd: number | null; hardLimitUsd: number | null; canEdit: boolean }) { const router = useRouter(); const [error, setError] = React.useState(null); const [saved, setSaved] = React.useState(false); const [pending, startTransition] = React.useTransition(); return (
{ e.preventDefault(); setError(null); setSaved(false); const fd = new FormData(e.currentTarget); startTransition(async () => { const res = await updateOrganization(fd); if (!res.ok) { setError(res.error); return; } setSaved(true); router.refresh(); }); }} > {!canEdit ? Only owners, admins and billing members can change organization settings. : null} {error ? {error} : null} {saved ? Organization updated. : null}
You get an email when total spend crosses this amount. All projects stop with USAGE_LIMIT_REACHED until the next month.
{canEdit ? (
) : null}
); }