Skip to content
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

"Download" buttons with popup (including Open in "QuiltSync" button) #4353

Merged
merged 80 commits into from
Mar 17, 2025
Merged
Changes from 1 commit
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
33e5de8
open in desktop on package page
fiskus Mar 6, 2025
1fe3708
put code into tooltip in Bucket/File and Bucket/Dir and configure the…
fiskus Mar 7, 2025
9d0eae8
refactor: replace link with button group for desktop app dropdown menu
fiskus Mar 7, 2025
488b8c2
refactor: move button inside tooltip and use ClickAwayListener for cl…
fiskus Mar 7, 2025
cea5aae
adjust styles
fiskus Mar 7, 2025
0defb91
refactor: replace M.Tabs with custom tab buttons and vertical divider
fiskus Mar 7, 2025
1898be5
simplify styles
fiskus Mar 7, 2025
e148f0a
refactor: replace TextField with StyledLink in QuiltSync component
fiskus Mar 7, 2025
f1e6604
optimize
fiskus Mar 7, 2025
2e8027e
refactor: split Download component into DownloadFile and DownloadDir
fiskus Mar 7, 2025
7ee8118
polishing the UI
fiskus Mar 7, 2025
968cac9
update the test spec
fiskus Mar 7, 2025
3b75e2b
reitrate on code and download button for Bucket view
fiskus Mar 10, 2025
e21c8fb
remove download component
fiskus Mar 10, 2025
bf791ee
move download button to ./Download
fiskus Mar 10, 2025
d49a1b8
optimize use of s3 handles
fiskus Mar 10, 2025
1186e3c
re-organize files, remove OpenInDesktop, re-use Download
fiskus Mar 10, 2025
90d7a32
dummy file
fiskus Mar 10, 2025
a3693ed
refactor: extract common tab component to OptionsTabs
fiskus Mar 10, 2025
88952eb
refactor: replace Tab interface with labels array and children render…
fiskus Mar 10, 2025
2a085e2
simplify
fiskus Mar 10, 2025
a73eb53
refactor: extract CodePanel and DownloadPanel components in bucket op…
fiskus Mar 10, 2025
51f0b91
refactor: use classnames package for conditional class application in…
fiskus Mar 10, 2025
6ef32e0
refactor: simplify tab rendering logic in download options components
fiskus Mar 10, 2025
a96056f
refactor: add TabPanel component and rename OptionsTabs to Tabs
fiskus Mar 10, 2025
3ba6232
TabPanel component
fiskus Mar 10, 2025
7023a49
feat: add hideDownload and hideCode options to BucketOptions and Pack…
fiskus Mar 10, 2025
016d39f
refactor: implement mutually exclusive hideCode and hideDownload options
fiskus Mar 10, 2025
5dcb999
fix types and reorganize to beautify
fiskus Mar 10, 2025
a98c439
refactor: implement FileHandle and DirHandle types with isFile type g…
fiskus Mar 10, 2025
0a7308c
cosmetic changes
fiskus Mar 10, 2025
4a9544f
refactor: replace StyledTooltip with positioned Paper in Download Button
fiskus Mar 10, 2025
da3e76f
refactor: replace custom click outside handler with M.ClickAwayListener
fiskus Mar 10, 2025
05cba4a
nicer position
fiskus Mar 10, 2025
d5dc4ea
refactor: move minWidth from Button to Panel components
fiskus Mar 10, 2025
6a07474
handle different widths
fiskus Mar 10, 2025
1dbd1c7
refactor: replace hideDownload/hideCode with single hide option
fiskus Mar 10, 2025
f7fb494
refactor: simplify options by replacing hide enum with hideCode boolean
fiskus Mar 10, 2025
91a8d01
hideCode option
fiskus Mar 10, 2025
91b5c15
autoformat
fiskus Mar 10, 2025
0acd352
make files structure more flat; move ./CodeSamples to ./Download
fiskus Mar 10, 2025
0ee7996
use outlined button
fiskus Mar 10, 2025
03c57e5
polish
fiskus Mar 10, 2025
8c39719
feat: implement smooth width transition for tabs based on active tab
fiskus Mar 10, 2025
753bbc4
inline prefs match
fiskus Mar 10, 2025
ea68b99
better formatting
fiskus Mar 10, 2025
ffb78ec
adjust test
fiskus Mar 10, 2025
d0c1ce0
polishing and make some cosmetic changes
fiskus Mar 11, 2025
5b8bfe1
handle selection outside, so it will work for embed
fiskus Mar 11, 2025
ba40daa
use backdrop instead of ClickAwayListener
fiskus Mar 11, 2025
b0ef709
add quiltsync url
fiskus Mar 11, 2025
235bd45
add changelog entry
fiskus Mar 11, 2025
d6fb99f
Merge branch 'master' into open-in-desktop-bucket
fiskus Mar 11, 2025
04963a4
Merge branch 'open-in-desktop-bucket' of github.com:quiltdata/quilt i…
fiskus Mar 11, 2025
29c6440
update tests
fiskus Mar 11, 2025
5ef1c54
Apply suggestions from code review
fiskus Mar 11, 2025
eafc555
remove extra classname
fiskus Mar 11, 2025
ab3d21b
autoformat
fiskus Mar 11, 2025
646d3a8
fix dirhandle
fiskus Mar 11, 2025
f2aff96
Merge branch 'master' into open-in-desktop-bucket
fiskus Mar 11, 2025
bc6fd8a
Merge branch 'master' into open-in-desktop-bucket
fiskus Mar 11, 2025
021fd3c
Get files
fiskus Mar 11, 2025
4a7b802
fix setting endIcon on iconbutton
fiskus Mar 11, 2025
5743932
handle narrow screens
fiskus Mar 11, 2025
37336c7
Merge branch 'open-in-desktop-bucket' of github.com:quiltdata/quilt i…
fiskus Mar 11, 2025
a458f22
Apply suggestions from code review
fiskus Mar 13, 2025
f4bdf03
feat: add memoized LineOfCode component for syntax highlighting
fiskus Mar 13, 2025
c2f287f
style: change tab highlight color from primary to secondary
fiskus Mar 13, 2025
df644fe
refactor: hardcode tab labels inside Tabs component
fiskus Mar 13, 2025
da650c2
refactor: use string literal type for activeTab instead of number
fiskus Mar 13, 2025
35a1331
refactor: replace children prop with download and code props in Optio…
fiskus Mar 13, 2025
6c3e944
chore: add debug logging to CodePanel component
fiskus Mar 13, 2025
42b7c5e
refactor: wrap components in TabPanel for consistent UI structure
fiskus Mar 13, 2025
dce24b0
re-use download panel
fiskus Mar 13, 2025
0053a4d
refactor: reuse DownloadPanel component in PackageOptions similar to …
fiskus Mar 13, 2025
d0d495d
reuse tab names for classes
fiskus Mar 13, 2025
8243f11
refactor: use TabType for TabsProps interface definition
fiskus Mar 13, 2025
1166396
fix
fiskus Mar 13, 2025
1d75c9a
remove extra useCallback; streamline width transition
fiskus Mar 14, 2025
2cbf1ae
Merge branch 'master' into open-in-desktop-bucket
fiskus Mar 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
simplify
fiskus committed Mar 10, 2025
commit 2a085e29e714a709f5569124bb5543f2daafd272
14 changes: 3 additions & 11 deletions catalog/app/containers/Bucket/Download/BucketOptions.tsx
Original file line number Diff line number Diff line change
@@ -40,10 +40,8 @@ interface OptionsProps {
}

export default function Options({ handle }: OptionsProps) {
const labels = ['Download', 'Code']

return (
<OptionsTabs labels={labels}>
<OptionsTabs labels={['Download', 'Code']}>
{(activeTab) => {
switch (activeTab) {
case 0:
@@ -54,15 +52,9 @@ export default function Options({ handle }: OptionsProps) {
)
case 1:
return handle.version ? (
<FileCodeSamples
bucket={handle.bucket}
path={handle.key}
/>
<FileCodeSamples bucket={handle.bucket} path={handle.key} />
) : (
<DirCodeSamples
bucket={handle.bucket}
path={handle.key}
/>
<DirCodeSamples bucket={handle.bucket} path={handle.key} />
)
default:
return null
43 changes: 17 additions & 26 deletions catalog/app/containers/Bucket/Download/OptionsTabs.tsx
Original file line number Diff line number Diff line change
@@ -33,11 +33,6 @@ const useStyles = M.makeStyles((t) => ({
backgroundColor: t.palette.primary.main,
},
},
quiltSync: {
padding: t.spacing(0, 0, 2),
borderBottom: `1px solid ${t.palette.divider}`,
marginBottom: t.spacing(1),
},
tab: {
padding: t.spacing(2, 2, 1),
animation: `$show 150ms ease-out`,
@@ -61,35 +56,31 @@ const useStyles = M.makeStyles((t) => ({
}))

interface OptionsTabsProps {
labels: string[]
labels: [string, string]
children: (activeTab: number) => React.ReactNode
initialTab?: number
}

export default function OptionsTabs({ labels, children, initialTab = 0 }: OptionsTabsProps) {
export default function OptionsTabs({ labels, children }: OptionsTabsProps) {
const classes = useStyles()
const [activeTab, setActiveTab] = React.useState(initialTab)
const [activeTab, setActiveTab] = React.useState(0)

return (
<div className={classes.root}>
<M.Paper className={classes.tabsContainer} elevation={1}>
{labels.map((label, index) => (
<React.Fragment key={index}>
{index > 0 && <M.Divider orientation="vertical" />}
<M.Button
className={`${classes.tabButton} ${activeTab === index ? classes.activeTab : ''}`}
onClick={() => setActiveTab(index)}
>
{label}
</M.Button>
</React.Fragment>
))}
<M.Button
className={`${classes.tabButton} ${activeTab === 0 ? classes.activeTab : ''}`}
onClick={() => setActiveTab(0)}
>
{labels[0]}
</M.Button>
<M.Button
className={`${classes.tabButton} ${activeTab === 1 ? classes.activeTab : ''}`}
onClick={() => setActiveTab(1)}
>
{labels[1]}
</M.Button>
</M.Paper>
<div className={classes.tab}>
{children(activeTab)}
</div>
<div className={classes.tab}>{children(activeTab)}</div>
</div>
)
}

export { useStyles }
18 changes: 11 additions & 7 deletions catalog/app/containers/Bucket/Download/PackageOptions.tsx
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ import copyToClipboard from 'utils/clipboard'
import * as FileView from '../FileView'
import PackageCodeSamples from '../CodeSamples/Package'
import * as Selection from '../Selection'
import OptionsTabs, { useStyles } from './OptionsTabs'
import OptionsTabs from './OptionsTabs'

interface DownloadFileProps {
fileHandle: Model.S3.S3ObjectLocation
@@ -110,6 +110,14 @@ function QuiltSync({ className, uri }: QuiltSyncProps) {
)
}

const useStyles = M.makeStyles((t) => ({
quiltSync: {
padding: t.spacing(0, 0, 2),
borderBottom: `1px solid ${t.palette.divider}`,
marginBottom: t.spacing(1),
},
}))

interface OptionsProps {
hashOrTag: string
fileHandle?: Model.S3.S3ObjectLocation
@@ -119,10 +127,8 @@ interface OptionsProps {
// FIXME: configure hiding tabs in Props, so we can manage it in Embed views
export default function Options({ fileHandle, hashOrTag, uri }: OptionsProps) {
const classes = useStyles()
const labels = ['QuiltSync', 'Code']

return (
<OptionsTabs labels={labels}>
<OptionsTabs labels={['QuiltSync', 'Code']}>
{(activeTab) => {
switch (activeTab) {
case 0:
@@ -137,9 +143,7 @@ export default function Options({ fileHandle, hashOrTag, uri }: OptionsProps) {
</>
)
case 1:
return (
<PackageCodeSamples hashOrTag={hashOrTag} {...uri} />
)
return <PackageCodeSamples hashOrTag={hashOrTag} {...uri} />
default:
return null
}