updated loading state

This commit is contained in:
Khalim Conn-Kowlessar 2025-11-03 19:46:47 +00:00
parent f873acd48a
commit cf509fd474
3 changed files with 22 additions and 15 deletions

View file

@ -1,4 +1,4 @@
import { PlanTypeEnum } from "@/app/db/schema/recommendations";
import type { PlanTypeEnum } from "@/app/db/schema/recommendations";
// Fixed Domna costs per delivery type
export const DOMNA_COST_MAP: Record<PlanTypeEnum, number> & {

View file

@ -142,6 +142,7 @@ export const columns: ColumnDef<PropertyWithRelations>[] = [
},
{
accessorKey: "postcode",
enableGlobalFilter: true,
header: ({ column }) => (
<Button
variant="ghost"
@ -237,6 +238,14 @@ export const columns: ColumnDef<PropertyWithRelations>[] = [
const expectedSapPoints = row.original.totalRecommendationSapPoints || 0;
// if currentSapPoints + expectedSapPoint is 0 expected EPC is ""
if (currentSapPoints + expectedSapPoints === 0) {
return (
<div className="text-gray-700 font-medium flex justify-center">
{<EpcLetterBubble letter={""} />}
</div>
);
}
const expectedEpc = sapToEpc(currentSapPoints + expectedSapPoints);
return (

View file

@ -1,16 +1,17 @@
import { Rating } from "./db/schema/property";
import { KeyboardEvent} from "react";
import { KeyboardEvent } from "react";
export function handleNumericKeyDown(event: KeyboardEvent<HTMLInputElement>) {
export function handleNumericKeyDown(event: KeyboardEvent<HTMLInputElement>) {
/**
* Allowing: Integers | Backspace | Tab | Delete | Left & Right arrow keys
**/
/**
* Allowing: Integers | Backspace | Tab | Delete | Left & Right arrow keys
**/
const regex = new RegExp(/(^\d*$)|(Backspace|Tab|Delete|ArrowLeft|ArrowRight|ArrowUp|ArrowDown)/);
return !event.key.match(regex) && event.preventDefault();
}
const regex = new RegExp(
/(^\d*$)|(Backspace|Tab|Delete|ArrowLeft|ArrowRight|ArrowUp|ArrowDown)/
);
return !event.key.match(regex) && event.preventDefault();
}
export function convertDaysToWorkingWeeks(days: number | null) {
if (days === null) {
@ -92,7 +93,7 @@ export const serializeBigInt = (_: any, value: any): string | any => {
};
export function sapToEpc(sapPoints: number): string {
if (sapPoints <= 0) {
if (sapPoints < 0) {
throw new Error("SAP points should be above 0.");
}
@ -151,7 +152,6 @@ export function formatNumber(number: number): string {
return formatted + suffixes[suffixIndex];
}
export function roundToDecimalPlaces(
number: number,
decimalPlaces: number
@ -159,5 +159,3 @@ export function roundToDecimalPlaces(
const factor = 10 ** decimalPlaces;
return Math.round(number * factor) / factor;
}