Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added toaster #439

Merged
merged 2 commits into from
Oct 3, 2024
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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
},
"devDependencies": {
"@types/bcryptjs": "^2.4.6",
"@types/node": "^20",
"@types/node": "^20.16.10",
"@types/nodemailer": "^6.4.16",
"@types/react": "^18",
"@types/react-dom": "^18",
Expand All @@ -97,6 +97,6 @@
"prisma": "^5.18.0",
"tailwindcss": "^3.4.1",
"ts-node": "^10.9.2",
"typescript": "^5"
"typescript": "^5.6.2"
}
}
}
17 changes: 15 additions & 2 deletions src/components/profile-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import {
import { signOut } from 'next-auth/react';
import Link from 'next/link';
import Icon from './ui/icon';
import { toast } from './ui/use-toast';
import { useToast } from '@/components/ui/use-toast'; // Add this import
import APP_PATHS from '@/config/path.config';
import { useRouter } from 'next/navigation';

export function ProfileMenu() {
const router = useRouter();
const { toast } = useToast(); // Add this line

const handleSignout = async () => {
try {
Expand All @@ -31,7 +32,7 @@ export function ProfileMenu() {
}
toast({
title: 'Logout successful!',
variant: 'success',
variant: 'default', // Change this to match your toaster's variants
});
const redirect = APP_PATHS.HOME;
router.push(redirect);
Expand All @@ -42,6 +43,15 @@ export function ProfileMenu() {
});
}
};

const handleManageProfile = () => {
toast({
title: 'Coming soon!',
description: 'This feature is not yet available.',
duration: 2000,
});
};

return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
Expand All @@ -55,6 +65,9 @@ export function ProfileMenu() {
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem onClick={handleManageProfile}>
Manage Profile
</DropdownMenuItem>
<DropdownMenuItem asChild>
<Link href={'/create'}>Create Job</Link>
</DropdownMenuItem>
Expand Down
Loading