feat: replace all native selects and date inputs with custom components

This commit is contained in:
Your Name
2026-02-17 22:27:51 +02:00
parent 5fea155332
commit b646dcd801
5 changed files with 60 additions and 92 deletions

View File

@@ -6,35 +6,28 @@
<div class="bg-bg-surface rounded-lg p-4 mb-6 flex flex-wrap items-end gap-4">
<div>
<label class="block text-[0.6875rem] text-text-tertiary uppercase tracking-[0.08em] mb-1.5">Start Date</label>
<input
<AppDatePicker
v-model="startDate"
type="date"
class="px-3 py-2 bg-bg-inset border border-border-subtle rounded-lg text-[0.8125rem] text-text-primary focus:outline-none focus:border-border-visible"
placeholder="Start date"
/>
</div>
<div>
<label class="block text-[0.6875rem] text-text-tertiary uppercase tracking-[0.08em] mb-1.5">End Date</label>
<input
<AppDatePicker
v-model="endDate"
type="date"
class="px-3 py-2 bg-bg-inset border border-border-subtle rounded-lg text-[0.8125rem] text-text-primary focus:outline-none focus:border-border-visible"
placeholder="End date"
/>
</div>
<div>
<label class="block text-[0.6875rem] text-text-tertiary uppercase tracking-[0.08em] mb-1.5">Project</label>
<select
<AppSelect
v-model="filterProject"
class="px-3 py-2 bg-bg-inset border border-border-subtle rounded-lg text-[0.8125rem] text-text-primary focus:outline-none focus:border-border-visible"
>
<option :value="null">All Projects</option>
<option
v-for="project in projectsStore.projects"
:key="project.id"
:value="project.id"
>
{{ project.name }}
</option>
</select>
:options="projectsStore.projects"
label-key="name"
value-key="id"
placeholder="All Projects"
:placeholder-value="null"
/>
</div>
<button
@click="applyFilters"
@@ -139,19 +132,13 @@
<!-- Project -->
<div>
<label class="block text-[0.6875rem] text-text-tertiary uppercase tracking-[0.08em] mb-1.5">Project *</label>
<select
<AppSelect
v-model="editForm.project_id"
required
class="w-full px-3 py-2 bg-bg-inset border border-border-subtle rounded-lg text-[0.8125rem] text-text-primary focus:outline-none focus:border-border-visible"
>
<option
v-for="project in projectsStore.projects"
:key="project.id"
:value="project.id"
>
{{ project.name }}
</option>
</select>
:options="projectsStore.projects"
label-key="name"
value-key="id"
placeholder="Select project"
/>
</div>
<!-- Description -->
@@ -239,6 +226,8 @@
<script setup lang="ts">
import { ref, reactive, computed, onMounted } from 'vue'
import { List as ListIcon } from 'lucide-vue-next'
import AppSelect from '../components/AppSelect.vue'
import AppDatePicker from '../components/AppDatePicker.vue'
import { useEntriesStore, type TimeEntry } from '../stores/entries'
import { useProjectsStore } from '../stores/projects'

View File

@@ -126,39 +126,30 @@
<!-- Client -->
<div>
<label class="block text-[0.6875rem] text-text-tertiary uppercase tracking-[0.08em] mb-1.5">Client *</label>
<select
<AppSelect
v-model="createForm.client_id"
required
class="w-full px-3 py-2 bg-bg-inset border border-border-subtle rounded-lg text-[0.8125rem] text-text-primary focus:outline-none focus:border-border-visible"
>
<option :value="0">Select a client</option>
<option
v-for="client in clientsStore.clients"
:key="client.id"
:value="client.id"
>
{{ client.name }}
</option>
</select>
:options="clientsStore.clients"
label-key="name"
value-key="id"
placeholder="Select a client"
:placeholder-value="0"
/>
</div>
<!-- Date -->
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-[0.6875rem] text-text-tertiary uppercase tracking-[0.08em] mb-1.5">Invoice Date *</label>
<input
<AppDatePicker
v-model="createForm.date"
type="date"
required
class="w-full px-3 py-2 bg-bg-inset border border-border-subtle rounded-lg text-[0.8125rem] text-text-primary focus:outline-none focus:border-border-visible"
placeholder="Invoice date"
/>
</div>
<div>
<label class="block text-[0.6875rem] text-text-tertiary uppercase tracking-[0.08em] mb-1.5">Due Date</label>
<input
<AppDatePicker
v-model="createForm.due_date"
type="date"
class="w-full px-3 py-2 bg-bg-inset border border-border-subtle rounded-lg text-[0.8125rem] text-text-primary focus:outline-none focus:border-border-visible"
placeholder="Due date"
/>
</div>
</div>
@@ -341,6 +332,8 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { FileText } from 'lucide-vue-next'
import AppSelect from '../components/AppSelect.vue'
import AppDatePicker from '../components/AppDatePicker.vue'
import { useInvoicesStore, type Invoice } from '../stores/invoices'
import { useClientsStore } from '../stores/clients'
import { useToastStore } from '../stores/toast'

View File

@@ -92,19 +92,14 @@
<!-- Client -->
<div>
<label class="block text-[0.6875rem] text-text-tertiary uppercase tracking-[0.08em] mb-1.5">Client</label>
<select
<AppSelect
v-model="formData.client_id"
class="w-full px-3 py-2 bg-bg-inset border border-border-subtle rounded-lg text-[0.8125rem] text-text-primary focus:outline-none focus:border-border-visible"
>
<option :value="undefined">No client</option>
<option
v-for="client in clientsStore.clients"
:key="client.id"
:value="client.id"
>
{{ client.name }}
</option>
</select>
:options="clientsStore.clients"
label-key="name"
value-key="id"
placeholder="No client"
:placeholder-value="undefined"
/>
</div>
<!-- Hourly Rate -->
@@ -201,6 +196,7 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { FolderKanban } from 'lucide-vue-next'
import AppSelect from '../components/AppSelect.vue'
import { useProjectsStore, type Project } from '../stores/projects'
import { useClientsStore } from '../stores/clients'

View File

@@ -6,18 +6,16 @@
<div class="bg-bg-surface rounded-lg p-4 mb-6 flex flex-wrap items-end gap-4">
<div>
<label class="block text-[0.6875rem] text-text-tertiary uppercase tracking-[0.08em] mb-1.5">Start Date</label>
<input
<AppDatePicker
v-model="startDate"
type="date"
class="px-3 py-2 bg-bg-inset border border-border-subtle rounded-lg text-[0.8125rem] text-text-primary focus:outline-none focus:border-border-visible"
placeholder="Start date"
/>
</div>
<div>
<label class="block text-[0.6875rem] text-text-tertiary uppercase tracking-[0.08em] mb-1.5">End Date</label>
<input
<AppDatePicker
v-model="endDate"
type="date"
class="px-3 py-2 bg-bg-inset border border-border-subtle rounded-lg text-[0.8125rem] text-text-primary focus:outline-none focus:border-border-visible"
placeholder="End date"
/>
</div>
<button
@@ -109,6 +107,7 @@ import { ref, computed, onMounted } from 'vue'
import { invoke } from '@tauri-apps/api/core'
import { Bar } from 'vue-chartjs'
import { BarChart3 } from 'lucide-vue-next'
import AppDatePicker from '../components/AppDatePicker.vue'
import { useToastStore } from '../stores/toast'
import {
Chart as ChartJS,

View File

@@ -26,37 +26,27 @@
<div class="grid grid-cols-2 gap-4 mb-4">
<div>
<label class="block text-[0.6875rem] text-text-tertiary uppercase tracking-[0.08em] mb-1.5">Project</label>
<select
<AppSelect
v-model="selectedProject"
:options="activeProjects"
label-key="name"
value-key="id"
placeholder="Select project"
:placeholder-value="null"
:disabled="timerStore.isRunning"
class="w-full px-3 py-2 bg-bg-inset border border-border-subtle rounded-lg text-[0.8125rem] text-text-primary focus:outline-none focus:border-border-visible disabled:opacity-40 disabled:cursor-not-allowed"
>
<option :value="null">Select project</option>
<option
v-for="project in activeProjects"
:key="project.id"
:value="project.id"
>
{{ project.name }}
</option>
</select>
/>
</div>
<div>
<label class="block text-[0.6875rem] text-text-tertiary uppercase tracking-[0.08em] mb-1.5">Task</label>
<select
<AppSelect
v-model="selectedTask"
:options="projectTasks"
label-key="name"
value-key="id"
placeholder="Select task"
:placeholder-value="null"
:disabled="timerStore.isRunning || !selectedProject"
class="w-full px-3 py-2 bg-bg-inset border border-border-subtle rounded-lg text-[0.8125rem] text-text-primary focus:outline-none focus:border-border-visible disabled:opacity-40 disabled:cursor-not-allowed"
>
<option :value="null">Select task</option>
<option
v-for="task in projectTasks"
:key="task.id"
:value="task.id"
>
{{ task.name }}
</option>
</select>
/>
</div>
</div>
<div>
@@ -119,6 +109,7 @@ import { useProjectsStore, type Task } from '../stores/projects'
import { useEntriesStore } from '../stores/entries'
import { useToastStore } from '../stores/toast'
import { Timer as TimerIcon } from 'lucide-vue-next'
import AppSelect from '../components/AppSelect.vue'
const timerStore = useTimerStore()
const projectsStore = useProjectsStore()