Skip to content

Commit 7c87f32

Browse files
committed
test if getSketchSize is necessary
1 parent 76d4202 commit 7c87f32

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

src/layouts/SketchLayout.astro

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ const { title, createdOn, instructions } = await getSketch(sketchId);
2626
const currentLocale = getCurrentLocale(Astro.url.pathname);
2727
const t = await getUiTranslator(currentLocale);
2828
const dateString = new Date(createdOn).toLocaleDateString(currentLocale, {
29-
year: "numeric",
30-
month: "long",
31-
day: "numeric",
32-
}
33-
);
29+
year: "numeric",
30+
month: "long",
31+
day: "numeric",
32+
});
3433
3534
setJumpToState(null);
3635
const moreSketches = await getRandomCurationSketches(4);
@@ -39,17 +38,17 @@ const featuredImageURL = makeThumbnailUrl(sketchId);
3938
// NOTE: Commenting out the call to getSketchSize to minimise calls to OP due to rate limiting
4039
// width and height should be moved to data fetched by either getCuratedSketches or getSketch to minimise calls.
4140
42-
// let { width, height } = await getSketchSize(sketchId);
43-
// let heightOverWidth = 1 / 1.5;
44-
// if (width && height) {
45-
// // Account for OP header bar
46-
// height += 50;
47-
// heightOverWidth = height / width;
48-
// }
49-
50-
let width = undefined;
51-
let height = undefined;
41+
let { width, height } = await getSketchSize(sketchId);
5242
let heightOverWidth = 1 / 1.5;
43+
if (width && height) {
44+
// Account for OP header bar
45+
height += 50;
46+
heightOverWidth = height / width;
47+
}
48+
49+
// let width = undefined;
50+
// let height = undefined;
51+
// let heightOverWidth = 1 / 1.5;
5352
5453
const iframeTitle = `OpenProcessing Sketch: ${title} by ${authorName}`;
5554
---

0 commit comments

Comments
 (0)