diff --git a/package-lock.json b/package-lock.json index f4636d5..ea158d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,6 +35,7 @@ "react-hook-form": "^7.67.0", "sonner": "^2.0.7", "tailwind-merge": "^3.4.0", + "tailwindcss-animate": "^1.0.7", "zod": "^4.1.13" }, "devDependencies": { @@ -8307,9 +8308,17 @@ "version": "4.1.17", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.17.tgz", "integrity": "sha512-j9Ee2YjuQqYT9bbRTfTZht9W/ytp5H+jJpZKiYdP/bpnXARAuELt9ofP0lPnmHjbga7SNQIxdTAXCmtKVYjN+Q==", - "dev": true, "license": "MIT" }, + "node_modules/tailwindcss-animate": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/tailwindcss-animate/-/tailwindcss-animate-1.0.7.tgz", + "integrity": "sha512-bl6mpH3T7I3UFxuvDEXLxy/VuFxBk5bbzplh7tXI68mwMokNYd1t9qPBHlnyTwfa4JGC4zP516I1hYYtQ/vspA==", + "license": "MIT", + "peerDependencies": { + "tailwindcss": ">=3.0.0 || insiders" + } + }, "node_modules/tapable": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz", diff --git a/package.json b/package.json index c75b609..e41eefd 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "react-hook-form": "^7.67.0", "sonner": "^2.0.7", "tailwind-merge": "^3.4.0", + "tailwindcss-animate": "^1.0.7", "zod": "^4.1.13" }, "devDependencies": { diff --git a/src/app/dashboard/settings/logs/page.tsx b/src/app/dashboard/settings/logs/page.tsx index 49af713..f30512d 100644 --- a/src/app/dashboard/settings/logs/page.tsx +++ b/src/app/dashboard/settings/logs/page.tsx @@ -22,21 +22,43 @@ export default async function AuditLogsPage() { // Use admin client if available to bypass RLS for debugging const client = supabaseAdmin || supabase - console.log("AuditLogsPage: Using admin client?", !!supabaseAdmin) + // Fetch logs without join first to avoid FK issues const { data: logs, error } = await client .from('audit_logs') - .select(` - *, - profiles:user_id (full_name, role) - `) + .select('*') .order('created_at', { ascending: false }) .limit(50) if (error) { console.error("AuditLogsPage: Error fetching logs:", error) - } else { - console.log("AuditLogsPage: Fetched logs count:", logs?.length) + } + + // Manually fetch profiles for the logs + let logsWithProfiles = [] + if (logs) { + const userIds = Array.from(new Set(logs.map((log: any) => log.user_id).filter(Boolean))) + + let profilesMap: Record = {} + + if (userIds.length > 0) { + const { data: profiles } = await client + .from('profiles') + .select('id, full_name, role') + .in('id', userIds) + + if (profiles) { + profilesMap = profiles.reduce((acc: any, profile: any) => { + acc[profile.id] = profile + return acc + }, {}) + } + } + + logsWithProfiles = logs.map((log: any) => ({ + ...log, + profiles: profilesMap[log.user_id] || null + })) } const getActionBadge = (action: string) => { @@ -78,14 +100,14 @@ export default async function AuditLogsPage() { - {logs?.length === 0 ? ( + {logsWithProfiles.length === 0 ? ( Kayıt bulunamadı. ) : ( - logs?.map((log) => ( + logsWithProfiles.map((log: any) => (
diff --git a/src/app/globals.css b/src/app/globals.css index fdb342a..d64e77e 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -7,6 +7,44 @@ @theme { --font-sans: var(--font-geist-sans); --font-mono: var(--font-geist-mono); + + --color-background: hsl(var(--background)); + --color-foreground: hsl(var(--foreground)); + + --color-card: hsl(var(--card)); + --color-card-foreground: hsl(var(--card-foreground)); + + --color-popover: hsl(var(--popover)); + --color-popover-foreground: hsl(var(--popover-foreground)); + + --color-primary: hsl(var(--primary)); + --color-primary-foreground: hsl(var(--primary-foreground)); + + --color-secondary: hsl(var(--secondary)); + --color-secondary-foreground: hsl(var(--secondary-foreground)); + + --color-muted: hsl(var(--muted)); + --color-muted-foreground: hsl(var(--muted-foreground)); + + --color-accent: hsl(var(--accent)); + --color-accent-foreground: hsl(var(--accent-foreground)); + + --color-destructive: hsl(var(--destructive)); + --color-destructive-foreground: hsl(var(--destructive-foreground)); + + --color-border: hsl(var(--border)); + --color-input: hsl(var(--input)); + --color-ring: hsl(var(--ring)); + + --color-chart-1: hsl(var(--chart-1)); + --color-chart-2: hsl(var(--chart-2)); + --color-chart-3: hsl(var(--chart-3)); + --color-chart-4: hsl(var(--chart-4)); + --color-chart-5: hsl(var(--chart-5)); + + --radius-lg: var(--radius); + --radius-md: calc(var(--radius) - 2px); + --radius-sm: calc(var(--radius) - 4px); } :root { @@ -68,6 +106,7 @@ * { @apply border-border outline-ring/50; } + body { @apply bg-background text-foreground; } @@ -78,7 +117,7 @@ .glass { @apply bg-white/70 dark:bg-black/70 backdrop-blur-lg border border-white/20 dark:border-white/10 shadow-xl; } - + .card-hover { @apply transition-all duration-300 hover:shadow-lg hover:-translate-y-1; } @@ -86,4 +125,4 @@ .gradient-text { @apply bg-clip-text text-transparent bg-gradient-to-r from-primary to-purple-600; } -} +} \ No newline at end of file