mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
formatting
This commit is contained in:
parent
cc6cdebeeb
commit
89db1d84e1
3 changed files with 9 additions and 29 deletions
|
|
@ -77,10 +77,7 @@ export default function PropertyFilters({
|
|||
|
||||
return (
|
||||
<div className="border-b bg-white">
|
||||
<div
|
||||
className="grid grid-cols-12 gap-4 p-4"
|
||||
onKeyDown={handleKeyDown}
|
||||
>
|
||||
<div className="grid grid-cols-12 gap-4 p-4" onKeyDown={handleKeyDown}>
|
||||
{/* Address */}
|
||||
<div className="col-span-4">
|
||||
<label className="block text-xs font-medium text-gray-600 mb-1">
|
||||
|
|
@ -125,10 +122,7 @@ export default function PropertyFilters({
|
|||
<option
|
||||
key={epc}
|
||||
value={epc}
|
||||
disabled={
|
||||
expectedEpc &&
|
||||
epcIndex(epc) <= epcIndex(expectedEpc)
|
||||
}
|
||||
disabled={expectedEpc && epcIndex(epc) <= epcIndex(expectedEpc)}
|
||||
>
|
||||
{epc} or below
|
||||
</option>
|
||||
|
|
@ -152,10 +146,7 @@ export default function PropertyFilters({
|
|||
<option
|
||||
key={epc}
|
||||
value={epc}
|
||||
disabled={
|
||||
currentEpc &&
|
||||
epcIndex(epc) >= epcIndex(currentEpc)
|
||||
}
|
||||
disabled={currentEpc && epcIndex(epc) >= epcIndex(currentEpc)}
|
||||
>
|
||||
{epc} or above
|
||||
</option>
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
import { useState, useMemo } from "react";
|
||||
import { useProperties } from "./useProperties";
|
||||
import DataTable from "./dataTable";
|
||||
import PropertyFilters, {
|
||||
PropertyFilterValues,
|
||||
} from "./PropertyFilters";
|
||||
import PropertyFilters, { PropertyFilterValues } from "./PropertyFilters";
|
||||
import { PropertyFilter } from "@/app/utils/propertyFilters";
|
||||
import { HomeIcon } from "@heroicons/react/24/outline";
|
||||
import { columns } from "@/app/portfolio/[slug]/components/propertyTableColumns";
|
||||
|
|
@ -86,10 +84,7 @@ export default function PropertyTable({
|
|||
expected_epc_at_least: "",
|
||||
});
|
||||
|
||||
const parsedFilters = useMemo(
|
||||
() => parsePropertyFilters(filters),
|
||||
[filters]
|
||||
);
|
||||
const parsedFilters = useMemo(() => parsePropertyFilters(filters), [filters]);
|
||||
|
||||
const hasActiveFilters = parsedFilters.length > 0;
|
||||
|
||||
|
|
@ -107,7 +102,6 @@ export default function PropertyTable({
|
|||
<div className="flex justify-center">
|
||||
<div className="grid grid-cols-11 w-full max-w-8xl">
|
||||
<div className="col-span-11 bg-white rounded-md border">
|
||||
|
||||
{/* Filters */}
|
||||
<PropertyFilters onApply={setFilters} />
|
||||
|
||||
|
|
@ -118,7 +112,6 @@ export default function PropertyTable({
|
|||
</div>
|
||||
)}
|
||||
|
||||
|
||||
{/* Filter info */}
|
||||
{hasActiveFilters && !isFetching && (
|
||||
<div className="px-4 py-2 text-xs text-gray-500 border-b">
|
||||
|
|
@ -128,13 +121,9 @@ export default function PropertyTable({
|
|||
|
||||
{/* Content */}
|
||||
{isLoading ? (
|
||||
<div className="p-6 text-gray-400">
|
||||
Loading properties…
|
||||
</div>
|
||||
<div className="p-6 text-gray-400">Loading properties…</div>
|
||||
) : isError ? (
|
||||
<div className="p-6 text-red-500">
|
||||
Failed to load properties.
|
||||
</div>
|
||||
<div className="p-6 text-red-500">Failed to load properties.</div>
|
||||
) : data.length === 0 && hasActiveFilters ? (
|
||||
<div className="p-10 text-center text-gray-500">
|
||||
<p>No properties match your filters.</p>
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ export function useProperties({ portfolioId, filters }: Params) {
|
|||
if (!res.ok) throw new Error("Failed to fetch properties");
|
||||
return res.json();
|
||||
},
|
||||
staleTime: 1000 * 60 * 5, // 5 minutes
|
||||
cacheTime: 1000 * 60 * 30, // 30 minutes
|
||||
staleTime: 1000 * 60 * 5, // 5 minutes
|
||||
cacheTime: 1000 * 60 * 30, // 30 minutes
|
||||
|
||||
refetchOnMount: false,
|
||||
refetchOnWindowFocus: false,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue