mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 22:18:12 +00:00
fix: type errors
This commit is contained in:
@@ -1,10 +1,5 @@
|
|||||||
import { Box, SimpleGrid } from "@mantine/core";
|
import { SimpleGrid } from "@mantine/core";
|
||||||
import {
|
import { CheckCircle2, Clock3, Truck, Wallet } from "lucide-react";
|
||||||
CheckCircle2,
|
|
||||||
Clock3,
|
|
||||||
Truck,
|
|
||||||
Wallet,
|
|
||||||
} from "lucide-react";
|
|
||||||
import { memo } from "react";
|
import { memo } from "react";
|
||||||
import { formatCurrency } from "@/pages/billing/invoices.mock";
|
import { formatCurrency } from "@/pages/billing/invoices.mock";
|
||||||
import { formatPct } from "../constants";
|
import { formatPct } from "../constants";
|
||||||
@@ -34,7 +29,6 @@ export const StatsSection = memo(function StatsSection({
|
|||||||
completionRate,
|
completionRate,
|
||||||
spendYtd,
|
spendYtd,
|
||||||
spendYtdChangePct,
|
spendYtdChangePct,
|
||||||
dashboardLoading,
|
|
||||||
}: StatsSectionProps) {
|
}: StatsSectionProps) {
|
||||||
return (
|
return (
|
||||||
<Card className="rounded-2xl border border-edr-border bg-gradient-to-br from-white to-edr-soft px-7 py-5">
|
<Card className="rounded-2xl border border-edr-border bg-gradient-to-br from-white to-edr-soft px-7 py-5">
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
Wallet,
|
Wallet,
|
||||||
type LucideIcon,
|
type LucideIcon,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import type { Currency, InvoiceStatus } from "@/pages/billing/invoices.mock";
|
import type { InvoiceStatus } from "@/pages/billing/invoices.mock";
|
||||||
|
|
||||||
export const cv = (token: string) => {
|
export const cv = (token: string) => {
|
||||||
const [name, shade] = token.split(".");
|
const [name, shade] = token.split(".");
|
||||||
@@ -319,12 +319,14 @@ export const STATUS_CONFIG: Record<string, StageConfig> = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ACTION_PROPS: Record<string, { bg: string; c: string; bd?: string }> =
|
export const ACTION_PROPS: Record<
|
||||||
{
|
string,
|
||||||
dark: { bg: "edr-ink", c: "white" },
|
{ bg: string; c: string; bd?: string }
|
||||||
amber: { bg: "edr-accent", c: "white" },
|
> = {
|
||||||
outline: { bg: "edr-card", c: "edr-text", bd: "1px solid edr-border" },
|
dark: { bg: "edr-ink", c: "white" },
|
||||||
};
|
amber: { bg: "edr-accent", c: "white" },
|
||||||
|
outline: { bg: "edr-card", c: "edr-text", bd: "1px solid edr-border" },
|
||||||
|
};
|
||||||
|
|
||||||
export const INVOICE_BADGE: Record<
|
export const INVOICE_BADGE: Record<
|
||||||
InvoiceStatus,
|
InvoiceStatus,
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ export function StatusHero({
|
|||||||
function ProgressTracker({
|
function ProgressTracker({
|
||||||
current,
|
current,
|
||||||
tone = "green",
|
tone = "green",
|
||||||
negative,
|
|
||||||
}: {
|
}: {
|
||||||
current: number;
|
current: number;
|
||||||
tone?: "green" | "ink";
|
tone?: "green" | "ink";
|
||||||
@@ -114,7 +113,6 @@ function ProgressTracker({
|
|||||||
const last = PROGRESS_STAGES.length - 1;
|
const last = PROGRESS_STAGES.length - 1;
|
||||||
const activeFill = tone === "ink" ? "#0C1A2B" : "#0EA371";
|
const activeFill = tone === "ink" ? "#0C1A2B" : "#0EA371";
|
||||||
const activeRing = tone === "ink" ? "#D9E0E7" : "#BFE8D4";
|
const activeRing = tone === "ink" ? "#D9E0E7" : "#BFE8D4";
|
||||||
const activeSub = tone === "ink" ? "#475569" : "#0A6F4D";
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
/* Scrollable on mobile so 5 stages never overflow */
|
/* Scrollable on mobile so 5 stages never overflow */
|
||||||
|
|||||||
@@ -16,12 +16,18 @@ import {
|
|||||||
Title,
|
Title,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import { AlertCircle, Check, ChevronLeft, ChevronRight, Send, XCircle } from "lucide-react";
|
import {
|
||||||
|
AlertCircle,
|
||||||
|
Check,
|
||||||
|
ChevronLeft,
|
||||||
|
ChevronRight,
|
||||||
|
Send,
|
||||||
|
XCircle,
|
||||||
|
} from "lucide-react";
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import useAuth from "@/hooks/useAuth";
|
import useAuth from "@/hooks/useAuth";
|
||||||
import type { Freight } from "@/types";
|
|
||||||
import {
|
import {
|
||||||
BookingFormInputValues,
|
BookingFormInputValues,
|
||||||
STEPS,
|
STEPS,
|
||||||
@@ -191,8 +197,12 @@ export default function NewBookingPage() {
|
|||||||
[docValues],
|
[docValues],
|
||||||
);
|
);
|
||||||
|
|
||||||
const [pricingPhase, setPricingPhase] = useState<"idle" | "generating" | "ready">("idle");
|
const [pricingPhase, setPricingPhase] = useState<
|
||||||
const [pricingData, setPricingData] = useState<GeneratePriceResponse | null>(null);
|
"idle" | "generating" | "ready"
|
||||||
|
>("idle");
|
||||||
|
const [pricingData, setPricingData] = useState<GeneratePriceResponse | null>(
|
||||||
|
null,
|
||||||
|
);
|
||||||
const [priceBookingId, setPriceBookingId] = useState<string | null>(null);
|
const [priceBookingId, setPriceBookingId] = useState<string | null>(null);
|
||||||
const [cancelDialogOpen, setCancelDialogOpen] = useState(false);
|
const [cancelDialogOpen, setCancelDialogOpen] = useState(false);
|
||||||
const [cancelReason, setCancelReason] = useState("");
|
const [cancelReason, setCancelReason] = useState("");
|
||||||
@@ -444,7 +454,9 @@ export default function NewBookingPage() {
|
|||||||
pricingData={pricingData}
|
pricingData={pricingData}
|
||||||
onConfirm={() => confirmMutation.mutate()}
|
onConfirm={() => confirmMutation.mutate()}
|
||||||
onContinueLater={
|
onContinueLater={
|
||||||
priceBookingId ? () => navigate(`/bookings/${priceBookingId}`) : undefined
|
priceBookingId
|
||||||
|
? () => navigate(`/bookings/${priceBookingId}`)
|
||||||
|
: undefined
|
||||||
}
|
}
|
||||||
onAbort={() => setCancelDialogOpen(true)}
|
onAbort={() => setCancelDialogOpen(true)}
|
||||||
confirmPending={confirmMutation.isPending}
|
confirmPending={confirmMutation.isPending}
|
||||||
@@ -502,7 +514,9 @@ export default function NewBookingPage() {
|
|||||||
createMutation.isPending ? undefined : <Check size={16} />
|
createMutation.isPending ? undefined : <Check size={16} />
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{createMutation.isPending ? "Saving Draft..." : "Save as Draft"}
|
{createMutation.isPending
|
||||||
|
? "Saving Draft..."
|
||||||
|
: "Save as Draft"}
|
||||||
</Button>
|
</Button>
|
||||||
{hasDocuments && (
|
{hasDocuments && (
|
||||||
<Button
|
<Button
|
||||||
@@ -511,21 +525,20 @@ export default function NewBookingPage() {
|
|||||||
radius="md"
|
radius="md"
|
||||||
loading={createAndPriceMutation.isPending}
|
loading={createAndPriceMutation.isPending}
|
||||||
leftSection={
|
leftSection={
|
||||||
createAndPriceMutation.isPending ? undefined : <Send size={16} />
|
createAndPriceMutation.isPending ? undefined : (
|
||||||
|
<Send size={16} />
|
||||||
|
)
|
||||||
}
|
}
|
||||||
onClick={() => handleGeneratePrice()}
|
onClick={() => handleGeneratePrice()}
|
||||||
>
|
>
|
||||||
{createAndPriceMutation.isPending ? "Generating price…" : "Submit"}
|
{createAndPriceMutation.isPending
|
||||||
|
? "Generating price…"
|
||||||
|
: "Submit"}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</Group>
|
</Group>
|
||||||
) : pricingPhase === "generating" ? (
|
) : pricingPhase === "generating" ? (
|
||||||
<Button
|
<Button type="button" color="edr-green" radius="md" loading>
|
||||||
type="button"
|
|
||||||
color="edr-green"
|
|
||||||
radius="md"
|
|
||||||
loading
|
|
||||||
>
|
|
||||||
Generating price estimate…
|
Generating price estimate…
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
Reference in New Issue
Block a user