no prev/next anymore
This commit is contained in:
@@ -21,10 +21,6 @@ type PreviewEntry = {
|
|||||||
contentType?: string | null;
|
contentType?: string | null;
|
||||||
filename?: string | null;
|
filename?: string | null;
|
||||||
expiresAt?: number;
|
expiresAt?: number;
|
||||||
canGoPrev?: boolean;
|
|
||||||
canGoNext?: boolean;
|
|
||||||
goPrev?: () => void;
|
|
||||||
goNext?: () => void;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
interface AssetManagerLike {
|
interface AssetManagerLike {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import type { JSX } from 'react';
|
import type { JSX } from 'react';
|
||||||
import { ArrowLeftIcon, ArrowRightIcon } from '../ui/icons';
|
|
||||||
import { useAssetNavigator } from '../hooks/useAssetNavigator';
|
import { useAssetNavigator } from '../hooks/useAssetNavigator';
|
||||||
import { preventAll } from './events';
|
|
||||||
|
|
||||||
type Identifier = string | number;
|
type Identifier = string | number;
|
||||||
|
|
||||||
@@ -32,11 +30,6 @@ type GetDocumentAsset = (document: DocumentLike | null, assetType: string) => As
|
|||||||
interface NavigatorSnapshot {
|
interface NavigatorSnapshot {
|
||||||
url: string | null;
|
url: string | null;
|
||||||
alt?: string;
|
alt?: string;
|
||||||
canGoPrev: boolean;
|
|
||||||
canGoNext: boolean;
|
|
||||||
goPrev?: () => void;
|
|
||||||
goNext?: () => void;
|
|
||||||
ordinal: number;
|
|
||||||
width: number | null;
|
width: number | null;
|
||||||
height: number | null;
|
height: number | null;
|
||||||
}
|
}
|
||||||
@@ -46,7 +39,6 @@ interface DesktopPreviewCardProps {
|
|||||||
title?: string;
|
title?: string;
|
||||||
ensureAssetUrl?: EnsureAssetUrl | null;
|
ensureAssetUrl?: EnsureAssetUrl | null;
|
||||||
getDocumentAsset: GetDocumentAsset;
|
getDocumentAsset: GetDocumentAsset;
|
||||||
prefetch?: number;
|
|
||||||
onNavigatorSnapshot?: (docId: Identifier, snapshot: NavigatorSnapshot | null) => void;
|
onNavigatorSnapshot?: (docId: Identifier, snapshot: NavigatorSnapshot | null) => void;
|
||||||
shouldLoad?: boolean;
|
shouldLoad?: boolean;
|
||||||
}
|
}
|
||||||
@@ -56,7 +48,6 @@ const DesktopPreviewCard = ({
|
|||||||
title,
|
title,
|
||||||
ensureAssetUrl,
|
ensureAssetUrl,
|
||||||
getDocumentAsset,
|
getDocumentAsset,
|
||||||
prefetch = 3,
|
|
||||||
onNavigatorSnapshot,
|
onNavigatorSnapshot,
|
||||||
shouldLoad = true,
|
shouldLoad = true,
|
||||||
}: DesktopPreviewCardProps): JSX.Element => {
|
}: DesktopPreviewCardProps): JSX.Element => {
|
||||||
@@ -65,10 +56,9 @@ const DesktopPreviewCard = ({
|
|||||||
assetType: 'thumbnail',
|
assetType: 'thumbnail',
|
||||||
ensureAssetUrl: shouldLoad ? ensureAssetUrl : null,
|
ensureAssetUrl: shouldLoad ? ensureAssetUrl : null,
|
||||||
getAsset: getDocumentAsset,
|
getAsset: getDocumentAsset,
|
||||||
prefetch,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const { currentUrl, cardinality, canGoPrev, canGoNext, currentMetadata, ordinal } = navigator;
|
const { currentUrl, currentMetadata } = navigator;
|
||||||
const docId = doc?.id ?? null;
|
const docId = doc?.id ?? null;
|
||||||
|
|
||||||
const metadataWidth = Number((currentMetadata as { width?: number } | null)?.width);
|
const metadataWidth = Number((currentMetadata as { width?: number } | null)?.width);
|
||||||
@@ -78,14 +68,13 @@ const DesktopPreviewCard = ({
|
|||||||
if (!onNavigatorSnapshot || !docId) {
|
if (!onNavigatorSnapshot || !docId) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
if (!currentUrl) {
|
||||||
|
onNavigatorSnapshot(docId, null);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
const snapshot = {
|
const snapshot = {
|
||||||
url: currentUrl || null,
|
url: currentUrl,
|
||||||
alt: title,
|
alt: title,
|
||||||
canGoPrev,
|
|
||||||
canGoNext,
|
|
||||||
goPrev: navigator.goPrev,
|
|
||||||
goNext: navigator.goNext,
|
|
||||||
ordinal,
|
|
||||||
width: Number.isFinite(metadataWidth) && metadataWidth > 0 ? metadataWidth : null,
|
width: Number.isFinite(metadataWidth) && metadataWidth > 0 ? metadataWidth : null,
|
||||||
height: Number.isFinite(metadataHeight) && metadataHeight > 0 ? metadataHeight : null,
|
height: Number.isFinite(metadataHeight) && metadataHeight > 0 ? metadataHeight : null,
|
||||||
};
|
};
|
||||||
@@ -95,21 +84,14 @@ const DesktopPreviewCard = ({
|
|||||||
docId,
|
docId,
|
||||||
currentUrl,
|
currentUrl,
|
||||||
title,
|
title,
|
||||||
canGoPrev,
|
|
||||||
canGoNext,
|
|
||||||
ordinal,
|
|
||||||
metadataWidth,
|
metadataWidth,
|
||||||
metadataHeight,
|
metadataHeight,
|
||||||
navigator.goPrev,
|
|
||||||
navigator.goNext,
|
|
||||||
onNavigatorSnapshot,
|
onNavigatorSnapshot,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const hasPreview = Boolean(currentUrl);
|
const hasPreview = Boolean(currentUrl);
|
||||||
const cardClasses = ['desk-item__card'];
|
const cardClasses = ['desk-item__card'];
|
||||||
if (!hasPreview) cardClasses.push('desk-item__card--empty');
|
if (!hasPreview) cardClasses.push('desk-item__card--empty');
|
||||||
const showNav = hasPreview && (cardinality > 1 || canGoPrev || canGoNext);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cardClasses.join(' ')}
|
className={cardClasses.join(' ')}
|
||||||
@@ -134,58 +116,6 @@ const DesktopPreviewCard = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{showNav ? (
|
|
||||||
<div className="desk-card__nav">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="desk-card__nav-button"
|
|
||||||
onClick={(event) => {
|
|
||||||
preventAll(event);
|
|
||||||
navigator.goPrev();
|
|
||||||
}}
|
|
||||||
onPointerDown={(event) => {
|
|
||||||
preventAll(event);
|
|
||||||
}}
|
|
||||||
onPointerUp={(event) => {
|
|
||||||
preventAll(event);
|
|
||||||
}}
|
|
||||||
onMouseDown={(event) => {
|
|
||||||
preventAll(event);
|
|
||||||
}}
|
|
||||||
onMouseUp={(event) => {
|
|
||||||
preventAll(event);
|
|
||||||
}}
|
|
||||||
disabled={!canGoPrev}
|
|
||||||
aria-label="Previous preview"
|
|
||||||
>
|
|
||||||
<ArrowLeftIcon />
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="desk-card__nav-button"
|
|
||||||
onClick={(event) => {
|
|
||||||
preventAll(event);
|
|
||||||
navigator.goNext();
|
|
||||||
}}
|
|
||||||
onPointerDown={(event) => {
|
|
||||||
preventAll(event);
|
|
||||||
}}
|
|
||||||
onPointerUp={(event) => {
|
|
||||||
preventAll(event);
|
|
||||||
}}
|
|
||||||
onMouseDown={(event) => {
|
|
||||||
preventAll(event);
|
|
||||||
}}
|
|
||||||
onMouseUp={(event) => {
|
|
||||||
preventAll(event);
|
|
||||||
}}
|
|
||||||
disabled={!canGoNext}
|
|
||||||
aria-label="Next preview"
|
|
||||||
>
|
|
||||||
<ArrowRightIcon />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -46,14 +46,8 @@ export interface DeskDocument {
|
|||||||
interface NavigatorSnapshot {
|
interface NavigatorSnapshot {
|
||||||
url: string | null;
|
url: string | null;
|
||||||
alt?: string | null;
|
alt?: string | null;
|
||||||
canGoPrev?: boolean;
|
|
||||||
canGoNext?: boolean;
|
|
||||||
goPrev?: () => void;
|
|
||||||
goNext?: () => void;
|
|
||||||
ordinal?: number | null;
|
|
||||||
width?: number | null;
|
width?: number | null;
|
||||||
height?: number | null;
|
height?: number | null;
|
||||||
contentType?: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type OverlayOriginHint = {
|
type OverlayOriginHint = {
|
||||||
@@ -71,8 +65,10 @@ interface OverlayOriginTransform {
|
|||||||
baseHeight: number;
|
baseHeight: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OverlayDisplay extends NavigatorSnapshot {
|
interface OverlayDisplay {
|
||||||
url: string;
|
url: string;
|
||||||
|
alt?: string | null;
|
||||||
|
contentType?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DocumentSizeInfo {
|
interface DocumentSizeInfo {
|
||||||
@@ -380,11 +376,6 @@ const DesktopWorkspace: React.FC<DesktopWorkspaceProps> = ({
|
|||||||
prevSnapshot &&
|
prevSnapshot &&
|
||||||
prevSnapshot.url === snapshot.url &&
|
prevSnapshot.url === snapshot.url &&
|
||||||
prevSnapshot.alt === snapshot.alt &&
|
prevSnapshot.alt === snapshot.alt &&
|
||||||
prevSnapshot.canGoPrev === snapshot.canGoPrev &&
|
|
||||||
prevSnapshot.canGoNext === snapshot.canGoNext &&
|
|
||||||
prevSnapshot.goPrev === snapshot.goPrev &&
|
|
||||||
prevSnapshot.goNext === snapshot.goNext &&
|
|
||||||
prevSnapshot.ordinal === snapshot.ordinal &&
|
|
||||||
prevSnapshot.width === snapshot.width &&
|
prevSnapshot.width === snapshot.width &&
|
||||||
prevSnapshot.height === snapshot.height;
|
prevSnapshot.height === snapshot.height;
|
||||||
if (sameSnapshot) {
|
if (sameSnapshot) {
|
||||||
@@ -672,11 +663,7 @@ const DesktopWorkspace: React.FC<DesktopWorkspaceProps> = ({
|
|||||||
if (!overlaySource) {
|
if (!overlaySource) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return {
|
return overlaySource;
|
||||||
...overlaySource,
|
|
||||||
canGoPrev: false,
|
|
||||||
canGoNext: false,
|
|
||||||
};
|
|
||||||
}, [overlaySource]);
|
}, [overlaySource]);
|
||||||
|
|
||||||
const overlayDocument = useMemo<DeskDocument | null>(() => {
|
const overlayDocument = useMemo<DeskDocument | null>(() => {
|
||||||
@@ -1122,7 +1109,6 @@ function DesktopWorkspaceView({
|
|||||||
</div>
|
</div>
|
||||||
<PreviewZoomOverlay
|
<PreviewZoomOverlay
|
||||||
open={Boolean(overlayDisplay?.url)}
|
open={Boolean(overlayDisplay?.url)}
|
||||||
display={overlayDisplay}
|
|
||||||
onClose={closeOverlay}
|
onClose={closeOverlay}
|
||||||
document={overlayDocument}
|
document={overlayDocument}
|
||||||
originRect={overlayOriginRect}
|
originRect={overlayOriginRect}
|
||||||
|
|||||||
@@ -24,10 +24,6 @@ type PreviewEntry = {
|
|||||||
url: string;
|
url: string;
|
||||||
alt?: string;
|
alt?: string;
|
||||||
contentType?: string | null;
|
contentType?: string | null;
|
||||||
canGoPrev?: boolean;
|
|
||||||
canGoNext?: boolean;
|
|
||||||
goPrev?: () => void;
|
|
||||||
goNext?: () => void;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type DocumentLikeWithPreview = DocumentLike & { previewEntry?: PreviewEntry };
|
type DocumentLikeWithPreview = DocumentLike & { previewEntry?: PreviewEntry };
|
||||||
|
|||||||
@@ -27,10 +27,7 @@ interface FolderNode {
|
|||||||
|
|
||||||
type PreviewEntry = {
|
type PreviewEntry = {
|
||||||
url?: string;
|
url?: string;
|
||||||
canGoPrev?: boolean;
|
contentType?: string | null;
|
||||||
canGoNext?: boolean;
|
|
||||||
goPrev?: () => void;
|
|
||||||
goNext?: () => void;
|
|
||||||
} | null;
|
} | null;
|
||||||
|
|
||||||
interface UseDetailWorkspaceArgs {
|
interface UseDetailWorkspaceArgs {
|
||||||
|
|||||||
@@ -1,28 +1,26 @@
|
|||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
import { createAssetView } from '../asset_manager';
|
import { createAssetView } from '../asset_manager';
|
||||||
|
|
||||||
type Identifier = string | number;
|
type Identifier = string | number;
|
||||||
|
|
||||||
interface DocumentLike {
|
type DocumentLike = {
|
||||||
id?: Identifier;
|
id?: Identifier;
|
||||||
[key: string]: unknown;
|
[key: string]: unknown;
|
||||||
}
|
};
|
||||||
|
|
||||||
interface AssetObject {
|
type AssetObject = {
|
||||||
ordinal?: number;
|
|
||||||
url?: string | null;
|
url?: string | null;
|
||||||
metadata?: Record<string, unknown> | null;
|
metadata?: Record<string, unknown> | null;
|
||||||
[key: string]: unknown;
|
[key: string]: unknown;
|
||||||
}
|
};
|
||||||
|
|
||||||
interface AssetLike {
|
type AssetLike = {
|
||||||
id?: Identifier;
|
id?: Identifier;
|
||||||
cardinality?: number;
|
|
||||||
url?: string | null;
|
url?: string | null;
|
||||||
metadata?: Record<string, unknown> | null;
|
metadata?: Record<string, unknown> | null;
|
||||||
objects?: AssetObject[];
|
objects?: AssetObject[];
|
||||||
[key: string]: unknown;
|
[key: string]: unknown;
|
||||||
}
|
};
|
||||||
|
|
||||||
type EnsureAssetUrl = (
|
type EnsureAssetUrl = (
|
||||||
documentId: Identifier,
|
documentId: Identifier,
|
||||||
@@ -32,21 +30,18 @@ type EnsureAssetUrl = (
|
|||||||
|
|
||||||
type GetAsset = (document: DocumentLike, assetType: string) => AssetLike | null;
|
type GetAsset = (document: DocumentLike, assetType: string) => AssetLike | null;
|
||||||
|
|
||||||
interface AssetViewLike {
|
type AssetViewLike = {
|
||||||
getCardinality: () => number;
|
|
||||||
getObjects: () => AssetObject[];
|
|
||||||
getObject: (ordinal?: number) => AssetObject | null;
|
getObject: (ordinal?: number) => AssetObject | null;
|
||||||
|
getObjects: () => AssetObject[];
|
||||||
getPrimaryUrl: () => string | null;
|
getPrimaryUrl: () => string | null;
|
||||||
getPrimaryMetadata: () => Record<string, unknown> | null;
|
getPrimaryMetadata: () => Record<string, unknown> | null;
|
||||||
}
|
};
|
||||||
|
|
||||||
interface UseAssetNavigatorOptions {
|
interface UseAssetNavigatorOptions {
|
||||||
document?: DocumentLike | null;
|
document?: DocumentLike | null;
|
||||||
assetType: string;
|
assetType: string;
|
||||||
ensureAssetUrl?: EnsureAssetUrl;
|
ensureAssetUrl?: EnsureAssetUrl | null;
|
||||||
getAsset?: GetAsset;
|
getAsset?: GetAsset;
|
||||||
prefetch?: number;
|
|
||||||
defaultOrdinal?: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AssetNavigatorReturn {
|
interface AssetNavigatorReturn {
|
||||||
@@ -54,36 +49,16 @@ interface AssetNavigatorReturn {
|
|||||||
documentId: Identifier | null;
|
documentId: Identifier | null;
|
||||||
asset: AssetLike | null;
|
asset: AssetLike | null;
|
||||||
assetType: string;
|
assetType: string;
|
||||||
ordinal: number;
|
|
||||||
setOrdinal: (next: number) => void;
|
|
||||||
goPrev: () => void;
|
|
||||||
goNext: () => void;
|
|
||||||
canGoPrev: boolean;
|
|
||||||
canGoNext: boolean;
|
|
||||||
cardinality: number;
|
|
||||||
currentObject: AssetObject | null;
|
|
||||||
currentUrl: string | null;
|
currentUrl: string | null;
|
||||||
currentMetadata: AssetObject['metadata'];
|
currentMetadata: Record<string, unknown> | null;
|
||||||
objects: AssetObject[];
|
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const clampOrdinalValue = (value: number, cardinality: number, defaultOrdinal: number) => {
|
|
||||||
const raw = Number.isFinite(value) ? value : defaultOrdinal;
|
|
||||||
let next = Math.max(1, Math.floor(raw));
|
|
||||||
if (cardinality && cardinality > 0) {
|
|
||||||
next = Math.min(next, cardinality);
|
|
||||||
}
|
|
||||||
return next;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const useAssetNavigator = ({
|
export const useAssetNavigator = ({
|
||||||
document,
|
document,
|
||||||
assetType,
|
assetType,
|
||||||
ensureAssetUrl,
|
ensureAssetUrl,
|
||||||
getAsset,
|
getAsset,
|
||||||
prefetch = 2,
|
|
||||||
defaultOrdinal = 1,
|
|
||||||
}: UseAssetNavigatorOptions): AssetNavigatorReturn => {
|
}: UseAssetNavigatorOptions): AssetNavigatorReturn => {
|
||||||
const documentId = (document?.id ?? null) as Identifier | null;
|
const documentId = (document?.id ?? null) as Identifier | null;
|
||||||
|
|
||||||
@@ -98,110 +73,42 @@ export const useAssetNavigator = ({
|
|||||||
() => createAssetView(asset) as unknown as AssetViewLike,
|
() => createAssetView(asset) as unknown as AssetViewLike,
|
||||||
[asset],
|
[asset],
|
||||||
);
|
);
|
||||||
const cardinality = view.getCardinality();
|
|
||||||
|
|
||||||
const [ordinal, setOrdinalInternal] = useState(defaultOrdinal);
|
const currentObject = view.getObject(1) || view.getObjects()[0] || null;
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setOrdinalInternal(defaultOrdinal);
|
|
||||||
}, [documentId, assetType, defaultOrdinal]);
|
|
||||||
|
|
||||||
const setOrdinal = useCallback(
|
|
||||||
(next: number) => {
|
|
||||||
setOrdinalInternal(clampOrdinalValue(next, cardinality, defaultOrdinal));
|
|
||||||
},
|
|
||||||
[cardinality, defaultOrdinal],
|
|
||||||
);
|
|
||||||
|
|
||||||
const goPrev = useCallback(() => {
|
|
||||||
setOrdinalInternal((prev) => clampOrdinalValue(prev - 1, cardinality, defaultOrdinal));
|
|
||||||
}, [cardinality, defaultOrdinal]);
|
|
||||||
|
|
||||||
const goNext = useCallback(() => {
|
|
||||||
setOrdinalInternal((prev) => clampOrdinalValue(prev + 1, cardinality, defaultOrdinal));
|
|
||||||
}, [cardinality, defaultOrdinal]);
|
|
||||||
|
|
||||||
const objects = view.getObjects();
|
|
||||||
const currentObject = view.getObject(ordinal);
|
|
||||||
const currentUrl = currentObject?.url ?? view.getPrimaryUrl() ?? null;
|
const currentUrl = currentObject?.url ?? view.getPrimaryUrl() ?? null;
|
||||||
const currentMetadata = currentObject?.metadata ?? view.getPrimaryMetadata() ?? null;
|
const currentMetadata = (currentObject?.metadata ?? view.getPrimaryMetadata()) || null;
|
||||||
|
|
||||||
const canGoPrev = ordinal > 1;
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const canGoNext = cardinality ? ordinal < cardinality : true;
|
|
||||||
|
|
||||||
const ordinalsNeedingLoad = useMemo<number[]>(() => {
|
|
||||||
const missing: number[] = [];
|
|
||||||
if (!asset) {
|
|
||||||
return missing;
|
|
||||||
}
|
|
||||||
const safePrefetch = Math.max(1, prefetch);
|
|
||||||
const maxOrdinal = cardinality && cardinality > 0
|
|
||||||
? Math.min(cardinality, ordinal + safePrefetch - 1)
|
|
||||||
: ordinal + safePrefetch - 1;
|
|
||||||
|
|
||||||
for (let ord = ordinal; ord <= maxOrdinal; ord += 1) {
|
|
||||||
const object = view.getObject(ord);
|
|
||||||
if (!object?.url) {
|
|
||||||
missing.push(ord);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return missing;
|
|
||||||
}, [asset, view, ordinal, prefetch, cardinality]);
|
|
||||||
|
|
||||||
const fetchStart = ordinalsNeedingLoad.length ? ordinalsNeedingLoad[0] : null;
|
|
||||||
const fetchEnd = ordinalsNeedingLoad.length
|
|
||||||
? ordinalsNeedingLoad[ordinalsNeedingLoad.length - 1]
|
|
||||||
: null;
|
|
||||||
const fetchLimit = fetchStart !== null && fetchEnd !== null ? fetchEnd - fetchStart + 1 : null;
|
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!documentId || !asset || !ensureAssetUrl) {
|
if (!ensureAssetUrl || !documentId || !asset) {
|
||||||
setLoading(false);
|
return undefined;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (fetchStart === null || fetchLimit === null) {
|
if (currentUrl) {
|
||||||
setLoading(false);
|
return undefined;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let cancelled = false;
|
let cancelled = false;
|
||||||
setLoading(true);
|
setIsLoading(true);
|
||||||
ensureAssetUrl(documentId, asset, {
|
ensureAssetUrl(documentId, asset, { start: 1, limit: 1 })
|
||||||
start: fetchStart,
|
|
||||||
limit: fetchLimit,
|
|
||||||
})
|
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
if (!cancelled) {
|
if (!cancelled) {
|
||||||
setLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
};
|
};
|
||||||
}, [documentId, asset, ensureAssetUrl, fetchStart, fetchLimit]);
|
}, [asset, currentUrl, documentId, ensureAssetUrl]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
document,
|
document,
|
||||||
documentId,
|
documentId,
|
||||||
asset,
|
asset,
|
||||||
assetType,
|
assetType,
|
||||||
ordinal,
|
|
||||||
setOrdinal,
|
|
||||||
goPrev,
|
|
||||||
goNext,
|
|
||||||
canGoPrev,
|
|
||||||
canGoNext,
|
|
||||||
cardinality,
|
|
||||||
currentObject,
|
|
||||||
currentUrl,
|
currentUrl,
|
||||||
currentMetadata,
|
currentMetadata,
|
||||||
objects,
|
isLoading,
|
||||||
isLoading: loading,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -931,9 +931,6 @@
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.desk-card__nav {
|
|
||||||
bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bulk-tags {
|
.bulk-tags {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -68,55 +68,3 @@
|
|||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.desk-card__nav {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1.8rem;
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
transform-origin: center;
|
|
||||||
display: flex;
|
|
||||||
gap: 1.5rem;
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
transition: opacity 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.desk-item__card:hover .desk-card__nav {
|
|
||||||
opacity: 1;
|
|
||||||
pointer-events: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.desk-card__nav-button {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 2.4em;
|
|
||||||
height: 2.4em;
|
|
||||||
padding: 0.25em;
|
|
||||||
border-radius: 50%;
|
|
||||||
border: none;
|
|
||||||
background: var(--preview-nav-bg);
|
|
||||||
color: var(--preview-nav-fg);
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background 0.15s ease, opacity 0.15s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.desk-card__nav-button:hover:not([disabled]) {
|
|
||||||
background: var(--preview-nav-bg-hover);
|
|
||||||
}
|
|
||||||
|
|
||||||
.desk-card__nav-button:disabled {
|
|
||||||
opacity: 0.4;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
.desk-card__nav-button:focus-visible {
|
|
||||||
outline: 2px solid var(--accent);
|
|
||||||
outline-offset: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.desk-card__nav-button svg {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user