diff --git a/packages/theme/styles/components.scss b/packages/theme/styles/components.scss index 3d712d641d..92c5c62acc 100644 --- a/packages/theme/styles/components.scss +++ b/packages/theme/styles/components.scss @@ -1081,12 +1081,21 @@ &:not(.only-icon) .btn-icon, &:not(.only-icon) .icon { margin-right: .375rem !important; } - .icon, .btn-icon { color: var(--theme-halfcontent-color) !important; } .label { font-size: 0.8125rem !important; color: var(--theme-halfcontent-color) !important; } } +.list-container .listitems-container, +.list-container .listitems-container:hover, +.list-container .antiButton.list, +.list-container .antiButton.list:hover { + .icon, .btn-icon { color: var(--theme-halfcontent-color) !important; } +} +.list-container .datetime-button .btn-icon.normal, +.list-container .datetime-button:hover .btn-icon.normal { + color: var(--theme-halfcontent-color) !important; +} /* Kanban - global style */ .kanban-container .card-container .antiButton.link-bordered { padding: 0 .5rem; } diff --git a/packages/ui/src/components/calendar/DatePresenter.svelte b/packages/ui/src/components/calendar/DatePresenter.svelte index 2c053d7055..5b8c68c1fb 100644 --- a/packages/ui/src/components/calendar/DatePresenter.svelte +++ b/packages/ui/src/components/calendar/DatePresenter.svelte @@ -24,6 +24,7 @@ import Label from '../Label.svelte' import DatePopup from './DatePopup.svelte' import DPCalendar from './icons/DPCalendar.svelte' + import DPCalendarOver from './icons/DPCalendarOver.svelte' import { getMonthName } from './internal/DateUtils' import { ComponentType } from 'svelte' @@ -33,6 +34,7 @@ export let editable: boolean = false export let icon: Asset | AnySvelteComponent | ComponentType | undefined = undefined export let iconModifier: 'normal' | 'warning' | 'critical' | 'overdue' = 'normal' + export let shouldIgnoreOverdue: boolean = false export let labelNull: IntlString = ui.string.NoDate export let showIcon = true export let shouldShowLabel: boolean = true @@ -94,7 +96,10 @@ > {#if showIcon}
- +
{/if} {#if value !== null && value !== undefined} diff --git a/packages/ui/src/components/calendar/DateRangePresenter.svelte b/packages/ui/src/components/calendar/DateRangePresenter.svelte index 588355bcea..247a0189eb 100644 --- a/packages/ui/src/components/calendar/DateRangePresenter.svelte +++ b/packages/ui/src/components/calendar/DateRangePresenter.svelte @@ -23,12 +23,14 @@ import IconClose from '../icons/Close.svelte' import DatePopup from './DatePopup.svelte' import DPCalendar from './icons/DPCalendar.svelte' + import DPCalendarOver from './icons/DPCalendarOver.svelte' import { daysInMonth, getMonthName } from './internal/DateUtils' export let value: number | null | undefined = null export let mode: DateRangeMode = DateRangeMode.DATE export let editable: boolean = false - export let iconModifier: 'normal' | 'warning' | 'overdue' = 'normal' + export let iconModifier: 'overdue' | 'critical' | 'warning' | 'normal' = 'normal' + export let shouldIgnoreOverdue: boolean = false export let labelNull: IntlString = ui.string.NoDate export let kind: 'default' | 'no-border' | 'link' | 'regular' = 'default' export let size: 'small' | 'medium' | 'large' = 'small' @@ -397,7 +399,7 @@ {/if} {:else}
- +
{#if value !== undefined && value !== null && value.toString() !== ''} {#if withDate} @@ -469,6 +471,9 @@ &.overdue { color: var(--theme-error-color); } + &.critical { + color: var(--theme-error-color); + } } &.default { @@ -525,6 +530,9 @@ &.overdue { color: var(--theme-error-color); } + &.critical { + color: var(--theme-error-color); + } } .time-divider { background-color: var(--theme-divider-color); diff --git a/packages/ui/src/components/calendar/DueDatePopup.svelte b/packages/ui/src/components/calendar/DueDatePopup.svelte index b8fbd58d1a..dc0ed3c40c 100644 --- a/packages/ui/src/components/calendar/DueDatePopup.svelte +++ b/packages/ui/src/components/calendar/DueDatePopup.svelte @@ -22,7 +22,7 @@ export let formattedDate: string = '' export let daysDifference: number = 0 export let isOverdue: boolean = false - export let iconModifier: 'warning' | 'critical' | 'overdue' | undefined = undefined + export let iconModifier: 'warning' | 'critical' | 'overdue' | 'normal' = 'normal' export let shouldIgnoreOverdue: boolean = false @@ -42,14 +42,14 @@ params={{ value: formattedDate }} /> -
- {#if !shouldIgnoreOverdue} + {#if !shouldIgnoreOverdue} +
+
+ {/if} {/if} @@ -58,11 +58,13 @@ .root { display: flex; width: 10rem; + min-width: 0; } .iconContainer { - color: var(--content-color); - margin-right: 1rem; + margin-top: 0.125rem; + margin-right: 0.5rem; + color: var(--theme-caption-color); &.mIconContainerWarning { color: var(--theme-warning-color); @@ -80,12 +82,12 @@ } .title { - color: var(--caption-color); + color: var(--theme-caption-color); font-weight: 500; } .description { margin-top: 0.25rem; - color: var(--dark-color); + color: var(--theme-dark-color); } diff --git a/packages/ui/src/components/calendar/DueDatePresenter.svelte b/packages/ui/src/components/calendar/DueDatePresenter.svelte index 7987c8d832..7f735c8bb3 100644 --- a/packages/ui/src/components/calendar/DueDatePresenter.svelte +++ b/packages/ui/src/components/calendar/DueDatePresenter.svelte @@ -17,7 +17,7 @@ import DueDatePopup from './DueDatePopup.svelte' import { tooltip } from '../../tooltips' import DatePresenter from './DatePresenter.svelte' - import { getDaysDifference } from './internal/DateUtils' + import { getDaysDifference, getDueDateIconModifier, getFormattedDate } from './internal/DateUtils' import { ButtonKind, ButtonSize } from '../../types' export let value: number | null = null @@ -33,14 +33,10 @@ $: isOverdue = value !== null && value < today.getTime() $: dueDate = value === null ? null : new Date(value) $: daysDifference = dueDate === null ? null : getDaysDifference(today, dueDate) - $: iconModifier = getDueDateIconModifier(isOverdue, daysDifference) + $: iconModifier = getDueDateIconModifier(isOverdue, daysDifference, shouldIgnoreOverdue) let formattedDate = getFormattedDate(value) $: formattedDate = getFormattedDate(value) - function getFormattedDate (value: number | null): string { - return !value ? '' : new Date(value).toLocaleString('default', { month: 'short', day: 'numeric' }) - } - const handleDueDateChanged = async (event: CustomEvent) => { const newDate = event.detail @@ -50,29 +46,6 @@ onChange(newDate) } - - const WARNING_DAYS = 7 - - const getDueDateIconModifier = ( - isOverdue: boolean, - daysDifference: number | null - ): 'overdue' | 'critical' | 'warning' | undefined => { - if (shouldIgnoreOverdue) { - return - } - - if (isOverdue) { - return 'overdue' - } - - if (daysDifference === 0) { - return 'critical' - } - - if (daysDifference !== null && daysDifference <= WARNING_DAYS) { - return 'warning' - } - } {#if shouldRender} @@ -93,6 +66,15 @@ } : undefined} > - + {/if} diff --git a/packages/ui/src/components/calendar/icons/DPCalendarOver.svelte b/packages/ui/src/components/calendar/icons/DPCalendarOver.svelte index 70d3f8a032..b4949ca099 100644 --- a/packages/ui/src/components/calendar/icons/DPCalendarOver.svelte +++ b/packages/ui/src/components/calendar/icons/DPCalendarOver.svelte @@ -3,8 +3,13 @@ export let fill: string = 'currentColor' - + + diff --git a/packages/ui/src/components/calendar/internal/DateUtils.ts b/packages/ui/src/components/calendar/internal/DateUtils.ts index 26640408f6..43c1331e53 100644 --- a/packages/ui/src/components/calendar/internal/DateUtils.ts +++ b/packages/ui/src/components/calendar/internal/DateUtils.ts @@ -108,3 +108,21 @@ export const getDaysDifference = (from: Date, to: Date): number => { export const getMillisecondsInMonth = (date: Date): number => { return daysInMonth(date) * MILLISECONDS_IN_DAY } + +const WARNING_DAYS = 7 + +export const getDueDateIconModifier = ( + isOverdue: boolean, + daysDifference: number | null, + shouldIgnoreOverdue: boolean +): 'overdue' | 'critical' | 'warning' | 'normal' => { + if (shouldIgnoreOverdue) return 'normal' + if (isOverdue) return 'overdue' + if (daysDifference === 0) return 'critical' + if (daysDifference !== null && daysDifference <= WARNING_DAYS) return 'warning' + return 'normal' +} + +export function getFormattedDate (value: number | null): string { + return value === null ? '' : new Date(value).toLocaleString('default', { month: 'short', day: 'numeric' }) +} diff --git a/plugins/task-resources/src/components/DueDateEditor.svelte b/plugins/task-resources/src/components/DueDateEditor.svelte index f43f9cea1b..b6d4241fd1 100644 --- a/plugins/task-resources/src/components/DueDateEditor.svelte +++ b/plugins/task-resources/src/components/DueDateEditor.svelte @@ -11,7 +11,7 @@ export let editable: boolean = true const client = getClient() - $: shouldIgnoreOverdue = object.doneState != null + $: shouldIgnoreOverdue = object.doneState !== null const handleDueDateChanged = async (newDueDate: number | undefined | null) => { if (newDueDate === undefined || object.dueDate === newDueDate) {