-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Select screen type page (#235)
- Loading branch information
Showing
17 changed files
with
287 additions
and
8 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,11 @@ | ||
.navbar-dark { | ||
background: $cool-gray-15; | ||
|
||
.navbar-brand { | ||
color: $text-primary; | ||
} | ||
|
||
.btn-close { | ||
background-color: transparent; | ||
} | ||
} |
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,30 @@ | ||
.button-image-container { | ||
display: flex; | ||
|
||
.button-image { | ||
display: flex; | ||
flex-direction: column; | ||
height: 268px; | ||
border-radius: 16px; | ||
background: #2b3741; | ||
border-color: transparent; | ||
flex: 1 1 306px; | ||
align-items: center; | ||
padding-bottom: 18px; | ||
|
||
&:hover { | ||
background: $cool-gray-30; | ||
border-color: transparent; | ||
} | ||
|
||
&__image-container { | ||
margin-top: auto; | ||
margin-bottom: auto; | ||
} | ||
|
||
&__label { | ||
font-size: 16px; | ||
font-weight: 700; | ||
} | ||
} | ||
} |
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,29 @@ | ||
.configure-screens-page { | ||
display: flex; | ||
flex-direction: column; | ||
color: $text-primary; | ||
background: #0f1417; | ||
overflow-y: scroll; | ||
min-height: 100%; | ||
|
||
.select-screen-type { | ||
max-width: 1320px; | ||
|
||
&__title { | ||
white-space: nowrap; | ||
width: fit-content; | ||
} | ||
|
||
.row { | ||
justify-content: center; | ||
gap: 24px; | ||
margin-bottom: 32px; | ||
} | ||
|
||
.col { | ||
width: fit-content; | ||
flex-grow: 0; | ||
min-width: 306px; | ||
} | ||
} | ||
} |
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
23 changes: 23 additions & 0 deletions
23
assets/js/components/Dashboard/PermanentConfiguration/AppBar.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,23 @@ | ||
import React, { ComponentType } from "react"; | ||
import { CloseButton, Container, Navbar } from "react-bootstrap"; | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
interface AppBarProps { | ||
title: string; | ||
} | ||
|
||
const Appbar: ComponentType<AppBarProps> = (props: AppBarProps) => { | ||
const { title } = props; | ||
const navigate = useNavigate(); | ||
|
||
return ( | ||
<Navbar variant="dark" data-bs-theme="dark"> | ||
<Container> | ||
<Navbar.Brand>{title}</Navbar.Brand> | ||
<CloseButton variant="white" onClick={() => navigate(-1)} /> | ||
</Container> | ||
</Navbar> | ||
); | ||
}; | ||
|
||
export default Appbar; |
26 changes: 26 additions & 0 deletions
26
assets/js/components/Dashboard/PermanentConfiguration/ButtonImage.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,26 @@ | ||
import React, { ComponentType } from "react"; | ||
import { Button } from "react-bootstrap"; | ||
|
||
interface ButtonImageProps { | ||
fileName: string; | ||
label: string; | ||
onClick: () => unknown; | ||
} | ||
|
||
const ButtonImage: ComponentType<ButtonImageProps> = ( | ||
props: ButtonImageProps | ||
) => { | ||
const { fileName, label, onClick } = props; | ||
return ( | ||
<div className="button-image-container"> | ||
<Button className="button-image" onClick={onClick}> | ||
<div className="button-image__image-container"> | ||
<img alt="" src={`/images/${fileName}`} /> | ||
</div> | ||
<div className="button-image__label">{label}</div> | ||
</Button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ButtonImage; |
136 changes: 136 additions & 0 deletions
136
assets/js/components/Dashboard/PermanentConfiguration/ConfigureScreensPage.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,136 @@ | ||
import React, { ComponentType, useState } from "react"; | ||
import { Col, Container, Row } from "react-bootstrap"; | ||
import AppBar from "./AppBar"; | ||
import ButtonImage from "./ButtonImage"; | ||
import "../../../../css/screenplay.scss"; | ||
import { Place } from "../../../models/place"; | ||
import { useScreenplayContext } from "../../../hooks/useScreenplayContext"; | ||
|
||
const ConfigureScreensPage: ComponentType = () => { | ||
const [selectedScreenType, setSelectedScreenType] = useState<string>(); | ||
const { places } = useScreenplayContext(); | ||
|
||
const getPlacesList = (screenType: string) => { | ||
let filteredPlaces: Place[] = []; | ||
switch (screenType) { | ||
case "gl-eink": | ||
filteredPlaces = places.filter((place) => | ||
place.routes.some((route) => route.startsWith("Green")) | ||
); | ||
break; | ||
default: | ||
throw new Error( | ||
`getPlacesList not implemented for screen type ${screenType}` | ||
); | ||
} | ||
|
||
return filteredPlaces; | ||
}; | ||
|
||
const selectScreenType = (screenType: string) => | ||
setSelectedScreenType(screenType); | ||
|
||
let layout; | ||
switch (selectedScreenType) { | ||
case "gl-eink": | ||
layout = <GlEinkConfigPage places={getPlacesList("gl-eink")} />; | ||
break; | ||
default: | ||
layout = ( | ||
<SelectScreenTypeComponent selectScreenType={selectScreenType} /> | ||
); | ||
} | ||
|
||
return ( | ||
<div className="configure-screens-page"> | ||
<AppBar title="Configure Screens" /> | ||
{layout} | ||
</div> | ||
); | ||
}; | ||
|
||
interface SelectScreenTypeComponentProps { | ||
selectScreenType: (screenType: string) => void; | ||
} | ||
|
||
const SelectScreenTypeComponent: ComponentType<SelectScreenTypeComponentProps> = | ||
(props: SelectScreenTypeComponentProps) => { | ||
const { selectScreenType } = props; | ||
|
||
return ( | ||
<Container className="select-screen-type p-5"> | ||
<Row> | ||
<Col> | ||
<div className="h3 select-screen-type__title"> | ||
Select screen type | ||
</div> | ||
</Col> | ||
<Col></Col> | ||
<Col></Col> | ||
</Row> | ||
<Row md={2} lg={3}> | ||
<Col> | ||
<ButtonImage | ||
fileName="bus-eink.png" | ||
label="Bus E-Ink" | ||
onClick={() => selectScreenType("bus-eink")} | ||
/> | ||
</Col> | ||
<Col> | ||
<ButtonImage | ||
fileName="bus-shelter.png" | ||
label="Bus Shelter" | ||
onClick={() => selectScreenType("bus-shelter")} | ||
/> | ||
</Col> | ||
<Col> | ||
<ButtonImage | ||
fileName="gl-eink.png" | ||
label="Green Line E-Ink" | ||
onClick={() => selectScreenType("gl-eink")} | ||
/> | ||
</Col> | ||
<Col> | ||
<ButtonImage | ||
fileName="dup.png" | ||
label="DUP" | ||
onClick={() => selectScreenType("dup")} | ||
/> | ||
</Col> | ||
<Col> | ||
<ButtonImage | ||
fileName="pre-fare.png" | ||
label="Pre Fare" | ||
onClick={() => selectScreenType("pre-fare")} | ||
/> | ||
</Col> | ||
<Col> | ||
<ButtonImage | ||
fileName="solari.png" | ||
label="Solari" | ||
onClick={() => selectScreenType("solari")} | ||
/> | ||
</Col> | ||
</Row> | ||
</Container> | ||
); | ||
}; | ||
|
||
interface SubwayConfigPageProps { | ||
places: Place[]; | ||
} | ||
|
||
const GlEinkConfigPage: ComponentType<SubwayConfigPageProps> = ({ | ||
places, | ||
}: SubwayConfigPageProps) => { | ||
return ( | ||
<> | ||
<div>GL-Eink</div> | ||
{places.map((place) => ( | ||
<div key={place.id}>{place.name}</div> | ||
))} | ||
</> | ||
); | ||
}; | ||
|
||
export default ConfigureScreensPage; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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