From f9df63a27d0959e57ad02c830aa10fed2149ae51 Mon Sep 17 00:00:00 2001 From: Firman Ramdhani <33869609+firmanramdhani@users.noreply.github.com> Date: Fri, 3 Jul 2026 15:51:00 +0700 Subject: [PATCH] feat: enhance HeaderLayout with user profile menu and notifications, update translations for common terms --- .../layouts/components/header.layout.tsx | 173 +++++++++++++++--- packages/core-i18n/src/locales/en/common.json | 12 +- packages/core-i18n/src/locales/id/common.json | 12 +- 3 files changed, 174 insertions(+), 23 deletions(-) diff --git a/apps/web/src/apps/modules/layouts/components/header.layout.tsx b/apps/web/src/apps/modules/layouts/components/header.layout.tsx index 69e822a..66ad44a 100644 --- a/apps/web/src/apps/modules/layouts/components/header.layout.tsx +++ b/apps/web/src/apps/modules/layouts/components/header.layout.tsx @@ -1,31 +1,162 @@ import { useTranslation } from '@repo/core-i18n'; -import { Burger, Group, Select, Text, useCoreAppShell } from '@repo/ui/components'; -import { Globe } from 'lucide-react'; +import { + Burger, + Group, + Select, + Text, + useCoreAppShell, + ActionIcon, + Indicator, + Menu, + Avatar, + UnstyledButton, + Box, +} from '@repo/ui/components'; +import { Globe, Bell, HelpCircle, Settings, User, Briefcase, LogOut, ChevronDown } from 'lucide-react'; import { AppStorageKey, secureStorage } from '../../../../core/storage/local'; +// Dummy user data for preview +const USER = { + name: 'Jane Doe', + email: 'jane.doe@enterprise.com', + role: 'System Administrator', + // avatar: null as string | null, // Simulated null for testing fallback + avatar: 'https://i.pravatar.cc/150?u=jane.doe', +}; + +const getInitials = (name: string): string => { + const parts = name.trim().split(/\s+/); + if (parts.length === 0) return ''; + if (parts.length === 1) return parts[0].substring(0, 2).toUpperCase(); + return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase(); +}; + export default function HeaderLayout() { - const { i18n } = useTranslation(); + const { i18n, t } = useTranslation(); const { mobileOpened, toggleMobile } = useCoreAppShell(); + return ( - - + + {/* 1. LEFT SECTION (Navigation & Context) */} + - LOGO - { + if (!val) return; + await i18n.changeLanguage(val); + await secureStorage.setItem(AppStorageKey.LOCALE, val); + }} + styles={{ input: { textAlign: 'right' } }} + /> + + + + + + + {t('common:application', { ns: 'common' })} + }> + {t('common:accountSettings', { ns: 'common' })} + + }>{t('common:myProfile', { ns: 'common' })} + + + + {t('common:workspace', { ns: 'common' })} + }> + {t('common:switchWorkspace', { ns: 'common' })} + + + + + + + }> + {t('common:signOut', { ns: 'common' })} + + + + ); diff --git a/packages/core-i18n/src/locales/en/common.json b/packages/core-i18n/src/locales/en/common.json index 8087839..498ac39 100644 --- a/packages/core-i18n/src/locales/en/common.json +++ b/packages/core-i18n/src/locales/en/common.json @@ -9,6 +9,16 @@ "delete": "Delete", "edit": "Edit", "duplicate": "Duplicate", - "view": "View" + "view": "View", + "preferences": "Preferences", + "language": "Language", + "application": "Application", + "accountSettings": "Account Settings", + "myProfile": "My Profile", + "workspace": "Workspace", + "switchWorkspace": "Switch Workspace", + "signOut": "Sign Out", + "english": "English", + "indonesian": "Indonesia" } } \ No newline at end of file diff --git a/packages/core-i18n/src/locales/id/common.json b/packages/core-i18n/src/locales/id/common.json index ff018cc..0fe528e 100644 --- a/packages/core-i18n/src/locales/id/common.json +++ b/packages/core-i18n/src/locales/id/common.json @@ -9,6 +9,16 @@ "delete": "Hapus", "edit": "Ubah", "duplicate": "Duplikat", - "view": "Lihat" + "view": "Lihat", + "preferences": "Preferensi", + "language": "Bahasa", + "application": "Aplikasi", + "accountSettings": "Pengaturan Akun", + "myProfile": "Profil Saya", + "workspace": "Ruang Kerja", + "switchWorkspace": "Ganti Ruang Kerja", + "signOut": "Keluar", + "english": "Inggris", + "indonesian": "Indonesia" } } \ No newline at end of file