-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Initial implementation of new StartStop UI - Started looking at UI store for generic ui action like a modal system instead of prop drilling down the component tree.
- Loading branch information
Showing
8 changed files
with
122 additions
and
31 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
File renamed without changes.
44 changes: 44 additions & 0 deletions
44
src/app/Marine2/components/_composed/modals/generator-stop-info/index.tsx
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,44 @@ | ||
import React, { FC } from "react" | ||
import { Modal } from "app/Marine2/components/ui/Modal/Modal" | ||
import { Message } from "../../../_elements/Message/Message" | ||
import { AppViews } from "../../../../modules/AppViews" | ||
|
||
interface Props { | ||
linkedView?: AppViews | ||
onClose: () => void | ||
infoText?: InfoText | ||
} | ||
|
||
export interface InfoText { | ||
title: string | ||
body: string | ||
} | ||
|
||
export const GeneratorStopInfo: FC<Props> = ({ linkedView, onClose, infoText }) => { | ||
|
||
if (linkedView || !infoText) { | ||
return null | ||
} | ||
{ | ||
/* {!linkedView && !!infoText && ( | ||
<div className="-mr-3 p-3" onClick={openInfo}> | ||
<InfoIcon | ||
className="w-7 text-victron-blue dark:text-victron-blue-dark cursor-pointer outline-none" | ||
alt="Info" | ||
/> | ||
</div> | ||
)}*/ | ||
} | ||
return ( | ||
<Modal.Frame open={true} onClose={onClose}> | ||
<Modal.Body> | ||
<Message variant="info" label="Fischer Panda Genset" title={infoText.title} text={infoText.body} /> | ||
</Modal.Body> | ||
<Modal.Footer> | ||
<button onClick={onClose} className="w-full h-[60px]"> | ||
Ok | ||
</button> | ||
</Modal.Footer> | ||
</Modal.Frame> | ||
) | ||
} |
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
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,24 @@ | ||
import { makeAutoObservable, observable, computed } from "mobx" | ||
|
||
export class UiState { | ||
language = "en_US" | ||
pendingRequestCount = 0 | ||
|
||
// .struct makes sure observer won't be signaled unless the | ||
// dimensions object changed in a deepEqual manner. | ||
windowDimensions = { | ||
width: window.innerWidth, | ||
height: window.innerHeight, | ||
} | ||
|
||
constructor() { | ||
makeAutoObservable(this, { windowDimensions: observable.struct }) | ||
window.onresize = () => { | ||
//this.windowDimensions = getWindowDimensions() | ||
} | ||
} | ||
|
||
get appIsInSync() { | ||
return this.pendingRequestCount === 0 | ||
} | ||
} |
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