Skip to content

Commit

Permalink
Improve stair details
Browse files Browse the repository at this point in the history
- Add `grabBars` (handrails)
- Add spiral stairs (#34)
- Add connected floor infos (#34)
  • Loading branch information
opyh committed Jan 17, 2023
1 parent 0dd0d1a commit 1243399
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/Stairs.test.ts
Original file line number Diff line number Diff line change
@@ -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<Stairs> = {
count: 123,
Expand All @@ -15,6 +16,9 @@ const stairsFixture: Complete<Stairs> = {
alternativeMobileEquipmentIds: ['foo', 'bar'],
hasMetalGrating: true,
isWellLit: true,
grabBars: grabBarsFixture,
isSpiral: false,
floors: ['1', '2'],
};

export default stairsFixture;
Expand Down
25 changes: 22 additions & 3 deletions src/Stairs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
*/
Expand Down Expand Up @@ -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<string, SchemaDefinition> = () => ({
Expand All @@ -74,11 +89,14 @@ export const getStairsSchemaDefinition: () => Record<string, SchemaDefinition> =
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),
Expand All @@ -94,4 +112,5 @@ export const getStairsSchemaDefinition: () => Record<string, SchemaDefinition> =
type: String,
label: t`accessibility.cloud Equipment ID`,
},
...getPrefixedSchemaDefinition('grabBars', getGrabBarsSchemaDefinition()),
});

0 comments on commit 1243399

Please sign in to comment.