From cdd76685603bf0884161350eef3e0ef580e9abf5 Mon Sep 17 00:00:00 2001 From: gulimabr Date: Thu, 4 Dec 2025 16:11:58 -0300 Subject: [PATCH] Normalized header layout after dashboard revision --- frontend/src/i18n/locales/en/common.json | 3 +- frontend/src/i18n/locales/pt/common.json | 3 +- frontend/src/pages/RequirementDetailPage.tsx | 96 ++++++++++++++------ frontend/src/pages/RequirementsPage.tsx | 89 ++++++++++++------ 4 files changed, 131 insertions(+), 60 deletions(-) diff --git a/frontend/src/i18n/locales/en/common.json b/frontend/src/i18n/locales/en/common.json index a4c013d..b55f049 100644 --- a/frontend/src/i18n/locales/en/common.json +++ b/frontend/src/i18n/locales/en/common.json @@ -45,5 +45,6 @@ "projects": "Projects", "project": "Project", "selectLanguage": "Select language", - "logout": "Logout" + "logout": "Logout", + "admin": "Admin" } diff --git a/frontend/src/i18n/locales/pt/common.json b/frontend/src/i18n/locales/pt/common.json index f9fb7f8..759fafe 100644 --- a/frontend/src/i18n/locales/pt/common.json +++ b/frontend/src/i18n/locales/pt/common.json @@ -45,5 +45,6 @@ "projects": "Projetos", "project": "Projeto", "selectLanguage": "Selecionar idioma", - "logout": "Sair" + "logout": "Sair", + "admin": "Admin" } diff --git a/frontend/src/pages/RequirementDetailPage.tsx b/frontend/src/pages/RequirementDetailPage.tsx index 0df6481..5b8eea2 100644 --- a/frontend/src/pages/RequirementDetailPage.tsx +++ b/frontend/src/pages/RequirementDetailPage.tsx @@ -1,8 +1,9 @@ import { useState, useEffect } from 'react' import { useTranslation } from 'react-i18next' import { useAuth, useProject } from '@/hooks' -import { useParams, Link } from 'react-router-dom' +import { useParams, Link, useNavigate } from 'react-router-dom' import { requirementService, validationService, relationshipService, commentService, tagService, priorityService, groupService, requirementStatusService } from '@/services' +import { LanguageSelector } from '@/components' import type { Requirement } from '@/services/requirementService' import type { RelationshipType, RequirementLink, RequirementSearchResult } from '@/services/relationshipService' import type { Tag } from '@/services/tagService' @@ -46,6 +47,7 @@ export default function RequirementDetailPage() { const { user, logout, isAuditor } = useAuth() const { currentProject } = useProject() const { id } = useParams<{ id: string }>() + const navigate = useNavigate() const [activeTab, setActiveTab] = useState('description') const [requirement, setRequirement] = useState(null) const [loading, setLoading] = useState(true) @@ -1650,46 +1652,82 @@ export default function RequirementDetailPage() { return (
- {/* Header */} -
-

- {t('pageTitle')} -

-
- {/* Top Bar */} -
+
{/* Breadcrumb */} -
+
{tCommon('projects')} - » + + + {currentProject?.project_name || tCommon('project')} - » + + + {t('breadcrumb.search')} - » + + + {t('breadcrumb.details')} {tagCode}
- {/* User Info */} -
-
- - - - - {user?.full_name || user?.preferred_username || tCommon('user')}{' '} - ({user?.role || tCommon('user')}) - + {/* Right side utilities */} +
+ {/* Language Selector */} + + + {/* Divider */} +
+ + {/* Admin Panel Button - Only visible for admins (role_id=3) */} + {user?.role_id === 3 && ( + + )} + + {/* User Info */} +
+
+
+ + + +
+
+

+ {user?.full_name || user?.preferred_username || tCommon('user')} +

+

{user?.role || tCommon('user').toLowerCase()}

+
+
+
-
+
+ + {/* Page Title */} +
+

+ {t('pageTitle')} +

{/* Main Content */} diff --git a/frontend/src/pages/RequirementsPage.tsx b/frontend/src/pages/RequirementsPage.tsx index 8dac46b..41f61d8 100644 --- a/frontend/src/pages/RequirementsPage.tsx +++ b/frontend/src/pages/RequirementsPage.tsx @@ -414,47 +414,78 @@ export default function RequirementsPage() { return (
- {/* Header */} -
-

- {t('header.title')} -

-
- {/* Top Bar */} -
+
{/* Breadcrumb */} -
+
{t('breadcrumb.projects')} - » + + + {currentProject.project_name} - » + + + {t('breadcrumb.searchRequirements')}
- {/* Language Selector */} - + {/* Right side utilities */} +
+ {/* Language Selector */} + - {/* User Info */} -
-
- - - - - {user?.full_name || user?.preferred_username || tCommon('user')}{' '} - ({user?.role || tCommon('user').toLowerCase()}) - + {/* Divider */} +
+ + {/* Admin Panel Button - Only visible for admins (role_id=3) */} + {user?.role_id === 3 && ( + + )} + + {/* User Info */} +
+
+
+ + + +
+
+

+ {user?.full_name || user?.preferred_username || tCommon('user')} +

+

{user?.role || tCommon('user').toLowerCase()}

+
+
+
-
+
+ + {/* Page Title */} +
+

+ {t('header.title')} +

{/* Main Content */}