Skip to content

Commit c9f8ace

Browse files
committed
Refactor Navbar component to simplify country display logic
- Removed the country display logic from the Navbar component, streamlining the rendering process. - Updated the Navbar header to eliminate country-specific information, focusing on the application name and description.
1 parent 40c4dc0 commit c9f8ace

1 file changed

Lines changed: 1 addition & 24 deletions

File tree

src/components/Layout/Navbar.tsx

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,11 @@ import React from 'react';
22
import { Link, useLocation } from 'react-router-dom';
33
import { IconCheck, IconChartBar, IconUsers } from '@tabler/icons-react';
44
import { useAuth } from '../Auth/AuthContext';
5-
import { getCountryFlag, getCountryName } from '../../utils/countryMetadata';
65

76
const Navbar: React.FC = () => {
87
const { user, logout } = useAuth();
98
const location = useLocation();
109

11-
// Determine country display for navbar
12-
const getCountryDisplay = () => {
13-
if (!user?.country || user.country.length === 0) {
14-
// Admin with access to all countries
15-
return { flag: '', name: '' };
16-
}
17-
18-
if (user.country.length === 1) {
19-
// Single country user
20-
const countryCode = user.country[0];
21-
return {
22-
flag: getCountryFlag(countryCode),
23-
name: getCountryName(countryCode)
24-
};
25-
}
26-
27-
// Multi-country user
28-
return { flag: '', name: 'Multi-Country' };
29-
};
30-
31-
const countryDisplay = getCountryDisplay();
32-
3310
return (
3411
<header className="navbar navbar-expand-md navbar-light d-print-none">
3512
<div className="container-xl">
@@ -38,7 +15,7 @@ const Navbar: React.FC = () => {
3815
</button>
3916
<h1 className="navbar-brand navbar-brand-autodark d-none-navbar-horizontal pe-0 pe-md-3">
4017
<Link to="/">
41-
{countryDisplay.flag && `${countryDisplay.flag} `}PESKAS{countryDisplay.name && ` | ${countryDisplay.name}`} | <span className="text-muted">validation portal</span>
18+
PESKAS | <span className="text-muted">validation portal</span>
4219
</Link>
4320
</h1>
4421
<div className="navbar-nav flex-row order-md-last">

0 commit comments

Comments
 (0)