generated from graasp/graasp-app-starter-ts-vite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow users to change the insulation of walls and windows (#57)
* feat: add new wall materials * feat: add window size and insulations * feat: allow to update the composition of materials
- Loading branch information
Showing
36 changed files
with
1,923 additions
and
498 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { BuildingMaterial } from '@/models/BuildingMaterial'; | ||
|
||
export const BUILDING_MATERIALS = { | ||
Aerogel: BuildingMaterial.create({ | ||
name: 'Aerogel', | ||
price: 10_000, | ||
thermalConductivity: 0.021, | ||
thickness: 0.16, | ||
}), | ||
FiberGlass: BuildingMaterial.create({ | ||
name: 'Fiber Glass', | ||
price: 3_000, | ||
thermalConductivity: 0.115, | ||
thickness: 0.16, | ||
}), | ||
XPSFoam: BuildingMaterial.create({ | ||
name: 'XPS Foam', | ||
price: 10, | ||
thermalConductivity: 0.024, | ||
thickness: 0.16, | ||
}), | ||
MineralWool: BuildingMaterial.create({ | ||
name: 'Mineral Wool', | ||
price: 7, | ||
thermalConductivity: 0.03, | ||
thickness: 0.16, | ||
}), | ||
Brick: BuildingMaterial.create({ | ||
name: 'Brick', | ||
price: 0, | ||
thermalConductivity: 0.6, | ||
thickness: 0.2, | ||
}), | ||
WindowGlass: BuildingMaterial.create({ | ||
name: 'Window Glass', | ||
price: 150, | ||
thermalConductivity: 0.8, | ||
thickness: 0.004, | ||
}), | ||
Argon: BuildingMaterial.create({ | ||
name: 'Argon', | ||
price: 0, | ||
thermalConductivity: 0.018, | ||
thickness: 0.006, | ||
}), | ||
Wood: BuildingMaterial.create({ | ||
name: 'Wood', | ||
price: 0, | ||
thermalConductivity: 0.08, | ||
thickness: 0.2, | ||
}), | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { UnionOfConst } from '@graasp/sdk'; | ||
|
||
import { BuildingMaterial } from '@/models/BuildingMaterial'; | ||
import { HouseComponent } from '@/types/houseComponent'; | ||
import { NonEmptyArray } from '@/types/utils'; | ||
|
||
import { BUILDING_MATERIALS } from './buildingMaterials'; | ||
|
||
export const HouseInsulationPerComponent = { | ||
[HouseComponent.Wall]: { | ||
Brick: 'Brick', | ||
Aerogel: 'Aerogel', | ||
Fiberglass: 'Fiberglass', | ||
XPSFoam: 'XPSFoam', | ||
MineralWool: 'MineralWool', | ||
}, | ||
[HouseComponent.Door]: { | ||
Wood: 'Wood', | ||
}, | ||
[HouseComponent.Window]: { | ||
SinglePane: 'SinglePane', | ||
DoublePane: 'DoublePane', | ||
TriplePane: 'TriplePane', | ||
}, | ||
} as const; | ||
|
||
export type HouseInsulation = | ||
| UnionOfConst<(typeof HouseInsulationPerComponent)[HouseComponent.Wall]> | ||
| UnionOfConst<(typeof HouseInsulationPerComponent)[HouseComponent.Door]> | ||
| UnionOfConst<(typeof HouseInsulationPerComponent)[HouseComponent.Window]>; | ||
|
||
export const HOUSE_INSULATIONS: { | ||
[houseComponent in HouseComponent]: { | ||
[componentInsulationName in keyof (typeof HouseInsulationPerComponent)[houseComponent]]: NonEmptyArray<BuildingMaterial>; | ||
}; | ||
} = { | ||
[HouseComponent.Wall]: { | ||
Brick: [BUILDING_MATERIALS.Brick], | ||
Aerogel: [BUILDING_MATERIALS.Brick, BUILDING_MATERIALS.Aerogel], | ||
Fiberglass: [BUILDING_MATERIALS.Brick, BUILDING_MATERIALS.FiberGlass], | ||
XPSFoam: [BUILDING_MATERIALS.Brick, BUILDING_MATERIALS.XPSFoam], | ||
MineralWool: [BUILDING_MATERIALS.Brick, BUILDING_MATERIALS.MineralWool], | ||
}, | ||
|
||
[HouseComponent.Door]: { | ||
Wood: [BUILDING_MATERIALS.Wood.from({ thickness: 0.1 })], | ||
}, | ||
|
||
[HouseComponent.Window]: { | ||
SinglePane: [BUILDING_MATERIALS.WindowGlass], | ||
DoublePane: [ | ||
BUILDING_MATERIALS.WindowGlass, | ||
BUILDING_MATERIALS.Argon, | ||
BUILDING_MATERIALS.WindowGlass, | ||
], | ||
TriplePane: [ | ||
BUILDING_MATERIALS.WindowGlass, | ||
BUILDING_MATERIALS.Argon, | ||
BUILDING_MATERIALS.WindowGlass, | ||
BUILDING_MATERIALS.Argon, | ||
BUILDING_MATERIALS.WindowGlass, | ||
], | ||
}, | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.