15 lines
587 B
TypeScript
15 lines
587 B
TypeScript
/** One pier as the 재료표 scope sees it. */
|
|
export interface QuantityPier {
|
|
name: string;
|
|
hasModel: boolean;
|
|
}
|
|
|
|
/**
|
|
* The piers the ④ 재료표 shows: every pier with a model when 전체 is on, otherwise only the chosen pier
|
|
* (교각 목록에서 고른 교각). A chosen pier without a model shows nothing.
|
|
*/
|
|
export function quantityTargetNames(piers: QuantityPier[], all: boolean, active: string | null): string[] {
|
|
if (all) return piers.filter((p) => p.hasModel).map((p) => p.name);
|
|
return piers.filter((p) => p.hasModel && p.name === active).map((p) => p.name);
|
|
}
|