From e1a7fb4999c00f9c5cb9c63f2e508a03d0ccfb32 Mon Sep 17 00:00:00 2001 From: konrad Date: Tue, 26 Oct 2021 20:21:19 +0000 Subject: [PATCH] fix: migration icons are not resolved properly (#864) Co-authored-by: kolaente Co-authored-by: Dominik Pschenitschni Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/864 Co-authored-by: konrad Co-committed-by: konrad --- src/components/migrator/migration.vue | 255 ----------------- src/helpers/migrator.ts | 48 ---- src/views/migrator/Migrate.vue | 40 +-- src/views/migrator/MigrateService.vue | 260 ++++++++++++++++-- .../migrator/icons}/microsoft-todo.svg | 0 .../migrator/icons}/todoist.svg | 0 .../migrator/icons}/trello.svg | 0 .../migrator/icons}/vikunja-file.png | Bin .../migrator/icons}/wunderlist.jpg | Bin src/views/migrator/migrators.ts | 45 +++ 10 files changed, 303 insertions(+), 345 deletions(-) delete mode 100644 src/components/migrator/migration.vue delete mode 100644 src/helpers/migrator.ts rename src/{assets/migration => views/migrator/icons}/microsoft-todo.svg (100%) rename src/{assets/migration => views/migrator/icons}/todoist.svg (100%) rename src/{assets/migration => views/migrator/icons}/trello.svg (100%) rename src/{assets/migration => views/migrator/icons}/vikunja-file.png (100%) rename src/{assets/migration => views/migrator/icons}/wunderlist.jpg (100%) create mode 100644 src/views/migrator/migrators.ts diff --git a/src/components/migrator/migration.vue b/src/components/migrator/migration.vue deleted file mode 100644 index 235df9ca..00000000 --- a/src/components/migrator/migration.vue +++ /dev/null @@ -1,255 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/helpers/migrator.ts b/src/helpers/migrator.ts deleted file mode 100644 index 92106b76..00000000 --- a/src/helpers/migrator.ts +++ /dev/null @@ -1,48 +0,0 @@ -export interface Migrator { - name: string - identifier: string - isFileMigrator?: boolean -} - -export const getMigratorFromSlug = (slug: string): Migrator => { - switch (slug) { - case 'wunderlist': - return { - name: 'Wunderlist', - identifier: 'wunderlist', - } - case 'todoist': - return { - name: 'Todoist', - identifier: 'todoist', - } - case 'trello': - return { - name: 'Trello', - identifier: 'trello', - } - case 'microsoft-todo': - return { - name: 'Microsoft Todo', - identifier: 'microsoft-todo', - } - case 'vikunja-file': - return { - name: 'Vikunja Export', - identifier: 'vikunja-file', - isFileMigrator: true, - } - default: - throw new 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'), -} \ No newline at end of file diff --git a/src/views/migrator/Migrate.vue b/src/views/migrator/Migrate.vue index 3f3a6e34..5ec7bf2f 100644 --- a/src/views/migrator/Migrate.vue +++ b/src/views/migrator/Migrate.vue @@ -2,13 +2,18 @@

{{ $t('migrate.title') }}

{{ $t('migrate.description') }}

-
+
- + {{ name }}
@@ -16,38 +21,37 @@ \ No newline at end of file diff --git a/src/views/migrator/MigrateService.vue b/src/views/migrator/MigrateService.vue index fddf901e..ae6d762b 100644 --- a/src/views/migrator/MigrateService.vue +++ b/src/views/migrator/MigrateService.vue @@ -1,40 +1,252 @@ + \ No newline at end of file diff --git a/src/assets/migration/microsoft-todo.svg b/src/views/migrator/icons/microsoft-todo.svg similarity index 100% rename from src/assets/migration/microsoft-todo.svg rename to src/views/migrator/icons/microsoft-todo.svg diff --git a/src/assets/migration/todoist.svg b/src/views/migrator/icons/todoist.svg similarity index 100% rename from src/assets/migration/todoist.svg rename to src/views/migrator/icons/todoist.svg diff --git a/src/assets/migration/trello.svg b/src/views/migrator/icons/trello.svg similarity index 100% rename from src/assets/migration/trello.svg rename to src/views/migrator/icons/trello.svg diff --git a/src/assets/migration/vikunja-file.png b/src/views/migrator/icons/vikunja-file.png similarity index 100% rename from src/assets/migration/vikunja-file.png rename to src/views/migrator/icons/vikunja-file.png diff --git a/src/assets/migration/wunderlist.jpg b/src/views/migrator/icons/wunderlist.jpg similarity index 100% rename from src/assets/migration/wunderlist.jpg rename to src/views/migrator/icons/wunderlist.jpg diff --git a/src/views/migrator/migrators.ts b/src/views/migrator/migrators.ts new file mode 100644 index 00000000..f0885950 --- /dev/null +++ b/src/views/migrator/migrators.ts @@ -0,0 +1,45 @@ +import wunderlistIcon from './icons/wunderlist.jpg' +import todoistIcon from './icons/todoist.svg' +import trelloIcon from './icons/trello.svg' +import microsoftTodoIcon from './icons/microsoft-todo.svg' +import vikunjaFileIcon from './icons/vikunja-file.png' + +export interface Migrator { + id: string + name: string + isFileMigrator?: boolean + icon: string +} + +interface IMigratorRecord { + [key: Migrator['id']]: Migrator + } + +export const MIGRATORS: IMigratorRecord = { + wunderlist: { + id: 'wunderlist', + name: 'Wunderlist', + icon: wunderlistIcon, + }, + todoist: { + id: 'todoist', + name: 'Todoist', + icon: todoistIcon, + }, + trello: { + id: 'trello', + name: 'Trello', + icon: trelloIcon, + }, + 'microsoft-todo': { + id: 'microsoft-todo', + name: 'Microsoft Todo', + icon: microsoftTodoIcon, + }, + 'vikunja-file': { + id: 'vikunja-file', + name: 'Vikunja Export', + icon: vikunjaFileIcon, + isFileMigrator: true, + }, +} \ No newline at end of file