Skip to content

Commit

Permalink
fix: Updated highlight styling and tool selection to match spec [PT-1…
Browse files Browse the repository at this point in the history
  • Loading branch information
dougmartin committed Sep 26, 2024
1 parent 905f341 commit 06b1019
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,10 @@
}
}
.sequences {
padding: 5px;
padding: 5px 0;

.sequence {
padding: 0 5px;
cursor: pointer;

&.highlighted {
Expand Down
3 changes: 3 additions & 0 deletions src/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ export const App = () => {
}
}, [highlightOutput, setHighlightOutput, setSelectedNodeId]);

const handleClearHighlightOutput = () => setHighlightOutput(undefined);

const uiForGenerate = () => {
const playLabel = generationMode === "playing" ? "Pause" : (generationMode === "paused" ? "Resume" : "Play");
const PlayOrPauseIcon = generationMode === "playing" ? PauseIcon : PlayIcon;
Expand Down Expand Up @@ -624,6 +626,7 @@ export const App = () => {
fitViewAt={fitViewAt}
recenterViewAt={recenterViewAt}
onDimensions={handleDimensionChange}
onClearHighlightOutput={handleClearHighlightOutput}
/>
:
<Dataset
Expand Down
4 changes: 3 additions & 1 deletion src/components/drawing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ interface Props {
onFitView: () => void;
onRecenterView: () => void;
onDimensions?: (dimensions: {width: number, height: number}) => void;
onClearHighlightOutput?: () => void;
}

const keepPunctuationRegex = /[.,?!:;]/g;
Expand All @@ -41,7 +42,7 @@ const removePunctuationRegex = /["(){}[\]_+=|\\/><]/g;
export const Drawing = (props: Props) => {
const {highlightNode, highlightLoopOnNode, highlightEdge, highlightAllNextNodes, highlightOutputNodes,
graph, setGraph, setHighlightNode, setSelectedNodeId: _setSelectedNodeId,
fitViewAt, recenterViewAt,
fitViewAt, recenterViewAt, onClearHighlightOutput,
selectedNodeId, animating, onReset, onReturnToMainMenu, onFitView, onRecenterView} = props;
const [drawingMode, setDrawingMode] = useState<DrawingMode>("select");
const [firstEdgeNode, setFirstEdgeNode] = useState<Node|undefined>(undefined);
Expand Down Expand Up @@ -120,6 +121,7 @@ export const Drawing = (props: Props) => {
}, [drawingMode, textAreaRef]);

const handleToolSelected = (tool: Tool) => {
onClearHighlightOutput?.();
if (drawingTools.includes(tool)) {
setDrawingMode(tool as DrawingMode);
setAutoArrange(tool === "addText");
Expand Down

0 comments on commit 06b1019

Please sign in to comment.