-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Stream type selection, Stream creation, and Preset creation moda…
…ls into the components folder and reuse them on the home page
- Loading branch information
1 parent
f9a577a
commit 259e28e
Showing
17 changed files
with
114 additions
and
74 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.
File renamed without changes.
49 changes: 49 additions & 0 deletions
49
web/src/components/CreateStreamModal/CreateStreamModal.jsx
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,49 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import StreamTemplates from "./StreamTemplates.json"; | ||
import TypeSelectModal from "./TypeSelectModal/TypeSelectModal"; | ||
import StreamModal from "./StreamModal/StreamModal"; | ||
|
||
export default function CreateStreamModal({showSelect, onClose}) { | ||
// A wrapper for two modals so that their workflows can easily be placed wherever needed | ||
const [showCreate, setShowCreate] = React.useState(false); | ||
const [selectedType, setSelectedType] = React.useState(""); | ||
|
||
const initEmptyStream = (type) => { | ||
const streamTemplate = StreamTemplates.filter((t) => t.type === type)[0]; | ||
let stream = { type: type, disabled: false }; | ||
streamTemplate.fields.forEach((field) => { | ||
stream[field.name] = field.default; | ||
}); | ||
return stream; | ||
}; | ||
|
||
return( | ||
<> | ||
{showSelect && ( | ||
<TypeSelectModal | ||
onClose={() => { | ||
onClose(); | ||
}} | ||
onSelect={(type) => { | ||
setSelectedType(type); | ||
onClose(); | ||
setShowCreate(true); | ||
}} | ||
/> | ||
)} | ||
{showCreate && ( | ||
<StreamModal | ||
stream={initEmptyStream(selectedType)} | ||
onClose={() => { | ||
setShowCreate(false); | ||
}} | ||
/> | ||
)} | ||
</> | ||
) | ||
}; | ||
CreateStreamModal.propTypes = { | ||
showSelect: PropTypes.bool.isRequired, | ||
onClose: PropTypes.func.isRequired, | ||
}; |
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.
File renamed without changes.
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.
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
18 changes: 18 additions & 0 deletions
18
web/src/components/RectangularAddButton/RectangularAddButton.jsx
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,18 @@ | ||
import React from "react"; | ||
import "./RectangularAddButton.scss" | ||
|
||
import PropTypes from "prop-types"; | ||
|
||
export default function RectangularAddButton({onClick}){ | ||
return( | ||
<div | ||
className="rectangular-add-button" | ||
onClick={onClick} | ||
> | ||
+ | ||
</div> | ||
) | ||
} | ||
RectangularAddButton.propTypes = { | ||
onClick: PropTypes.func.isRequired, | ||
}; |
19 changes: 19 additions & 0 deletions
19
web/src/components/RectangularAddButton/RectangularAddButton.scss
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,19 @@ | ||
@use "src/general"; | ||
|
||
.rectangular-add-button { | ||
// @include general.low-shadow; | ||
width: 100%; | ||
height: 4rem; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
font-size: 3rem; | ||
color: general.$controls-color; | ||
border-color: general.$secondary; | ||
border-style: solid; | ||
border-radius: 1rem; | ||
background-color: general.$bg; | ||
|
||
@include general.button-hover; | ||
} |
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
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