fix(task): remove default task color
Previously, the task would use the default color. This was now removed, as this resulted in the default color not being visible on tasks. Resolves https://github.com/go-vikunja/frontend/issues/135#issuecomment-1917576392
This commit is contained in:
parent
dc360d4a18
commit
6cc75928d8
@ -123,6 +123,23 @@ watch(
|
|||||||
|
|
||||||
function transformTaskToGanttBar(t: ITask) {
|
function transformTaskToGanttBar(t: ITask) {
|
||||||
const black = 'var(--grey-800)'
|
const black = 'var(--grey-800)'
|
||||||
|
|
||||||
|
const taskColor = getHexColor(t.hexColor)
|
||||||
|
|
||||||
|
let textColor = black
|
||||||
|
let backgroundColor = 'var(--grey-100)'
|
||||||
|
if(t.startDate) {
|
||||||
|
backgroundColor = taskColor ?? ''
|
||||||
|
if(typeof taskColor === 'undefined') {
|
||||||
|
textColor = 'white'
|
||||||
|
backgroundColor = 'var(--primary)'
|
||||||
|
} else if(colorIsDark(taskColor)) {
|
||||||
|
textColor = black
|
||||||
|
} else {
|
||||||
|
textColor = 'white'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
startDate: isoToKebabDate(t.startDate ? t.startDate.toISOString() : props.defaultTaskStartDate),
|
startDate: isoToKebabDate(t.startDate ? t.startDate.toISOString() : props.defaultTaskStartDate),
|
||||||
endDate: isoToKebabDate(t.endDate ? t.endDate.toISOString() : props.defaultTaskEndDate),
|
endDate: isoToKebabDate(t.endDate ? t.endDate.toISOString() : props.defaultTaskEndDate),
|
||||||
@ -131,8 +148,8 @@ function transformTaskToGanttBar(t: ITask) {
|
|||||||
label: t.title,
|
label: t.title,
|
||||||
hasHandles: true,
|
hasHandles: true,
|
||||||
style: {
|
style: {
|
||||||
color: t.startDate ? (colorIsDark(getHexColor(t.hexColor)) ? black : 'white') : black,
|
color: textColor,
|
||||||
backgroundColor: t.startDate ? getHexColor(t.hexColor) : 'var(--grey-100)',
|
backgroundColor,
|
||||||
border: t.startDate ? '' : '2px dashed var(--grey-300)',
|
border: t.startDate ? '' : '2px dashed var(--grey-300)',
|
||||||
'text-decoration': t.done ? 'line-through' : null,
|
'text-decoration': t.done ? 'line-through' : null,
|
||||||
},
|
},
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
:class="{
|
:class="{
|
||||||
'is-loading': loadingInternal || loading,
|
'is-loading': loadingInternal || loading,
|
||||||
'draggable': !(loadingInternal || loading),
|
'draggable': !(loadingInternal || loading),
|
||||||
'has-light-text': color !== TASK_DEFAULT_COLOR && !colorIsDark(color),
|
'has-light-text': !colorIsDark(color),
|
||||||
'has-custom-background-color': color !== TASK_DEFAULT_COLOR ? color : undefined,
|
'has-custom-background-color': color ?? undefined,
|
||||||
}"
|
}"
|
||||||
:style="{'background-color': color !== TASK_DEFAULT_COLOR ? color : undefined}"
|
:style="{'background-color': color ?? undefined}"
|
||||||
@click.exact="openTaskDetail()"
|
@click.exact="openTaskDetail()"
|
||||||
@click.ctrl="() => toggleTaskDone(task)"
|
@click.ctrl="() => toggleTaskDone(task)"
|
||||||
@click.meta="() => toggleTaskDone(task)"
|
@click.meta="() => toggleTaskDone(task)"
|
||||||
@ -83,7 +83,7 @@ import Done from '@/components/misc/Done.vue'
|
|||||||
import Labels from '@/components/tasks/partials/labels.vue'
|
import Labels from '@/components/tasks/partials/labels.vue'
|
||||||
import ChecklistSummary from './checklist-summary.vue'
|
import ChecklistSummary from './checklist-summary.vue'
|
||||||
|
|
||||||
import {TASK_DEFAULT_COLOR, getHexColor} from '@/models/task'
|
import {getHexColor} from '@/models/task'
|
||||||
import type {ITask} from '@/modelTypes/ITask'
|
import type {ITask} from '@/modelTypes/ITask'
|
||||||
import {SUPPORTED_IMAGE_SUFFIX} from '@/models/attachment'
|
import {SUPPORTED_IMAGE_SUFFIX} from '@/models/attachment'
|
||||||
import AttachmentService from '@/services/attachment'
|
import AttachmentService from '@/services/attachment'
|
||||||
|
@ -23,11 +23,9 @@ import type {ITaskReminder} from '@/modelTypes/ITaskReminder'
|
|||||||
import TaskReminderModel from '@/models/taskReminder'
|
import TaskReminderModel from '@/models/taskReminder'
|
||||||
import {secondsToPeriod} from '@/helpers/time/period'
|
import {secondsToPeriod} from '@/helpers/time/period'
|
||||||
|
|
||||||
export const TASK_DEFAULT_COLOR = '#1973ff'
|
export function getHexColor(hexColor: string): string | undefined {
|
||||||
|
|
||||||
export function getHexColor(hexColor: string): string {
|
|
||||||
if (hexColor === '' || hexColor === '#') {
|
if (hexColor === '' || hexColor === '#') {
|
||||||
return TASK_DEFAULT_COLOR
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
return hexColor
|
return hexColor
|
||||||
|
@ -472,7 +472,7 @@ import {klona} from 'klona/lite'
|
|||||||
import {eventToHotkeyString} from '@github/hotkey'
|
import {eventToHotkeyString} from '@github/hotkey'
|
||||||
|
|
||||||
import TaskService from '@/services/task'
|
import TaskService from '@/services/task'
|
||||||
import TaskModel, {TASK_DEFAULT_COLOR} from '@/models/task'
|
import TaskModel from '@/models/task'
|
||||||
|
|
||||||
import type {ITask} from '@/modelTypes/ITask'
|
import type {ITask} from '@/modelTypes/ITask'
|
||||||
import type {IProject} from '@/modelTypes/IProject'
|
import type {IProject} from '@/modelTypes/IProject'
|
||||||
@ -582,9 +582,7 @@ const color = computed(() => {
|
|||||||
? task.value.getHexColor()
|
? task.value.getHexColor()
|
||||||
: undefined
|
: undefined
|
||||||
|
|
||||||
return color === TASK_DEFAULT_COLOR
|
return color
|
||||||
? ''
|
|
||||||
: color
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const hasAttachments = computed(() => attachmentStore.attachments.length > 0)
|
const hasAttachments = computed(() => attachmentStore.attachments.length > 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user