Skip to content

Commit 77158b2

Browse files
ADD: Make screenshot clickable to show fullscreen in card dialog
1 parent e7a3392 commit 77158b2

File tree

1 file changed

+52
-26
lines changed

1 file changed

+52
-26
lines changed

heartbeat_monitor/src/jsMain/kotlin/heartbeatmonitor/plugins/KanbanBroFirebaseHeartbeatCardProviderPlugin.kt

Lines changed: 52 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -210,34 +210,60 @@ object KanbanBroFirebaseHeartbeatCardProviderPlugin : AbstractPlugin("KanbanBroF
210210

211211
center {
212212
shadow {
213-
element(document.createDivElement().also { screenshotDiv ->
214-
screenshotDiv.className = "screenshot"
215-
screenshotDiv.style.maxWidth = "var(--base)"
216-
217-
screenshotDiv.append(document.createDivElement().also { screenshotPlaceholderDiv ->
218-
screenshotPlaceholderDiv.style.textAlign = "center"
219-
MainScope().launch {
220-
val image = imageCache.await()
221-
if (image != null) {
222-
screenshotPlaceholderDiv.append(Image().also { img ->
223-
img.asDynamic().loading = "lazy"
224-
img.asDynamic().decoding = "async"
225-
setImageBlob(img, image)
226-
img.alt = titleCache.await()
227-
})
228-
} else {
229-
screenshotPlaceholderDiv.style.width = "300px"
230-
screenshotPlaceholderDiv.style.height = "200px"
231-
screenshotPlaceholderDiv.textContent = "No Image"
232-
screenshotPlaceholderDiv.style.fontStyle = "italic"
233-
screenshotPlaceholderDiv.style.fontSize = "200%"
234-
screenshotPlaceholderDiv.style.color = "gray"
235-
screenshotPlaceholderDiv.style.textAlign = "center"
236-
screenshotPlaceholderDiv.style.lineHeight = "200px"
213+
clickable {
214+
element(document.createDivElement().also { screenshotDiv ->
215+
screenshotDiv.className = "screenshot"
216+
screenshotDiv.style.maxWidth = "var(--base)"
217+
218+
screenshotDiv.append(document.createDivElement().also { screenshotPlaceholderDiv ->
219+
screenshotPlaceholderDiv.style.textAlign = "center"
220+
MainScope().launch {
221+
val image = imageCache.await()
222+
if (image != null) {
223+
screenshotPlaceholderDiv.append(Image().also { img ->
224+
img.asDynamic().loading = "lazy"
225+
img.asDynamic().decoding = "async"
226+
setImageBlob(img, image)
227+
img.alt = titleCache.await()
228+
})
229+
} else {
230+
screenshotPlaceholderDiv.style.width = "300px"
231+
screenshotPlaceholderDiv.style.height = "200px"
232+
screenshotPlaceholderDiv.textContent = "No Image"
233+
screenshotPlaceholderDiv.style.fontStyle = "italic"
234+
screenshotPlaceholderDiv.style.fontSize = "200%"
235+
screenshotPlaceholderDiv.style.color = "gray"
236+
screenshotPlaceholderDiv.style.textAlign = "center"
237+
screenshotPlaceholderDiv.style.lineHeight = "200px"
238+
}
237239
}
238-
}
240+
})
239241
})
240-
})
242+
243+
clickable = false
244+
MainScope().launch {
245+
val image = imageCache.await() ?: return@launch
246+
clickable = true
247+
onClick {
248+
showDialog {
249+
frame {
250+
yScrollable {
251+
element(Image().also { img ->
252+
img.asDynamic().loading = "lazy"
253+
img.asDynamic().decoding = "async"
254+
setImageBlob(img, image)
255+
img.alt = titleCache.await()
256+
img.style.width = "100%"
257+
})
258+
}
259+
onClick {
260+
onClosed.emit()
261+
}
262+
}
263+
}
264+
}
265+
}
266+
}
241267
}
242268
}
243269
left {

0 commit comments

Comments
 (0)