From 12433998ee07acd0e8912e0bf0e7b7c66a49b87e Mon Sep 17 00:00:00 2001 From: Sebastian Felix Zappe Date: Tue, 17 Jan 2023 14:47:13 +0100 Subject: [PATCH] Improve stair details - Add `grabBars` (handrails) - Add spiral stairs (#34) - Add connected floor infos (#34) --- src/Stairs.test.ts | 4 ++++ src/Stairs.ts | 25 ++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/Stairs.test.ts b/src/Stairs.test.ts index cc712e7..ce02baa 100644 --- a/src/Stairs.test.ts +++ b/src/Stairs.test.ts @@ -1,6 +1,7 @@ import { Stairs, getStairsSchemaDefinition } from './Stairs'; import { Complete } from './Complete'; import expectValidFixture from './lib/expectValidFixture'; +import grabBarsFixture from './GrabBars.test'; const stairsFixture: Complete = { count: 123, @@ -15,6 +16,9 @@ const stairsFixture: Complete = { alternativeMobileEquipmentIds: ['foo', 'bar'], hasMetalGrating: true, isWellLit: true, + grabBars: grabBarsFixture, + isSpiral: false, + floors: ['1', '2'], }; export default stairsFixture; diff --git a/src/Stairs.ts b/src/Stairs.ts index 40a2bbd..5555497 100644 --- a/src/Stairs.ts +++ b/src/Stairs.ts @@ -3,6 +3,8 @@ import { t } from 'ttag'; import { getPrefixedQuantitySchemaDefinition, Length, LengthSchemaDefinition } from './Quantity'; import { getLocalizedStringSchemaDefinition, LocalizedString } from './LocalizedString'; import BooleanField from './BooleanField'; +import getPrefixedSchemaDefinition from './lib/getPrefixedSchemaDefinition'; +import { getGrabBarsSchemaDefinition, GrabBars } from './GrabBars'; /** * The `Stairs` interface describes one or more walkable stairs. @@ -12,6 +14,15 @@ export interface Stairs { * Number of steps. */ count?: number; + + /** + * Floor numbers that are accessible via these stairs. + */ + floors?: string[]; + /** + * `true` if the stairs are spiral, `false` if not. + */ + isSpiral?: boolean; /** * `true` if all relevant steps have a high contrast nosing. */ @@ -59,6 +70,10 @@ export interface Stairs { * detectable with the touch of a foot or sweep of a cane. */ hasTactileSafetyStrips?: boolean; + /** + * Grab bars belonging to the stairs. + */ + grabBars?: GrabBars; } export const getStairsSchemaDefinition: () => Record = () => ({ @@ -74,11 +89,14 @@ export const getStairsSchemaDefinition: () => Record = hasHighContrastNosing: BooleanField, hasAntiSlipNosing: BooleanField, hasMetalGrating: BooleanField, + isWellLit: BooleanField, + isSpiral: BooleanField, + floors: { + type: Array, optional: true, }, - isWellLit: { - type: Boolean, - optional: true, + 'floors.$': { + type: String, }, ...getLocalizedStringSchemaDefinition('name'), ...getPrefixedQuantitySchemaDefinition('stepHeight', LengthSchemaDefinition), @@ -94,4 +112,5 @@ export const getStairsSchemaDefinition: () => Record = type: String, label: t`accessibility.cloud Equipment ID`, }, + ...getPrefixedSchemaDefinition('grabBars', getGrabBarsSchemaDefinition()), });