Skip to content

Commit 0f52b01

Browse files
fix: use custom chart minimap reset button (#1512)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 2eca59e commit 0f52b01

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

app/components/Package/TrendsChart.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,6 +1575,7 @@ const chartConfig = computed(() => {
15751575
zoom: {
15761576
maxWidth: isMobile.value ? 350 : 500,
15771577
highlightColor: colors.value.bgElevated,
1578+
useResetSlot: true,
15781579
minimap: {
15791580
show: true,
15801581
lineColor: '#FAFAFA',
@@ -1805,6 +1806,19 @@ watch(selectedMetric, value => {
18051806
</div>
18061807
</template>
18071808

1809+
<!-- Custom minimap reset button -->
1810+
<template #reset-action="{ reset: resetMinimap }">
1811+
<button
1812+
type="button"
1813+
aria-label="reset minimap"
1814+
class="absolute inset-is-1/2 -translate-x-1/2 -bottom-18 sm:inset-is-unset sm:translate-x-0 sm:bottom-auto sm:-inset-ie-20 sm:-top-3 flex items-center justify-center px-2.5 py-1.75 border border-transparent rounded-md text-fg-subtle hover:text-fg transition-colors hover:border-border focus-visible:outline-accent/70 sm:mb-0"
1815+
style="pointer-events: all !important"
1816+
@click="resetMinimap"
1817+
>
1818+
<span class="i-lucide:undo-2 w-5 h-5" aria-hidden="true" />
1819+
</button>
1820+
</template>
1821+
18081822
<template #menuIcon="{ isOpen }">
18091823
<span v-if="isOpen" class="i-lucide:x w-6 h-6" aria-hidden="true" />
18101824
<span v-else class="i-lucide:ellipsis-vertical w-6 h-6" aria-hidden="true" />

app/components/Package/VersionDistribution.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ const chartConfig = computed(() => {
243243
zoom: {
244244
maxWidth: isMobile.value ? 350 : 500,
245245
highlightColor: colors.value.bgElevated,
246+
useResetSlot: true,
246247
minimap: {
247248
show: true,
248249
lineColor: '#FAFAFA',
@@ -521,6 +522,19 @@ const endDate = computed(() => {
521522
</div>
522523
</template>
523524

525+
<!-- Custom minimap reset button -->
526+
<template #reset-action="{ reset: resetMinimap }">
527+
<button
528+
type="button"
529+
aria-label="reset minimap"
530+
class="absolute inset-is-1/2 -translate-x-1/2 -bottom-18 sm:inset-is-unset sm:translate-x-0 sm:bottom-auto sm:-inset-ie-20 sm:-top-3 flex items-center justify-center px-2.5 py-1.75 border border-transparent rounded-md text-fg-subtle hover:text-fg transition-colors hover:border-border focus-visible:outline-accent/70 sm:mb-0"
531+
style="pointer-events: all !important"
532+
@click="resetMinimap"
533+
>
534+
<span class="i-lucide:undo-2 w-5 h-5" aria-hidden="true" />
535+
</button>
536+
</template>
537+
524538
<!-- Contextual menu icon -->
525539
<template #menuIcon="{ isOpen }">
526540
<span v-if="isOpen" class="i-lucide:x w-6 h-6" aria-hidden="true" />

0 commit comments

Comments
 (0)