Spaces:
Paused
Paused
Download frontend/apps/customer/src/components/WorkspaceView.tsx from 3SCError404/miracle: direct link, hf CLI and curl.
- Browser
- Download file 30.8 kB
-
https://huggingface.co/spaces/3SCError404/miracle/resolve/main/frontend/apps/customer/src/components/WorkspaceView.tsx
- Command line
-
hf download hf://spaces/3SCError404/miracle/frontend/apps/customer/src/components/WorkspaceView.tsx
-
curl -L -o WorkspaceView.tsx https://huggingface.co/spaces/3SCError404/miracle/resolve/main/frontend/apps/customer/src/components/WorkspaceView.tsx
30.8 kB
| import React, { useState } from 'react'; | |
| import { api, useWorkspace, useUsers } from '@nexus/shared'; | |
| import { | |
| UserPlus, | |
| Shield, | |
| ShieldCheck, | |
| X, | |
| Mail, | |
| Lock, | |
| Users, | |
| RefreshCcw, | |
| ChevronDown | |
| } from 'lucide-react'; | |
| const COLORS = { | |
| brand: "var(--primary)", | |
| border: "var(--border-subtle)", | |
| bg: "var(--bg-card)", | |
| text: "var(--text-main)", | |
| muted: "var(--text-muted)", | |
| success: "var(--success)", | |
| error: "var(--error)", | |
| }; | |
| const TEAM_OPTIONS = ["ENGINEERING", "FINANCE", "SUCCESS", "ACCOUNT", "SECURITY", "COMPLIANCE", "GENERAL", "OTHER"]; | |
| export const WorkspaceView: React.FC<{ user: any }> = ({ user }) => { | |
| const { workspace, loading: workspaceLoading, refresh: refreshWorkspace } = useWorkspace(); | |
| const { users: members, loading: usersLoading, refresh: refreshUsers, addUser, loaded: usersLoaded } = useUsers(); | |
| // Branding State | |
| const [brandingLogo, setBrandingLogo] = useState(workspace?.branding?.logo_url || ''); | |
| const [brandingColor, setBrandingColor] = useState(workspace?.branding?.colors?.primary || '#7c3aed'); | |
| const [brandingSubmitting, setBrandingSubmitting] = useState(false); | |
| // Synchronize state when workspace loads | |
| React.useEffect(() => { | |
| if (workspace?.branding) { | |
| setBrandingLogo(workspace.branding.logo_url || ''); | |
| setBrandingColor(workspace.branding.colors?.primary || '#7c3aed'); | |
| } | |
| }, [workspace]); | |
| // Provisioning State | |
| const [modalType, setModalType] = useState<'create' | 'edit' | null>(null); | |
| const [editingUser, setEditingUser] = useState<any>(null); | |
| const [form, setForm] = useState({ email: '', full_name: '', password: '', role: 'customer_user', team: 'GENERAL' }); | |
| const [submitting, setSubmitting] = useState(false); | |
| const isAdmin = user.role.includes('admin'); | |
| const isInitialLoading = (workspaceLoading && !workspace) || (usersLoading && !usersLoaded); | |
| const handleUpdateBranding = async () => { | |
| setBrandingSubmitting(true); | |
| try { | |
| await api.patch('/workspace/', { | |
| workspace_id: workspace?.id, | |
| branding: { | |
| ...workspace?.branding, | |
| logo_url: brandingLogo, | |
| colors: { | |
| ...workspace?.branding?.colors, | |
| primary: brandingColor | |
| } | |
| } | |
| }); | |
| sessionStorage.removeItem('nexus_active_ws_v1'); | |
| await refreshWorkspace(workspace?.id); | |
| } catch (err) { | |
| console.error("Branding update failed:", err); | |
| } finally { | |
| setBrandingSubmitting(false); | |
| } | |
| }; | |
| const handleProvision = async (e: React.FormEvent) => { | |
| e.preventDefault(); | |
| setSubmitting(true); | |
| try { | |
| if (modalType === 'edit' && editingUser) { | |
| await api.patch(`/users/${editingUser.id}/`, { | |
| full_name: form.full_name, | |
| role: form.role, | |
| team: form.team | |
| }); | |
| } else { | |
| await addUser(form); | |
| } | |
| setForm({ email: '', full_name: '', password: '', role: 'customer_user', team: 'GENERAL' }); | |
| setModalType(null); | |
| setEditingUser(null); | |
| refreshUsers(); | |
| } catch (err) { | |
| console.error("Provisioning failed:", err); | |
| } finally { | |
| setSubmitting(false); | |
| } | |
| }; | |
| const openEdit = (m: any) => { | |
| setEditingUser(m); | |
| setForm({ | |
| email: m.email, | |
| full_name: m.full_name, | |
| password: '', // Hidden in edit | |
| role: m.role, | |
| team: m.team || 'GENERAL' | |
| }); | |
| setModalType('edit'); | |
| }; | |
| const removeMember = async (memberId: string) => { | |
| if (!window.confirm("Are you sure you want to revoke this member's access? They will be marked as deactivated in this workspace.")) return; | |
| try { | |
| await api.delete(`/users/${memberId}/`); | |
| refreshUsers(); | |
| } catch (err) { | |
| console.error("Failed to remove member:", err); | |
| } | |
| }; | |
| if (isInitialLoading) return ( | |
| <div style={{ padding: 120, textAlign: 'center', background: 'var(--bg-dark)', height: '100vh' }}> | |
| <div className="spin" style={{ width: 40, height: 40, border: '3px solid var(--primary)', borderTopColor: 'transparent', borderRadius: '50%', marginInline: 'auto', marginBottom: 24 }} /> | |
| <div className="metadata" style={{ fontSize: 13, letterSpacing: '0.2em', fontWeight: 900, color: 'var(--text-muted)' }}>INITIALIZING WORKSPACE...</div> | |
| </div> | |
| ); | |
| return ( | |
| <div style={{ padding: "80px 64px", maxWidth: 1600, margin: "0 auto", fontFamily: "var(--font-sans)", background: "var(--bg-dark)", minHeight: "100vh" }}> | |
| {/* Main Header */} | |
| <div style={{ marginBottom: 80, position: 'relative' }}> | |
| <div style={{ display: 'flex', alignItems: 'center', gap: 16, marginBottom: 12 }}> | |
| <div style={{ width: 32, height: 2, background: 'var(--primary)' }} /> | |
| <div className="metadata" style={{ color: 'var(--primary)', letterSpacing: '0.2em', fontWeight: 900 }}>WORKSPACE OVERVIEW</div> | |
| </div> | |
| <h1 style={{ fontSize: 48, fontWeight: 800, color: COLORS.text, marginBottom: 20, fontFamily: 'var(--font-heading)', letterSpacing: '-0.04em' }}>{workspace?.name?.toUpperCase()}</h1> | |
| <p style={{ color: COLORS.muted, fontSize: 20, fontWeight: 500, maxWidth: 900, lineHeight: 1.6 }}>Manage your organization's team members, roles, and access permissions from this central dashboard.</p> | |
| </div> | |
| {/* Identity & Branding Section (Admin Only) */} | |
| {isAdmin && ( | |
| <div style={{ marginBottom: 64 }}> | |
| <div style={{ display: 'flex', alignItems: 'center', gap: 16, marginBottom: 32 }}> | |
| <div style={{ padding: 12, borderRadius: 12, background: 'var(--bg-hover)', border: '1px solid var(--border-subtle)', color: 'var(--primary)' }}> | |
| <ShieldCheck size={24} /> | |
| </div> | |
| <h2 style={{ fontSize: 28, fontWeight: 800, color: COLORS.text, margin: 0, fontFamily: "var(--font-heading)", letterSpacing: '-0.02em' }}>Identity & Branding</h2> | |
| </div> | |
| <div className="glass-card" style={{ background: "var(--bg-card)", border: `1.5px solid var(--border-subtle)`, borderRadius: 32, padding: 40, boxShadow: "var(--shadow-2xl)" }}> | |
| <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 40, alignItems: 'start' }}> | |
| <div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}> | |
| <div> | |
| <label className="metadata" style={{ marginBottom: 12, display: 'block', fontWeight: 800, letterSpacing: '0.05em', fontSize: 10, color: COLORS.muted }}>BRANDING LOGO URL</label> | |
| <div style={{ display: 'flex', gap: 16 }}> | |
| <input | |
| value={brandingLogo} | |
| onChange={e => setBrandingLogo(e.target.value)} | |
| className="input-focus" | |
| placeholder="https://example.com/logo.png" | |
| style={{ flex: 1, padding: "18px 24px", borderRadius: 16, border: `1.5px solid var(--border-subtle)`, fontSize: 16, outline: "none", background: "var(--bg-dark)", color: COLORS.text, boxSizing: "border-box", fontWeight: 600 }} | |
| /> | |
| <div style={{ width: 58, height: 58, borderRadius: 16, background: 'var(--bg-dark)', border: '1.5px solid var(--border-subtle)', display: 'flex', alignItems: 'center', justifyContent: 'center', overflow: 'hidden' }}> | |
| {brandingLogo ? ( | |
| <img src={brandingLogo} alt="Logo" style={{ maxWidth: '80%', maxHeight: '80%', objectFit: 'contain' }} /> | |
| ) : ( | |
| <Users size={20} style={{ opacity: 0.2 }} /> | |
| )} | |
| </div> | |
| </div> | |
| </div> | |
| <div> | |
| <label className="metadata" style={{ marginBottom: 12, display: 'block', fontWeight: 800, letterSpacing: '0.05em', fontSize: 10, color: COLORS.muted }}>OFFICIAL WORKSPACE NAME</label> | |
| <input | |
| defaultValue={workspace?.name} | |
| onBlur={async (e) => { | |
| if (e.target.value && e.target.value !== workspace?.name) { | |
| try { | |
| await api.patch('/workspace/', { name: e.target.value }); | |
| sessionStorage.removeItem('nexus_active_ws_v1'); | |
| refreshWorkspace(workspace?.id); | |
| } catch (err) { console.error(err); } | |
| } | |
| }} | |
| className="input-focus" | |
| placeholder="e.g. ACME CORP" | |
| style={{ width: "100%", padding: "18px 24px", borderRadius: 16, border: `1.5px solid var(--border-subtle)`, fontSize: 16, outline: "none", background: "var(--bg-dark)", color: COLORS.text, boxSizing: "border-box", fontWeight: 700, fontFamily: 'var(--font-heading)' }} | |
| /> | |
| </div> | |
| </div> | |
| <div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}> | |
| <div> | |
| <label className="metadata" style={{ marginBottom: 12, display: 'block', fontWeight: 800, letterSpacing: '0.05em', fontSize: 10, color: COLORS.muted }}>WORKSPACE THEME COLOR</label> | |
| <div style={{ display: 'flex', alignItems: 'center', gap: 16, background: 'var(--bg-dark)', padding: '8px 16px', borderRadius: 16, border: '1.5px solid var(--border-subtle)' }}> | |
| <input | |
| type="color" | |
| value={brandingColor} | |
| onChange={e => { | |
| setBrandingColor(e.target.value); | |
| document.documentElement.style.setProperty('--primary', e.target.value); | |
| document.documentElement.style.setProperty('--banner-gradient', `linear-gradient(135deg, ${e.target.value} 0%, ${e.target.value}dd 100%)`); | |
| }} | |
| style={{ width: 42, height: 42, border: 'none', borderRadius: 10, cursor: 'pointer', background: 'none' }} | |
| /> | |
| <input | |
| value={brandingColor} | |
| onChange={e => { | |
| setBrandingColor(e.target.value); | |
| if (e.target.value.startsWith('#') && e.target.value.length === 7) { | |
| document.documentElement.style.setProperty('--primary', e.target.value); | |
| } | |
| }} | |
| style={{ background: 'none', border: 'none', color: COLORS.text, fontSize: 16, fontWeight: 700, outline: 'none', width: 100, textTransform: 'uppercase', fontFamily: 'var(--font-mono)' }} | |
| /> | |
| </div> | |
| </div> | |
| <button | |
| onClick={handleUpdateBranding} | |
| disabled={brandingSubmitting} | |
| className="hover-lift" | |
| style={{ | |
| width: '100%', | |
| padding: "18px", | |
| background: "var(--primary)", | |
| color: "var(--bg-card)", | |
| border: "none", | |
| borderRadius: 18, | |
| fontSize: 14, | |
| fontWeight: 900, | |
| cursor: brandingSubmitting ? "wait" : "pointer", | |
| textTransform: 'uppercase', | |
| letterSpacing: '0.1em', | |
| boxShadow: '0 10px 25px var(--primary-glow)', | |
| fontFamily: "var(--font-heading)", | |
| display: 'flex', | |
| alignItems: 'center', | |
| justifyContent: 'center', | |
| gap: 12, | |
| transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)', | |
| opacity: brandingSubmitting ? 0.7 : 1 | |
| }} | |
| > | |
| {brandingSubmitting ? <RefreshCcw size={18} className="spin" /> : <ShieldCheck size={18} />} | |
| {brandingSubmitting ? "Saving Branding..." : "Save Identity Changes"} | |
| </button> | |
| </div> | |
| </div> | |
| <div style={{ marginTop: 32, padding: '16px 24px', background: 'var(--bg-dark)', borderRadius: 16, border: '1px solid var(--border-subtle)', display: 'flex', alignItems: 'center', gap: 12 }}> | |
| <Shield size={16} color="var(--primary)" /> | |
| <span style={{ fontSize: 12, color: COLORS.muted, fontWeight: 500 }}>Identity changes sync across all member portals and analytical reports in real-time.</span> | |
| </div> | |
| </div> | |
| </div> | |
| )} | |
| <div style={{ gap: 64, alignItems: "start" }}> | |
| {/* Member Directory Section */} | |
| <div style={{ width: "100%" }}> | |
| <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 40 }}> | |
| <div style={{ display: 'flex', alignItems: 'center', gap: 16 }}> | |
| <div style={{ padding: 12, borderRadius: 12, background: 'var(--bg-hover)', border: '1px solid var(--border-subtle)', color: 'var(--primary)' }}> | |
| <Users size={24} /> | |
| </div> | |
| <h2 style={{ fontSize: 28, fontWeight: 800, color: COLORS.text, margin: 0, fontFamily: "var(--font-heading)", letterSpacing: '-0.02em' }}>Workspace Members</h2> | |
| <button | |
| onClick={() => refreshUsers()} | |
| disabled={usersLoading} | |
| className="hover-lift" | |
| style={{ | |
| background: usersLoading ? 'var(--bg-dark)' : 'var(--primary-glow)', | |
| border: `1.5px solid ${usersLoading ? 'var(--border-subtle)' : 'var(--primary-glow)'}`, | |
| color: 'var(--primary)', | |
| width: 40, height: 40, borderRadius: 12, | |
| display: 'flex', alignItems: 'center', justifyContent: 'center', | |
| cursor: usersLoading ? 'wait' : 'pointer', | |
| transition: 'all 0.3s' | |
| }} | |
| title="Bypass Cache & Refresh List" | |
| > | |
| <RefreshCcw size={18} className={usersLoading ? "spin" : ""} /> | |
| </button> | |
| </div> | |
| {isAdmin ? ( | |
| <button | |
| onClick={() => { | |
| setForm({ email: '', full_name: '', password: '', role: 'customer_user', team: 'GENERAL' }); | |
| setModalType('create'); | |
| }} | |
| className="hover-lift" | |
| style={{ | |
| padding: "16px 36px", | |
| background: "var(--primary)", | |
| color: "var(--bg-card)", | |
| border: "none", | |
| borderRadius: 18, | |
| fontSize: 14, | |
| fontWeight: 900, | |
| cursor: "pointer", | |
| textTransform: 'uppercase', | |
| letterSpacing: '0.1em', | |
| boxShadow: '0 10px 25px var(--primary-glow)', | |
| fontFamily: "var(--font-heading)", | |
| display: 'flex', | |
| alignItems: 'center', gap: 12 | |
| }} | |
| > | |
| <UserPlus size={18} /> Add Member | |
| </button> | |
| ) : ( | |
| <div className="metadata" style={{ display: 'flex', alignItems: 'center', gap: 10, padding: "12px 24px", background: "var(--bg-card)", borderRadius: 14, fontSize: 11, border: '1.5px solid var(--border-subtle)', fontWeight: 900 }}> | |
| <Shield size={14} /> ADMIN RESTRICTION ACTIVE | |
| </div> | |
| )} | |
| </div> | |
| <div className="glass-card" style={{ background: "var(--bg-card)", border: `1.5px solid var(--border-subtle)`, borderRadius: 32, overflow: "hidden", boxShadow: "var(--shadow-2xl)" }}> | |
| <table style={{ width: "100%", borderCollapse: "collapse", textAlign: "left" }}> | |
| <thead> | |
| <tr style={{ background: "var(--bg-dark)", borderBottom: `1.5px solid var(--border-subtle)` }}> | |
| <th className="metadata" style={{ padding: "28px 32px", fontSize: 10, letterSpacing: '0.15em', fontWeight: 900 }}>MEMBER INFO</th> | |
| <th className="metadata" style={{ padding: "28px 32px", fontSize: 10, letterSpacing: '0.15em', fontWeight: 900, width: 220 }}>ACCESS ROLE</th> | |
| <th className="metadata" style={{ padding: "28px 32px", fontSize: 10, letterSpacing: '0.15em', fontWeight: 900 }}>STATUS</th> | |
| <th className="metadata" style={{ padding: "28px 32px", fontSize: 10, letterSpacing: '0.15em', fontWeight: 900, textAlign: "right" }}>ACTIONS</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| {members.map(member => ( | |
| <tr key={member.id} className="hover-lift" style={{ borderBottom: `1.5px solid var(--border-subtle)`, transition: 'all 0.3s cubic-bezier(0.19, 1, 0.22, 1)' }}> | |
| <td style={{ padding: "32px" }}> | |
| <div style={{ display: "flex", alignItems: "center", gap: 20 }}> | |
| <div style={{ width: 52, height: 52, borderRadius: 16, background: "var(--bg-dark)", border: '1.5px solid var(--border-subtle)', display: "flex", alignItems: "center", justifyContent: "center", fontWeight: 900, fontSize: 18, color: COLORS.brand, fontFamily: 'var(--font-heading)' }}> | |
| {member.full_name[0].toUpperCase()} | |
| </div> | |
| <div> | |
| <div style={{ fontSize: 17, fontWeight: 700, color: COLORS.text, fontFamily: 'var(--font-heading)' }}>{member.full_name}</div> | |
| <div className="numeric" style={{ fontSize: 13, color: COLORS.muted, fontWeight: 600, letterSpacing: '0.02em', marginTop: 4 }}>{member.email}</div> | |
| </div> | |
| </div> | |
| </td> | |
| <td style={{ padding: "32px" }}> | |
| <span style={{ fontSize: 10, fontWeight: 900, color: COLORS.brand, background: "var(--primary-glow)", padding: "6px 14px", borderRadius: 10, letterSpacing: '0.1em', fontFamily: "var(--font-heading)", border: '1px solid var(--primary)' }}> | |
| {member.role.replace('_', ' ').toUpperCase()} | |
| </span> | |
| </td> | |
| <td style={{ padding: "32px" }}> | |
| <div style={{ display: "flex", alignItems: "center", gap: 12 }}> | |
| <div style={{ | |
| width: 10, height: 10, borderRadius: "50%", | |
| background: member.is_active ? COLORS.success : COLORS.muted, | |
| boxShadow: member.is_active ? "0 0 12px var(--success)" : "none" | |
| }} /> | |
| <span style={{ | |
| fontSize: 13, fontWeight: 700, | |
| color: member.is_active ? COLORS.success : COLORS.muted, | |
| textTransform: "uppercase", letterSpacing: "0.1em", fontFamily: 'var(--font-heading)' | |
| }}> | |
| {member.is_active ? "ACTIVE" : "DEACTIVATED"} | |
| </span> | |
| </div> | |
| </td> | |
| <td style={{ padding: "32px", textAlign: "right" }}> | |
| <div style={{ display: 'flex', gap: 12, justifyContent: 'flex-end' }}> | |
| {isAdmin && ( | |
| <button | |
| onClick={() => openEdit(member)} | |
| className="hover-lift" | |
| style={{ background: "var(--primary-glow)", border: "1.5px solid var(--border-subtle)", color: "var(--primary)", fontSize: 10, fontWeight: 900, cursor: "pointer", letterSpacing: "0.15em", padding: '10px 18px', borderRadius: 12, fontFamily: 'var(--font-heading)' }} | |
| > | |
| EDIT | |
| </button> | |
| )} | |
| {isAdmin && member.id !== user.id && member.is_active && ( | |
| <button | |
| onClick={() => removeMember(member.id)} | |
| className="hover-lift" | |
| style={{ background: "var(--error-glow)", border: "1.5px solid var(--border-subtle)", color: COLORS.error, fontSize: 10, fontWeight: 900, cursor: "pointer", letterSpacing: "0.15em", padding: '10px 18px', borderRadius: 12, fontFamily: 'var(--font-heading)' }} | |
| > | |
| REVOKE | |
| </button> | |
| )} | |
| </div> | |
| </td> | |
| </tr> | |
| ))} | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| {modalType && ( | |
| <div style={{ position: 'fixed', top: 0, left: 0, width: '100vw', height: '100vh', background: 'rgba(0,0,0,0.85)', backdropFilter: 'blur(10px)', zIndex: 1000, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 24 }}> | |
| <div className="glass-card" style={{ | |
| background: "var(--bg-card)", | |
| width: 'calc(100% - 48px)', | |
| maxWidth: 540, | |
| padding: "36px 40px", | |
| borderRadius: 32, | |
| border: `1.5px solid var(--border-subtle)`, | |
| boxShadow: "0 40px 100px rgba(0,0,0,0.6)", | |
| animation: 'appear 0.4s cubic-bezier(0.16, 1, 0.3, 1)', | |
| position: 'relative', | |
| maxHeight: '85vh', | |
| overflowY: 'auto', | |
| display: 'flex', | |
| flexDirection: 'column' | |
| }}> | |
| <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 28, flexShrink: 0 }}> | |
| <div> | |
| <div className="metadata" style={{ color: 'var(--primary)', marginBottom: 4, fontWeight: 900, letterSpacing: '0.15em', fontSize: 10 }}>MEMBER REGISTRATION</div> | |
| <h3 style={{ margin: 0, fontSize: 22, fontWeight: 800, fontFamily: 'var(--font-heading)', letterSpacing: '-0.02em', color: COLORS.text }}> | |
| {modalType === 'edit' ? 'Update Member Profile' : 'Invite New Member'} | |
| </h3> | |
| </div> | |
| <button | |
| onClick={() => setModalType(null)} | |
| className="hover-lift" | |
| style={{ background: "var(--bg-dark)", border: "1.5px solid var(--border-subtle)", width: 36, height: 36, borderRadius: "50%", display: "flex", alignItems: "center", justifyContent: "center", cursor: "pointer", color: COLORS.text, transition: 'all 0.3s' }} | |
| > | |
| <X size={16} /> | |
| </button> | |
| </div> | |
| <form onSubmit={handleProvision} style={{ display: "flex", flexDirection: "column", gap: 24 }}> | |
| <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 24 }}> | |
| <div> | |
| <label className="metadata" style={{ marginBottom: 10, display: 'block', fontWeight: 800, letterSpacing: '0.05em', fontSize: 10, color: COLORS.muted }}>FULL NAME</label> | |
| <input | |
| required | |
| value={form.full_name} | |
| onChange={e => setForm({...form, full_name: e.target.value})} | |
| placeholder="e.g. John Doe" | |
| className="input-focus" | |
| style={{ width: "100%", padding: "16px 20px", borderRadius: 14, border: `1.5px solid var(--border-subtle)`, fontSize: 15, outline: "none", background: "var(--bg-dark)", color: COLORS.text, boxSizing: "border-box", fontWeight: 600 }} | |
| /> | |
| </div> | |
| <div> | |
| <label className="metadata" style={{ marginBottom: 10, display: 'block', fontWeight: 800, letterSpacing: '0.05em', fontSize: 10, color: COLORS.muted }}>DEPT. TEAM</label> | |
| <div className="select-wrapper"> | |
| <select | |
| value={form.team} | |
| onChange={e => setForm({...form, team: e.target.value})} | |
| className="nexus-select" | |
| > | |
| {TEAM_OPTIONS.map(t => <option key={t} value={t}>{t}</option>)} | |
| </select> | |
| <ChevronDown size={14} className="select-chevron" /> | |
| </div> | |
| </div> | |
| </div> | |
| <div> | |
| <label className="metadata" style={{ marginBottom: 10, display: 'block', fontWeight: 800, letterSpacing: '0.05em', fontSize: 10, color: COLORS.muted }}>EMAIL ADDRESS</label> | |
| <div style={{ position: 'relative' }}> | |
| <Mail size={16} style={{ position: 'absolute', left: 18, top: '50%', transform: 'translateY(-50%)', color: 'var(--primary)', opacity: 0.5 }} /> | |
| <input | |
| required | |
| type="email" | |
| disabled={modalType === 'edit'} | |
| value={form.email} | |
| onChange={e => setForm({...form, email: e.target.value})} | |
| placeholder="user@example.com" | |
| className="input-focus" | |
| style={{ width: "100%", padding: "16px 20px 16px 48px", borderRadius: 14, border: `1.5px solid var(--border-subtle)`, fontSize: 15, outline: "none", background: "var(--bg-dark)", color: modalType === 'edit' ? COLORS.muted : COLORS.text, boxSizing: "border-box", fontWeight: 600 }} | |
| /> | |
| </div> | |
| </div> | |
| {modalType === 'create' && ( | |
| <div> | |
| <label className="metadata" style={{ marginBottom: 10, display: 'block', fontWeight: 800, letterSpacing: '0.05em', fontSize: 10, color: COLORS.muted }}>ACCOUNT PASSWORD</label> | |
| <div style={{ position: 'relative' }}> | |
| <Lock size={16} style={{ position: 'absolute', left: 18, top: '50%', transform: 'translateY(-50%)', color: 'var(--primary)', opacity: 0.5 }} /> | |
| <input | |
| required | |
| type="password" | |
| value={form.password} | |
| onChange={e => setForm({...form, password: e.target.value})} | |
| placeholder="••••••••••••" | |
| className="input-focus" | |
| style={{ width: "100%", padding: "16px 20px 16px 48px", borderRadius: 14, border: `1.5px solid var(--border-subtle)`, fontSize: 15, outline: "none", background: "var(--bg-dark)", color: COLORS.text, boxSizing: "border-box", fontWeight: 600 }} | |
| /> | |
| </div> | |
| </div> | |
| )} | |
| <div> | |
| <label className="metadata" style={{ marginBottom: 10, display: 'block', fontWeight: 800, letterSpacing: '0.05em', fontSize: 10, color: COLORS.muted }}>ACCESS ROLE</label> | |
| <div className="select-wrapper"> | |
| <select | |
| value={form.role} | |
| onChange={e => setForm({...form, role: e.target.value})} | |
| className="nexus-select" | |
| > | |
| <option value="customer_user">Standard User</option> | |
| <option value="customer_admin">Workspace Admin</option> | |
| </select> | |
| <ChevronDown size={14} className="select-chevron" /> | |
| </div> | |
| </div> | |
| <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16, marginTop: 8, flexShrink: 0 }}> | |
| <button | |
| type="button" | |
| onClick={() => setModalType(null)} | |
| style={{ padding: "18px", background: "var(--bg-dark)", border: "1.5px solid var(--border-subtle)", borderRadius: 16, color: COLORS.text, fontWeight: 900, cursor: "pointer", textTransform: 'uppercase', letterSpacing: '0.1em', fontSize: 13 }} | |
| > | |
| Cancel | |
| </button> | |
| <button | |
| type="submit" | |
| disabled={submitting} | |
| className="hover-lift" | |
| style={{ | |
| padding: "18px", | |
| background: "var(--primary)", | |
| color: "var(--bg-card)", | |
| border: "none", | |
| borderRadius: 16, | |
| fontWeight: 900, | |
| cursor: submitting ? "wait" : "pointer", | |
| textTransform: 'uppercase', | |
| letterSpacing: '0.15em', | |
| boxShadow: '0 10px 30px var(--primary-glow)', | |
| fontFamily: "var(--font-heading)", | |
| display: 'flex', | |
| alignItems: 'center', | |
| justifyContent: 'center', | |
| gap: 12, | |
| fontSize: 14 | |
| }} | |
| > | |
| {submitting ? <RefreshCcw size={18} className="spin" /> : <ShieldCheck size={18} />} | |
| {submitting ? "SYNC..." : modalType === 'edit' ? "Save" : "Create"} | |
| </button> | |
| </div> | |
| </form> | |
| </div> | |
| </div> | |
| )} | |
| </div> | |
| <style>{` | |
| @keyframes appear { | |
| from { opacity: 0; transform: scale(0.95) translateY(20px); } | |
| to { opacity: 1; transform: scale(1) translateY(0); } | |
| } | |
| .spin { animation: spin 1s linear infinite; } | |
| @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } | |
| .input-focus:focus { | |
| border-color: var(--primary) ; | |
| box-shadow: 0 0 0 4px var(--primary-glow) ; | |
| } | |
| `}</style> | |
| </div> | |
| ); | |
| }; | |