mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-11 17:26:32 +02:00
chore(cleanup): remove unused imports, variables and fix missing hook dependencies
This commit is contained in:
1 parent
c1bd0ae097
commit
86240f4b46
6 files changed
+11
-17
No files matched your search
+1
-1
@@ -6,7 +6,7 @@ import { sql } from "drizzle-orm";
|
|||||||
async function diagnose() {
|
async function diagnose() {
|
||||||
console.log("Checking DB connection...");
|
console.log("Checking DB connection...");
|
||||||
try {
|
try {
|
||||||
const result = await db.execute(sql`SELECT 1`);
|
await db.execute(sql`SELECT 1`);
|
||||||
console.log("DB Connection OK.");
|
console.log("DB Connection OK.");
|
||||||
|
|
||||||
console.log("Checking table 'ventes_produits'...");
|
console.log("Checking table 'ventes_produits'...");
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { getFournisseurs, getGridData, getMagasins } from "@/features/grid/actions";
|
import { getFournisseurs, getGridData, getMagasins } from "@/features/grid/actions";
|
||||||
import { GridClient } from "@/features/grid/components/grid-client";
|
import { GridClient } from "@/features/grid/components/grid-client";
|
||||||
import { SupplierSelectionLanding } from "@/features/grid/components/supplier-selection-landing";
|
import { SupplierSelectionLanding } from "@/features/grid/components/supplier-selection-landing";
|
||||||
import { Suspense } from "react";
|
|
||||||
|
|
||||||
interface GridPageProps {
|
interface GridPageProps {
|
||||||
searchParams: Promise<{ fournisseur?: string; magasin?: string }>;
|
searchParams: Promise<{ fournisseur?: string; magasin?: string }>;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState, useCallback } from "react";
|
import { useState, useCallback } from "react";
|
||||||
import { Save, Eye, EyeOff, CheckCircle, AlertCircle, Loader2, RefreshCw, Sun, Moon, BarChart3, RotateCcw } from "lucide-react";
|
import { Save, Eye, EyeOff, CheckCircle, AlertCircle, Loader2, RefreshCw, Sun, Moon, RotateCcw } from "lucide-react";
|
||||||
import { useTheme } from "next-themes";
|
import { useTheme } from "next-themes";
|
||||||
import { useGridStore } from "@/features/grid/store/use-grid-store";
|
import { useGridStore } from "@/features/grid/store/use-grid-store";
|
||||||
import { useScoreSettingsStore } from "@/features/score/store/use-score-settings-store";
|
import { useScoreSettingsStore } from "@/features/score/store/use-score-settings-store";
|
||||||
@@ -71,11 +71,6 @@ export default function SettingsPage() {
|
|||||||
getDatabaseUrl
|
getDatabaseUrl
|
||||||
} = useDbSettingsStore();
|
} = useDbSettingsStore();
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setIsMounted(true);
|
|
||||||
reloadFromServer();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const fetchModels = useCallback(async (key: string) => {
|
const fetchModels = useCallback(async (key: string) => {
|
||||||
if (!key.trim()) return;
|
if (!key.trim()) return;
|
||||||
setModelsStatus("loading");
|
setModelsStatus("loading");
|
||||||
@@ -90,7 +85,7 @@ export default function SettingsPage() {
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const reloadFromServer = async () => {
|
const reloadFromServer = useCallback(async () => {
|
||||||
const config = await getSavedDatabaseConfig();
|
const config = await getSavedDatabaseConfig();
|
||||||
if (config) {
|
if (config) {
|
||||||
if (config.url) {
|
if (config.url) {
|
||||||
@@ -115,7 +110,12 @@ export default function SettingsPage() {
|
|||||||
setSelectedModel(config.openRouterModel);
|
setSelectedModel(config.openRouterModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}, [fetchModels, setApiKey, setDatabase, setHost, setPassword, setPort, setSelectedModel, setSsl, setUser]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setIsMounted(true);
|
||||||
|
reloadFromServer();
|
||||||
|
}, [reloadFromServer]);
|
||||||
|
|
||||||
const testDb = async () => {
|
const testDb = async () => {
|
||||||
setDbStatus("testing");
|
setDbStatus("testing");
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { db } from "@/db";
|
import { db } from "@/db";
|
||||||
import { ventesProduits } from "@/db/schema";
|
import { ventesProduits } from "@/db/schema";
|
||||||
import { eq, and, ne, sql } from "drizzle-orm";
|
import { eq, and, ne } from "drizzle-orm";
|
||||||
import type { ProductRow, GammeCode } from "@/types/grid";
|
import type { ProductRow, GammeCode } from "@/types/grid";
|
||||||
import { computeProductScores } from "@/lib/score-engine";
|
import { computeProductScores } from "@/lib/score-engine";
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,6 @@ interface FinancialCellProps {
|
|||||||
tauxMarge: number;
|
tauxMarge: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMarginColor(pct: number): string {
|
|
||||||
if (pct >= 45) return "#10b981"; // emerald-500
|
|
||||||
if (pct >= 20) return "#f59e0b"; // amber-500
|
|
||||||
return "#f43f5e"; // rose-500
|
|
||||||
}
|
|
||||||
|
|
||||||
export function FinancialCell({ totalCa, totalMarge, tauxMarge }: FinancialCellProps) {
|
export function FinancialCell({ totalCa, totalMarge, tauxMarge }: FinancialCellProps) {
|
||||||
const isHighMargin = tauxMarge >= 45;
|
const isHighMargin = tauxMarge >= 45;
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ export function HeatmapGrid({ onSelectionChange }: HeatmapGridProps) {
|
|||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
cell: ({ row }) => <AiInsightBlock row={row.original} />,
|
cell: ({ row }) => <AiInsightBlock row={row.original} />,
|
||||||
},
|
},
|
||||||
], [draftChanges, setDraftGamme]);
|
], [draftChanges, setDraftGamme, MONTHS_12]);
|
||||||
|
|
||||||
const table = useReactTable({
|
const table = useReactTable({
|
||||||
data: rows,
|
data: rows,
|
||||||
|
|||||||
Reference in new issue
Block a user