Fix: Resolve Tailwind CSS build error and Audit Logs FK issue

This commit is contained in:
2025-12-03 23:19:14 +03:00
parent b87f024b7d
commit 3107014dae
4 changed files with 83 additions and 12 deletions

11
package-lock.json generated
View File

@@ -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",

View File

@@ -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": {

View File

@@ -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<string, any> = {}
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() {
</TableRow>
</TableHeader>
<TableBody>
{logs?.length === 0 ? (
{logsWithProfiles.length === 0 ? (
<TableRow>
<TableCell colSpan={4} className="text-center h-24 text-muted-foreground">
Kayıt bulunamadı.
</TableCell>
</TableRow>
) : (
logs?.map((log) => (
logsWithProfiles.map((log: any) => (
<TableRow key={log.id}>
<TableCell className="font-medium">
<div className="flex items-center gap-2">

View File

@@ -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;
}