-
Notifications
You must be signed in to change notification settings - Fork 557
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# About the pull request Gives microwaves a TGUI. ![image](https://github.com/cmss13-devs/cmss13/assets/59719612/72072d6f-bdf9-42d6-a0db-819c98df63da) # Testing Photographs and Procedure <details> <summary>Screenshots & Videos</summary> ![image](https://github.com/cmss13-devs/cmss13/assets/59719612/39c49b3c-a8e6-4215-96aa-ab206172976c) ![image](https://github.com/cmss13-devs/cmss13/assets/59719612/0c2fe594-c1c8-4c7c-ae41-e66b078be903) ![image](https://github.com/cmss13-devs/cmss13/assets/59719612/9f4703a6-fb00-47dd-bfbe-e0c1b1e9d5de) ![image](https://github.com/cmss13-devs/cmss13/assets/59719612/a8943afc-88a2-4ade-867d-00c46c777a8f) </details> # Changelog :cl: Casper ui: added microwave TGUI /:cl:
- Loading branch information
1 parent
157bcfc
commit bc7c578
Showing
2 changed files
with
158 additions
and
72 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
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,86 @@ | ||
import { useBackend } from '../backend'; | ||
import { Button, NoticeBox, Section, Flex, Box } from '../components'; | ||
import { BooleanLike } from 'common/react'; | ||
import { Window } from '../layouts'; | ||
|
||
type Ingredient = { | ||
name: string; | ||
count: number; | ||
measure: string; | ||
}; | ||
|
||
type BackendContext = { | ||
operating: BooleanLike; | ||
broken: BooleanLike; | ||
dirty: BooleanLike; | ||
ingredients: Ingredient[]; | ||
}; | ||
|
||
export const Microwave = (props, context) => { | ||
const { data, act } = useBackend<BackendContext>(context); | ||
const { operating, broken, dirty, ingredients } = data; | ||
|
||
return ( | ||
<Window width={350} height={350}> | ||
<Window.Content scrollable> | ||
<Section | ||
fill | ||
title="Ingredients" | ||
buttons={ | ||
<Flex> | ||
<Button | ||
height="100%" | ||
icon="power-off" | ||
disabled={!!operating || !!dirty || !!broken} | ||
onClick={() => act('cook')}> | ||
Activate | ||
</Button> | ||
|
||
<Button | ||
height="100%" | ||
icon="eject" | ||
disabled={!ingredients.length || !!operating} | ||
onClick={() => act('eject_all')}> | ||
Eject all | ||
</Button> | ||
</Flex> | ||
}> | ||
{!!operating && ( | ||
<NoticeBox | ||
width="100%" | ||
textAlign="center" | ||
p=".5rem" | ||
fontSize="1.5rem"> | ||
Cooking... | ||
</NoticeBox> | ||
)} | ||
|
||
{!!broken && ( | ||
<NoticeBox danger width="100%" textAlign="center" p="1rem"> | ||
Appliance broken. Please contact your local technician. | ||
</NoticeBox> | ||
)} | ||
|
||
{!!dirty && ( | ||
<NoticeBox danger width="100%" textAlign="center" p="1rem"> | ||
This microwave is too dirty. Cleaning required. | ||
</NoticeBox> | ||
)} | ||
|
||
{!ingredients.length && <Box>None</Box>} | ||
|
||
<Flex direction="column"> | ||
{ingredients.map((ingredient) => { | ||
return ( | ||
<Flex.Item key={ingredient.name} py=".2rem"> | ||
<b>{ingredient.name}</b>: {ingredient.count}{' '} | ||
{ingredient.measure} | ||
</Flex.Item> | ||
); | ||
})} | ||
</Flex> | ||
</Section> | ||
</Window.Content> | ||
</Window> | ||
); | ||
}; |