-
Notifications
You must be signed in to change notification settings - Fork 0
date picker autocomplete #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
IslandRhythms
wants to merge
5
commits into
main
Choose a base branch
from
IslandRhythms/improve-date-search
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
205 changes: 205 additions & 0 deletions
205
frontend/src/models/date-range-filter/date-range-filter.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,205 @@ | ||
| <div class="relative shrink-0" ref="root"> | ||
| <button | ||
| type="button" | ||
| @click="togglePanel" | ||
| :class="[ | ||
| 'rounded-md p-1.5 shrink-0 border shadow-sm transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary', | ||
| panelOpen | ||
| ? 'border-primary bg-primary-subtle text-primary ring-1 ring-inset ring-primary/25' | ||
| : 'border-edge-strong bg-surface text-content-secondary hover:bg-muted hover:text-content hover:border-edge' | ||
| ]" | ||
| title="Filter by date" | ||
| aria-label="Filter by date" | ||
| :aria-expanded="panelOpen" | ||
| > | ||
| <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5" aria-hidden="true"> | ||
| <path stroke-linecap="round" stroke-linejoin="round" d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5" /> | ||
| </svg> | ||
| </button> | ||
| <div | ||
| v-if="panelOpen" | ||
| class="absolute right-0 left-auto top-full z-[80] mt-1 w-[min(17.5rem,calc(100vw-0.75rem))] max-h-[min(26rem,calc(100dvh-4.5rem))] overflow-x-hidden overflow-y-auto overscroll-contain rounded-md border border-edge bg-surface py-2 px-2.5 shadow-lg ring-1 ring-black/5" | ||
| role="dialog" | ||
| aria-label="Date filter" | ||
| @keyup.esc.prevent="closePanel" | ||
| > | ||
| <div class="mb-1.5 flex flex-wrap items-center justify-between gap-1.5"> | ||
| <div class="text-[10px] font-semibold uppercase tracking-wider leading-tight text-gray-400">Anchor (UTC)</div> | ||
| <div | ||
| class="isolate inline-flex shrink-0 rounded-md shadow-sm ring-1 ring-inset ring-edge" | ||
| role="group" | ||
| aria-label="Anchor input mode" | ||
| > | ||
| <button | ||
| type="button" | ||
| @click="anchorIsoMode = false" | ||
| class="relative inline-flex items-center rounded-none rounded-l-md px-2 py-0.5 text-[10px] font-semibold focus:z-10 focus:outline-none focus:ring-1 focus:ring-primary-subtle" | ||
| :class="!anchorIsoMode ? 'bg-primary-subtle text-primary z-[1]' : 'bg-page text-content-secondary hover:bg-muted'" | ||
| > | ||
| Numbers | ||
| </button> | ||
| <button | ||
| type="button" | ||
| @click="anchorIsoMode = true" | ||
| class="relative -ml-px inline-flex items-center rounded-none rounded-r-md px-2 py-0.5 text-[10px] font-semibold focus:z-10 focus:outline-none focus:ring-1 focus:ring-primary-subtle" | ||
| :class="anchorIsoMode ? 'bg-primary-subtle text-primary z-[1]' : 'bg-page text-content-secondary hover:bg-muted'" | ||
| > | ||
| ISO | ||
| </button> | ||
| </div> | ||
| </div> | ||
| <div v-if="anchorIsoMode" class="mb-2"> | ||
| <label class="block"> | ||
| <span class="sr-only">ISO 8601</span> | ||
| <input | ||
| v-model="isoAnchorInput" | ||
| type="text" | ||
| autocomplete="off" | ||
| spellcheck="false" | ||
| placeholder="2026-05-08T14:30:00Z" | ||
| class="w-full rounded border border-edge-strong px-1.5 py-1 font-mono text-xs text-content placeholder:text-gray-400 focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary-subtle" | ||
| @paste="onIsoAnchorPaste" | ||
| /> | ||
| </label> | ||
| </div> | ||
| <div v-else class="mb-2 grid grid-cols-3 gap-x-1.5 gap-y-1.5"> | ||
| <label class="flex min-w-0 flex-col gap-0.5"> | ||
| <span class="text-[10px] font-medium leading-none text-content-secondary">Year</span> | ||
| <input | ||
| v-model.number="anchorYear" | ||
| type="number" | ||
| inputmode="numeric" | ||
| min="1970" | ||
| max="2100" | ||
| step="1" | ||
| placeholder="–" | ||
| class="w-full min-w-0 rounded border border-edge-strong px-1.5 py-1 text-xs tabular-nums leading-snug text-content focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary-subtle" | ||
| /> | ||
| </label> | ||
| <label class="flex min-w-0 flex-col gap-0.5"> | ||
| <span class="text-[10px] font-medium leading-none text-content-secondary">Mo</span> | ||
| <input | ||
| v-model.number="anchorMonth" | ||
| type="number" | ||
| inputmode="numeric" | ||
| min="1" | ||
| max="12" | ||
| step="1" | ||
| placeholder="–" | ||
| class="w-full min-w-0 rounded border border-edge-strong px-1.5 py-1 text-xs tabular-nums leading-snug text-content focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary-subtle" | ||
| /> | ||
| </label> | ||
| <label class="flex min-w-0 flex-col gap-0.5"> | ||
| <span class="text-[10px] font-medium leading-none text-content-secondary">Day</span> | ||
| <input | ||
| v-model.number="anchorDay" | ||
| type="number" | ||
| inputmode="numeric" | ||
| min="1" | ||
| max="31" | ||
| step="1" | ||
| placeholder="–" | ||
| class="w-full min-w-0 rounded border border-edge-strong px-1.5 py-1 text-xs tabular-nums leading-snug text-content focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary-subtle" | ||
| /> | ||
| </label> | ||
| <label class="flex min-w-0 flex-col gap-0.5"> | ||
| <span class="text-[10px] font-medium leading-none text-content-secondary">Hr</span> | ||
| <input | ||
| v-model.number="anchorHour" | ||
| type="number" | ||
| inputmode="numeric" | ||
| min="0" | ||
| max="23" | ||
| step="1" | ||
| placeholder="–" | ||
| class="w-full min-w-0 rounded border border-edge-strong px-1.5 py-1 text-xs tabular-nums leading-snug text-content focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary-subtle" | ||
| /> | ||
| </label> | ||
| <label class="flex min-w-0 flex-col gap-0.5"> | ||
| <span class="text-[10px] font-medium leading-none text-content-secondary">Min</span> | ||
| <input | ||
| v-model.number="anchorMinute" | ||
| type="number" | ||
| inputmode="numeric" | ||
| min="0" | ||
| max="59" | ||
| step="1" | ||
| placeholder="–" | ||
| class="w-full min-w-0 rounded border border-edge-strong px-1.5 py-1 text-xs tabular-nums leading-snug text-content focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary-subtle" | ||
| /> | ||
| </label> | ||
| </div> | ||
| <div v-if="!useCustomPath" class="mb-2"> | ||
| <label class="block text-[10px] font-semibold uppercase tracking-wider text-gray-400 mb-0.5">Date field</label> | ||
| <select | ||
| v-model="selectedPath" | ||
| class="w-full max-w-full rounded border border-edge-strong px-1.5 py-1 text-xs text-content focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary-subtle" | ||
| > | ||
| <option v-for="p in datePaths" :key="p" :value="p">{{ p }}</option> | ||
| </select> | ||
| </div> | ||
| <div v-else class="mb-2"> | ||
| <label class="block text-[10px] font-semibold uppercase tracking-wider text-gray-400 mb-0.5">Field path</label> | ||
| <input | ||
| v-model="customPath" | ||
| type="text" | ||
| placeholder="createdAt" | ||
| class="w-full max-w-full rounded border border-edge-strong px-1.5 py-1 text-xs font-mono text-content placeholder:text-gray-400 focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary-subtle" | ||
| /> | ||
| <p class="mt-0.5 text-[10px] leading-snug text-content-tertiary">No Date fields in schema; enter path.</p> | ||
| </div> | ||
| <div class="mb-2 grid grid-cols-2 gap-1"> | ||
| <button | ||
| type="button" | ||
| title="Replace filter: field strictly greater than UTC anchor (hour and minute included)" | ||
| class="rounded bg-primary px-2 py-1.5 text-xs font-semibold tabular-nums text-primary-text shadow-sm hover:bg-primary-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary" | ||
| @click="applyAnchorComparison('$gt')" | ||
| > | ||
| $gt | ||
| </button> | ||
| <button | ||
| type="button" | ||
| title="Replace filter: field strictly less than UTC anchor (hour and minute included)" | ||
| class="rounded bg-primary px-2 py-1.5 text-xs font-semibold tabular-nums text-primary-text shadow-sm hover:bg-primary-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary" | ||
| @click="applyAnchorComparison('$lt')" | ||
| > | ||
| $lt | ||
| </button> | ||
| </div> | ||
| <div class="text-[10px] font-semibold uppercase tracking-wider text-gray-400 mb-0.5">From anchor instant</div> | ||
| <div class="grid grid-cols-2 gap-1"> | ||
| <button | ||
| type="button" | ||
| title="Replace filter—7 days ending at anchor instant" | ||
| class="rounded border border-edge bg-page px-1.5 py-1 text-left text-[10px] leading-tight text-content-secondary hover:bg-muted" | ||
| @click="presetRangePreviousDays(7)" | ||
| > | ||
| −7 d | ||
| </button> | ||
| <button | ||
| type="button" | ||
| title="Replace filter—7 days starting at anchor instant" | ||
| class="rounded border border-edge bg-page px-1.5 py-1 text-left text-[10px] leading-tight text-content-secondary hover:bg-muted" | ||
| @click="presetRangeNextDays(7)" | ||
| > | ||
| +7 d | ||
| </button> | ||
| <button | ||
| type="button" | ||
| title="Replace filter—3 weeks ending at anchor instant" | ||
| class="rounded border border-edge bg-page px-1.5 py-1 text-left text-[10px] leading-tight text-content-secondary hover:bg-muted" | ||
| @click="presetRangePreviousWeeks(3)" | ||
| > | ||
| −3 wk | ||
| </button> | ||
| <button | ||
| type="button" | ||
| title="Replace filter—3 weeks starting at anchor instant" | ||
| class="rounded border border-edge bg-page px-1.5 py-1 text-left text-[10px] leading-tight text-content-secondary hover:bg-muted" | ||
| @click="presetRangeNextWeeks(3)" | ||
| > | ||
| +3 wk | ||
| </button> | ||
| </div> | ||
| </div> | ||
| </div> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.