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:
parent
9175b103c2
commit
a4844efe22
1 changed files with 5 additions and 5 deletions
|
|
@ -5,8 +5,8 @@ import Link from "next/link";
|
|||
import { GameStructure, Structure, Faction, Resource } from "@/payload-types";
|
||||
import { convertLexicalToPlaintext } from "@payloadcms/richtext-lexical/plaintext";
|
||||
import { CapacityBar } from "@/components/frontend/storage/CapacityBar";
|
||||
import { ResourceList } from "@/components/frontend/storage/ResourceList";
|
||||
import { StorageRules } from "@/components/frontend/storage/StorageRules";
|
||||
import { StructureStorageView } from "@/components/frontend/storage/StructureStorageView";
|
||||
import {
|
||||
calculateStoredMass,
|
||||
calculateUtilization,
|
||||
|
|
@ -14,6 +14,7 @@ import {
|
|||
getFunctionTypeLabel,
|
||||
getGridSlots,
|
||||
} from "@/lib/logistics";
|
||||
import { pluralize } from "@/lib/utils";
|
||||
import {
|
||||
ArrowLeftIcon,
|
||||
BoxIcon,
|
||||
|
|
@ -200,9 +201,8 @@ export default async function StructureDetailPage({ params }: StructureDetailPag
|
|||
)}
|
||||
</div>
|
||||
|
||||
<ResourceList
|
||||
storedResources={storedResources}
|
||||
maxCapacityMass={structureType.maxCapacityMass ?? null}
|
||||
<StructureStorageView
|
||||
structure={structure}
|
||||
/>
|
||||
|
||||
<StorageRules
|
||||
|
|
@ -226,7 +226,7 @@ export default async function StructureDetailPage({ params }: StructureDetailPag
|
|||
if (!resource || typeof resource === "number") return null;
|
||||
return (
|
||||
<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>
|
||||
);
|
||||
})}
|
||||
|
|
|
|||
Loading…
Reference in a new issue