@@ -195,7 +195,7 @@ function initDateRangeFallbackClient() {
195195}
196196
197197watch (
198- () => weeklyDownloads ,
198+ () => weeklyDownloads ?. length ,
199199 () => {
200200 initDateRangeFromWeekly ()
201201 initDateRangeFallbackClient ()
@@ -456,104 +456,99 @@ const config = computed(() => ({
456456
457457<template >
458458 <div class =" w-full relative" >
459- <div class =" w-full mb-2 flex flex-col gap-2" >
460- <div class =" w-full grid grid-cols-1 sm:grid-cols-[1fr_auto] gap-2" >
461- <div class =" flex gap-2" >
462- <!-- Granularity -->
459+ <div class =" w-full mb-4 flex flex-col gap-3" >
460+ <!-- Mobile: stack vertically, Desktop: horizontal -->
461+ <div class =" flex flex-col sm:flex-row gap-3 sm:gap-2 sm:items-end" >
462+ <!-- Granularity -->
463+ <div class =" flex flex-col gap-1 sm:shrink-0" >
464+ <label
465+ for =" granularity"
466+ class =" text-[10px] font-mono text-fg-subtle tracking-wide uppercase"
467+ >
468+ Granularity
469+ </label >
470+
471+ <div
472+ class =" flex items-center px-2.5 py-1.75 bg-bg-subtle border border-border rounded-md focus-within:(border-border-hover ring-2 ring-fg/50)"
473+ >
474+ <select
475+ id =" granularity"
476+ v-model =" selectedGranularity"
477+ class =" w-full bg-transparent font-mono text-sm text-fg outline-none"
478+ >
479+ <option value =" daily" >Daily</option >
480+ <option value =" weekly" >Weekly</option >
481+ <option value =" monthly" >Monthly</option >
482+ <option value =" yearly" >Yearly</option >
483+ </select >
484+ </div >
485+ </div >
486+
487+ <!-- Date range inputs -->
488+ <div class =" grid grid-cols-2 gap-2 flex-1" >
463489 <div class =" flex flex-col gap-1" >
464490 <label
465- for =" granularity "
491+ for =" startDate "
466492 class =" text-[10px] font-mono text-fg-subtle tracking-wide uppercase"
467493 >
468- Granularity
494+ Start
469495 </label >
470-
471496 <div
472- class =" flex items-center px-2.5 py-1.75 bg-bg-subtle border border-border rounded-md focus-within:(border-border-hover ring-2 ring-fg/50)"
497+ class =" flex items-center gap-2 px-2.5 py-1.75 bg-bg-subtle border border-border rounded-md focus-within:(border-border-hover ring-2 ring-fg/50)"
473498 >
474- <select
475- id =" granularity"
476- v-model =" selectedGranularity"
477- class =" w-full bg-transparent font-mono text-sm text-fg outline-none"
478- >
479- <option value =" daily" >Daily</option >
480- <option value =" weekly" >Weekly</option >
481- <option value =" monthly" >Monthly</option >
482- <option value =" yearly" >Yearly</option >
483- </select >
499+ <span class =" i-carbon-calendar w-4 h-4 text-fg-subtle shrink-0" aria-hidden =" true" />
500+ <input
501+ id =" startDate"
502+ v-model =" startDate"
503+ type =" date"
504+ class =" w-full min-w-0 bg-transparent font-mono text-sm text-fg outline-none [color-scheme:dark]"
505+ />
484506 </div >
485507 </div >
486508
487- <!-- Date range inputs -->
488- <div class =" grid grid-cols-2 gap-2" >
489- <div class =" flex flex-col gap-1" >
490- <label
491- for =" startDate"
492- class =" text-[10px] font-mono text-fg-subtle tracking-wide uppercase"
493- >
494- Start
495- </label >
496- <div
497- class =" flex items-center gap-2 px-2.5 py-1.75 bg-bg-subtle border border-border rounded-md focus-within:(border-border-hover ring-2 ring-fg/50)"
498- >
499- <span class =" i-carbon-calendar w-4 h-4 text-fg-subtle" aria-hidden =" true" />
500- <input
501- id =" startDate"
502- v-model =" startDate"
503- type =" date"
504- class =" w-full bg-transparent font-mono text-sm text-fg outline-none [color-scheme:dark]"
505- />
506- </div >
507- </div >
508-
509- <div class =" flex flex-col gap-1" >
510- <label
511- for =" endDate"
512- class =" text-[10px] font-mono text-fg-subtle tracking-wide uppercase"
513- >
514- End
515- </label >
516- <div
517- class =" flex items-center gap-2 px-2.5 py-1.75 bg-bg-subtle border border-border rounded-md focus-within:(border-border-hover ring-2 ring-fg/50)"
518- >
519- <span class =" i-carbon-calendar w-4 h-4 text-fg-subtle" aria-hidden =" true" />
520- <input
521- id =" endDate"
522- v-model =" endDate"
523- type =" date"
524- class =" w-full bg-transparent font-mono text-sm text-fg outline-none [color-scheme:dark]"
525- />
526- </div >
527- </div >
528- </div >
529- <!-- Reset -->
530509 <div class =" flex flex-col gap-1" >
531- <!-- spacer label to align with others -->
532- <div class =" font-mono tracking-wide uppercase invisible" >Reset</div >
533-
534- <button
535- v-if =" showResetButton"
536- type =" button"
537- aria-label =" Reset date range"
538- class =" 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-none focus-visible:ring-2 focus-visible:ring-fg/50"
539- @click ="
540- () => {
541- hasUserEditedDates = false
542- startDate = ''
543- endDate = ''
544- initDateRangeFromWeekly()
545- initDateRangeFallbackClient()
546- }
547- "
510+ <label
511+ for =" endDate"
512+ class =" text-[10px] font-mono text-fg-subtle tracking-wide uppercase"
548513 >
549- <span class =" i-carbon-reset w-5 h-5 inline-block" aria-hidden =" true" />
550- </button >
514+ End
515+ </label >
516+ <div
517+ class =" flex items-center gap-2 px-2.5 py-1.75 bg-bg-subtle border border-border rounded-md focus-within:(border-border-hover ring-2 ring-fg/50)"
518+ >
519+ <span class =" i-carbon-calendar w-4 h-4 text-fg-subtle shrink-0" aria-hidden =" true" />
520+ <input
521+ id =" endDate"
522+ v-model =" endDate"
523+ type =" date"
524+ class =" w-full min-w-0 bg-transparent font-mono text-sm text-fg outline-none [color-scheme:dark]"
525+ />
526+ </div >
551527 </div >
552528 </div >
529+
530+ <!-- Reset button -->
531+ <button
532+ v-if =" showResetButton"
533+ type =" button"
534+ aria-label =" Reset date range"
535+ class =" self-end 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-none focus-visible:ring-2 focus-visible:ring-fg/50 sm:mb-0"
536+ @click ="
537+ () => {
538+ hasUserEditedDates = false
539+ startDate = ''
540+ endDate = ''
541+ initDateRangeFromWeekly()
542+ initDateRangeFallbackClient()
543+ }
544+ "
545+ >
546+ <span class =" i-carbon-reset w-5 h-5 inline-block" aria-hidden =" true" />
547+ </button >
553548 </div >
554549 </div >
555550
556- <ClientOnly v-if =" inModal" >
551+ <ClientOnly v-if =" inModal && chartData.dataset " >
557552 <VueUiXy :dataset =" chartData.dataset" :config =" config" >
558553 <template #menuIcon =" { isOpen } " >
559554 <span v-if =" isOpen" class =" i-carbon-close w-6 h-6" aria-hidden =" true" />
@@ -632,6 +627,14 @@ const config = computed(() => ({
632627 </template >
633628 </ClientOnly >
634629
630+ <!-- Empty state when no chart data -->
631+ <div
632+ v-if =" inModal && !chartData.dataset && !pending"
633+ class =" min-h-[260px] flex items-center justify-center text-fg-subtle font-mono text-sm"
634+ >
635+ No download data available
636+ </div >
637+
635638 <div
636639 v-if =" pending"
637640 role =" status"
0 commit comments