fixed build issues. its builds now
This commit is contained in:
@@ -4,7 +4,7 @@ import { useEffect, useMemo, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { useParams, useRouter, useSearchParams } from "next/navigation";
|
||||
|
||||
import type { CategoryId } from "@/types/builderSlots";
|
||||
import type { BuilderSlotKey } from "@/types/builderSlots";
|
||||
import { PART_ROLE_TO_CATEGORY, normalizePartRole } from "@/lib/catalogMappings";
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ type GunbuilderProductFromApi = {
|
||||
offers?: OfferFromApi[] | null;
|
||||
};
|
||||
|
||||
type BuildState = Partial<Record<CategoryId, string>>;
|
||||
type BuildState = Partial<Record<BuilderSlotKey, string>>;
|
||||
|
||||
const API_BASE_URL =
|
||||
process.env.NEXT_PUBLIC_API_BASE_URL ?? "http://localhost:8080";
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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,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 (
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -45,6 +45,7 @@ export default function BetaMagicPage() {
|
||||
// We can simulate "login" by directly setting localStorage like AuthContext does,
|
||||
// but easiest is just to store it here in the same shape.
|
||||
setSession(data.token ?? data.accessToken, {
|
||||
uuid: data.uuid ?? data.id,
|
||||
email: data.email,
|
||||
displayName: data.displayName ?? null,
|
||||
role: data.role ?? "USER",
|
||||
|
||||
Reference in New Issue
Block a user