mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 08:12:17 +01:00
fix last tracked tasks empty state
This commit is contained in:
committed by
Gregor Vostrak
parent
5b86c85aca
commit
4400741391
@@ -12,6 +12,7 @@ const props = withDefaults(
|
||||
border: boolean;
|
||||
}>(),
|
||||
{
|
||||
name: '',
|
||||
size: 'base',
|
||||
tag: 'div',
|
||||
color: 'var(--theme-color-icon-default)',
|
||||
|
||||
@@ -24,6 +24,7 @@ async function submit() {
|
||||
project_id: props.projectId,
|
||||
});
|
||||
show.value = false;
|
||||
taskName.value = '';
|
||||
}
|
||||
|
||||
const taskNameInput = ref<HTMLInputElement | null>(null);
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
<CardTitle :title="title" :icon="icon"></CardTitle>
|
||||
|
||||
<div
|
||||
class="rounded-lg bg-card-background border border-card-border flex-1 flex items-center">
|
||||
<div class="divide-y divide-card-background-separator w-full">
|
||||
class="rounded-lg bg-card-background border border-card-border flex-1 flex items-stretch">
|
||||
<div
|
||||
class="divide-y divide-card-background-separator w-full flex flex-col">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
import RecentlyTrackedTasksCardEntry from '@/Components/Dashboard/RecentlyTrackedTasksCardEntry.vue';
|
||||
import DashboardCard from '@/Components/Dashboard/DashboardCard.vue';
|
||||
import { CheckCircleIcon } from '@heroicons/vue/20/solid';
|
||||
import SecondaryButton from '@/Components/SecondaryButton.vue';
|
||||
import { PlusCircleIcon } from '@heroicons/vue/24/solid';
|
||||
import { router } from '@inertiajs/vue3';
|
||||
|
||||
const props = defineProps<{
|
||||
latestTasks: {
|
||||
id: string;
|
||||
@@ -17,7 +21,30 @@ const props = defineProps<{
|
||||
<RecentlyTrackedTasksCardEntry
|
||||
v-for="lastTask in props.latestTasks"
|
||||
:key="lastTask.id"
|
||||
:project="lastTask.project_name"
|
||||
:project_id="lastTask.project_id"
|
||||
:task_id="lastTask.id"
|
||||
:title="lastTask.name"></RecentlyTrackedTasksCardEntry>
|
||||
<div v-if="props.latestTasks.length === 0" class="text-center">
|
||||
<PlusCircleIcon
|
||||
class="w-8 text-icon-default inline pb-2"></PlusCircleIcon>
|
||||
<h3 class="text-white font-semibold">No recent tasks found</h3>
|
||||
<p class="pb-5">Create tasks inside of a project!</p>
|
||||
<SecondaryButton @click="router.visit(route('projects'))"
|
||||
>Go to Projects
|
||||
</SecondaryButton>
|
||||
</div>
|
||||
<div
|
||||
v-if="props.latestTasks.length === 1"
|
||||
class="text-center flex flex-1 justify-center items-center">
|
||||
<div>
|
||||
<PlusCircleIcon
|
||||
class="w-8 text-icon-default inline pb-2"></PlusCircleIcon>
|
||||
<h3 class="text-white font-semibold">Add more tasks</h3>
|
||||
<p class="pb-5">Create tasks inside of a project!</p>
|
||||
<SecondaryButton @click="router.visit(route('projects'))"
|
||||
>Go to Projects
|
||||
</SecondaryButton>
|
||||
</div>
|
||||
</div>
|
||||
</DashboardCard>
|
||||
</template>
|
||||
|
||||
@@ -1,11 +1,37 @@
|
||||
<script setup lang="ts">
|
||||
import ProjectBadge from '@/Components/Common/Project/ProjectBadge.vue';
|
||||
import TimeTrackerStartStop from '@/Components/Common/TimeTrackerStartStop.vue';
|
||||
import { useProjectsStore } from '@/utils/useProjects';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { useCurrentTimeEntryStore } from '@/utils/useCurrentTimeEntry';
|
||||
|
||||
defineProps<{
|
||||
const props = defineProps<{
|
||||
title: string;
|
||||
project: string;
|
||||
project_id: string;
|
||||
task_id: string;
|
||||
}>();
|
||||
|
||||
const { projects } = storeToRefs(useProjectsStore());
|
||||
|
||||
const project = computed(() => {
|
||||
return projects.value.find((project) => project.id === props.project_id);
|
||||
});
|
||||
|
||||
const { currentTimeEntry } = storeToRefs(useCurrentTimeEntryStore());
|
||||
const { stopTimer, startTimer } = useCurrentTimeEntryStore();
|
||||
|
||||
async function startTaskTimer() {
|
||||
if (currentTimeEntry.value.id) {
|
||||
await stopTimer();
|
||||
}
|
||||
currentTimeEntry.value.project_id = props.project_id;
|
||||
currentTimeEntry.value.task_id = props.task_id;
|
||||
currentTimeEntry.value.start = dayjs().utc().format();
|
||||
await startTimer();
|
||||
useCurrentTimeEntryStore().fetchCurrentTimeEntry();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -14,10 +40,13 @@ defineProps<{
|
||||
<p class="font-semibold text-white text-sm pb-1">
|
||||
{{ title }}
|
||||
</p>
|
||||
<ProjectBadge :name="project"></ProjectBadge>
|
||||
<ProjectBadge
|
||||
:name="project?.name"
|
||||
:color="project?.color"></ProjectBadge>
|
||||
</div>
|
||||
<div class="flex items-center justify-center">
|
||||
<TimeTrackerStartStop></TimeTrackerStartStop>
|
||||
<TimeTrackerStartStop
|
||||
@changed="startTaskTimer"></TimeTrackerStartStop>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user