feat: implement inventory and pantry management views with CRUD functionality and user-friendly interfaces

This commit is contained in:
Nils-Johan Gynther
2026-04-21 14:43:18 +02:00
parent 82c3dc3fee
commit 81b63b3fdb
14 changed files with 352 additions and 59 deletions
+8 -3
View File
@@ -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 (
<>