feat: implement inventory and pantry management views with CRUD functionality and user-friendly interfaces
This commit is contained in:
@@ -16,7 +16,7 @@ export default async function ProfilPage({ searchParams }: Props) {
|
||||
|
||||
// DatabsTab och AnvandareTab laddas dynamiskt för att hålla page.tsx tunn
|
||||
let TabContent: React.ComponentType;
|
||||
if (tab === 'databas' && isAdmin) {
|
||||
if (tab === 'databas') {
|
||||
const { default: DatabsTab } = await import('./tabs/DatabsTab');
|
||||
TabContent = DatabsTab;
|
||||
} else if (tab === 'anvandare' && isAdmin) {
|
||||
@@ -32,8 +32,13 @@ export default async function ProfilPage({ searchParams }: Props) {
|
||||
TabContent = MinProfilTab;
|
||||
}
|
||||
|
||||
const adminTabs = ['databas', 'anvandare', 'forslag', 'ai'];
|
||||
const activeTab = isAdmin && adminTabs.includes(tab) ? tab : 'profil';
|
||||
const adminTabs = ['anvandare', 'forslag', 'ai'];
|
||||
const userTabs = ['databas'];
|
||||
const activeTab =
|
||||
(isAdmin && (adminTabs.includes(tab) || userTabs.includes(tab))) ||
|
||||
userTabs.includes(tab)
|
||||
? tab
|
||||
: 'profil';
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user