Some checks failed
tests / ci (pull_request) Has been cancelled
- Moved profile and security settings from the general settings route to a dedicated admin settings route. - Created new components and pages for managing user profile and security settings. - Updated user menu to link to the new admin settings pages. - Removed old settings pages and routes that are no longer in use. - Added tests for profile and security settings functionality.
56 lines
1.6 KiB
TypeScript
56 lines
1.6 KiB
TypeScript
import { Link, router } from '@inertiajs/react';
|
|
import { LogOut, Settings } from 'lucide-react';
|
|
import {
|
|
DropdownMenuGroup,
|
|
DropdownMenuItem,
|
|
DropdownMenuSeparator,
|
|
} from '@/components/ui/dropdown-menu';
|
|
import { useMobileNavigation } from '@/hooks/use-mobile-navigation';
|
|
import { logout } from '@/routes';
|
|
import { edit } from '@/routes/admin/settings/profile';
|
|
import type { User } from '@/types';
|
|
|
|
type Props = {
|
|
user: User;
|
|
};
|
|
|
|
export function UserMenuContent({ user }: Props) {
|
|
const cleanup = useMobileNavigation();
|
|
|
|
const handleLogout = () => {
|
|
cleanup();
|
|
router.flushAll();
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<DropdownMenuGroup>
|
|
<DropdownMenuItem asChild>
|
|
<Link
|
|
className="block w-full cursor-pointer"
|
|
href={edit()}
|
|
prefetch
|
|
onClick={cleanup}
|
|
>
|
|
<Settings className="mr-2" />
|
|
Pengaturan
|
|
</Link>
|
|
</DropdownMenuItem>
|
|
</DropdownMenuGroup>
|
|
<DropdownMenuSeparator />
|
|
<DropdownMenuItem asChild>
|
|
<Link
|
|
className="block w-full cursor-pointer"
|
|
href={logout()}
|
|
as="button"
|
|
onClick={handleLogout}
|
|
data-test="logout-button"
|
|
>
|
|
<LogOut className="mr-2" />
|
|
Keluar
|
|
</Link>
|
|
</DropdownMenuItem>
|
|
</>
|
|
);
|
|
}
|