Skip to content

Commit

Permalink
Merge pull request #38 from concord-consortium/187369359-update-ui-to…
Browse files Browse the repository at this point in the history
…-match-specs

feat: Update UI to meet design specs [PT-187369359]
  • Loading branch information
dougmartin authored Apr 4, 2024
2 parents d896ae0 + c59a778 commit a5c4424
Show file tree
Hide file tree
Showing 24 changed files with 487 additions and 120 deletions.
6 changes: 6 additions & 0 deletions src/assets/add-state.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/assets/add-transition.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/delete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions src/assets/dropdown-down-arrow-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions src/assets/dropdown-up-arrow-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/fit-view.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions src/assets/home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/assets/pause.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/assets/play.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/recenter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions src/assets/reset.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions src/assets/select.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/assets/step.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 49 additions & 8 deletions src/components/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,25 @@
flex: 1;
flex-grow: 0;
gap: 10px;
background-color: #dddddd7f;
border-radius: 3px;
padding: 5px;

button {
width: fit-content;
padding: 3px 5px;
border-radius: 3px;
border: solid 1px #177991;
background-color: #fff;
font-weight: 500;
display: flex;
align-items: center;
gap: 3px;

&:hover {
background-color: rgba(114, 191, 202, 0.12);
}
}

.generate {
display: flex;
Expand All @@ -102,15 +121,22 @@
label {
display: block;
white-space: nowrap;
font-weight: bold;
}

select {
padding: 2px;
width: 125px;
width: 100%;
border-radius: 1.5px;
border: solid 1px #177991;
background-color: #fff;
}
input {
padding: 2px;
width: 55px;
border-radius: 1.5px;
border: solid 1px #177991;
background-color: #fff;
}
}

Expand All @@ -123,25 +149,22 @@
.buttons {
display: flex;
gap: 5px;

button {
width: fit-content;
}
}
}

.sequence-output {
display: flex;
flex-direction: column;
flex: 1;
gap: 10px;
gap: 5px;

.output {
display: flex;
flex-direction: column;
// gap: 10px;
flex: 1;
border: 1px solid #000;
border: 1px solid #979797;
background-color: white;
position: relative;

.inner-output {
Expand All @@ -163,13 +186,29 @@

&.expanded {
flex-direction: column;

.firstItem {
display: flex;
flex-direction: row;

.collapse {
flex-grow: 1;
text-align: right;
width: 10px;
height: 10px;
margin-top: -2px;
}
}
}
&.collapsed {
flex-direction: row;

.expand {
flex-grow: 1;
text-align: right;
width: 10px;
height: 10px;
margin-top: -2px;
}
}
}
Expand All @@ -181,7 +220,9 @@
}

.buttons {

button {
padding: 8px;
}
}
}
}
Expand Down
29 changes: 22 additions & 7 deletions src/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ import { clsx } from "clsx";

import { useCODAP } from "../hooks/use-codap";
import { useGraph } from "../hooks/use-graph";
import { Graph } from "./graph";
import { useGenerator } from "../hooks/use-generator";
import { Edge, Node } from "../type";
import { Drawing } from "./drawing";
import { Dataset } from "./dataset";

import StepIcon from "../assets/step.svg";
import PlayIcon from "../assets/play.svg";
import PauseIcon from "../assets/pause.svg";
import DropdownUpArrowIcon from "../assets/dropdown-up-arrow-icon.svg";
import DropdownDownArrowIcon from "../assets/dropdown-down-arrow-icon.svg";

import "./app.scss";

Expand Down Expand Up @@ -34,7 +40,10 @@ const SequenceOutputHeader = ({ group }: { group: SequenceGroup }) => {
if (expanded) {
return (
<div className="header expanded" onClick={handleToggleExpanded}>
<div>Starting State: {startingState}</div>
<div className="firstItem">
<div>Starting State: {startingState}</div>
<span className="collapse"><DropdownUpArrowIcon /></span>
</div>
<div>Max Length: {lengthLimit}</div>
<div>Delimiter: {delimiter}</div>
</div>
Expand All @@ -48,7 +57,7 @@ const SequenceOutputHeader = ({ group }: { group: SequenceGroup }) => {
<span>{lengthLimit}</span>
<span>/</span>
<span>{delimiter}</span>
<span className="expand">&hellip;</span>
<span className="expand"><DropdownDownArrowIcon /></span>
</div>
);
};
Expand Down Expand Up @@ -266,6 +275,7 @@ export const App = () => {
const uiForGenerate = () => {
const disabled = graphEmpty();
const playLabel = generationMode === "playing" ? "Pause" : (generationMode === "paused" ? "Resume" : "Play");
const PlayOrPauseIcon = generationMode === "playing" ? PauseIcon : PlayIcon;
const onPlayClick = generationMode === "playing"
? handlePause
: (generationMode === "paused" ? handleResume : handlePlay);
Expand Down Expand Up @@ -303,18 +313,26 @@ export const App = () => {
/>
</div>
</div>

<div>
<label>Simulation Speed:</label>
<div>TBD</div>
</div>

</div>
<div className="buttons">
<button
type="button"
onClick={onPlayClick}
disabled={disabled || lengthLimit === undefined || generationMode === "stepping"}>
<PlayOrPauseIcon />
{playLabel}
</button>
<button
type="button"
onClick={handleStep}
disabled={disabled || lengthLimit === undefined || generationMode === "playing"}>
<StepIcon />
Step
</button>
</div>
Expand Down Expand Up @@ -427,17 +445,14 @@ export const App = () => {
setSelectedNodeId={setSelectedNodeId}
/>
:
<Graph
mode="dataset"
<Dataset
graph={graph}
highlightNode={highlightNode}
highlightLoopOnNode={highlightLoopOnNode}
highlightEdge={highlightEdge}
highlightAllNextNodes={highlightAllNextNodes}
selectedNodeId={selectedNodeId}
animating={animating}
allowDragging={true && !animating}
autoArrange={true}
setSelectedNodeId={setSelectedNodeId}
/>
}
Expand Down
5 changes: 5 additions & 0 deletions src/components/dataset.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.dataset {
display: flex;
flex-direction: row;
flex: 1;
}
Loading

0 comments on commit a5c4424

Please sign in to comment.