add support for history_group and loading indicators to export buttons

This commit is contained in:
Gregor Vostrak
2024-10-25 18:09:28 +02:00
committed by Constantin Graf
parent 8712cfb9dc
commit ab4dbd64df
6 changed files with 74 additions and 56 deletions

View File

@@ -123,7 +123,7 @@ export type TimeEntriesQueryParams = ZodiosQueryParamsByAlias<
export type AggregatedTimeEntriesQueryParams = ZodiosQueryParamsByAlias<
SolidTimeApi,
'getAggregatedTimeEntries'
>;
> & { start: string; end: string };
export type OrganizationResponse = ZodiosResponseByAlias<
SolidTimeApi,

View File

@@ -2675,38 +2675,39 @@ If the group parameters are all set to &#x60;null&#x60; or are all missing, the
{
name: 'group',
type: 'Query',
schema: z
.enum([
'day',
'week',
'month',
'year',
'user',
'project',
'task',
'client',
'billable',
'description',
])
.optional(),
schema: z.enum([
'day',
'week',
'month',
'year',
'user',
'project',
'task',
'client',
'billable',
'description',
]),
},
{
name: 'sub_group',
type: 'Query',
schema: z
.enum([
'day',
'week',
'month',
'year',
'user',
'project',
'task',
'client',
'billable',
'description',
])
.optional(),
schema: z.enum([
'day',
'week',
'month',
'year',
'user',
'project',
'task',
'client',
'billable',
'description',
]),
},
{
name: 'history_group',
type: 'Query',
schema: z.enum(['day', 'week', 'month', 'year']),
},
{
name: 'member_id',
@@ -2721,12 +2722,12 @@ If the group parameters are all set to &#x60;null&#x60; or are all missing, the
{
name: 'start',
type: 'Query',
schema: start,
schema: z.string(),
},
{
name: 'end',
type: 'Query',
schema: start,
schema: z.string(),
},
{
name: 'active',

View File

@@ -2,16 +2,19 @@
import type { HtmlButtonType } from '@/types/dom';
import { twMerge } from 'tailwind-merge';
import { type Component } from 'vue';
import LoadingSpinner from '../LoadingSpinner.vue';
const props = withDefaults(
defineProps<{
type: HtmlButtonType;
icon?: Component;
size: 'small' | 'base';
loading: boolean;
}>(),
{
type: 'button',
size: 'base',
loading: false,
}
);
@@ -24,6 +27,7 @@ const sizeClasses = {
<template>
<button
:type="type"
:disabled="loading"
:class="
twMerge(
'bg-button-secondary-background border border-button-secondary-border hover:bg-button-secondary-background-hover shadow-sm transition text-white rounded-lg font-semibold inline-flex items-center space-x-1.5 focus-visible:border-input-border-active focus:outline-none focus:ring-0 disabled:opacity-25 ease-in-out',
@@ -34,10 +38,11 @@ const sizeClasses = {
:class="
twMerge('flex items-center ', props.icon ? 'space-x-1.5' : '')
">
<LoadingSpinner v-if="loading"></LoadingSpinner>
<component
v-if="props.icon"
v-if="props.icon && !loading"
:is="props.icon"
class="w-4 sm:w-5 h-4 sm:h-5 -ml-0.5 sm:-ml-1"></component>
class="text-text-tertiary w-4 -ml-0.5 mr-1"></component>
<span>
<slot />
</span>