Skip to content

Commit

Permalink
refactor(CompanyLogo): optimize navigation with Next.js Link component (
Browse files Browse the repository at this point in the history
#560)

* refactor(CompanyLogo): optimize navigation with Next.js Link component

- Replace window.location.href with Next.js Link for client-side navigation
- Improve page transition performance with built-in prefetching
- Maintain application state during navigation
- Remove manual click handler in favor of declarative routing

Closes #558

* fix: restore padding to CompanyLogo component
  • Loading branch information
SinghAstra authored Nov 1, 2024
1 parent a8d6364 commit 4142290
Showing 1 changed file with 20 additions and 23 deletions.
43 changes: 20 additions & 23 deletions src/layouts/header.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,42 @@
'use client';
import { MobileNav } from '@/layouts/mobile-nav';
import {
adminNavbar,
nonUserNavbar,
userNavbar,
} from '@/lib/constant/app.constant';
import { signOut, useSession } from 'next-auth/react';
import Link from 'next/link';
import { NavItem } from '@/components/navitem';
import Image from 'next/image';
import { Skeleton } from '@/components/ui/skeleton';
import { Moon, Sun } from 'lucide-react';
import { useTheme } from 'next-themes';
import { ADMIN_ROLE, HR_ROLE } from '@/config/app.config';
import { useEffect, useState } from 'react';
import { Button } from '@/components/ui/button';
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
import { useRouter } from 'next/navigation';
import { getNameInitials } from '@/lib/utils';
import { Button } from '@/components/ui/button';
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
import { Skeleton } from '@/components/ui/skeleton';
import { ADMIN_ROLE, HR_ROLE } from '@/config/app.config';
import { MobileNav } from '@/layouts/mobile-nav';
import {
adminNavbar,
nonUserNavbar,
userNavbar,
} from '@/lib/constant/app.constant';
import icons from '@/lib/icons';
import { getNameInitials } from '@/lib/utils';
import { Moon, Sun } from 'lucide-react';
import { signOut, useSession } from 'next-auth/react';
import { useTheme } from 'next-themes';
import Image from 'next/image';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { useEffect, useState } from 'react';

export const CompanyLogo = () => {
return (
<div
className="flex items-center gap-2 cursor-pointer"
onClick={() => {
window.location.href = '/';
}}
>
<div className="flex items-center gap-2">
<Image
src={'/main.svg'}
alt="100xJobs logo"
width={30}
height={30}
className="rounded"
priority
/>
<h3 className="text-xl font-bold">
100x<span className="text-blue-700">Jobs</span>
Expand Down

0 comments on commit 4142290

Please sign in to comment.