import React, { useState } from 'react'; import { View, Text, StyleSheet, ScrollView, TouchableOpacity, Switch, Pressable, } from 'react-native'; import { UX4GColors } from '../foundation/colors'; import { useUx4gTheme } from '../theme/Ux4gThemeContext'; import { Ux4gIcons } from '../foundation/icons'; import { Ux4gButton } from '../components/button'; import { Ux4gSideMenu, Ux4gSideMenuItem, Ux4gSideMenuVariant, } from '../components/side-menu'; import { Ux4gCard } from '../components/card'; import { Ux4gBadge } from '../components/badge'; interface VariantInfo { id: Ux4gSideMenuVariant; title: string; badge: string; description: string; highlights: string[]; } const VARIANTS: VariantInfo[] = [ { id: 'citizen', title: 'Citizen Profile (Variant 1)', badge: 'User Profile & Branding', description: 'Features a user identity header with initials avatar ("RK"), citizen role tag, flat quick navigation with alerts badge, and bottom Government of India branding with sign out action.', highlights: [ 'Circular avatar initials ("RK") with user role ("Citizen")', 'Notifications item with purple count badge (3)', 'Bottom Revenue Department & Government of India branding', 'Sign out footer action', ], }, { id: 'department-services', title: 'Department Services + Action Card (Variant 2)', badge: 'Hierarchical & Callout', description: 'Government departmental drawer with hierarchical nested sub-items (Applications tree with connector line), workspace sections, and an actionable peach alert card ("Verify your Aadhaar").', highlights: [ 'Emblem header with division subtitle ("Kanpur division")', 'SERVICES & WORKSPACE sections with nested sub-items', 'Action Required Callout Card with "Verify now" button', 'Priority applications & Archive navigation', ], }, { id: 'department-switcher', title: 'Department Switcher (Variant 3)', badge: 'Multi-Tenant Context', description: 'Department selector allowing citizens or officers to switch between government departments with avatar badges ("RD", "TD"), active checkmark, and pending applications status pills.', highlights: [ 'Header: "Departments - Choose a department to work in."', 'Square avatar badges ("RD", "TD") with subtitle links', 'Status pill: "3 applications pending" in peach highlight', 'Footer actions: "+ Request department access", "Settings", "Help & support"', ], }, { id: 'mailbox', title: 'User Mailbox & Workspace (Variant 4)', badge: 'Inbox & Folders', description: 'Mailbox and work items drawer displaying user email header ("ramesh.kumar@gov.in"), inbox item badge (9), folder hierarchy, "Customize inbox" action link, and Kanpur division branding.', highlights: [ 'User email identity header', 'MAILBOX & FOLDERS categorized sections with active inbox state', '"Customize inbox" purple action link', 'Footer with "Inbox settings" and division branding', ], }, { id: 'profile-summary', title: 'Centered Profile Summary (Variant 5)', badge: 'Large Profile & Stats', description: 'Citizen summary view with large 58dp centered avatar, role badge, application statistics ("12 applications · 3 actions required"), and "View profile" action button with categorized account links.', highlights: [ 'Large centered avatar circle with user name & citizen title', 'Summary metrics: "12 applications · 3 actions required"', 'Outline "View profile" action button', 'ACCOUNT, APPLICATIONS & SUPPORT categorized navigation', ], }, { id: 'standard', title: 'Standard Government Portal', badge: 'Default System', description: 'Standard UX4G government navigation with Ashoka emblem, instant search bar filter, expandable accordion sections, and Sign out footer.', highlights: [ 'National Emblem branding & real-time search filter', 'Expandable multi-level accordion tree', 'Dark mode and Light mode automatic styling', ], }, ]; export const SideMenuShowcase: React.FC = () => { const theme = useUx4gTheme(); const { isDark } = theme; // Selected variant state const [activeVariant, setActiveVariant] = useState('citizen'); // Drawer state const [isDrawerOpen, setIsDrawerOpen] = useState(false); const [drawerPosition, setDrawerPosition] = useState<'left' | 'right'>('left'); const [selectedKey, setSelectedKey] = useState('my-applications'); const [showSearch, setShowSearch] = useState(false); const [activeScreenTitle, setActiveScreenTitle] = useState('My applications'); const [lastActionMessage, setLastActionMessage] = useState(null); const currentVariantInfo = VARIANTS.find((v) => v.id === activeVariant) || VARIANTS[0]; const handleSelectVariant = (v: Ux4gSideMenuVariant) => { setActiveVariant(v); if (v === 'citizen') { setSelectedKey('my-applications'); setActiveScreenTitle('My applications'); setShowSearch(false); } else if (v === 'department-services') { setSelectedKey('dashboard'); setActiveScreenTitle('Dashboard'); setShowSearch(false); } else if (v === 'department-switcher') { setSelectedKey('dept-revenue'); setActiveScreenTitle('Revenue Department'); setShowSearch(false); } else if (v === 'mailbox') { setSelectedKey('inbox'); setActiveScreenTitle('Inbox'); setShowSearch(false); } else if (v === 'profile-summary') { setSelectedKey('profile-settings'); setActiveScreenTitle('Profile & settings'); setShowSearch(false); } else { setSelectedKey('dashboard'); setActiveScreenTitle('Dashboard'); setShowSearch(true); } }; const handleOpenDrawer = (pos: 'left' | 'right') => { setDrawerPosition(pos); setIsDrawerOpen(true); }; const handleItemPress = (item: Ux4gSideMenuItem) => { setSelectedKey(item.key); setActiveScreenTitle(item.label); setLastActionMessage(`Selected menu item: "${item.label}" (key: ${item.key})`); setIsDrawerOpen(false); }; const handleSignOut = () => { setIsDrawerOpen(false); setActiveScreenTitle('Signed Out'); setLastActionMessage('Sign out action triggered.'); }; const handleActionCardPress = () => { setIsDrawerOpen(false); setActiveScreenTitle('Identity Verification'); setLastActionMessage('Action Card button "Verify now" clicked.'); }; const handleViewProfilePress = () => { setIsDrawerOpen(false); setActiveScreenTitle('User Profile Details'); setLastActionMessage('"View profile" button clicked.'); }; return ( {/* Title Header */} Side Menu / Navigation Drawer Comprehensive government navigation drawer supporting Citizen Profile, Department Services with Action Callouts, Department Switcher, User Mailbox, and Centered Profile Summary variants with fully responsive layout. {/* ─── VARIANT SELECTOR PILLS ────────────────────────────────────────── */} Select Design Variant: {VARIANTS.map((v) => { const isSelected = activeVariant === v.id; return ( handleSelectVariant(v.id)} style={[ styles.variantPill, { backgroundColor: isSelected ? UX4GColors.primary600 : isDark ? UX4GColors.neutral800 : UX4GColors.neutral0, borderColor: isSelected ? UX4GColors.primary600 : isDark ? UX4GColors.neutral700 : UX4GColors.neutral300, }, ]} > {v.title} ); })} {/* ─── VARIANT DETAILS CARD ─────────────────────────────────────────── */} {currentVariantInfo.title} {currentVariantInfo.description} {/* Highlight Bullets */} {currentVariantInfo.highlights.map((h, i) => ( {h} ))} {/* Live Triggers */} handleOpenDrawer('left')} style={styles.actionBtn} /> handleOpenDrawer('right')} style={styles.actionBtn} /> {/* Options Toggles */} Show Search Input: {/* ─── SIMULATED MOBILE SCREEN PREVIEW ──────────────────────────────── */} {/* Mock Top App Bar */} handleOpenDrawer('left')} style={styles.hamburgerBtn} accessibilityLabel="Open Navigation Menu" > National Citizen Portal Active Variant: {activeVariant} handleOpenDrawer('right')} style={styles.hamburgerBtn} accessibilityLabel="Open Right Drawer" > {/* Mock Screen Content Body */} {activeScreenTitle} Tap the menu icon (top-left) or profile icon (top-right) to preview the drawer matching the exact UX4G visual design specifications. {lastActionMessage && ( ✓ {lastActionMessage} )} {/* Quick Info Dashboard Tiles */} 12 Applications 48 Approved 3 Pending {/* ─── LIVE UX4G SIDE MENU DRAWER COMPONENT ─────────────────────────── */} setIsDrawerOpen(false)} variant={activeVariant} position={drawerPosition} selectedKey={selectedKey} onItemPress={handleItemPress} showSearch={showSearch} onSignOut={handleSignOut} actionCard={ activeVariant === 'department-services' ? { tag: 'ACTION REQUIRED', title: 'Verify your Aadhaar', description: 'Complete identity verification to continue.', buttonText: 'Verify now', onButtonPress: handleActionCardPress, } : undefined } profileSummary={ activeVariant === 'profile-summary' ? { name: 'Ramesh Kumar', role: 'Citizen', metaInfo: '12 applications · 3 actions required', avatarText: 'RK', actionLabel: 'View profile', onActionPress: handleViewProfilePress, } : undefined } /> ); }; const styles = StyleSheet.create({ container: { flex: 1, }, contentContainer: { padding: 16, paddingBottom: 40, }, header: { marginBottom: 16, }, titleRow: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', flexWrap: 'wrap', gap: 8, marginBottom: 6, }, title: { fontSize: 24, fontWeight: '700', }, subtitle: { fontSize: 14, lineHeight: 20, }, selectorSection: { marginBottom: 16, }, sectionHeading: { fontSize: 14, fontWeight: '700', marginBottom: 10, }, pillsScroll: { gap: 8, paddingBottom: 4, }, variantPill: { borderWidth: 1, borderRadius: 20, paddingHorizontal: 14, paddingVertical: 8, alignItems: 'center', justifyContent: 'center', }, variantPillText: { fontSize: 13, }, card: { padding: 16, borderRadius: 12, marginBottom: 20, }, cardHeaderRow: { flexDirection: 'row', alignItems: 'flex-start', justifyContent: 'space-between', marginBottom: 12, gap: 12, }, cardTitleGroup: { flex: 1, }, cardTitle: { fontSize: 16, fontWeight: '700', marginBottom: 4, }, cardDesc: { fontSize: 13, lineHeight: 18, }, highlightsBox: { backgroundColor: 'rgba(0,0,0,0.02)', borderRadius: 8, padding: 12, marginBottom: 16, gap: 8, }, highlightRow: { flexDirection: 'row', alignItems: 'center', gap: 8, }, bulletDot: { width: 6, height: 6, borderRadius: 3, }, highlightText: { fontSize: 12, flex: 1, lineHeight: 16, }, buttonRow: { flexDirection: 'row', flexWrap: 'wrap', gap: 10, marginBottom: 14, }, actionBtn: { flex: 1, minWidth: 140, }, toggleRow: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingTop: 12, borderTopWidth: 1, borderTopColor: 'rgba(0,0,0,0.06)', }, toggleLabel: { fontSize: 14, fontWeight: '500', }, screenMockup: { borderWidth: 1, borderRadius: 16, overflow: 'hidden', minHeight: 360, shadowColor: '#000', shadowOffset: { width: 0, height: 4 }, shadowOpacity: 0.08, shadowRadius: 10, elevation: 3, }, mockAppBar: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 14, paddingVertical: 12, borderBottomWidth: 1, }, hamburgerBtn: { padding: 6, borderRadius: 6, }, mockAppTitleGroup: { alignItems: 'center', }, mockAppTitle: { fontSize: 15, fontWeight: '700', }, mockAppSubtitle: { fontSize: 11, marginTop: 1, }, mockScreenBody: { padding: 16, }, activeStatusBadgeRow: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: 8, }, activeScreenHeading: { fontSize: 20, fontWeight: '700', }, screenInfoText: { fontSize: 13, lineHeight: 19, marginBottom: 14, }, feedbackToastBox: { borderWidth: 1, borderRadius: 8, paddingHorizontal: 12, paddingVertical: 8, marginBottom: 14, }, feedbackToastText: { fontSize: 12, fontWeight: '600', }, tilesGrid: { flexDirection: 'row', gap: 10, }, infoTile: { flex: 1, padding: 12, borderRadius: 10, alignItems: 'center', }, tileNum: { fontSize: 22, fontWeight: '800', marginBottom: 2, }, tileLabel: { fontSize: 11, fontWeight: '600', }, });