mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-16 12:12:15 +01:00
fix last tracked tasks empty state
This commit is contained in:
@@ -12,6 +12,7 @@ const props = withDefaults(
|
|||||||
border: boolean;
|
border: boolean;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
|
name: '',
|
||||||
size: 'base',
|
size: 'base',
|
||||||
tag: 'div',
|
tag: 'div',
|
||||||
color: 'var(--theme-color-icon-default)',
|
color: 'var(--theme-color-icon-default)',
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ async function submit() {
|
|||||||
project_id: props.projectId,
|
project_id: props.projectId,
|
||||||
});
|
});
|
||||||
show.value = false;
|
show.value = false;
|
||||||
|
taskName.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
const taskNameInput = ref<HTMLInputElement | null>(null);
|
const taskNameInput = ref<HTMLInputElement | null>(null);
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
<CardTitle :title="title" :icon="icon"></CardTitle>
|
<CardTitle :title="title" :icon="icon"></CardTitle>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="rounded-lg bg-card-background border border-card-border flex-1 flex items-center">
|
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">
|
<div
|
||||||
|
class="divide-y divide-card-background-separator w-full flex flex-col">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
import RecentlyTrackedTasksCardEntry from '@/Components/Dashboard/RecentlyTrackedTasksCardEntry.vue';
|
import RecentlyTrackedTasksCardEntry from '@/Components/Dashboard/RecentlyTrackedTasksCardEntry.vue';
|
||||||
import DashboardCard from '@/Components/Dashboard/DashboardCard.vue';
|
import DashboardCard from '@/Components/Dashboard/DashboardCard.vue';
|
||||||
import { CheckCircleIcon } from '@heroicons/vue/20/solid';
|
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<{
|
const props = defineProps<{
|
||||||
latestTasks: {
|
latestTasks: {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -17,7 +21,30 @@ const props = defineProps<{
|
|||||||
<RecentlyTrackedTasksCardEntry
|
<RecentlyTrackedTasksCardEntry
|
||||||
v-for="lastTask in props.latestTasks"
|
v-for="lastTask in props.latestTasks"
|
||||||
:key="lastTask.id"
|
:key="lastTask.id"
|
||||||
:project="lastTask.project_name"
|
:project_id="lastTask.project_id"
|
||||||
|
:task_id="lastTask.id"
|
||||||
:title="lastTask.name"></RecentlyTrackedTasksCardEntry>
|
: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>
|
</DashboardCard>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,11 +1,37 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import ProjectBadge from '@/Components/Common/Project/ProjectBadge.vue';
|
import ProjectBadge from '@/Components/Common/Project/ProjectBadge.vue';
|
||||||
import TimeTrackerStartStop from '@/Components/Common/TimeTrackerStartStop.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;
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -14,10 +40,13 @@ defineProps<{
|
|||||||
<p class="font-semibold text-white text-sm pb-1">
|
<p class="font-semibold text-white text-sm pb-1">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</p>
|
</p>
|
||||||
<ProjectBadge :name="project"></ProjectBadge>
|
<ProjectBadge
|
||||||
|
:name="project?.name"
|
||||||
|
:color="project?.color"></ProjectBadge>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center justify-center">
|
<div class="flex items-center justify-center">
|
||||||
<TimeTrackerStartStop></TimeTrackerStartStop>
|
<TimeTrackerStartStop
|
||||||
|
@changed="startTaskTimer"></TimeTrackerStartStop>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user