Move invite flow to client navigation
This commit is contained in:
@@ -209,7 +209,6 @@ export default function AdminInviteManagementPage() {
|
||||
const [inviteFlowStep, setInviteFlowStep] = useState(1)
|
||||
const [useCustomInviteCode, setUseCustomInviteCode] = useState(false)
|
||||
const [inviteDeliveryMethod, setInviteDeliveryMethod] = useState<InviteDeliveryMethod>('')
|
||||
const [createdInvite, setCreatedInvite] = useState<Invite | null>(null)
|
||||
const [inviteSummary, setInviteSummary] = useState<InviteSummary | null>(null)
|
||||
const [inviteView, setInviteView] = useState<InviteView>('all')
|
||||
|
||||
@@ -392,7 +391,6 @@ export default function AdminInviteManagementPage() {
|
||||
setInviteFlowStep(4)
|
||||
setUseCustomInviteCode(true)
|
||||
setInviteDeliveryMethod(invite.recipient_email ? 'email' : 'manual')
|
||||
setCreatedInvite(null)
|
||||
setStatus(null)
|
||||
setError(null)
|
||||
}
|
||||
@@ -449,8 +447,6 @@ export default function AdminInviteManagementPage() {
|
||||
throw new Error(text || 'Save failed')
|
||||
}
|
||||
const data = await response.json()
|
||||
const savedInvite = (data?.invite ?? null) as Invite | null
|
||||
setCreatedInvite(savedInvite)
|
||||
resetInviteEditor()
|
||||
if (data?.email?.status === 'ok') {
|
||||
setStatus(
|
||||
@@ -912,9 +908,6 @@ export default function AdminInviteManagementPage() {
|
||||
const inviteIdentityReady = Boolean(
|
||||
inviteForm.label.trim() && (!useCustomInviteCode || inviteCodeCharacters.length >= 6)
|
||||
)
|
||||
const createdInviteUrl = createdInvite
|
||||
? `${signupBaseUrl}?code=${encodeURIComponent(createdInvite.code)}`
|
||||
: ''
|
||||
const inviteAttentionCount = inviteSummary?.attention ?? invites.filter((invite) => !isInviteOperationallyReady(invite)).length
|
||||
const filteredInvites = useMemo(() => {
|
||||
if (inviteView === 'ready') return invites.filter(isInviteOperationallyReady)
|
||||
@@ -1281,13 +1274,9 @@ export default function AdminInviteManagementPage() {
|
||||
<button
|
||||
type="button"
|
||||
className="ghost-button"
|
||||
onClick={() => {
|
||||
setCreatedInvite(null)
|
||||
resetInviteEditor()
|
||||
setActiveTab('invites')
|
||||
}}
|
||||
onClick={() => router.push('/profile/invites')}
|
||||
>
|
||||
New invite
|
||||
Create invite
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@@ -1694,37 +1683,20 @@ export default function AdminInviteManagementPage() {
|
||||
<div className="admin-panel invite-admin-form-panel">
|
||||
<div className="invite-flow-heading">
|
||||
<div>
|
||||
<span className="eyebrow">Invite flow</span>
|
||||
<h2>{inviteEditingId == null ? 'Create an invite' : `Edit ${inviteForm.label || 'invite'}`}</h2>
|
||||
<p className="lede">Set up the invite one decision at a time.</p>
|
||||
<span className="eyebrow">Invite operations</span>
|
||||
<h2>{inviteEditingId == null ? 'Client invite workspace' : `Edit ${inviteForm.label || 'invite'}`}</h2>
|
||||
<p className="lede">Creation is client-facing. Admins can still maintain existing invites here.</p>
|
||||
</div>
|
||||
{inviteEditingId != null && (
|
||||
<button type="button" className="ghost-button" onClick={resetInviteEditor}>Cancel edit</button>
|
||||
)}
|
||||
</div>
|
||||
{createdInvite && inviteEditingId == null ? (
|
||||
<div className="invite-created-card" role="status">
|
||||
<span className="eyebrow">Invite ready</span>
|
||||
<h3>{createdInvite.label || 'Your invite'}</h3>
|
||||
<p>
|
||||
{createdInvite.recipient_email
|
||||
? `The invitation was emailed to ${createdInvite.recipient_email}. You can also copy the link below.`
|
||||
: 'Copy this link and send it to the person you are inviting.'}
|
||||
</p>
|
||||
<div className="invite-created-link">
|
||||
<input value={createdInviteUrl} readOnly aria-label="Created invite link" />
|
||||
<button type="button" onClick={() => void copyInviteLink(createdInvite)}>Copy link</button>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
className="ghost-button"
|
||||
onClick={() => {
|
||||
setCreatedInvite(null)
|
||||
resetInviteEditor()
|
||||
}}
|
||||
>
|
||||
Create another invite
|
||||
</button>
|
||||
{inviteEditingId == null ? (
|
||||
<div className="invite-created-card">
|
||||
<span className="eyebrow">Option 04 · Invites</span>
|
||||
<h3>Create invites from the client workspace</h3>
|
||||
<p>The guided invite flow now lives in the main navigation where users can create and manage their own invitations.</p>
|
||||
<button type="button" onClick={() => router.push('/profile/invites')}>Open client invite workspace</button>
|
||||
</div>
|
||||
) : (
|
||||
<form onSubmit={saveInvite} className="invite-flow-form">
|
||||
|
||||
Reference in New Issue
Block a user