1
0

Merge branch 'main' into vue3

# Conflicts:
#	src/components/input/editor.vue
#	src/components/list/partials/filters.vue
#	src/components/tasks/partials/editAssignees.vue
#	src/helpers/find.ts
#	src/helpers/time/formatDate.js
#	src/main.ts
#	src/store/modules/attachments.js
#	src/store/modules/kanban.js
#	src/views/list/views/List.vue
#	yarn.lock
This commit is contained in:
Dominik Pschenitschni
2021-10-07 12:20:52 +02:00
120 changed files with 717 additions and 272 deletions

View File

@ -1,7 +0,0 @@
export function findIndexById(array : [], id : string | number) {
return array.findIndex(({id: currentId}) => currentId === id)
}
export function findById(array : [], id : string | number) {
return array.find(({id: currentId}) => currentId === id)
}

View File

@ -35,4 +35,14 @@ export const getMigratorFromSlug = (slug: string): Migrator => {
default:
throw Error('Unknown migrator slug ' + slug)
}
}
// NOTE: we list the imports individually for better build time optimisation
export const SERVICE_ICONS = {
'vikunja-file': () => import('@/assets/migration/vikunja-file.png'),
'microsoft-todo': () => import('@/assets/migration/microsoft-todo.svg'),
'todoist': () => import('@/assets/migration/todoist.svg'),
'trello': () => import('@/assets/migration/trello.svg'),
'wunderlist': () => import('@/assets/migration/wunderlist.jpg'),
}

View File

@ -6,6 +6,6 @@ export const playPop = () => {
return
}
const popSound = new Audio('/audio/pop.wav')
const popSound = new Audio('/audio/pop.mp3')
popSound.play()
}

View File

@ -1,5 +1,5 @@
import {createDateFromString} from '@/helpers/time/createDateFromString'
import {format, formatDistance} from 'date-fns'
import {format, formatDistanceToNow} from 'date-fns'
import {enGB, de, fr, ru} from 'date-fns/locale'
import {i18n} from '@/i18n'
@ -39,12 +39,8 @@ export const formatDateSince = (date) => {
date = createDateFromString(date)
const currentDate = new Date()
const distance = formatDistance(date, currentDate, {locale: locales[i18n.global.t('date.locale')]})
if (date > currentDate) {
return i18n.global.t('date.in', {date: distance})
}
return i18n.global.t('date.ago', {date: distance})
return formatDistanceToNow(date, {
locale: locales[i18n.global.t('date.locale')],
addSuffix: true,
})
}

26
src/helpers/utils.ts Normal file
View File

@ -0,0 +1,26 @@
export function findIndexById(array : [], id : string | number) {
return array.findIndex(({id: currentId}) => currentId === id)
}
export function findById(array : [], id : string | number) {
return array.find(({id: currentId}) => currentId === id)
}
export function includesById(array: [], id: string | number) {
return array.some(({id: currentId}) => currentId === id)
}
// https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_isnil
export function isNil(value: any) {
return value == null
}
export function omitBy(obj: {}, check: (value: any) => Boolean): {} {
if (isNil(obj)) {
return {}
}
return Object.fromEntries(
Object.entries(obj).filter(([, value]) => !check(value)),
)
}