Skip to content

Commit

Permalink
Improve GrabBars entity
Browse files Browse the repository at this point in the history
- Add documentation
- Add info if handrails are continuous
- Add info where grab bars are located relative to the user
  • Loading branch information
opyh committed Jan 17, 2023
1 parent 1ebc95c commit 4ebab45
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 19 deletions.
2 changes: 2 additions & 0 deletions src/GrabBars.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import interactionModeFixture from './InteractionMode.test';
const grabBarsFixture: Complete<GrabBars> = {
onUsersLeftSide: true,
onUsersRightSide: true,
inFrontOfTheUser: false,
topHeightFromFloor: '80cm',
distanceBetweenBars: '80cm',
foldable: true,
interactions: [interactionModeFixture],
continuous: true,
};

export default grabBarsFixture;
Expand Down
58 changes: 39 additions & 19 deletions src/GrabBars.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
import { t } from 'ttag';
import getPrefixedSchemaDefinition from './lib/getPrefixedSchemaDefinition';
import BooleanField from './BooleanField';
import { getInteractableSchemaDefinition, Interactable } from './Interactable';
import { getPrefixedQuantitySchemaDefinition, Length, LengthSchemaDefinition } from './Quantity';

/**
* Describes grab bars or hand rails.
*/
export interface GrabBars extends Interactable {
/**
* `true` if there is a folding handle on left side (from the perspective of somebody using the
* toilet), `false` if not, `undefined` if condition is unknown.
* `true` if there is a folding handle on left side, `false` if not.
*
* Seen from the perspective
*
* - of somebody using a toilet
* - of somebody in front of stairs, facing upwards
* - of somebody in front of a door
*/
onUsersLeftSide?: boolean;
/**
* `true` if there is a folding handle on right side (from the perspective of somebody using the
* toilet), `false` if not, `undefined` if condition is unknown.
* `true` if there is a folding handle on right side, `false` if not.
*
* Seen from the perspective
*
* - of somebody using a toilet
* - of somebody in front of stairs, facing upwards
* - of somebody in front of a door
*/
onUsersRightSide?: boolean;
/**
* `true` if there is a folding handle in front of the user, `false` if not.
*
* Seen from the perspective
*
* - of somebody using a toilet
* - of somebody in front of stairs, facing upwards
* - of somebody in front of a door
*/
inFrontOfTheUser?: boolean;
/**
* Indicates how high the grab bars are (top edge, measured from the floor).
*/
Expand All @@ -23,25 +45,23 @@ export interface GrabBars extends Interactable {
*/
distanceBetweenBars?: Length;
/**
* `true` if the grab bars can be folded, `false` if not, `undefined` if condition is unknown.
* `true` if the grab bars can be folded, `false` if not..
*/
foldable?: boolean;

/**
* Indicates if the grab bars are continuous or not. Helpful for stair grab rails.
*/
continuous: boolean;
}

export const getGrabBarsSchemaDefinition: () => Record<string, SchemaDefinition> = () => ({
onUsersLeftSide: {
type: Boolean,
optional: true,
},
onUsersRightSide: {
type: Boolean,
optional: true,
},
onUsersLeftSide: BooleanField,
onUsersRightSide: BooleanField,
inFrontOfTheUser: BooleanField,
...getPrefixedQuantitySchemaDefinition('topHeightFromFloor', LengthSchemaDefinition),
...getPrefixedQuantitySchemaDefinition('distanceBetweenBars', LengthSchemaDefinition),
foldable: {
type: Boolean,
optional: true,
},
foldable: BooleanField,
continuous: BooleanField,
...getInteractableSchemaDefinition(),
});
1 change: 1 addition & 0 deletions src/Toilet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const toiletFixture: Complete<Toilet> = {
onUsersRightSide: true,
topHeightFromFloor: '>85cm',
distanceBetweenBars: '60 .. 65cm',
continuous: false,
},
isSquatToilet: false,
isUrinal: false,
Expand Down

0 comments on commit 4ebab45

Please sign in to comment.