-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Viewer improvements #2909
Merged
Merged
Viewer improvements #2909
Changes from 13 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
66b8cc2
move imperative handle to SquiggleProvider
berekuk bbc9569
extract <FocusedNavigation> component
berekuk de1f595
dropdown in DynamicSquiggleViewer
berekuk 0be4cb9
ValueWithContextViewer refactorings
berekuk 9157b24
dropdown icons, titles
berekuk 324d276
further viewer improvements
berekuk 5d3bd64
rename and improve SquiggleOutputViewer; allow jsx in dropdown item t…
berekuk c497ab1
storybook improvements
berekuk 2d6d20d
SquiggleViewer value is required
berekuk 1d13477
SquiggleViewer now takes a value, not a result
berekuk 38b45d4
expose SquiggleErrorAlert, add some stories
berekuk c88a8d3
lint fix
berekuk aede924
build fixes
berekuk c364c10
Merge branch 'main' into viewer-improvements
berekuk ce6b7c5
address CR comments
berekuk df9b901
build fix
berekuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
81 changes: 0 additions & 81 deletions
81
packages/components/src/components/DynamicSquiggleViewer.tsx
This file was deleted.
Oops, something went wrong.
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
21 changes: 21 additions & 0 deletions
21
packages/components/src/components/SquiggleOutputViewer/Indicator.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,21 @@ | ||
import { FC } from "react"; | ||
|
||
import { SquiggleOutput } from "../../lib/hooks/useSquiggle.js"; | ||
|
||
export const Indicator: FC<{ output: SquiggleOutput; isRunning: boolean }> = ({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
output, | ||
isRunning, | ||
}) => { | ||
const showTime = (executionTime: number) => | ||
executionTime > 1000 | ||
? `${(executionTime / 1000).toFixed(2)}s` | ||
: `${executionTime}ms`; | ||
|
||
return ( | ||
<div className="text-zinc-400 text-sm whitespace-nowrap"> | ||
{isRunning | ||
? "rendering..." | ||
: `render #${output.executionId} in ${showTime(output.executionTime)}`} | ||
</div> | ||
); | ||
}; |
23 changes: 23 additions & 0 deletions
23
packages/components/src/components/SquiggleOutputViewer/Layout.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 { FC, ReactNode } from "react"; | ||
berekuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export const Layout: FC<{ | ||
viewer: ReactNode; | ||
menu: ReactNode; | ||
indicator: ReactNode; | ||
}> = ({ viewer, menu, indicator }) => { | ||
return ( | ||
// `flex flex-col` helps to fit this in playground right panel and doesn't hurt otherwise | ||
<div className="flex flex-col overflow-y-auto"> | ||
<div className="flex justify-between items-center px-2 h-8 mb-1"> | ||
{menu} | ||
{indicator} | ||
</div> | ||
<div | ||
className="flex-1 overflow-auto px-2 pb-1" | ||
data-testid="dynamic-viewer-result" | ||
> | ||
{viewer} | ||
</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this SquiggleErrorAlert, but the others MessageAlert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name is the same as it was before, but I think it's good:
SqError
, so it's squiggle-specific<MessageAlert>
, this component is public, and other components haveSquiggle
prefix