Skip to content

Commit

Permalink
Fix text for install netbird modal
Browse files Browse the repository at this point in the history
  • Loading branch information
heisbrot committed Jan 15, 2025
1 parent 57e71a3 commit f3d4dcb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
19 changes: 14 additions & 5 deletions src/modules/setup-keys/SetupKeyModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ type Props = {
children?: React.ReactNode;
open: boolean;
setOpen: (open: boolean) => void;
name?: string;
};
const copyMessage = "Setup-Key was copied to your clipboard!";
export default function SetupKeyModal({
children,
open,
setOpen,
name,
}: Readonly<Props>) {
const [successModal, setSuccessModal] = useState(false);
const [setupKey, setSetupKey] = useState<SetupKey>();
Expand All @@ -62,13 +64,16 @@ export default function SetupKeyModal({
<>
<Modal open={open} onOpenChange={setOpen} key={open ? 1 : 0}>
{children && <ModalTrigger asChild>{children}</ModalTrigger>}
<SetupKeyModalContent onSuccess={handleSuccess} />
<SetupKeyModalContent onSuccess={handleSuccess} predefinedName={name} />
</Modal>

<Modal
open={installModal}
onOpenChange={setInstallModal}
key={installModal ? 1 : 0}
onOpenChange={(state) => {
setInstallModal(state);
setOpen(false);
}}
key={installModal ? 2 : 3}
>
<SetupModal showClose={true} setupKey={setupKey?.key} />
</Modal>
Expand Down Expand Up @@ -144,13 +149,17 @@ export default function SetupKeyModal({

type ModalProps = {
onSuccess?: (setupKey: SetupKey) => void;
predefinedName?: string;
};

export function SetupKeyModalContent({ onSuccess }: Readonly<ModalProps>) {
export function SetupKeyModalContent({
onSuccess,
predefinedName = "",
}: Readonly<ModalProps>) {
const setupKeyRequest = useApiCall<SetupKey>("/setup-keys", true);
const { mutate } = useSWRConfig();

const [name, setName] = useState("");
const [name, setName] = useState(predefinedName);
const [reusable, setReusable] = useState(false);
const [usageLimit, setUsageLimit] = useState("");
const [expiresIn, setExpiresIn] = useState("7");
Expand Down
2 changes: 1 addition & 1 deletion src/modules/setup-netbird-modal/SetupModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function SetupModalContent({
{`It's time to add your first device.`}
</>
) : (
<>Install NetBird with Setup Key</>
<>Install NetBird{setupKey && " with Setup Key"}</>
)}
</h2>
<Paragraph
Expand Down

0 comments on commit f3d4dcb

Please sign in to comment.