Fix: Resolve Tailwind CSS build error and Audit Logs FK issue
This commit is contained in:
11
package-lock.json
generated
11
package-lock.json
generated
@@ -35,6 +35,7 @@
|
|||||||
"react-hook-form": "^7.67.0",
|
"react-hook-form": "^7.67.0",
|
||||||
"sonner": "^2.0.7",
|
"sonner": "^2.0.7",
|
||||||
"tailwind-merge": "^3.4.0",
|
"tailwind-merge": "^3.4.0",
|
||||||
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"zod": "^4.1.13"
|
"zod": "^4.1.13"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -8307,9 +8308,17 @@
|
|||||||
"version": "4.1.17",
|
"version": "4.1.17",
|
||||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.17.tgz",
|
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.17.tgz",
|
||||||
"integrity": "sha512-j9Ee2YjuQqYT9bbRTfTZht9W/ytp5H+jJpZKiYdP/bpnXARAuELt9ofP0lPnmHjbga7SNQIxdTAXCmtKVYjN+Q==",
|
"integrity": "sha512-j9Ee2YjuQqYT9bbRTfTZht9W/ytp5H+jJpZKiYdP/bpnXARAuELt9ofP0lPnmHjbga7SNQIxdTAXCmtKVYjN+Q==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"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": {
|
"node_modules/tapable": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz",
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
"react-hook-form": "^7.67.0",
|
"react-hook-form": "^7.67.0",
|
||||||
"sonner": "^2.0.7",
|
"sonner": "^2.0.7",
|
||||||
"tailwind-merge": "^3.4.0",
|
"tailwind-merge": "^3.4.0",
|
||||||
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"zod": "^4.1.13"
|
"zod": "^4.1.13"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -22,21 +22,43 @@ export default async function AuditLogsPage() {
|
|||||||
|
|
||||||
// Use admin client if available to bypass RLS for debugging
|
// Use admin client if available to bypass RLS for debugging
|
||||||
const client = supabaseAdmin || supabase
|
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
|
const { data: logs, error } = await client
|
||||||
.from('audit_logs')
|
.from('audit_logs')
|
||||||
.select(`
|
.select('*')
|
||||||
*,
|
|
||||||
profiles:user_id (full_name, role)
|
|
||||||
`)
|
|
||||||
.order('created_at', { ascending: false })
|
.order('created_at', { ascending: false })
|
||||||
.limit(50)
|
.limit(50)
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error("AuditLogsPage: Error fetching logs:", 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) => {
|
const getActionBadge = (action: string) => {
|
||||||
@@ -78,14 +100,14 @@ export default async function AuditLogsPage() {
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{logs?.length === 0 ? (
|
{logsWithProfiles.length === 0 ? (
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={4} className="text-center h-24 text-muted-foreground">
|
<TableCell colSpan={4} className="text-center h-24 text-muted-foreground">
|
||||||
Kayıt bulunamadı.
|
Kayıt bulunamadı.
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
) : (
|
) : (
|
||||||
logs?.map((log) => (
|
logsWithProfiles.map((log: any) => (
|
||||||
<TableRow key={log.id}>
|
<TableRow key={log.id}>
|
||||||
<TableCell className="font-medium">
|
<TableCell className="font-medium">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
|
|||||||
@@ -7,6 +7,44 @@
|
|||||||
@theme {
|
@theme {
|
||||||
--font-sans: var(--font-geist-sans);
|
--font-sans: var(--font-geist-sans);
|
||||||
--font-mono: var(--font-geist-mono);
|
--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 {
|
:root {
|
||||||
@@ -68,6 +106,7 @@
|
|||||||
* {
|
* {
|
||||||
@apply border-border outline-ring/50;
|
@apply border-border outline-ring/50;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
@apply bg-background text-foreground;
|
@apply bg-background text-foreground;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user