mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-10-16 09:43:18 +01:00
fix type error and adapt formatting to new prettier version changes
This commit is contained in:
@@ -10,13 +10,7 @@ import Pagination from '@/Components/Common/Pagination.vue';
|
|||||||
import LoadingSpinner from '@/packages/ui/src/LoadingSpinner.vue';
|
import LoadingSpinner from '@/packages/ui/src/LoadingSpinner.vue';
|
||||||
|
|
||||||
export type SortColumn =
|
export type SortColumn =
|
||||||
| 'name'
|
'name' | 'client_name' | 'spent_time' | 'progress' | 'billable_rate' | 'status' | 'visibility';
|
||||||
| 'client_name'
|
|
||||||
| 'spent_time'
|
|
||||||
| 'progress'
|
|
||||||
| 'billable_rate'
|
|
||||||
| 'status'
|
|
||||||
| 'visibility';
|
|
||||||
export type { SortDirection } from '@/utils/useSortableTable';
|
export type { SortDirection } from '@/utils/useSortableTable';
|
||||||
import { canCreateProjects } from '@/utils/permissions';
|
import { canCreateProjects } from '@/utils/permissions';
|
||||||
import type { CreateProjectBody, Project, Client, CreateClientBody } from '@/packages/api/src';
|
import type { CreateProjectBody, Project, Client, CreateClientBody } from '@/packages/api/src';
|
||||||
|
|||||||
@@ -146,7 +146,10 @@ const changeSummary = computed<PlanLine[]>(() => {
|
|||||||
{ times: range(plan.breakSlot), label: 'Break' },
|
{ times: range(plan.breakSlot), label: 'Break' },
|
||||||
{ times: range(plan.secondHalf), label: workLabel },
|
{ times: range(plan.secondHalf), label: workLabel },
|
||||||
...plan.shifted.map((shift) => ({
|
...plan.shifted.map((shift) => ({
|
||||||
times: moved(req.otherEntries.find((e) => e.id === shift.id)!, shift),
|
times: moved(
|
||||||
|
req.otherEntries.find((e) => e.id === shift.id)!,
|
||||||
|
shift
|
||||||
|
),
|
||||||
label: props.entryLabel(shift.id),
|
label: props.entryLabel(shift.id),
|
||||||
})),
|
})),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ const emit = defineEmits<{
|
|||||||
:organization-billable-rate="organization?.billable_rate ?? null"
|
:organization-billable-rate="organization?.billable_rate ?? null"
|
||||||
:no-project-value="null"
|
:no-project-value="null"
|
||||||
align="start"
|
align="start"
|
||||||
@changed="(p, t) => emit('add-row', p, t)">
|
@changed="(p: string | null, t: string | null) => emit('add-row', p, t)">
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<Button variant="ghost" size="sm" class="text-text-secondary">
|
<Button variant="ghost" size="sm" class="text-text-secondary">
|
||||||
<PlusIcon class="h-4 w-4 mr-1 text-icon-default" />
|
<PlusIcon class="h-4 w-4 mr-1 text-icon-default" />
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ async function deleteUser() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error && typeof error === 'object' && 'response' in error) {
|
if (error && typeof error === 'object' && 'response' in error) {
|
||||||
const response = error.response as
|
const response = error.response as
|
||||||
| { status?: number; data?: { errors?: { password?: string[] } } }
|
{ status?: number; data?: { errors?: { password?: string[] } } } | undefined;
|
||||||
| undefined;
|
|
||||||
if (response?.status === 422) {
|
if (response?.status === 422) {
|
||||||
passwordError.value = response.data?.errors?.password?.[0] ?? 'Invalid password.';
|
passwordError.value = response.data?.errors?.password?.[0] ?? 'Invalid password.';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,7 @@ const deleteTeam = async () => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error && typeof error === 'object' && 'response' in error) {
|
if (error && typeof error === 'object' && 'response' in error) {
|
||||||
const response = error.response as
|
const response = error.response as
|
||||||
| { status?: number; data?: { errors?: { password?: string[] } } }
|
{ status?: number; data?: { errors?: { password?: string[] } } } | undefined;
|
||||||
| undefined;
|
|
||||||
if (response?.status === 422) {
|
if (response?.status === 422) {
|
||||||
passwordError.value = response.data?.errors?.password?.[0] ?? 'Invalid password.';
|
passwordError.value = response.data?.errors?.password?.[0] ?? 'Invalid password.';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,7 +118,10 @@ export type DetailedInvoiceResponse = ZodiosResponseByAlias<SolidTimeApi, 'getIn
|
|||||||
export type DetailedInvoice = DetailedInvoiceResponse['data'];
|
export type DetailedInvoice = DetailedInvoiceResponse['data'];
|
||||||
|
|
||||||
export type InvoiceIndexEntry = ZodiosResponseByAlias<SolidTimeApi, 'getInvoices'>['data'][0];
|
export type InvoiceIndexEntry = ZodiosResponseByAlias<SolidTimeApi, 'getInvoices'>['data'][0];
|
||||||
export type InvoiceRecipient = ZodiosResponseByAlias<SolidTimeApi, 'getInvoiceRecipients'>['data'][0];
|
export type InvoiceRecipient = ZodiosResponseByAlias<
|
||||||
|
SolidTimeApi,
|
||||||
|
'getInvoiceRecipients'
|
||||||
|
>['data'][0];
|
||||||
export type InvoiceRecipientBody = ZodiosBodyByAlias<SolidTimeApi, 'createInvoiceRecipient'>;
|
export type InvoiceRecipientBody = ZodiosBodyByAlias<SolidTimeApi, 'createInvoiceRecipient'>;
|
||||||
|
|
||||||
export type UpdateInvoiceSettings = ZodiosBodyByAlias<SolidTimeApi, 'updateInvoiceSettings'>;
|
export type UpdateInvoiceSettings = ZodiosBodyByAlias<SolidTimeApi, 'updateInvoiceSettings'>;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
TooltipProvider,
|
TooltipProvider,
|
||||||
TooltipTrigger,
|
TooltipTrigger,
|
||||||
} from '@/packages/ui/src/tooltip';
|
} from '@/packages/ui/src/tooltip';
|
||||||
const active = defineModel({ default: false });
|
const active = defineModel<boolean>({ default: false });
|
||||||
const emit = defineEmits(['changed']);
|
const emit = defineEmits(['changed']);
|
||||||
function toggleBillable() {
|
function toggleBillable() {
|
||||||
active.value = !active.value;
|
active.value = !active.value;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const props = withDefaults(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const emit = defineEmits(['open', 'submit']);
|
const emit = defineEmits(['open', 'submit']);
|
||||||
const open = defineModel({ default: false });
|
const open = defineModel<boolean>({ default: false });
|
||||||
|
|
||||||
function handleAutofocus(event: Event) {
|
function handleAutofocus(event: Event) {
|
||||||
if (props.autoFocus === false) {
|
if (props.autoFocus === false) {
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ import { type ComputedRef } from 'vue';
|
|||||||
|
|
||||||
const temporaryCustomTimerEntry = ref<string>('');
|
const temporaryCustomTimerEntry = ref<string>('');
|
||||||
|
|
||||||
const start = defineModel('start', {
|
const start = defineModel<string>('start', {
|
||||||
default: '',
|
default: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
const end = defineModel('end', {
|
const end = defineModel<string>('end', {
|
||||||
default: '',
|
default: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const NONE_ID = 'none';
|
|||||||
const ROW_HEIGHT = 32;
|
const ROW_HEIGHT = 32;
|
||||||
|
|
||||||
const model = defineModel<string[]>({
|
const model = defineModel<string[]>({
|
||||||
default: [],
|
default: () => [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ const props = withDefaults(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const model = defineModel<string[]>({
|
const model = defineModel<string[]>({
|
||||||
default: [],
|
default: () => [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import TimeEntryRow from '@/packages/ui/src/TimeEntry/TimeEntryRow.vue';
|
|||||||
import type { TimeEntriesGroupedByType } from '@/types/time-entries';
|
import type { TimeEntriesGroupedByType } from '@/types/time-entries';
|
||||||
|
|
||||||
const selectedTimeEntries = defineModel<TimeEntry[]>('selected', {
|
const selectedTimeEntries = defineModel<TimeEntry[]>('selected', {
|
||||||
default: [],
|
default: () => [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const emit = defineEmits<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const model = defineModel<string[]>({
|
const model = defineModel<string[]>({
|
||||||
default: [],
|
default: () => [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const timeEntryTags = computed<Tag[]>(() => {
|
const timeEntryTags = computed<Tag[]>(() => {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const emit = defineEmits<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const model = defineModel<string[]>({
|
const model = defineModel<string[]>({
|
||||||
default: [],
|
default: () => [],
|
||||||
});
|
});
|
||||||
const iconColorClasses = computed(() => {
|
const iconColorClasses = computed(() => {
|
||||||
if (model.value.length > 0) {
|
if (model.value.length > 0) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { getUserTimezone } from './utils/settings';
|
|||||||
import { getDayJsInstance } from './utils/time';
|
import { getDayJsInstance } from './utils/time';
|
||||||
import { useSessionStorage } from '@vueuse/core';
|
import { useSessionStorage } from '@vueuse/core';
|
||||||
|
|
||||||
const show = defineModel('show', { default: false });
|
const show = defineModel<boolean>('show', { default: false });
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
update: [timezone: string];
|
update: [timezone: string];
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
export type NumberFormat =
|
export type NumberFormat =
|
||||||
| 'point-comma'
|
'point-comma' | 'comma-point' | 'space-comma' | 'space-point' | 'apostrophe-point';
|
||||||
| 'comma-point'
|
|
||||||
| 'space-comma'
|
|
||||||
| 'space-point'
|
|
||||||
| 'apostrophe-point';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats a number according to the specified format
|
* Formats a number according to the specified format
|
||||||
|
|||||||
@@ -27,13 +27,7 @@ import BillableIcon from '@/packages/ui/src/Icons/BillableIcon.vue';
|
|||||||
import type { Organization } from '@/types/models';
|
import type { Organization } from '@/types/models';
|
||||||
|
|
||||||
export type CommandGroup =
|
export type CommandGroup =
|
||||||
| 'timer'
|
'timer' | 'active-timer' | 'navigation' | 'create' | 'theme' | 'organization' | 'entity';
|
||||||
| 'active-timer'
|
|
||||||
| 'navigation'
|
|
||||||
| 'create'
|
|
||||||
| 'theme'
|
|
||||||
| 'organization'
|
|
||||||
| 'entity';
|
|
||||||
|
|
||||||
export interface Command {
|
export interface Command {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -385,21 +385,19 @@ export function useCommandPalette() {
|
|||||||
const matching = projects.value
|
const matching = projects.value
|
||||||
.filter((p: Project) => p.name.toLowerCase().includes(query))
|
.filter((p: Project) => p.name.toLowerCase().includes(query))
|
||||||
.slice(0, maxPerType)
|
.slice(0, maxPerType)
|
||||||
.map(
|
.map((p: Project): EntitySearchResult => ({
|
||||||
(p: Project): EntitySearchResult => ({
|
id: `entity-project-${p.id}`,
|
||||||
id: `entity-project-${p.id}`,
|
label: p.name,
|
||||||
label: p.name,
|
icon: ENTITY_ICONS.project,
|
||||||
icon: ENTITY_ICONS.project,
|
keywords: ['project'],
|
||||||
keywords: ['project'],
|
action: () => {
|
||||||
action: () => {
|
closePaletteAfterAction();
|
||||||
closePaletteAfterAction();
|
router.visit(route('projects.show', { project: p.id }));
|
||||||
router.visit(route('projects.show', { project: p.id }));
|
},
|
||||||
},
|
entityType: 'project',
|
||||||
entityType: 'project',
|
color: p.color,
|
||||||
color: p.color,
|
badgeClass: ENTITY_BADGE_CLASSES.project,
|
||||||
badgeClass: ENTITY_BADGE_CLASSES.project,
|
}));
|
||||||
})
|
|
||||||
);
|
|
||||||
results.push(...matching);
|
results.push(...matching);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,20 +405,18 @@ export function useCommandPalette() {
|
|||||||
const matching = clients.value
|
const matching = clients.value
|
||||||
.filter((c: Client) => c.name.toLowerCase().includes(query))
|
.filter((c: Client) => c.name.toLowerCase().includes(query))
|
||||||
.slice(0, maxPerType)
|
.slice(0, maxPerType)
|
||||||
.map(
|
.map((c: Client): EntitySearchResult => ({
|
||||||
(c: Client): EntitySearchResult => ({
|
id: `entity-client-${c.id}`,
|
||||||
id: `entity-client-${c.id}`,
|
label: c.name,
|
||||||
label: c.name,
|
icon: ENTITY_ICONS.client,
|
||||||
icon: ENTITY_ICONS.client,
|
keywords: ['client'],
|
||||||
keywords: ['client'],
|
action: () => {
|
||||||
action: () => {
|
closePaletteAfterAction();
|
||||||
closePaletteAfterAction();
|
router.visit(route('clients'));
|
||||||
router.visit(route('clients'));
|
},
|
||||||
},
|
entityType: 'client',
|
||||||
entityType: 'client',
|
badgeClass: ENTITY_BADGE_CLASSES.client,
|
||||||
badgeClass: ENTITY_BADGE_CLASSES.client,
|
}));
|
||||||
})
|
|
||||||
);
|
|
||||||
results.push(...matching);
|
results.push(...matching);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,22 +424,20 @@ export function useCommandPalette() {
|
|||||||
const matching = tasks.value
|
const matching = tasks.value
|
||||||
.filter((t: Task) => t.name.toLowerCase().includes(query))
|
.filter((t: Task) => t.name.toLowerCase().includes(query))
|
||||||
.slice(0, maxPerType)
|
.slice(0, maxPerType)
|
||||||
.map(
|
.map((t: Task): EntitySearchResult => ({
|
||||||
(t: Task): EntitySearchResult => ({
|
id: `entity-task-${t.id}`,
|
||||||
id: `entity-task-${t.id}`,
|
label: t.name,
|
||||||
label: t.name,
|
icon: ENTITY_ICONS.task,
|
||||||
icon: ENTITY_ICONS.task,
|
keywords: ['task'],
|
||||||
keywords: ['task'],
|
action: () => {
|
||||||
action: () => {
|
closePaletteAfterAction();
|
||||||
closePaletteAfterAction();
|
if (t.project_id) {
|
||||||
if (t.project_id) {
|
router.visit(route('projects.show', { project: t.project_id }));
|
||||||
router.visit(route('projects.show', { project: t.project_id }));
|
}
|
||||||
}
|
},
|
||||||
},
|
entityType: 'task',
|
||||||
entityType: 'task',
|
badgeClass: ENTITY_BADGE_CLASSES.task,
|
||||||
badgeClass: ENTITY_BADGE_CLASSES.task,
|
}));
|
||||||
})
|
|
||||||
);
|
|
||||||
results.push(...matching);
|
results.push(...matching);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,20 +445,18 @@ export function useCommandPalette() {
|
|||||||
const matching = tags.value
|
const matching = tags.value
|
||||||
.filter((t: Tag) => t.name.toLowerCase().includes(query))
|
.filter((t: Tag) => t.name.toLowerCase().includes(query))
|
||||||
.slice(0, maxPerType)
|
.slice(0, maxPerType)
|
||||||
.map(
|
.map((t: Tag): EntitySearchResult => ({
|
||||||
(t: Tag): EntitySearchResult => ({
|
id: `entity-tag-${t.id}`,
|
||||||
id: `entity-tag-${t.id}`,
|
label: t.name,
|
||||||
label: t.name,
|
icon: ENTITY_ICONS.tag,
|
||||||
icon: ENTITY_ICONS.tag,
|
keywords: ['tag'],
|
||||||
keywords: ['tag'],
|
action: () => {
|
||||||
action: () => {
|
closePaletteAfterAction();
|
||||||
closePaletteAfterAction();
|
router.visit(route('tags'));
|
||||||
router.visit(route('tags'));
|
},
|
||||||
},
|
entityType: 'tag',
|
||||||
entityType: 'tag',
|
badgeClass: ENTITY_BADGE_CLASSES.tag,
|
||||||
badgeClass: ENTITY_BADGE_CLASSES.tag,
|
}));
|
||||||
})
|
|
||||||
);
|
|
||||||
results.push(...matching);
|
results.push(...matching);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,20 +464,18 @@ export function useCommandPalette() {
|
|||||||
const matching = members.value
|
const matching = members.value
|
||||||
.filter((m: Member) => m.name.toLowerCase().includes(query))
|
.filter((m: Member) => m.name.toLowerCase().includes(query))
|
||||||
.slice(0, maxPerType)
|
.slice(0, maxPerType)
|
||||||
.map(
|
.map((m: Member): EntitySearchResult => ({
|
||||||
(m: Member): EntitySearchResult => ({
|
id: `entity-member-${m.id}`,
|
||||||
id: `entity-member-${m.id}`,
|
label: m.name,
|
||||||
label: m.name,
|
icon: ENTITY_ICONS.member,
|
||||||
icon: ENTITY_ICONS.member,
|
keywords: ['member'],
|
||||||
keywords: ['member'],
|
action: () => {
|
||||||
action: () => {
|
closePaletteAfterAction();
|
||||||
closePaletteAfterAction();
|
router.visit(route('members'));
|
||||||
router.visit(route('members'));
|
},
|
||||||
},
|
entityType: 'member',
|
||||||
entityType: 'member',
|
badgeClass: ENTITY_BADGE_CLASSES.member,
|
||||||
badgeClass: ENTITY_BADGE_CLASSES.member,
|
}));
|
||||||
})
|
|
||||||
);
|
|
||||||
results.push(...matching);
|
results.push(...matching);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user