-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement basic sidebar layout #60
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
28ee32b
Update names
aganders3 ea0a1a2
Icon changes, add DataControls for info, copy URL, and set data URL
aganders3 1af901b
Add Zebrahub logo
aganders3 86103a6
Remove commented code. Tweak appearance.
aganders3 d2f5897
Match toolbar sizes
aganders3 722f186
Fix SDS deprecation warning
aganders3 8986052
Partially functioning popover for Zarr URL input
aganders3 0e9e6b0
Add snackbar when copying URL
aganders3 043c420
Minor padding tweaks
aganders3 f22c77b
Use frames instead of percent for track highlight length
aganders3 8bbc90e
Remove arbitrary camera position and target in PointCanvas constructo…
aganders3 e0b46ef
Update data URL input to use cancel/apply buttons instead of loading …
aganders3 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
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
aganders3 marked this conversation as resolved.
Show resolved
Hide resolved
|
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,137 @@ | ||
import { useState } from "react"; | ||
|
||
import { Alert, Box, Popover, Snackbar, Stack, Typography } from "@mui/material"; | ||
import { styled } from "@mui/material/styles"; | ||
import { fontBodyXs } from "czifui"; | ||
|
||
import { Button, ButtonIcon, InputText } from "@czi-sds/components"; | ||
|
||
import { TrackManager } from "@/lib/TrackManager"; | ||
|
||
interface DataControlsProps { | ||
dataUrl: string; | ||
initialDataUrl: string; | ||
setDataUrl: (dataUrl: string) => void; | ||
copyShareableUrlToClipboard: () => void; | ||
trackManager: TrackManager | null; // TODO: remove this? | ||
} | ||
|
||
export default function DataControls(props: DataControlsProps) { | ||
const [copyUrlSnackBarOpen, setCopyUrlSnackBarOpen] = useState(false); | ||
const [urlPopoverAnchor, setUrlPopoverAnchor] = useState<HTMLButtonElement | null>(null); | ||
|
||
const copyShareableUrlToClipBoard = () => { | ||
props.copyShareableUrlToClipboard(); | ||
setCopyUrlSnackBarOpen(true); | ||
}; | ||
|
||
const handleShareableUrlSnackBarClose = () => { | ||
setCopyUrlSnackBarOpen(false); | ||
}; | ||
|
||
const showUrlPopover = (event: React.MouseEvent<HTMLButtonElement>) => { | ||
setUrlPopoverAnchor(event.currentTarget); | ||
}; | ||
|
||
const handleUrlPopoverClose = () => { | ||
setUrlPopoverAnchor(null); | ||
}; | ||
|
||
return ( | ||
<Box | ||
sx={{ | ||
display: "flex", | ||
flexDirection: "row", | ||
justifyContent: "space-between", | ||
// 5px margin makes this bar match the PlaybackControls height | ||
// because that component uses primary buttons, which hava a 5px margin | ||
margin: "5px", | ||
}} | ||
> | ||
{/* TODO: make this do something */} | ||
<ButtonIcon | ||
sdsIcon="infoCircle" | ||
sdsSize="large" | ||
sdsType="secondary" | ||
onClick={() => { | ||
window.alert("Not implemented :)"); | ||
}} | ||
/> | ||
|
||
<ButtonIcon | ||
sdsIcon="share" | ||
sdsSize="large" | ||
sdsType="secondary" | ||
disabled={!props.trackManager} | ||
onClick={copyShareableUrlToClipBoard} | ||
/> | ||
<Snackbar | ||
open={copyUrlSnackBarOpen} | ||
anchorOrigin={{ vertical: "bottom", horizontal: "left" }} | ||
autoHideDuration={2500} | ||
onClose={handleShareableUrlSnackBarClose} | ||
// This is a hack to make the snackbar appear above the bottom bar | ||
sx={{ | ||
"&.MuiSnackbar-root": { bottom: "100px" }, | ||
}} | ||
> | ||
<Alert | ||
// SDS alert does not work in here | ||
severity="success" | ||
variant="filled" | ||
> | ||
Shareable URL copied to clipboard! | ||
</Alert> | ||
</Snackbar> | ||
|
||
<ButtonIcon sdsIcon="globeBasic" sdsSize="large" sdsType="secondary" onClick={showUrlPopover} /> | ||
<Popover | ||
open={Boolean(urlPopoverAnchor)} | ||
anchorEl={urlPopoverAnchor} | ||
onClose={handleUrlPopoverClose} | ||
anchorOrigin={{ | ||
vertical: "top", | ||
horizontal: "right", | ||
}} | ||
transformOrigin={{ | ||
vertical: "bottom", | ||
horizontal: "left", | ||
}} | ||
> | ||
<Stack | ||
spacing={4} | ||
sx={{ | ||
"padding": "1em", | ||
"width": "768px", | ||
"& > label": { fontSize: "0.83em", fontWeight: "bold" }, | ||
}} | ||
> | ||
<InputText | ||
id="url-input" | ||
label="Zarr URL" | ||
placeholder={props.initialDataUrl} | ||
defaultValue={props.initialDataUrl} | ||
onChange={(e) => props.setDataUrl(e.target.value)} | ||
aganders3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fullWidth={true} | ||
intent={props.trackManager ? "default" : "error"} | ||
/> | ||
<Note> | ||
<strong>Note:</strong> Changing this URL will replace the image and reset the canvas. | ||
</Note> | ||
<Stack direction="row" spacing={4}> | ||
<Button sdsStyle="square" sdsType="secondary" onClick={handleUrlPopoverClose}> | ||
Cancel | ||
</Button> | ||
<Button sdsStyle="square" sdsType="primary"> | ||
Apply | ||
</Button> | ||
</Stack> | ||
</Stack> | ||
</Popover> | ||
</Box> | ||
); | ||
} | ||
|
||
const Note = styled(Typography)` | ||
${fontBodyXs} | ||
`; |
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
File renamed without changes.
Oops, something went wrong.
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.
Here are the zebrahub icons if we want a bigger one. We probably also want to set this as our favicon unless we come up with a separate logo for this.