Skip to content

TaskView is a self-hosted project and task management platform focused on clarity, ownership, and control. TaskView is built for teams that want a transparent, self-hosted alternative to SaaS task managers.

fix: #130

Nikolai Gimanc8078784b692
diff --git a/api/src/tv-modules/ui-preferences/types.ts b/api/src/tv-modules/ui-preferences/types.ts
index c5fba36..30fc425 100644
--- a/api/src/tv-modules/ui-preferences/types.ts
+++ b/api/src/tv-modules/ui-preferences/types.ts
@@ -48,6 +48,7 @@ export const UiSettingsArkType = type({
'defaultView?': "'tasks' | 'kanban' | 'graph' | 'sprints'",
'taskSortBy?': "'date' | 'priority'",
'taskSortFirstNew?': '0 | 1',
+ 'showTaskId?': '0 | 1',
})
export type UiSettings = typeof UiSettingsArkType.infer
diff --git a/taskview-packages/taskview-api/src/api/__tests__/ui-preferences.test.ts b/taskview-packages/taskview-api/src/api/__tests__/ui-preferences.test.ts
index 35c5106..5db41f8 100644
--- a/taskview-packages/taskview-api/src/api/__tests__/ui-preferences.test.ts
+++ b/taskview-packages/taskview-api/src/api/__tests__/ui-preferences.test.ts
@@ -33,6 +33,20 @@ describe('UI preferences: remembered task sort', () => {
expect(settingsOf(await api.uiPreferences.fetch())).toMatchObject({ taskSortBy: 'priority', taskSortFirstNew: 0 })
})
+ it('stores whether task cards show the task ID', async () => {
+ const saved = await api.uiPreferences.update({
+ ...original,
+ [UI_SETTINGS_KEY]: { ...settingsOf(original), showTaskId: 1 },
+ })
+ expect(settingsOf(saved)).toMatchObject({ showTaskId: 1 })
+ expect(settingsOf(await api.uiPreferences.fetch())).toMatchObject({ showTaskId: 1 })
+
+ await expectApiError({
+ request: api.uiPreferences.update({ [UI_SETTINGS_KEY]: { showTaskId: true as never } }),
+ status: 400,
+ })
+ })
+
it('rejects a sort field or direction the task list does not support', async () => {
await expectApiError({
request: api.uiPreferences.update({ [UI_SETTINGS_KEY]: { taskSortBy: 'name' as never } }),
diff --git a/taskview-packages/taskview-api/src/api/ui-preferences.types.ts b/taskview-packages/taskview-api/src/api/ui-preferences.types.ts
index 0d6fa68..77de580 100644
--- a/taskview-packages/taskview-api/src/api/ui-preferences.types.ts
+++ b/taskview-packages/taskview-api/src/api/ui-preferences.types.ts
@@ -17,6 +17,7 @@ export type UiSettings = {
defaultView?: DefaultView
taskSortBy?: TaskSortBy
taskSortFirstNew?: 0 | 1
+ showTaskId?: 0 | 1
}
export const UI_SETTINGS_KEY = '__settings__'
diff --git a/web/src/components/features/base/TvDateRange.vue b/web/src/components/features/base/TvDateRange.vue
index c8e59b7..749b2ba 100644
--- a/web/src/components/features/base/TvDateRange.vue
+++ b/web/src/components/features/base/TvDateRange.vue
@@ -109,6 +109,10 @@ const { activatorUi } = useNuxtUiTaskItemStyles()
const open = ref(false)
const isRange = ref(false)
+watch(() => !!model.value?.start, (hasStart) => {
+ isRange.value = hasStart
+}, { immediate: true })
+
// drop the start date when switching back to single-date mode
watch(isRange, (on) => {
if (!on && model.value?.start) {
diff --git a/web/src/components/features/graph/composables/useLayout.ts b/web/src/components/features/graph/composables/useLayout.ts
index 2e617b2..c4f86b9 100644
--- a/web/src/components/features/graph/composables/useLayout.ts
+++ b/web/src/components/features/graph/composables/useLayout.ts
@@ -1,6 +1,7 @@
import dagre from '@dagrejs/dagre'
import { type Edge, type GraphNode, type Node, Position, type XYPosition } from '@vue-flow/core'
import type { GraphPlaceNodeNearArgs } from '@/types/graph.types'
+import { useUiPreferencesStore } from '@/stores/uiPreferences.store'
const NODE_WIDTH = 288 // w-72 wrapper in TaskNode
const NODE_MIN_HEIGHT = 74 // checkbox + priority column with paddings
@@ -41,7 +42,8 @@ export function estimateNodeSize(node: Pick<Node, 'data'>): { width: number; hei
const badgeWidth = (labelLength: number) =>
Math.min(CONTENT_WIDTH, BADGE_CHROME_WIDTH + labelLength * BADGE_CHAR_WIDTH)
const badgeWidths: number[] = []
- if (task.endDate) badgeWidths.push(badgeWidth(11)) // dd.Mon.yyyy
+ if (useUiPreferencesStore().settings.showTaskId === 1) badgeWidths.push(badgeWidth(String(task.id).length))
+ if (task.endDate) badgeWidths.push(badgeWidth(task.startDate ? 25 : 11)) // dd.Mon.yyyy, or dd.Mon.yyyy → dd.Mon.yyyy
if (task.recurrenceRuleId) badgeWidths.push(BADGE_CHROME_WIDTH) // icon-only
if (task.goalListId) badgeWidths.push(badgeWidth(10)) // list name (unknown here)
if (task.amount) badgeWidths.push(badgeWidth(String(task.amount).length + 1))
diff --git a/web/src/components/features/tasks/parts/TaskIdCopy.vue b/web/src/components/features/tasks/parts/TaskIdCopy.vue
index 313d65a..090e3cc 100644
--- a/web/src/components/features/tasks/parts/TaskIdCopy.vue
+++ b/web/src/components/features/tasks/parts/TaskIdCopy.vue
@@ -1,10 +1,7 @@
<template>
<UButton
- variant="link"
- color="neutral"
- size="sm"
+ v-bind="appearance"
:icon="copied ? 'i-lucide-check' : 'i-lucide-hash'"
- class="text-muted hover:text-default"
:title="t('tasks.copyId')"
data-testid="task-id-copy"
@click="copyId"
@@ -14,17 +11,36 @@
</template>
<script setup lang="ts">
+import { computed } from 'vue'
import { useClipboard } from '@vueuse/core'
import { useI18n } from 'vue-i18n'
const props = defineProps<{
taskId: number
+ badge?: boolean
}>()
const { t } = useI18n()
const toast = useToast()
const { copy, copied } = useClipboard({ copiedDuring: 2000 })
+const appearance = computed(() =>
+ props.badge
+ ? {
+ variant: 'subtle' as const,
+ color: 'neutral' as const,
+ size: 'xs' as const,
+ class: 'bg-elevated text-muted hover:text-default rounded-md',
+ ui: { leadingIcon: 'size-3' },
+ }
+ : {
+ variant: 'link' as const,
+ color: 'neutral' as const,
+ size: 'sm' as const,
+ class: 'text-muted hover:text-default',
+ },
+)
+
async function copyId() {
await copy(`#${props.taskId}`)
toast.add({
diff --git a/web/src/components/features/tasks/parts/TaskItem.vue b/web/src/components/features/tasks/parts/TaskItem.vue
index 88bb0d3..fff1e14 100644
--- a/web/src/components/features/tasks/parts/TaskItem.vue
+++ b/web/src/components/features/tasks/parts/TaskItem.vue
@@ -32,6 +32,18 @@
:class="ui?.additionalInfo"
class="flex flex-wrap items-center gap-2"
>
+ <span
+ v-if="showTaskId"
+ class="inline-flex"
+ @click.stop
+ >
+ <TaskIdCopy
+ :task-id="task.id"
+ badge
+ :data-testid="`task-card-id-${task.id}`"
+ />
+ </span>
+
<!-- Date -->
<UBadge
v-if="task.endDate"
@@ -148,9 +160,11 @@ import { useGoalListsStore } from '@/stores/goal-lists.store'
import { useBaseScreenStore } from '@/stores/base-screen.store'
import { useCollaborationStore } from '@/stores/collaboration.store'
import { useTagsStore } from '@/stores/tag.store'
-import { formatDate } from '@vueuse/core'
+import { formatDate, normalizeDate } from '@vueuse/core'
import { AllGoalPermissions } from '@/types/goals.types'
import { useTaskDetailPanel } from '@/composables/useTaskDetailPanel'
+import { useUiPreferencesStore } from '@/stores/uiPreferences.store'
+import TaskIdCopy from './TaskIdCopy.vue'
const TOGGLE_DELAY = 200
const props = defineProps<{
@@ -191,6 +205,9 @@ const goalListsStore = useGoalListsStore()
const baseScreenStore = useBaseScreenStore()
const collaborationStore = useCollaborationStore()
const tagsStore = useTagsStore()
+const uiPreferencesStore = useUiPreferencesStore()
+
+const showTaskId = computed(() => uiPreferencesStore.settings.showTaskId === 1)
const priorityColor = computed(() => {
switch (props.task.priorityId) {
@@ -216,17 +233,17 @@ const listName = computed(() => {
|| ''
})
+function formatTaskDate(date: string, time: string | null) {
+ const value = normalizeDate(time ? `${date}T${time}Z` : date)
+ const day = value.getFullYear() === new Date().getFullYear() ? 'DD.MMM' : 'DD.MMM.YYYY'
+ return formatDate(value, time ? `${day} HH:mm` : day)
+}
+
const formattedDate = computed(() => {
if (!props.task.endDate) return ''
- if (props.task.endTime) {
- const match = props.task.endTime.match(/^(\d{2}):(\d{2})/)
- if (match) {
- const utc = new Date(`${props.task.endDate}T${match[1]}:${match[2]}:00Z`)
- return formatDate(utc, 'DD.MMM.YYYY HH:mm')
- }
- }
- const [y, m, d] = props.task.endDate.split('-').map(Number)
- return formatDate(new Date(y, m - 1, d), 'DD.MMM.YYYY')
+ const end = formatTaskDate(props.task.endDate, props.task.endTime)
+ if (!props.task.startDate) return end
+ return `${formatTaskDate(props.task.startDate, props.task.startTime)} → ${end}`
})
const isOverdue = computed(() => {
@@ -273,7 +290,8 @@ const transactionColor = computed(() => {
})
const hasAdditionalInfo = computed(() => {
- return projectName.value ||
+ return showTaskId.value ||
+ projectName.value ||
listName.value ||
props.task.endDate ||
props.task.amount ||
diff --git a/web/src/components/features/ui-customization/UiCustomizationOthers.vue b/web/src/components/features/ui-customization/UiCustomizationOthers.vue
index 2557dcc..d10c743 100644
--- a/web/src/components/features/ui-customization/UiCustomizationOthers.vue
+++ b/web/src/components/features/ui-customization/UiCustomizationOthers.vue
@@ -45,6 +45,13 @@
:ui="{ base: 'rounded-xl' }"
/>
</UFormField>
+
+ <USwitch
+ v-model="showTaskId"
+ :label="t('uiCustomization.others.showTaskId')"
+ :description="t('uiCustomization.others.showTaskIdHint')"
+ data-testid="show-task-id-switch"
+ />
</div>
</template>
@@ -80,6 +87,13 @@ const defaultView = computed<DefaultView>({
},
})
+const showTaskId = computed<boolean>({
+ get: () => store.settings.showTaskId === 1,
+ set: (value) => {
+ store.setSetting('showTaskId', value ? 1 : undefined)
+ },
+})
+
const projectItems = computed(() => [
{ value: NONE, label: t('uiCustomization.others.defaultProjectNone') },
...goalsStore.goals.map((goal) => ({ value: goal.id, label: goal.name })),
diff --git a/web/src/locales/de.ts b/web/src/locales/de.ts
index 37ae956..b2395be 100644
--- a/web/src/locales/de.ts
+++ b/web/src/locales/de.ts
@@ -879,6 +879,8 @@ export default {
defaultProjectNone: 'Startbildschirm (Standard)',
defaultView: 'Standardansicht',
defaultViewHint: 'Welche Ansicht beim Öffnen eines Projekts angezeigt wird.',
+ showTaskId: 'Aufgaben-ID anzeigen',
+ showTaskIdHint: 'Zeigt die Aufgabennummer (#163) auf Karten und in Listen; Klick kopiert sie.',
viewTasks: 'Aufgaben',
viewKanban: 'Kanban',
viewGraph: 'Graph',
diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts
index f331647..f5131e3 100644
--- a/web/src/locales/en.ts
+++ b/web/src/locales/en.ts
@@ -893,6 +893,8 @@ export default {
defaultProjectNone: 'Home screen (default)',
defaultView: 'Default view',
defaultViewHint: 'Which view to open when you enter a project.',
+ showTaskId: 'Show task ID',
+ showTaskIdHint: 'Show the task number (#163) on cards and list rows; click to copy.',
viewTasks: 'Tasks',
viewKanban: 'Kanban',
viewGraph: 'Graph',
diff --git a/web/src/locales/es.ts b/web/src/locales/es.ts
index 4798675..8142d3e 100644
--- a/web/src/locales/es.ts
+++ b/web/src/locales/es.ts
@@ -879,6 +879,8 @@ export default {
defaultProjectNone: 'Pantalla de inicio (predeterminado)',
defaultView: 'Vista predeterminada',
defaultViewHint: 'Qué vista abrir al entrar en un proyecto.',
+ showTaskId: 'Mostrar ID de la tarea',
+ showTaskIdHint: 'Muestra el número de la tarea (#163) en tarjetas y listas; haz clic para copiarlo.',
viewTasks: 'Tareas',
viewKanban: 'Kanban',
viewGraph: 'Grafo',
diff --git a/web/src/locales/pt-br.ts b/web/src/locales/pt-br.ts
index ec72ca5..afd5c15 100644
--- a/web/src/locales/pt-br.ts
+++ b/web/src/locales/pt-br.ts
@@ -892,6 +892,8 @@ export default {
defaultProjectNone: 'Tela inicial (padrão)',
defaultView: 'Visualização padrão',
defaultViewHint: 'Qual visualização do projeto padrão abrir.',
+ showTaskId: 'Mostrar ID da tarefa',
+ showTaskIdHint: 'Mostra o número da tarefa (#163) nos cartões e listas; clique para copiar.',
viewTasks: 'Tarefas',
viewKanban: 'Kanban',
viewGraph: 'Gráfico',
diff --git a/web/src/locales/ru.ts b/web/src/locales/ru.ts
index 8369d5f..8601b2f 100644
--- a/web/src/locales/ru.ts
+++ b/web/src/locales/ru.ts
@@ -860,6 +860,8 @@ export default {
defaultProjectNone: 'Главный экран (по умолчанию)',
defaultView: 'Вид по умолчанию',
defaultViewHint: 'Какой вид открывать при переходе в проект.',
+ showTaskId: 'Показывать ID задачи',
+ showTaskIdHint: 'Номер задачи (#163) на карточках и в списках, по клику копируется.',
viewTasks: 'Задачи',
viewKanban: 'Канбан',
viewGraph: 'Граф',