fixed build issues. its builds now

This commit is contained in:
2026-01-19 09:11:42 -05:00
parent b0db3167c5
commit 775a351425
17 changed files with 64 additions and 37 deletions
+5 -5
View File
@@ -1,6 +1,6 @@
"use client";
import { useEffect, useMemo, useState } from "react";
import { useCallback, useEffect, useMemo, useState } from "react";
import { useAuth } from "@/context/AuthContext";
import {
fetchEmailRequests,
@@ -32,13 +32,13 @@ export default function AdminEmailPage() {
const [statusTab, setStatusTab] = useState<EmailStatusTab>("ALL");
const loadEmails = async () => {
const loadEmails = useCallback(async () => {
if (!token) return;
try {
setLoading(true);
const data = await fetchEmailRequests(token);
setEmails(data.data);
setEmails(data);
setError(null);
} catch (e: any) {
console.error(e);
@@ -46,11 +46,11 @@ export default function AdminEmailPage() {
} finally {
setLoading(false);
}
};
}, [token]);
useEffect(() => {
loadEmails();
}, [token]);
}, [loadEmails]);
const normalizeStatus = (s: unknown) => String(s ?? "").trim().toUpperCase();
+6 -6
View File
@@ -1,6 +1,6 @@
"use client";
import { useEffect, useState } from "react";
import { useCallback, useEffect, useState } from "react";
import { useAuth } from "@/context/AuthContext";
import {
fetchEmailRequests,
@@ -27,13 +27,13 @@ export default function AdminEmailPage() {
});
const [submitting, setSubmitting] = useState(false);
const loadEmails = async () => {
const loadEmails = useCallback(async () => {
if (!token) return;
try {
setLoading(true);
const data = await fetchEmailRequests(token);
setEmails(data.data);
setEmails(data);
setError(null);
} catch (e: any) {
console.error(e);
@@ -41,11 +41,11 @@ export default function AdminEmailPage() {
} finally {
setLoading(false);
}
};
}, [token]);
useEffect(() => {
loadEmails();
}, [token]);
}, [loadEmails]);
const handleCreate = () => {
setModalMode("create");
+1 -1
View File
@@ -1,7 +1,7 @@
"use client";
import { useEffect, useRef, useState } from "react";
import { sendEmailAction, type ApiResponse, type EmailRequest } from "/app/actions/sendEmail";
import { sendEmailAction, type ApiResponse, type EmailRequest } from "@/app/actions/sendEmail";
import { Button, Field, Input, Textarea } from "@/components/ui/form";
export default function SendEmailForm(): JSX.Element {
@@ -1,6 +1,6 @@
"use client";
import { useEffect, useState } from "react";
import { useCallback, useEffect, useState } from "react";
import { useApi } from "@/lib/useApi";
type Merchant = {
@@ -91,7 +91,7 @@ export default function MerchantCategoryMappingPage() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
// 2) Load mappings when merchant changes (THIS sends merchantId)
useEffect(() => {
const loadMappings = useCallback(() => {
if (selectedMerchantId == null) return;
setLoadingMappings(true);
@@ -112,7 +112,11 @@ export default function MerchantCategoryMappingPage() {
);
})
.finally(() => setLoadingMappings(false));
}, [selectedMerchantId]);
}, [selectedMerchantId, get]);
useEffect(() => {
loadMappings();
}, [loadMappings]);
// 3) Save a single mapping row (adjust endpoint if yours differs)
const handleSaveMapping = async (
+5 -5
View File
@@ -1,6 +1,6 @@
"use client";
import { useMemo, useState } from "react";
import { useCallback, useMemo, useState } from "react";
import type { CaliberDto, PlatformDto } from "../_lib/types";
import { RightDrawer } from "./RightDrawer";
@@ -91,12 +91,10 @@ export function BulkBar(props: {
const [open, setOpen] = useState(false);
if (selectedCount <= 0) return null;
const disabled = loading || selectedCount <= 0;
// one button to apply staged field updates
const applyFieldChanges = () => {
const applyFieldChanges = useCallback(() => {
const patch: BulkUpdateSet = { classificationReason: "Admin bulk override" };
if (bulkPlatformKey) {
@@ -121,7 +119,9 @@ export function BulkBar(props: {
if (keys.length === 0) return;
runBulk(patch);
};
}, [bulkPlatformKey, bulkPlatformLock, bulkRole, bulkRoleLock, bulkCaliber, bulkCaliberGroup, bulkCaliberLock, bulkForceCaliber, runBulk]);
if (selectedCount <= 0) return null;
let footer: JSX.Element;
// eslint-disable-next-line react-hooks/rules-of-hooks