Merge pull request 'feat: institutional membership tiers and corrected member directory' (#16) from devin/1778358341-institutional-membership-tiers into master
All checks were successful
phoenix-deploy Deployed to explorer-live
Deploy Explorer Live / deploy (push) Successful in 2m58s
All checks were successful
phoenix-deploy Deployed to explorer-live
Deploy Explorer Live / deploy (push) Successful in 2m58s
This commit was merged in pull request #16.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import Link from 'next/link'
|
||||
import { usePathname, useRouter } from 'next/navigation'
|
||||
import { type ReactNode, useEffect, useId, useMemo, useRef, useState } from 'react'
|
||||
import { accessApi, type WalletAccessSession } from '@/services/api/access'
|
||||
import { accessApi, institutionalTierLabels, type WalletAccessSession } from '@/services/api/access'
|
||||
import BrandLockup from './BrandLockup'
|
||||
import HeaderCommandPalette, { type HeaderCommandItem } from './HeaderCommandPalette'
|
||||
import { useUiMode } from './UiModeContext'
|
||||
@@ -310,6 +310,9 @@ function SearchControl({
|
||||
}
|
||||
|
||||
function getAccessTier(walletSession: WalletAccessSession) {
|
||||
if (walletSession.institutionalTier) {
|
||||
return institutionalTierLabels[walletSession.institutionalTier] ?? walletSession.institutionalTier
|
||||
}
|
||||
const permissions = walletSession.permissions || []
|
||||
if (permissions.some((permission) => permission.startsWith('operator.'))) {
|
||||
return 'Operator Tier'
|
||||
@@ -326,10 +329,11 @@ function getAccessTier(walletSession: WalletAccessSession) {
|
||||
function getSessionSummary(walletSession: WalletAccessSession) {
|
||||
const permissionCount = walletSession.permissions?.length || 0
|
||||
const tierLabel = getAccessTier(walletSession)
|
||||
const institutionSuffix = walletSession.institutionName ? ` (${walletSession.institutionName})` : ''
|
||||
if (permissionCount > 0) {
|
||||
return `${tierLabel} · ${permissionCount} permission${permissionCount === 1 ? '' : 's'}`
|
||||
return `${tierLabel}${institutionSuffix} · ${permissionCount} permission${permissionCount === 1 ? '' : 's'}`
|
||||
}
|
||||
return `${tierLabel} · Explorer access active`
|
||||
return `${tierLabel}${institutionSuffix} · Explorer access active`
|
||||
}
|
||||
|
||||
function UiModeToggle({ mobile = false }: { mobile?: boolean }) {
|
||||
|
||||
@@ -21,12 +21,33 @@ export interface AccessSession {
|
||||
expires_at: string
|
||||
}
|
||||
|
||||
export type InstitutionalTier =
|
||||
| 'sovereign_central_bank'
|
||||
| 'global_family_office'
|
||||
| 'settlement_member'
|
||||
| 'infrastructure_operator'
|
||||
| 'oversight_judicial'
|
||||
| 'delegated_authority'
|
||||
| 'standards_body'
|
||||
|
||||
export const institutionalTierLabels: Record<InstitutionalTier, string> = {
|
||||
sovereign_central_bank: 'Sovereign Central Bank',
|
||||
global_family_office: 'Global Family Office',
|
||||
settlement_member: 'Settlement Member',
|
||||
infrastructure_operator: 'Infrastructure Operator',
|
||||
oversight_judicial: 'Oversight & Judicial',
|
||||
delegated_authority: 'Delegated Authority',
|
||||
standards_body: 'Standards Body',
|
||||
}
|
||||
|
||||
export interface WalletAccessSession {
|
||||
token: string
|
||||
expiresAt: string
|
||||
track: string
|
||||
permissions: string[]
|
||||
address: string
|
||||
institutionalTier?: InstitutionalTier
|
||||
institutionName?: string
|
||||
}
|
||||
|
||||
export interface AccessProduct {
|
||||
@@ -220,6 +241,8 @@ export const accessApi = {
|
||||
expires_at: string
|
||||
track: string
|
||||
permissions: string[]
|
||||
institutional_tier?: InstitutionalTier
|
||||
institution_name?: string
|
||||
}>(`${ACCESS_API_PREFIX}/auth/wallet`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ address, signature, nonce }),
|
||||
@@ -230,6 +253,8 @@ export const accessApi = {
|
||||
track: response.track,
|
||||
permissions: response.permissions || [],
|
||||
address,
|
||||
institutionalTier: response.institutional_tier,
|
||||
institutionName: response.institution_name,
|
||||
}
|
||||
setStoredWalletSession(session)
|
||||
return session
|
||||
|
||||
Reference in New Issue
Block a user