mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-18 08:18:43 +02:00
use mobile friendly dialog in regenerate invite
This commit is contained in:
parent
bc8cd5c941
commit
e057c5f3bf
1 changed files with 83 additions and 82 deletions
|
@ -1,11 +1,14 @@
|
||||||
import { Button } from "@app/components/ui/button";
|
import { Button } from "@app/components/ui/button";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Credenza,
|
||||||
DialogContent,
|
CredenzaBody,
|
||||||
DialogFooter,
|
CredenzaClose,
|
||||||
DialogHeader,
|
CredenzaContent,
|
||||||
DialogTitle
|
CredenzaDescription,
|
||||||
} from "@app/components/ui/dialog";
|
CredenzaFooter,
|
||||||
|
CredenzaHeader,
|
||||||
|
CredenzaTitle
|
||||||
|
} from "@app/components/Credenza";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { createApiClient } from "@app/lib/api";
|
import { createApiClient } from "@app/lib/api";
|
||||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
|
@ -20,6 +23,7 @@ import {
|
||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
SelectValue
|
SelectValue
|
||||||
} from "@app/components/ui/select";
|
} from "@app/components/ui/select";
|
||||||
|
import { Label } from "@app/components/ui/label";
|
||||||
|
|
||||||
type RegenerateInvitationFormProps = {
|
type RegenerateInvitationFormProps = {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
|
@ -153,7 +157,7 @@ export default function RegenerateInvitationForm({
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Credenza
|
||||||
open={open}
|
open={open}
|
||||||
onOpenChange={(isOpen) => {
|
onOpenChange={(isOpen) => {
|
||||||
setOpen(isOpen);
|
setOpen(isOpen);
|
||||||
|
@ -162,16 +166,20 @@ export default function RegenerateInvitationForm({
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DialogContent aria-describedby="regenerate-invite-description">
|
<CredenzaContent>
|
||||||
<DialogHeader>
|
<CredenzaHeader>
|
||||||
<DialogTitle>Regenerate Invitation</DialogTitle>
|
<CredenzaTitle>Regenerate Invitation</CredenzaTitle>
|
||||||
</DialogHeader>
|
<CredenzaDescription>
|
||||||
|
Revoke previous invitation and create a new one
|
||||||
|
</CredenzaDescription>
|
||||||
|
</CredenzaHeader>
|
||||||
|
<CredenzaBody>
|
||||||
{!inviteLink ? (
|
{!inviteLink ? (
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
Are you sure you want to regenerate the invitation
|
Are you sure you want to regenerate the
|
||||||
for <b>{invitation?.email}</b>? This will revoke the
|
invitation for <b>{invitation?.email}</b>? This
|
||||||
previous invitation.
|
will revoke the previous invitation.
|
||||||
</p>
|
</p>
|
||||||
<div className="flex items-center space-x-2 mt-4">
|
<div className="flex items-center space-x-2 mt-4">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
@ -185,10 +193,10 @@ export default function RegenerateInvitationForm({
|
||||||
Send email notification to the user
|
Send email notification to the user
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-4">
|
<div className="mt-4 space-y-2">
|
||||||
<label className="block text-sm font-medium text-gray-700">
|
<Label>
|
||||||
Validity Period
|
Validity Period
|
||||||
</label>
|
</Label>
|
||||||
<Select
|
<Select
|
||||||
value={validHours.toString()}
|
value={validHours.toString()}
|
||||||
onValueChange={(value) =>
|
onValueChange={(value) =>
|
||||||
|
@ -214,21 +222,20 @@ export default function RegenerateInvitationForm({
|
||||||
) : (
|
) : (
|
||||||
<div className="space-y-4 max-w-md">
|
<div className="space-y-4 max-w-md">
|
||||||
<p>
|
<p>
|
||||||
The invitation has been regenerated. The user must
|
The invitation has been regenerated. The user
|
||||||
access the link below to accept the invitation.
|
must access the link below to accept the
|
||||||
|
invitation.
|
||||||
</p>
|
</p>
|
||||||
<CopyTextBox text={inviteLink} wrapText={false} />
|
<CopyTextBox text={inviteLink} wrapText={false} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<DialogFooter>
|
</CredenzaBody>
|
||||||
|
<CredenzaFooter>
|
||||||
{!inviteLink ? (
|
{!inviteLink ? (
|
||||||
<>
|
<>
|
||||||
<Button
|
<CredenzaClose asChild>
|
||||||
variant="outline"
|
<Button variant="outline">Cancel</Button>
|
||||||
onClick={() => setOpen(false)}
|
</CredenzaClose>
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</Button>
|
|
||||||
<Button
|
<Button
|
||||||
onClick={handleRegenerate}
|
onClick={handleRegenerate}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
|
@ -237,18 +244,12 @@ export default function RegenerateInvitationForm({
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Button
|
<CredenzaClose asChild>
|
||||||
variant="outline"
|
<Button variant="outline">Close</Button>
|
||||||
onClick={() => {
|
</CredenzaClose>
|
||||||
setOpen(false);
|
|
||||||
setInviteLink(null);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</Button>
|
|
||||||
)}
|
)}
|
||||||
</DialogFooter>
|
</CredenzaFooter>
|
||||||
</DialogContent>
|
</CredenzaContent>
|
||||||
</Dialog>
|
</Credenza>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue