Separate invites from profile navigation
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import { useEffect, useMemo, useState } from 'react'
|
import { useEffect, useMemo, useState } from 'react'
|
||||||
import { authFetch, clearToken, getApiBase, getToken } from '../../lib/auth'
|
import { authFetch, clearToken, getApiBase, getToken } from '../../lib/auth'
|
||||||
import { useUserViewPreview } from '../../lib/viewMode'
|
|
||||||
|
|
||||||
type ProfileInfo = {
|
type ProfileInfo = {
|
||||||
username: string
|
username: string
|
||||||
@@ -98,7 +97,6 @@ export default function ProfileInvitesPage() {
|
|||||||
const [inviteManagedByMaster, setInviteManagedByMaster] = useState(false)
|
const [inviteManagedByMaster, setInviteManagedByMaster] = useState(false)
|
||||||
const [masterInviteTemplate, setMasterInviteTemplate] = useState<OwnedInvitesResponse['master_invite']>(null)
|
const [masterInviteTemplate, setMasterInviteTemplate] = useState<OwnedInvitesResponse['master_invite']>(null)
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const viewAsUser = useUserViewPreview()
|
|
||||||
|
|
||||||
const signupBaseUrl = useMemo(() => {
|
const signupBaseUrl = useMemo(() => {
|
||||||
if (typeof window === 'undefined') return '/signup'
|
if (typeof window === 'undefined') return '/signup'
|
||||||
@@ -317,54 +315,8 @@ export default function ProfileInvitesPage() {
|
|||||||
<main className="card">
|
<main className="card">
|
||||||
<div className="user-directory-panel-header profile-page-header">
|
<div className="user-directory-panel-header profile-page-header">
|
||||||
<div>
|
<div>
|
||||||
<h1>{viewAsUser ? 'Invites' : 'My invites'}</h1>
|
<h1>Invites</h1>
|
||||||
<p className="lede">
|
<p className="lede">Create invite links, email them directly, and track who you have invited.</p>
|
||||||
{viewAsUser
|
|
||||||
? 'Preview the invite workspace exactly as a permitted non-admin user sees it.'
|
|
||||||
: 'Create invite links, email them directly, and track who you have invited.'}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div className="admin-inline-actions">
|
|
||||||
<button type="button" className="ghost-button" onClick={() => router.push('/profile')}>
|
|
||||||
Back to profile
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{profile && viewAsUser ? (
|
|
||||||
<div className="status-banner">
|
|
||||||
<strong>User view preview.</strong> The non-admin presentation is active. Your admin permissions and invite data remain unchanged.
|
|
||||||
</div>
|
|
||||||
) : profile ? (
|
|
||||||
<div className="status-banner">
|
|
||||||
Signed in as <strong>{profile.username}</strong> ({profile.role}).
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
<div className="profile-tabbar">
|
|
||||||
<div className="admin-segmented" role="tablist" aria-label="Profile sections">
|
|
||||||
<button type="button" role="tab" aria-selected={false} onClick={() => router.push('/profile')}>
|
|
||||||
Overview
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
role="tab"
|
|
||||||
aria-selected={false}
|
|
||||||
onClick={() => router.push('/profile?tab=activity')}
|
|
||||||
>
|
|
||||||
Activity
|
|
||||||
</button>
|
|
||||||
<button type="button" role="tab" aria-selected className="is-active">
|
|
||||||
My invites
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
role="tab"
|
|
||||||
aria-selected={false}
|
|
||||||
onClick={() => router.push('/profile?tab=security')}
|
|
||||||
>
|
|
||||||
Security
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useEffect, useMemo, useState } from 'react'
|
|
||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
|
import { useEffect, useMemo, useState } from 'react'
|
||||||
import { authFetch, clearToken, getApiBase, getToken } from '../lib/auth'
|
import { authFetch, clearToken, getApiBase, getToken } from '../lib/auth'
|
||||||
|
|
||||||
type ProfileInfo = {
|
type ProfileInfo = {
|
||||||
@@ -265,11 +265,6 @@ export default function ProfilePage() {
|
|||||||
>
|
>
|
||||||
Activity
|
Activity
|
||||||
</button>
|
</button>
|
||||||
{canManageInvites ? (
|
|
||||||
<button type="button" role="tab" aria-selected={false} onClick={() => router.push(inviteLink)}>
|
|
||||||
My invites
|
|
||||||
</button>
|
|
||||||
) : null}
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
role="tab"
|
role="tab"
|
||||||
|
|||||||
Reference in New Issue
Block a user