537a4f8ab6
- Added adminCreateUser endpoint and corresponding DTO for creating users. - Implemented deleteUser and resetPassword functionalities for admin users. - Introduced updateEmail functionality for admin users. - Updated UsersService to handle user creation, deletion, password reset, and email updates. - Modified UsersController to include new admin routes with appropriate role checks. - Refactored frontend navigation to link to user management under profile. - Created new profile tabs for user management and database management. - Developed AnvandareClient component for user management, including user creation, deletion, role changes, and password resets. - Added DatabsTab for managing product listings and merging duplicates. - Enhanced MinProfilTab for user profile management with form handling.
57 lines
1.5 KiB
TypeScript
57 lines
1.5 KiB
TypeScript
'use client';
|
|
|
|
import Link from 'next/link';
|
|
|
|
type Tab = { id: string; label: string };
|
|
|
|
const USER_TABS: Tab[] = [{ id: 'profil', label: 'Min profil' }];
|
|
const ADMIN_TABS: Tab[] = [
|
|
{ id: 'profil', label: 'Min profil' },
|
|
{ id: 'anvandare', label: '👥 Användare' },
|
|
{ id: 'databas', label: '🗄️ Databas' },
|
|
];
|
|
|
|
type Props = {
|
|
activeTab: string;
|
|
isAdmin: boolean;
|
|
};
|
|
|
|
export default function ProfileTabs({ activeTab, isAdmin }: Props) {
|
|
const tabs = isAdmin ? ADMIN_TABS : USER_TABS;
|
|
|
|
return (
|
|
<div
|
|
style={{
|
|
display: 'flex',
|
|
gap: '0.25rem',
|
|
borderBottom: '2px solid #e5e7eb',
|
|
marginBottom: '2rem',
|
|
}}
|
|
>
|
|
{tabs.map((tab) => {
|
|
const active = tab.id === activeTab;
|
|
return (
|
|
<Link
|
|
key={tab.id}
|
|
href={`/profil?tab=${tab.id}`}
|
|
style={{
|
|
padding: '0.6rem 1.2rem',
|
|
textDecoration: 'none',
|
|
fontWeight: active ? 600 : 400,
|
|
fontSize: '0.95rem',
|
|
color: active ? '#2563eb' : '#555',
|
|
borderBottom: active ? '2px solid #2563eb' : '2px solid transparent',
|
|
marginBottom: '-2px',
|
|
borderRadius: '4px 4px 0 0',
|
|
background: active ? '#eff6ff' : 'transparent',
|
|
transition: 'background 0.15s',
|
|
}}
|
|
>
|
|
{tab.label}
|
|
</Link>
|
|
);
|
|
})}
|
|
</div>
|
|
);
|
|
}
|