mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-01 05:14:25 +00:00
feat(share): add allow download config to share links (#275)
* feat(share): add allow download config to share links * fix(share): hide download in public share list page when disabled
This commit is contained in:
@@ -25,6 +25,8 @@ interface CompareControlBarProps {
|
||||
onFit: () => void
|
||||
onDownload: (key?: string) => void
|
||||
onToggleFullScreen: () => void
|
||||
/** When false, hides the download affordance. Defaults to true. */
|
||||
allowDownload?: boolean
|
||||
}
|
||||
|
||||
export function CompareControlBar({
|
||||
@@ -44,6 +46,7 @@ export function CompareControlBar({
|
||||
onFit,
|
||||
onDownload,
|
||||
onToggleFullScreen,
|
||||
allowDownload = true,
|
||||
}: CompareControlBarProps) {
|
||||
// Active side is a video: reuse the shared VideoControlBar.
|
||||
if (activeState?.kind === 'video' && activeState.video && activeAsset) {
|
||||
@@ -94,6 +97,7 @@ export function CompareControlBar({
|
||||
totalFrames={v.totalFrames}
|
||||
currentFrame={v.currentFrame}
|
||||
seekToFrame={onSeek}
|
||||
allowDownload={allowDownload}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -109,6 +113,7 @@ export function CompareControlBar({
|
||||
onDownload={() => onDownload()}
|
||||
canDownload={!!activeAsset?.media?.original?.key}
|
||||
fullscreen={{ isFullScreen, onToggle: onToggleFullScreen }}
|
||||
allowDownload={allowDownload}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ interface CompareViewerProps {
|
||||
onActiveAssetChange: (asset: AssetInfo | null) => void
|
||||
onPlay?: () => void
|
||||
onTimeUpdate?: (second: number) => void
|
||||
/** When false, hides the download affordance. Defaults to true. */
|
||||
allowDownload?: boolean
|
||||
}
|
||||
|
||||
function useCompareAsset(id: string, isPublic: boolean, shareId?: string) {
|
||||
@@ -73,6 +75,7 @@ export function CompareViewer({
|
||||
onActiveAssetChange,
|
||||
onPlay,
|
||||
onTimeUpdate,
|
||||
allowDownload = true,
|
||||
}: CompareViewerProps) {
|
||||
const rootRef = useRef<HTMLDivElement>(null)
|
||||
const leftRef = useRef<ComparePaneHandle | null>(null)
|
||||
@@ -378,6 +381,7 @@ export function CompareViewer({
|
||||
onFit={handleFit}
|
||||
onDownload={handleDownload}
|
||||
onToggleFullScreen={handleToggleFullScreen}
|
||||
allowDownload={allowDownload}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user