Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const BlockchainLedger = lazy(() => import('./pages/BlockchainLedger/BlockchainL
const Settlements = lazy(() => import('./pages/Settlements/Settlements'));
const Analytics = lazy(() => import('./pages/Analytics/Analytics'));
const RevenueAnalytics = lazy(() => import('./pages/Analytics/RevenueAnalytics'));
const ExceptionDashboard = lazy(() => import('./pages/dashboard/ExceptionDashboard'));
const CompanySettings = lazy(() => import('./pages/dashboard/Company/Settings/CompanySettings'));
const Settings = lazy(() => import('./pages/Settings/Settings'));
const HelpCenter = lazy(() => import('./pages/HelpCenter/HelpCenter'));
Expand Down Expand Up @@ -82,6 +83,7 @@ const router = createBrowserRouter([
{ path: '/dashboard/payments', element: S(<PaymentHistory />) },
{ path: '/dashboard/analytics', element: S(<Analytics />) },
{ path: '/dashboard/analytics/revenue', element: S(<RevenueAnalytics />) },
{ path: '/dashboard/analytics/exceptions', element: S(<ExceptionDashboard />) },
{ path: '/dashboard/team', element: S(<UserManagement />) },
{ path: '/dashboard/shipments/create', element: <CreateShipment /> },
{ path: '/dashboard/company-settings', element: S(<CompanySettings />) },
Expand Down
14 changes: 12 additions & 2 deletions frontend/src/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import { Link, useLocation } from 'react-router-dom';
import { Menu, X } from 'lucide-react';
import { useScrollSpy } from '../../hooks/useScrollSpy';
Expand All @@ -15,6 +15,7 @@ const navLinks = [

const Navbar: React.FC = () => {
const [isMenuOpen, setIsMenuOpen] = useState(false);
const [companyLogo, setCompanyLogo] = useState<string | null>(null);
const location = useLocation();

const isLandingPage = location.pathname === '/';
Expand All @@ -36,6 +37,11 @@ const Navbar: React.FC = () => {
}
};

useEffect(() => {
const storedLogo = window.localStorage.getItem('navin-company-logo');
setCompanyLogo(storedLogo ?? null);
}, [location.pathname]);

const handleLogoClick = () => setIsMenuOpen(false);

return (
Expand All @@ -47,7 +53,11 @@ const Navbar: React.FC = () => {
className="flex items-center gap-2 no-underline font-albert font-normal text-[30px] text-white transition-opacity duration-300 hover:opacity-80 absolute left-8"
onClick={handleLogoClick}
>
<img src="/images/logo.svg" alt="Navin Logo" className="w-[56.44px] h-[55.19px] object-contain" />
{companyLogo ? (
<img src={companyLogo} alt="Company logo" className="w-[56.44px] h-[55.19px] object-cover rounded-xl border border-white/10" />
) : (
<img src="/images/logo.svg" alt="Navin Logo" className="w-[56.44px] h-[55.19px] object-contain" />
)}
<span className="bg-white bg-clip-text text-transparent">Navin</span>
</Link>

Expand Down
28 changes: 28 additions & 0 deletions frontend/src/pages/Settings/CompanyProfile/CompanyProfile.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import CompanyProfile from './CompanyProfile';

describe('CompanyProfile', () => {
it('shows validation errors and unsaved state for contact details', async () => {
const user = userEvent.setup();
render(<CompanyProfile />);

expect(screen.getByText('Company Profile')).toBeInTheDocument();

const emailInput = screen.getByLabelText(/email/i);
const phoneInput = screen.getByLabelText(/phone/i);
const websiteInput = screen.getByLabelText(/website/i);

await user.type(emailInput, 'not-an-email');
await user.type(phoneInput, 'abc');
await user.type(websiteInput, 'not-a-url');

expect(screen.getByLabelText(/unsaved changes/i)).toBeInTheDocument();

await user.click(screen.getByRole('button', { name: /save contact details/i }));

expect(await screen.findByText(/please enter a valid email address/i)).toBeInTheDocument();
expect(screen.getByText(/please enter a valid phone number/i)).toBeInTheDocument();
expect(screen.getByText(/please enter a valid website url/i)).toBeInTheDocument();
});
});
Loading
Loading