Skip to content

Commit

Permalink
troubleshoot viewer in prod preview
Browse files Browse the repository at this point in the history
  • Loading branch information
mnyrop committed Jan 9, 2025
1 parent 09d8ff4 commit 8aeaf2a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/routes/+layout.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const prerender = true;
export const trailingSlash = 'always';
20 changes: 11 additions & 9 deletions src/routes/view/afile/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import { Tabs, Tab, TabContent } from "carbon-components-svelte";
let { data } = $props();
const manifestId = 'https://mats-aperitiiif-presenation-api-store-v1.s3.us-east-1.amazonaws.com/og-2024-sf-nara/A002475884/manifest.json';
const currentPage = writable(0);
const numPages = writable(0);
onMount(() => {
console.log('hello!');
const miradorInstance = Mirador.viewer({
id: 'mirador',
window: {
Expand All @@ -20,7 +22,7 @@
allowWindowSideBar: false,
},
windows: [{
manifestId: 'https://mats-aperitiiif-presenation-api-store-v1.s3.us-east-1.amazonaws.com/og-2024-sf-nara/A002475884/manifest.json',
manifestId: manifestId,
canvasId: 'https://mats-aperitiiif-presenation-api-store-v1.s3.us-east-1.amazonaws.com/canvas/og-2024-sf-nara_A002475884_0006.json'
}],
thumbnailNavigation: {
Expand All @@ -37,19 +39,19 @@
const windows = state.windows;
const windowId = Object.keys(windows)[0];
const currentCanvas = windows[windowId];
const currentManifestId = currentCanvas.manifestId;
const currentCanvasId = currentCanvas.canvasId;
const canvases = state.manifests[currentManifestId].json.sequences[0].canvases;
const currentManifest = state.manifests[manifestId];
const canvases = currentManifest.json.sequences[0].canvases;
// Find the index of the current canvas
const currentCanvasIndex = canvases.findIndex(canvas => canvas['@id'] === currentCanvasId);
// Find the index of the current canvas
const currentCanvasIndex = canvases.findIndex(canvas => canvas['@id'] === currentCanvasId);
// Update the current page based on the canvas index
currentPage.set(currentCanvasIndex + 1);
// Update the current page based on the canvas index
currentPage.set(currentCanvasIndex + 1);
numPages.set(canvases.length);
console.log('Current Canvas Index:', currentCanvasIndex);
console.log('Current Page:', currentCanvasIndex + 1);
console.log('Current Canvas Index:', currentCanvasIndex);
console.log('Current Page:', currentCanvasIndex + 1);
});
});
</script>
Expand Down

0 comments on commit 8aeaf2a

Please sign in to comment.