Skip to content

Commit bbf59a5

Browse files
committed
fix: fallback to full width screenshot for non-performance scans
Fixes #245
1 parent a7670b8 commit bbf59a5

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

packages/client/components/Cell/CellRouteName.vue

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts" setup>
22
import type { UnlighthouseColumn, UnlighthouseRouteReport } from '@unlighthouse/core'
3-
import { apiUrl, device, iframeModalUrl, isModalOpen, isOffline } from '../../logic'
3+
import { apiUrl, categories, device, iframeModalUrl, isModalOpen, isOffline } from '../../logic'
44
55
const props = defineProps<{
66
report: UnlighthouseRouteReport
@@ -35,13 +35,26 @@ const fetchTime = computed(() => {
3535
timeStyle: 'short',
3636
}).format(date)
3737
})
38+
39+
const thumbnail = computed(() => {
40+
const mobileProps = device === 'mobile' ? { class: 'w-68px h-112px' } : { class: 'h-82px w-112px' }
41+
if (categories.includes('performance')) {
42+
return {
43+
src: `${props.report.artifactUrl}/screenshot.jpeg`,
44+
...mobileProps,
45+
}
46+
}
47+
return {
48+
src: `${props.report.artifactUrl}/full-screenshot.jpeg`,
49+
...mobileProps,
50+
}
51+
})
3852
</script>
3953

4054
<template>
4155
<div class="text-xs flex items-center w-full">
4256
<btn-action v-if="report.tasks.runLighthouseTask === 'completed'" class="hidden md:block" :style="{ flex: `0 0 ${device === 'mobile' ? '67' : '112'}px` }" title="Open Full Page Screenshot" @click="openModal()">
43-
<img v-if="device === 'mobile'" :src="`${report.artifactUrl}/screenshot.jpeg`" loading="lazy" height="112" width="68" class="w-68px h-112px">
44-
<img v-else :src="`${report.artifactUrl}/screenshot.jpeg`" loading="lazy" height="82" width="112" class="h-82px w-112px">
57+
<img v-bind="thumbnail" loading="lazy" height="82" width="112">
4558
</btn-action>
4659
<div class="md:ml-3 flex-grow w-full">
4760
<a v-if="report.seo?.title" :href="report.route.url" target="_blank" class="text-xs dark:(opacity-80) underline hover:no-underline">

0 commit comments

Comments
 (0)