From d3171b59be530b814fb0ff5c3ef7b32165611fd4 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 7 Sep 2022 22:29:54 +0200 Subject: [PATCH 01/10] feat(link shares): allows switching the initial view by passing a query parameter --- src/components/sharing/linkSharing.vue | 46 +++++++++++++++++++++----- src/i18n/lang/en.json | 3 +- src/views/sharing/LinkSharingAuth.vue | 10 +++++- 3 files changed, 48 insertions(+), 11 deletions(-) diff --git a/src/components/sharing/linkSharing.vue b/src/components/sharing/linkSharing.vue index c36b3ddcf..15517de7b 100644 --- a/src/components/sharing/linkSharing.vue +++ b/src/components/sharing/linkSharing.vue @@ -83,6 +83,7 @@ {{ $t('list.share.attributes.name') }} {{ $t('list.share.attributes.sharedBy') }} {{ $t('list.share.attributes.right') }} + {{ $t('list.share.links.view') }} {{ $t('list.share.attributes.delete') }} @@ -92,7 +93,7 @@
@@ -140,6 +141,24 @@ {{ $t('list.share.right.read') }} + +
+ +
+ // FIXME: I think this is not needed .sharables-list:not(.card-content) { - overflow-y: auto + overflow-y: auto } @include modal-transition(); diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json index 0653cfcf1..d7a376fc7 100644 --- a/src/i18n/lang/en.json +++ b/src/i18n/lang/en.json @@ -242,7 +242,8 @@ "remove": "Remove a link share", "removeText": "Are you sure you want to remove this link share? It will no longer be possible to access this list with this link share. This cannot be undone!", "createSuccess": "The link share was successfully created.", - "deleteSuccess": "The link share was successfully deleted" + "deleteSuccess": "The link share was successfully deleted", + "view": "View" }, "userTeam": { "typeUser": "user | users", diff --git a/src/views/sharing/LinkSharingAuth.vue b/src/views/sharing/LinkSharingAuth.vue index b9e373d13..5d758ef14 100644 --- a/src/views/sharing/LinkSharingAuth.vue +++ b/src/views/sharing/LinkSharingAuth.vue @@ -79,7 +79,15 @@ function useAuth() { ? route.query.logoVisible === 'true' : true store.commit(LOGO_VISIBLE, logoVisible) - router.push({name: 'list.list', params: {listId}}) + + let view = 'list' + if (route.query.view && + (route.query.view === 'gantt' || + route.query.view === 'kanban' || + route.query.view === 'table')) { + view = route.query.view + } + router.push({name: `list.${view}`, params: {listId}}) } catch (e: any) { if (e.response?.data?.code === 13001) { authenticateWithPassword.value = true From 7a457eb16162b2b90fa7d9b46e658b132316140e Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 7 Sep 2022 22:37:32 +0200 Subject: [PATCH 02/10] feat(link shares): cleanup link share table --- src/components/sharing/linkSharing.vue | 66 ++++++++++++++------------ src/i18n/lang/en.json | 6 +-- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/src/components/sharing/linkSharing.vue b/src/components/sharing/linkSharing.vue index 15517de7b..958e3ece5 100644 --- a/src/components/sharing/linkSharing.vue +++ b/src/components/sharing/linkSharing.vue @@ -80,9 +80,7 @@ {{ $t('list.share.attributes.link') }} - {{ $t('list.share.attributes.name') }} - {{ $t('list.share.attributes.sharedBy') }} - {{ $t('list.share.attributes.right') }} +   {{ $t('list.share.links.view') }} {{ $t('list.share.attributes.delete') }} @@ -112,34 +110,37 @@
- - - {{ $t('list.share.links.noName') }} - - - {{ s.sharedBy.getDisplayName() }} - - - - +

+ {{ s.name }} +

+ +

+ + {{ s.sharedBy.getDisplayName() }} + +

+ +

+ + + +

@@ -229,6 +230,7 @@ const showNewForm = ref(false) interface SelectedViewMapper { [listId: number]: string, } + const selectedView = ref({}) const copy = useCopyToClipboard() @@ -294,5 +296,9 @@ function getShareLink(hash: string, view: string = 'list') { overflow-y: auto } +.rights-item { + white-space: nowrap; +} + @include modal-transition(); \ No newline at end of file diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json index d7a376fc7..d484aed03 100644 --- a/src/i18n/lang/en.json +++ b/src/i18n/lang/en.json @@ -243,7 +243,8 @@ "removeText": "Are you sure you want to remove this link share? It will no longer be possible to access this list with this link share. This cannot be undone!", "createSuccess": "The link share was successfully created.", "deleteSuccess": "The link share was successfully deleted", - "view": "View" + "view": "View", + "sharedBy": "Shared by {0}" }, "userTeam": { "typeUser": "user | users", @@ -265,9 +266,6 @@ }, "attributes": { "link": "Link", - "name": "Name", - "sharedBy": "Shared by", - "right": "Right", "delete": "Delete" } }, From d91d1fecf1b34734ef8af21c3c34bdaaa6d53e09 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 8 Sep 2022 13:58:49 +0200 Subject: [PATCH 03/10] chore: remove   --- src/components/sharing/linkSharing.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/sharing/linkSharing.vue b/src/components/sharing/linkSharing.vue index 958e3ece5..a86d7b4af 100644 --- a/src/components/sharing/linkSharing.vue +++ b/src/components/sharing/linkSharing.vue @@ -80,7 +80,7 @@ {{ $t('list.share.attributes.link') }} -   + {{ $t('list.share.links.view') }} {{ $t('list.share.attributes.delete') }} From 23598dd2ee649449f2176ae86acbc16ecbf01e6f Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 8 Sep 2022 14:11:19 +0200 Subject: [PATCH 04/10] fix: introduce a ListView type to properly type all available list views --- src/components/sharing/linkSharing.vue | 13 +++++++------ src/types/ListView.ts | 8 ++++++++ src/views/sharing/LinkSharingAuth.vue | 12 +++++------- 3 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 src/types/ListView.ts diff --git a/src/components/sharing/linkSharing.vue b/src/components/sharing/linkSharing.vue index a86d7b4af..2143b15b3 100644 --- a/src/components/sharing/linkSharing.vue +++ b/src/components/sharing/linkSharing.vue @@ -201,13 +201,16 @@ import {useStore} from '@/store' import {useI18n} from 'vue-i18n' import {RIGHTS} from '@/constants/rights' -import LinkShareModel, {type ILinkShare} from '@/models/linkShare' +import LinkShareModel from '@/models/linkShare' +import type {ILinkShare} from '@/modelTypes/ILinkShare' import LinkShareService from '@/services/linkShare' import {useCopyToClipboard} from '@/composables/useCopyToClipboard' import {success} from '@/message' -import type {IList} from '@/models/list' +import type {IList} from '@/modelTypes/IList' +import type {ListView} from '@/types/ListView' +import {LIST_VIEWS} from '@/types/ListView' const props = defineProps({ listId: { @@ -227,9 +230,7 @@ const showDeleteModal = ref(false) const linkIdToDelete = ref(0) const showNewForm = ref(false) -interface SelectedViewMapper { - [listId: number]: string, -} +type SelectedViewMapper = Record const selectedView = ref({}) @@ -285,7 +286,7 @@ async function remove(listId: IList['id']) { } } -function getShareLink(hash: string, view: string = 'list') { +function getShareLink(hash: string, view: ListView = LIST_VIEWS.LIST) { return frontendUrl.value + 'share/' + hash + '/auth?view=' + view } diff --git a/src/types/ListView.ts b/src/types/ListView.ts new file mode 100644 index 000000000..bf8aa3554 --- /dev/null +++ b/src/types/ListView.ts @@ -0,0 +1,8 @@ +export const LIST_VIEWS = { + LIST: 'list', + GANTT: 'gantt', + TABLE: 'table', + KANBAN: 'kanban', +} as const + +export type ListView = typeof LIST_VIEWS[keyof typeof LIST_VIEWS] diff --git a/src/views/sharing/LinkSharingAuth.vue b/src/views/sharing/LinkSharingAuth.vue index 5d758ef14..0962e8b98 100644 --- a/src/views/sharing/LinkSharingAuth.vue +++ b/src/views/sharing/LinkSharingAuth.vue @@ -41,6 +41,7 @@ import {useTitle} from '@vueuse/core' import Message from '@/components/misc/message.vue' import {LOGO_VISIBLE} from '@/store/mutation-types' +import {LIST_VIEWS, type ListView} from '@/types/ListView' const {t} = useI18n({useScope: 'global'}) useTitle(t('sharing.authenticating')) @@ -80,13 +81,10 @@ function useAuth() { : true store.commit(LOGO_VISIBLE, logoVisible) - let view = 'list' - if (route.query.view && - (route.query.view === 'gantt' || - route.query.view === 'kanban' || - route.query.view === 'table')) { - view = route.query.view - } + const view = route.query.view && Object.values(LIST_VIEWS).includes(route.query.view as ListView) + ? route.query.view + : 'list' + router.push({name: `list.${view}`, params: {listId}}) } catch (e: any) { if (e.response?.data?.code === 13001) { From 5f678e2449529758cd6ade233c52a0c091889fd9 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 8 Sep 2022 16:26:51 +0200 Subject: [PATCH 05/10] chore: remove unused id --- src/components/sharing/linkSharing.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/sharing/linkSharing.vue b/src/components/sharing/linkSharing.vue index 2143b15b3..abec02a38 100644 --- a/src/components/sharing/linkSharing.vue +++ b/src/components/sharing/linkSharing.vue @@ -144,7 +144,7 @@
- From 26d02d5593283c3ad2fb961348ba2f412cc9eaa8 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 8 Sep 2022 16:29:29 +0200 Subject: [PATCH 06/10] feat: programmatically generate list of available views --- src/components/sharing/linkSharing.vue | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/components/sharing/linkSharing.vue b/src/components/sharing/linkSharing.vue index abec02a38..5fede63a8 100644 --- a/src/components/sharing/linkSharing.vue +++ b/src/components/sharing/linkSharing.vue @@ -145,17 +145,11 @@
@@ -234,6 +228,8 @@ type SelectedViewMapper = Record const selectedView = ref({}) +const availableViews = computed(() => Object.values(LIST_VIEWS)) + const copy = useCopyToClipboard() watch( () => props.listId, From e67fc7fb7e1678b1b691fee77d3237b222ad50c6 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 13 Sep 2022 22:04:24 +0200 Subject: [PATCH 07/10] fix: use proper computed for available views list --- src/components/sharing/linkSharing.vue | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/sharing/linkSharing.vue b/src/components/sharing/linkSharing.vue index 5fede63a8..47ef4968e 100644 --- a/src/components/sharing/linkSharing.vue +++ b/src/components/sharing/linkSharing.vue @@ -146,10 +146,10 @@
@@ -228,7 +228,12 @@ type SelectedViewMapper = Record const selectedView = ref({}) -const availableViews = computed(() => Object.values(LIST_VIEWS)) +const availableViews = computed>(() => ({ + list: t('list.list.title'), + gantt: t('list.gantt.title'), + table: t('list.table.title'), + kanban: t('list.kanban.title'), +})) const copy = useCopyToClipboard() watch( From 7e7fa807fd1c6a34c5236cca4fb20141ca9d0454 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 14 Sep 2022 16:17:31 +0200 Subject: [PATCH 08/10] chore: set more expressive variable names for available views dropdowns --- src/components/sharing/linkSharing.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/sharing/linkSharing.vue b/src/components/sharing/linkSharing.vue index f6ee0d267..9395ef5a2 100644 --- a/src/components/sharing/linkSharing.vue +++ b/src/components/sharing/linkSharing.vue @@ -146,10 +146,10 @@
From 224cea33ced403f45c7d833ab576be44c89d199a Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 14 Sep 2022 16:27:57 +0200 Subject: [PATCH 09/10] feat: make share link name italic --- src/components/sharing/linkSharing.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/sharing/linkSharing.vue b/src/components/sharing/linkSharing.vue index 9395ef5a2..a520203dd 100644 --- a/src/components/sharing/linkSharing.vue +++ b/src/components/sharing/linkSharing.vue @@ -111,7 +111,7 @@
-

+

{{ s.name }}

From 6576b6148ce1b02dbe6a335778592c4b72e275de Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 14 Sep 2022 16:31:05 +0200 Subject: [PATCH 10/10] feat: move the url link to the bottom of the items --- src/components/sharing/linkSharing.vue | 52 ++++++++++++-------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/src/components/sharing/linkSharing.vue b/src/components/sharing/linkSharing.vue index a520203dd..e0b3baded 100644 --- a/src/components/sharing/linkSharing.vue +++ b/src/components/sharing/linkSharing.vue @@ -79,7 +79,6 @@ > - {{ $t('list.share.attributes.link') }} {{ $t('list.share.links.view') }} {{ $t('list.share.attributes.delete') }} @@ -88,29 +87,6 @@ -
-
- -
-
- - - - - -
-
- -

{{ s.name }}

@@ -121,7 +97,7 @@

-

+

+ +
+
+ +
+
+ + + + + +
+
@@ -299,9 +297,5 @@ function getShareLink(hash: string, view: ListView = LIST_VIEWS.LIST) { overflow-y: auto } -.rights-item { - white-space: nowrap; -} - @include modal-transition(); \ No newline at end of file