2018-09-06 17:46:38 +00:00
|
|
|
<template>
|
2018-09-09 14:22:02 +00:00
|
|
|
<div class="content has-text-centered">
|
2024-02-07 11:18:19 +00:00
|
|
|
<h2 v-if="salutation">
|
|
|
|
{{ salutation }}
|
|
|
|
</h2>
|
2022-10-16 17:36:04 +00:00
|
|
|
|
2024-02-07 11:18:19 +00:00
|
|
|
<Message
|
|
|
|
v-if="deletionScheduledAt !== null"
|
|
|
|
variant="danger"
|
|
|
|
class="mb-4"
|
|
|
|
>
|
2021-08-11 19:08:18 +00:00
|
|
|
{{
|
|
|
|
$t('user.deletion.scheduled', {
|
|
|
|
date: formatDateShort(deletionScheduledAt),
|
|
|
|
dateSince: formatDateSince(deletionScheduledAt),
|
|
|
|
})
|
|
|
|
}}
|
|
|
|
<router-link :to="{name: 'user.settings', hash: '#deletion'}">
|
|
|
|
{{ $t('user.deletion.scheduledCancel') }}
|
|
|
|
</router-link>
|
2024-02-07 11:18:19 +00:00
|
|
|
</Message>
|
|
|
|
<AddTask
|
2021-07-17 21:21:46 +00:00
|
|
|
class="is-max-width-desktop"
|
2024-02-07 11:18:19 +00:00
|
|
|
@taskAdded="updateTaskKey"
|
2021-07-17 21:21:46 +00:00
|
|
|
/>
|
2023-03-25 13:54:20 +00:00
|
|
|
<template v-if="!hasTasks && !loading && migratorsEnabled">
|
|
|
|
<p class="mt-4">
|
2022-11-13 21:04:57 +00:00
|
|
|
{{ $t('home.project.importText') }}
|
2021-01-17 19:53:09 +00:00
|
|
|
</p>
|
2021-04-15 15:21:20 +00:00
|
|
|
<x-button
|
|
|
|
:to="{ name: 'migrate.start' }"
|
2024-02-07 11:18:19 +00:00
|
|
|
:shadow="false"
|
|
|
|
>
|
2022-11-13 21:04:57 +00:00
|
|
|
{{ $t('home.project.import') }}
|
2021-01-17 17:57:57 +00:00
|
|
|
</x-button>
|
2020-06-15 16:47:17 +00:00
|
|
|
</template>
|
2024-02-07 11:18:19 +00:00
|
|
|
<div
|
|
|
|
v-if="projectHistory.length > 0"
|
|
|
|
class="is-max-width-desktop has-text-left mt-4"
|
|
|
|
>
|
2021-07-06 20:22:57 +00:00
|
|
|
<h3>{{ $t('home.lastViewed') }}</h3>
|
2024-02-07 11:18:19 +00:00
|
|
|
<ProjectCardGrid
|
|
|
|
v-cy="'projectCardGrid'"
|
|
|
|
:projects="projectHistory"
|
|
|
|
/>
|
2021-07-06 20:22:57 +00:00
|
|
|
</div>
|
2022-02-06 19:11:13 +00:00
|
|
|
<ShowTasks
|
2023-04-12 09:56:14 +00:00
|
|
|
v-if="projectStore.hasProjects"
|
2022-02-06 19:11:13 +00:00
|
|
|
:key="showTasksKey"
|
2024-02-07 11:18:19 +00:00
|
|
|
class="show-tasks"
|
2022-02-06 19:11:13 +00:00
|
|
|
/>
|
2018-09-06 17:46:38 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2021-11-30 20:06:15 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import {ref, computed} from 'vue'
|
|
|
|
|
|
|
|
import Message from '@/components/misc/message.vue'
|
|
|
|
import ShowTasks from '@/views/tasks/ShowTasks.vue'
|
2022-11-13 21:04:57 +00:00
|
|
|
import ProjectCardGrid from '@/components/project/partials/ProjectCardGrid.vue'
|
2021-11-30 20:06:15 +00:00
|
|
|
import AddTask from '@/components/tasks/add-task.vue'
|
|
|
|
|
2022-11-13 21:04:57 +00:00
|
|
|
import {getHistory} from '@/modules/projectHistory'
|
2021-11-30 20:06:15 +00:00
|
|
|
import {parseDateOrNull} from '@/helpers/parseDateOrNull'
|
|
|
|
import {formatDateShort, formatDateSince} from '@/helpers/time/formatDate'
|
2022-10-17 00:12:32 +00:00
|
|
|
import {useDaytimeSalutation} from '@/composables/useDaytimeSalutation'
|
2022-09-24 13:20:40 +00:00
|
|
|
|
|
|
|
import {useBaseStore} from '@/stores/base'
|
2022-11-13 21:04:57 +00:00
|
|
|
import {useProjectStore} from '@/stores/projects'
|
2022-09-21 00:21:22 +00:00
|
|
|
import {useConfigStore} from '@/stores/config'
|
2022-09-21 01:37:39 +00:00
|
|
|
import {useAuthStore} from '@/stores/auth'
|
2022-09-24 13:20:40 +00:00
|
|
|
import {useTaskStore} from '@/stores/tasks'
|
2021-11-30 20:06:15 +00:00
|
|
|
|
2022-10-17 00:12:32 +00:00
|
|
|
const salutation = useDaytimeSalutation()
|
2021-01-17 19:53:09 +00:00
|
|
|
|
2022-09-24 13:20:40 +00:00
|
|
|
const baseStore = useBaseStore()
|
2022-09-21 01:37:39 +00:00
|
|
|
const authStore = useAuthStore()
|
2022-09-21 00:21:22 +00:00
|
|
|
const configStore = useConfigStore()
|
2022-11-13 21:04:57 +00:00
|
|
|
const projectStore = useProjectStore()
|
2022-09-24 13:20:40 +00:00
|
|
|
const taskStore = useTaskStore()
|
|
|
|
|
2022-11-13 21:04:57 +00:00
|
|
|
const projectHistory = computed(() => {
|
|
|
|
// If we don't check this, it tries to load the project background right after logging out
|
2022-09-21 01:37:39 +00:00
|
|
|
if(!authStore.authenticated) {
|
2022-07-21 13:53:08 +00:00
|
|
|
return []
|
|
|
|
}
|
|
|
|
|
2022-01-04 16:54:00 +00:00
|
|
|
return getHistory()
|
2023-04-12 09:13:55 +00:00
|
|
|
.map(l => projectStore.projects[l.id])
|
|
|
|
.filter(l => Boolean(l))
|
2021-11-30 20:06:15 +00:00
|
|
|
})
|
2021-07-06 15:13:13 +00:00
|
|
|
|
2022-09-21 00:21:22 +00:00
|
|
|
const migratorsEnabled = computed(() => configStore.availableMigrators?.length > 0)
|
2022-09-24 13:20:40 +00:00
|
|
|
const hasTasks = computed(() => baseStore.hasTasks)
|
|
|
|
const loading = computed(() => taskStore.isLoading)
|
2022-09-21 01:37:39 +00:00
|
|
|
const deletionScheduledAt = computed(() => parseDateOrNull(authStore.info?.deletionScheduledAt))
|
2021-07-06 15:13:13 +00:00
|
|
|
|
2021-11-30 20:06:15 +00:00
|
|
|
// This is to reload the tasks list after adding a new task through the global task add.
|
2022-09-24 13:20:40 +00:00
|
|
|
// FIXME: Should use pinia (somehow?)
|
2021-11-30 20:06:15 +00:00
|
|
|
const showTasksKey = ref(0)
|
2022-02-06 19:11:13 +00:00
|
|
|
|
2022-11-13 21:04:57 +00:00
|
|
|
function updateTaskKey() {
|
2021-11-30 20:06:15 +00:00
|
|
|
showTasksKey.value++
|
2020-09-05 20:35:52 +00:00
|
|
|
}
|
2018-09-06 17:46:38 +00:00
|
|
|
</script>
|
2021-10-18 12:21:02 +00:00
|
|
|
|
2022-11-15 16:25:52 +00:00
|
|
|
<style scoped lang="scss">
|
|
|
|
.show-tasks {
|
|
|
|
margin-top: 2rem;
|
2021-10-18 12:21:02 +00:00
|
|
|
}
|
|
|
|
</style>
|