@@ -44,6 +44,8 @@ import { useExchangeRate } from './hooks/useExchangeRate';
4444import { AMMPoolBrowser } from './components/AMMPoolBrowser' ;
4545import { ConvertWidget } from './components/ConvertWidget' ;
4646import { AccountRecovery } from './components/AccountRecovery' ;
47+ import { ComplianceDashboard } from './components/ComplianceDashboard' ;
48+ import { BackupSettings } from './components/BackupSettings' ;
4749
4850const STATUS_COLORS = { connected : '#22c55e' , disconnected : '#ef4444' , reconnecting : '#f59e0b' } ;
4951const TIMEOUT_MS = 30000 ;
@@ -71,6 +73,9 @@ function App() {
7173 const [ kycStatus , setKycStatus ] = useState ( null ) ;
7274 const [ kycLoading , setKycLoading ] = useState ( false ) ;
7375 const [ kycError , setKycError ] = useState ( null ) ;
76+ const [ showComplianceDashboard , setShowComplianceDashboard ] = useState ( false ) ;
77+ const [ showBackupSettings , setShowBackupSettings ] = useState ( false ) ;
78+ const [ userRole , setUserRole ] = useState ( null ) ;
7479
7580 const msg = useMessages ( ) ;
7681 const { canInstall, install, updateAvailable, applyUpdate, pushEnabled, enablePush } = usePWA ( ) ;
@@ -214,6 +219,16 @@ function App() {
214219
215220 useEffect ( ( ) => {
216221 fetchKycStatus ( ) ;
222+ // Check if user has admin role from JWT token
223+ const token = localStorage . getItem ( 'authToken' ) ;
224+ if ( token ) {
225+ try {
226+ const payload = JSON . parse ( atob ( token . split ( '.' ) [ 1 ] ) ) ;
227+ setUserRole ( payload . role ) ;
228+ } catch ( e ) {
229+ // Invalid token format
230+ }
231+ }
217232 } , [ fetchKycStatus ] ) ;
218233
219234 const saveLabel = async ( ) => {
@@ -902,11 +917,19 @@ function App() {
902917 { id : 'multisig' , label : '🔐 Multi-Sig' } ,
903918 { id : 'kyc' , label : '📋 KYC' } ,
904919 { id : 'notifications' , label : '🔔 Notifications' } ,
920+ { id : 'backup' , label : '💾 Backup' , action : ( ) => setShowBackupSettings ( true ) } ,
921+ ...( userRole === 'admin' ? [ { id : 'compliance' , label : '🛡️ Compliance' , action : ( ) => setShowComplianceDashboard ( true ) } ] : [ ] ) ,
905922 ] . map ( ( section ) => (
906923 < button
907924 key = { section . id }
908925 type = "button"
909- onClick = { ( ) => setActiveSettingsSection ( activeSettingsSection === section . id ? null : section . id ) }
926+ onClick = { ( ) => {
927+ if ( section . action ) {
928+ section . action ( ) ;
929+ } else {
930+ setActiveSettingsSection ( activeSettingsSection === section . id ? null : section . id ) ;
931+ }
932+ } }
910933 style = { {
911934 padding : '10px 16px' ,
912935 background : activeSettingsSection === section . id ? '#2563eb' : '#f3f4f6' ,
@@ -1036,6 +1059,14 @@ function App() {
10361059 onClose = { ( ) => setShowSettings ( false ) }
10371060 />
10381061 ) }
1062+
1063+ { showComplianceDashboard && (
1064+ < ComplianceDashboard onClose = { ( ) => setShowComplianceDashboard ( false ) } />
1065+ ) }
1066+
1067+ { showBackupSettings && (
1068+ < BackupSettings onClose = { ( ) => setShowBackupSettings ( false ) } />
1069+ ) }
10391070 </ div >
10401071 </ >
10411072 );
0 commit comments