@@ -13,6 +13,7 @@ const props = defineProps<{
1313
1414const router = useRouter ()
1515const route = useRoute ()
16+ const { settings } = useSettings ()
1617
1718const chartModal = useModal (' chart-modal' )
1819const hasChartModalTransitioned = shallowRef (false )
@@ -87,6 +88,12 @@ const { colors } = useCssVariables(
8788 },
8889)
8990
91+ function toggleSparklineAnimation() {
92+ settings .value .sidebar .animateSparkline = ! settings .value .sidebar .animateSparkline
93+ }
94+
95+ const hasSparklineAnimation = computed (() => settings .value .sidebar .animateSparkline )
96+
9097const isDarkMode = computed (() => resolvedMode .value === ' dark' )
9198
9299const accentColorValueById = computed <Record <string , string >>(() => {
@@ -224,7 +231,7 @@ const config = computed(() => {
224231 line: {
225232 color: colors .value .borderHover ,
226233 pulse: {
227- show: true , // the pulse will not show if prefers-reduced-motion (enforced by vue-data-ui)
234+ show: hasSparklineAnimation . value , // the pulse will not show if prefers-reduced-motion (enforced by vue-data-ui)
228235 loop: true , // runs only once if false
229236 radius: 1.5 ,
230237 color: pulseColor .value ,
@@ -302,6 +309,16 @@ const config = computed(() => {
302309 </div >
303310 </template >
304311 </ClientOnly >
312+
313+ <div v-if =" hasWeeklyDownloads" class =" hidden motion-safe:flex justify-end" >
314+ <ButtonBase size =" small" @click =" toggleSparklineAnimation" >
315+ {{
316+ hasSparklineAnimation
317+ ? $t('package.trends.pause_animation')
318+ : $t('package.trends.play_animation')
319+ }}
320+ </ButtonBase >
321+ </div >
305322 </template >
306323 <p v-else class =" py-2 text-sm font-mono text-fg-subtle" >
307324 {{ $t('package.trends.no_data') }}
0 commit comments