Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 39 additions & 23 deletions src/components/OrgForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,54 @@ import {
FormMessage,
} from "./ui/form";
import { Input } from "./ui/input";
import { InputWithButton } from "./ui/input-with-button";
import { useActiveOrg } from "@/hooks/useActiveOrg";

interface OrgFormProps {
forceVertical?: boolean;
}

export const OrgForm: FunctionComponent<OrgFormProps> = ({
forceVertical = true,
}) => (
<Section
description="Enter the name of your organization. This will be used to identify your organization in the system."
title="General Information"
forceVertical={forceVertical}
>
<div className="mt-6">
<FormField
name="name"
rules={{
}) => {
const activeOrg = useActiveOrg();
const orgID = activeOrg?.id;

return (
<Section
description="Enter the name of your organization. This will be used to identify your organization in the system."
title="General Information"
forceVertical={forceVertical}
>
<div className="mt-6">
<FormField
name="name"
rules={{
validate: (value) =>
// Allows every character as long as one letter or number is given.
/[a-z0-9]/i.test(value ?? "") ||
"The name must contain at least one letter or number.",
}}
render={({ field }) => (
<FormItem>
<FormLabel>Organization name*</FormLabel>
<FormControl>
<Input data-testid="org-name-label" {...field} />
</FormControl>
<FormMessage />
</FormItem>
render={({ field }) => (
<FormItem>
<FormLabel>Organization name*</FormLabel>
<FormControl>
<Input data-testid="org-name-label" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{activeOrg && (
<InputWithButton
label="Organization-ID"
value={`${orgID}`}
nameKey="settings-org-id"
variant="default"
copyable
copyToastDescription="The organization ID has been copied to your clipboard."
/>
)}
/>
</div>
</Section>
);
</div>
</Section>
);
};
2 changes: 1 addition & 1 deletion src/components/OrgRegister.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default function OrgRegisterForm(props: Props) {
>
<OrgForm />

<div className="mt-6 flex items-center justify-end gap-x-6">
<div className="-mt-4 flex items-center justify-end gap-x-6">
<Button
disabled={form.formState.isSubmitting}
isSubmitting={form.formState.isSubmitting}
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const config = {
"https://gitlab.com/l3montree/devguard/-/raw/main",
devguardGithubAppUrl: process.env.DEVGUARD_API_URL_PUBLIC_INTERNET?.includes(
"main.devguard.org",
)
) || process.env.DEVGUARD_API_URL_PUBLIC_INTERNET?.includes("localhost")
? "devguard-bot-dev"
: "devguard-bot",
enforceTheme: (process.env.ENFORCE_THEME || false) as
Expand Down
Loading