1
0
Fork 0

feat(grid): integrate grid view into structure detail page

Replace flat ResourceList with StructureStorageView (grid/list
toggle for structures with dimensions, flat list fallback for
non-grid structures). Apply pluralize to upkeep labels.
This commit is contained in:
Jason Fraley 2026-07-28 14:03:39 -04:00
parent 9175b103c2
commit a4844efe22

View file

@ -5,8 +5,8 @@ import Link from "next/link";
import { GameStructure, Structure, Faction, Resource } from "@/payload-types"; import { GameStructure, Structure, Faction, Resource } from "@/payload-types";
import { convertLexicalToPlaintext } from "@payloadcms/richtext-lexical/plaintext"; import { convertLexicalToPlaintext } from "@payloadcms/richtext-lexical/plaintext";
import { CapacityBar } from "@/components/frontend/storage/CapacityBar"; import { CapacityBar } from "@/components/frontend/storage/CapacityBar";
import { ResourceList } from "@/components/frontend/storage/ResourceList";
import { StorageRules } from "@/components/frontend/storage/StorageRules"; import { StorageRules } from "@/components/frontend/storage/StorageRules";
import { StructureStorageView } from "@/components/frontend/storage/StructureStorageView";
import { import {
calculateStoredMass, calculateStoredMass,
calculateUtilization, calculateUtilization,
@ -14,6 +14,7 @@ import {
getFunctionTypeLabel, getFunctionTypeLabel,
getGridSlots, getGridSlots,
} from "@/lib/logistics"; } from "@/lib/logistics";
import { pluralize } from "@/lib/utils";
import { import {
ArrowLeftIcon, ArrowLeftIcon,
BoxIcon, BoxIcon,
@ -200,9 +201,8 @@ export default async function StructureDetailPage({ params }: StructureDetailPag
)} )}
</div> </div>
<ResourceList <StructureStorageView
storedResources={storedResources} structure={structure}
maxCapacityMass={structureType.maxCapacityMass ?? null}
/> />
<StorageRules <StorageRules
@ -226,7 +226,7 @@ export default async function StructureDetailPage({ params }: StructureDetailPag
if (!resource || typeof resource === "number") return null; if (!resource || typeof resource === "number") return null;
return ( return (
<span key={upkeep.id ?? index} className="text-sm bg-muted px-2.5 py-1 rounded-md"> <span key={upkeep.id ?? index} className="text-sm bg-muted px-2.5 py-1 rounded-md">
{resource.name}: {upkeep.amount?.toLocaleString()} {resource.unitOfMeasure}/tick {resource.name}: {upkeep.amount?.toLocaleString()} {pluralize(upkeep.amount ?? 0, resource.unitOfMeasure)}/tick
</span> </span>
); );
})} })}