From 63e2e5fdad93a2216eaec77f3aad50f78dc86d80 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Mon, 15 Jan 2024 17:25:03 +0100 Subject: [PATCH 01/19] `NotificationActions`: update CSS to be responsive --- .../Notifications/NotificationActions.vue | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/client/src/components/Notifications/NotificationActions.vue b/client/src/components/Notifications/NotificationActions.vue index 438fafec1712..d574b5ab1796 100644 --- a/client/src/components/Notifications/NotificationActions.vue +++ b/client/src/components/Notifications/NotificationActions.vue @@ -2,7 +2,7 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faHourglassHalf } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; -import { BButton, BCol, BInputGroup, BRow } from "bootstrap-vue"; +import { BButton, BInputGroup } from "bootstrap-vue"; import { formatDistanceToNow, parseISO } from "date-fns"; import type { UserNotification } from "@/api/notifications"; @@ -34,9 +34,10 @@ function getNotificationExpirationTitle(notification: UserNotification) { + + From ec73d08f005acf6d0a92631c5055b75f4ba11006 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Mon, 15 Jan 2024 17:29:17 +0100 Subject: [PATCH 02/19] `SharedItemNotification`: update CSS to be responsive --- .../Categories/SharedItemNotification.vue | 47 +++++++++++++++---- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/client/src/components/Notifications/Categories/SharedItemNotification.vue b/client/src/components/Notifications/Categories/SharedItemNotification.vue index 8b1ba9495bc6..9b52f9b8a05c 100644 --- a/client/src/components/Notifications/Categories/SharedItemNotification.vue +++ b/client/src/components/Notifications/Categories/SharedItemNotification.vue @@ -2,14 +2,13 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faExternalLinkAlt, faRetweet } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; -import { BCol, BLink, BRow } from "bootstrap-vue"; +import { BLink } from "bootstrap-vue"; import { computed } from "vue"; import type { SharedItemNotification } from "@/api/notifications"; import { useNotificationsStore } from "@/stores/notificationsStore"; import { absPath } from "@/utils/redirect"; -import Heading from "@/components/Common/Heading.vue"; import NotificationActions from "@/components/Notifications/NotificationActions.vue"; library.add(faExternalLinkAlt, faRetweet); @@ -54,15 +53,19 @@ function markNotificationAsSeen() { + + From b96ef4be5d008e815ab2da10e9c59ae2ab532b09 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Mon, 15 Jan 2024 17:29:35 +0100 Subject: [PATCH 03/19] `MessageNotification`: update CSS to be responsive --- .../Categories/MessageNotification.vue | 46 +++++++++++++++---- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/client/src/components/Notifications/Categories/MessageNotification.vue b/client/src/components/Notifications/Categories/MessageNotification.vue index ca62f44d8511..18eaae5af8ee 100644 --- a/client/src/components/Notifications/Categories/MessageNotification.vue +++ b/client/src/components/Notifications/Categories/MessageNotification.vue @@ -2,13 +2,11 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faInbox } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; -import { BCol, BRow } from "bootstrap-vue"; import { computed } from "vue"; import { type MessageNotification } from "@/api/notifications"; import { useMarkdown } from "@/composables/markdown"; -import Heading from "@/components/Common/Heading.vue"; import NotificationActions from "@/components/Notifications/NotificationActions.vue"; library.add(faInbox); @@ -42,16 +40,44 @@ const notificationVariant = computed(() => { + + From c6736dcb2a278b01f0286c0b810c670d8013a075 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Mon, 15 Jan 2024 17:40:09 +0100 Subject: [PATCH 04/19] `NotificationsList`: update CSS --- .../Notifications/NotificationsList.vue | 55 +++++++++++-------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/client/src/components/Notifications/NotificationsList.vue b/client/src/components/Notifications/NotificationsList.vue index 978c8e253349..f4a59e8e0dff 100644 --- a/client/src/components/Notifications/NotificationsList.vue +++ b/client/src/components/Notifications/NotificationsList.vue @@ -144,29 +144,23 @@ function togglePreferences() { No matching notifications with current filters. - - +
- - - - - - - - - - + + + + + + + +
@@ -175,9 +169,26 @@ function togglePreferences() { From fdd498f2464d35641f07002f4270e8d608338374 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Mon, 15 Jan 2024 17:41:38 +0100 Subject: [PATCH 06/19] add `NotificationsBox` to `ActivityBar` --- client/src/components/ActivityBar/ActivityBar.vue | 9 ++++++--- .../components/ActivityBar/Items/NotificationItem.vue | 2 -- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/client/src/components/ActivityBar/ActivityBar.vue b/client/src/components/ActivityBar/ActivityBar.vue index 9dc3cf03f173..0625ab342b13 100644 --- a/client/src/components/ActivityBar/ActivityBar.vue +++ b/client/src/components/ActivityBar/ActivityBar.vue @@ -17,6 +17,7 @@ import NotificationItem from "./Items/NotificationItem.vue"; import UploadItem from "./Items/UploadItem.vue"; import ContextMenu from "@/components/Common/ContextMenu.vue"; import FlexPanel from "@/components/Panels/FlexPanel.vue"; +import NotificationsBox from "@/components/Panels/NotificationsBox.vue"; import ToolPanel from "@/components/Panels/ToolPanel.vue"; import WorkflowBox from "@/components/Panels/WorkflowBox.vue"; @@ -196,10 +197,9 @@ function toggleContextMenu(evt: MouseEvent) { v-if="!isAnonymous && isConfigLoaded && config.enable_notification_system" id="activity-notifications" icon="bell" - :is-active="isActiveRoute('/user/notifications')" + :is-active="isActiveSideBar('notifications')" title="Notifications" - to="/user/notifications" - @click="onToggleSidebar()" /> + @click="onToggleSidebar('notifications')" /> + + + diff --git a/client/src/components/ActivityBar/Items/NotificationItem.vue b/client/src/components/ActivityBar/Items/NotificationItem.vue index 1e2f6fd1b65e..84e5a05bceda 100644 --- a/client/src/components/ActivityBar/Items/NotificationItem.vue +++ b/client/src/components/ActivityBar/Items/NotificationItem.vue @@ -13,7 +13,6 @@ export interface Props { title: string; icon: string; isActive: boolean; - to: string; } defineProps(); @@ -37,6 +36,5 @@ const tooltip = computed(() => :is-active="isActive" :title="title" :tooltip="tooltip" - :to="to" @click="emit('click')" /> From d925c56ae94638b60741f49bf10578c239b38553 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Mon, 22 Jan 2024 16:20:04 +0100 Subject: [PATCH 07/19] create `ActivityPanel` component for consistent ui --- .../src/components/Panels/ActivityPanel.vue | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 client/src/components/Panels/ActivityPanel.vue diff --git a/client/src/components/Panels/ActivityPanel.vue b/client/src/components/Panels/ActivityPanel.vue new file mode 100644 index 000000000000..47480ba91d62 --- /dev/null +++ b/client/src/components/Panels/ActivityPanel.vue @@ -0,0 +1,74 @@ + + + + + From f99488e322eb6f78a617fa739e57947735fb2199 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Mon, 22 Jan 2024 16:25:06 +0100 Subject: [PATCH 08/19] add `card-container` class to `ui.scss` base style --- client/src/style/scss/ui.scss | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/src/style/scss/ui.scss b/client/src/style/scss/ui.scss index 30f090bd5ac2..35501d175c55 100644 --- a/client/src/style/scss/ui.scss +++ b/client/src/style/scss/ui.scss @@ -458,3 +458,10 @@ $ui-margin-horizontal-large: $margin-v * 2; color: $brand-light; } } + +.card-container { + padding: 0.7rem; + margin-bottom: 0.5rem; + border-radius: 0.5rem; + border: 0.1rem solid $brand-secondary; +} From e70f190f5d6ebcc61f8a4d5344ecd76b66e0ef54 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Mon, 22 Jan 2024 16:30:26 +0100 Subject: [PATCH 09/19] rename `NotificationItem` to `NotificationCard` and add checkbox --- .../Notifications/NotificationCard.vue | 60 +++++++++++++++++++ .../Notifications/NotificationItem.vue | 18 ------ 2 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 client/src/components/Notifications/NotificationCard.vue delete mode 100644 client/src/components/Notifications/NotificationItem.vue diff --git a/client/src/components/Notifications/NotificationCard.vue b/client/src/components/Notifications/NotificationCard.vue new file mode 100644 index 000000000000..99dc1da69a6d --- /dev/null +++ b/client/src/components/Notifications/NotificationCard.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/client/src/components/Notifications/NotificationItem.vue b/client/src/components/Notifications/NotificationItem.vue deleted file mode 100644 index bf05199476ae..000000000000 --- a/client/src/components/Notifications/NotificationItem.vue +++ /dev/null @@ -1,18 +0,0 @@ - - - From 3def865391d9ec67f7d074ed769885a986ad9a87 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Mon, 22 Jan 2024 16:26:58 +0100 Subject: [PATCH 10/19] `NotificationsPanel`: update `ActivityPanel` and `NotificationCard` --- .../components/ActivityBar/ActivityBar.vue | 4 +- ...icationsBox.vue => NotificationsPanel.vue} | 79 +++++++++---------- 2 files changed, 38 insertions(+), 45 deletions(-) rename client/src/components/Panels/{NotificationsBox.vue => NotificationsPanel.vue} (51%) diff --git a/client/src/components/ActivityBar/ActivityBar.vue b/client/src/components/ActivityBar/ActivityBar.vue index 0625ab342b13..cb39b997a593 100644 --- a/client/src/components/ActivityBar/ActivityBar.vue +++ b/client/src/components/ActivityBar/ActivityBar.vue @@ -17,7 +17,7 @@ import NotificationItem from "./Items/NotificationItem.vue"; import UploadItem from "./Items/UploadItem.vue"; import ContextMenu from "@/components/Common/ContextMenu.vue"; import FlexPanel from "@/components/Panels/FlexPanel.vue"; -import NotificationsBox from "@/components/Panels/NotificationsBox.vue"; +import NotificationsPanel from "@/components/Panels/NotificationsPanel.vue"; import ToolPanel from "@/components/Panels/ToolPanel.vue"; import WorkflowBox from "@/components/Panels/WorkflowBox.vue"; @@ -217,7 +217,7 @@ function toggleContextMenu(evt: MouseEvent) { - + diff --git a/client/src/components/Panels/NotificationsBox.vue b/client/src/components/Panels/NotificationsPanel.vue similarity index 51% rename from client/src/components/Panels/NotificationsBox.vue rename to client/src/components/Panels/NotificationsPanel.vue index f567a375186b..b0c0bd61cbe1 100644 --- a/client/src/components/Panels/NotificationsBox.vue +++ b/client/src/components/Panels/NotificationsPanel.vue @@ -11,7 +11,8 @@ import { useConfirmDialog } from "@/composables/confirmDialog"; import { useNotificationsStore } from "@/stores/notificationsStore"; import LoadingSpan from "@/components/LoadingSpan.vue"; -import NotificationItem from "@/components/Notifications/NotificationItem.vue"; +import NotificationCard from "@/components/Notifications/NotificationCard.vue"; +import ActivityPanel from "@/components/Panels/ActivityPanel.vue"; library.add(faCheckDouble); @@ -44,57 +45,49 @@ function goToAllNotifications() { From da340fc03c978f7f360245fbe8a7fdff7f1f541c Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Mon, 22 Jan 2024 16:33:38 +0100 Subject: [PATCH 13/19] update `MessageNotification` ui --- .../Notifications/Categories/MessageNotification.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/components/Notifications/Categories/MessageNotification.vue b/client/src/components/Notifications/Categories/MessageNotification.vue index 18eaae5af8ee..9b6dcdfe1725 100644 --- a/client/src/components/Notifications/Categories/MessageNotification.vue +++ b/client/src/components/Notifications/Categories/MessageNotification.vue @@ -45,7 +45,7 @@ const notificationVariant = computed(() => {
- + {{ props.options.notification?.content?.subject }}
@@ -67,6 +67,9 @@ const notificationVariant = computed(() => { .message-notification-title { font-size: 1rem; + display: flex; + gap: 0.2rem; + align-items: center; } @container message-notification (min-width: 576px) { From 38f13cca0815b4f1cd5fac7e9cc02ae163769f9a Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Mon, 22 Jan 2024 16:34:55 +0100 Subject: [PATCH 14/19] update `NotificationPreferences` ui --- .../NotificationsPreferences.vue | 218 +++++++++++------- 1 file changed, 131 insertions(+), 87 deletions(-) diff --git a/client/src/components/User/Notifications/NotificationsPreferences.vue b/client/src/components/User/Notifications/NotificationsPreferences.vue index deda784f691b..5d6f0c3ca017 100644 --- a/client/src/components/User/Notifications/NotificationsPreferences.vue +++ b/client/src/components/User/Notifications/NotificationsPreferences.vue @@ -2,7 +2,7 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faExclamationCircle } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; -import { BAlert, BButton, BCard, BCol, BFormCheckbox, BRow } from "bootstrap-vue"; +import { BAlert, BButton, BFormCheckbox } from "bootstrap-vue"; import { computed, ref, watch } from "vue"; import { @@ -19,15 +19,19 @@ import { } from "@/composables/utils/pushNotifications"; import AsyncButton from "@/components/Common/AsyncButton.vue"; +import Heading from "@/components/Common/Heading.vue"; import LoadingSpan from "@/components/LoadingSpan.vue"; library.add(faExclamationCircle); -defineProps({ - headerSize: { - type: String, - default: "h-lg", - }, +interface NotificationsPreferencesProps { + embedded?: boolean; + headerSize?: string; +} + +const props = withDefaults(defineProps(), { + embedded: true, + headerSize: "h-lg", }); const { config } = useConfig(true); @@ -96,12 +100,23 @@ watch( diff --git a/client/src/components/Notifications/NotificationsList.test.ts b/client/src/components/Notifications/NotificationsList.test.ts index 4df924464e02..7c8d54a91ecb 100644 --- a/client/src/components/Notifications/NotificationsList.test.ts +++ b/client/src/components/Notifications/NotificationsList.test.ts @@ -1,6 +1,6 @@ import { createTestingPinia } from "@pinia/testing"; import { getLocalVue } from "@tests/jest/helpers"; -import { shallowMount } from "@vue/test-utils"; +import { mount } from "@vue/test-utils"; import flushPromises from "flush-promises"; import { setActivePinia } from "pinia"; @@ -22,9 +22,12 @@ async function mountNotificationsList() { const notificationsStore = useNotificationsStore(pinia); notificationsStore.notifications = mergeObjectListsById(FAKE_NOTIFICATIONS, []); - const wrapper = shallowMount(NotificationsList, { + const wrapper = mount(NotificationsList, { localVue, pinia, + stubs: { + FontAwesomeIcon: true, + }, }); await flushPromises(); @@ -34,9 +37,10 @@ async function mountNotificationsList() { describe("NotificationsList", () => { it("render and count unread notifications", async () => { const wrapper = await mountNotificationsList(); + expect(wrapper.findAll(".notification-card")).toHaveLength(messageCount + sharedItemCount); - const unreadNotification = wrapper.findAll(".unread-status"); + const unreadNotification = wrapper.findAll(".unread-notification"); expect(unreadNotification).toHaveLength(FAKE_NOTIFICATIONS.filter((n) => !n.seen_time).length); }); From 5b5635db209b738fe8d7852de3edece6f14b02b7 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Tue, 23 Jan 2024 16:03:20 +0100 Subject: [PATCH 17/19] create `style.scss` using css grid for notification content --- .../Notifications/Categories/style.scss | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 client/src/components/Notifications/Categories/style.scss diff --git a/client/src/components/Notifications/Categories/style.scss b/client/src/components/Notifications/Categories/style.scss new file mode 100644 index 000000000000..d00b1c48a8bd --- /dev/null +++ b/client/src/components/Notifications/Categories/style.scss @@ -0,0 +1,39 @@ +.notification-container { + container: notification-content / inline-size; + + width: 100%; + display: grid; + align-items: center; + grid-template-rows: auto auto auto; + + .notification-title { + display: flex; + gap: 0.2rem; + font-size: 1rem; + flex-flow: wrap; + align-items: center; + } + + @container notification-content (min-width: 576px) { + .notification-header { + .notification-title { + font-size: 1.25rem; + } + } + + .notification-actions { + grid-area: 1/2; + justify-self: end; + } + + .notification-message { + grid-column: 1/3; + } + } + + @container notification-content (max-width: 576px) { + .notification-message { + margin-bottom: 0.5rem; + } + } +} From 80b0cd5946563acb7f209229ec56b866c3c6d0a2 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Tue, 23 Jan 2024 16:04:00 +0100 Subject: [PATCH 18/19] update notification categories with new style file --- .../Categories/Categories.test.ts | 7 +- .../Categories/MessageNotification.vue | 49 ++++-------- .../Categories/SharedItemNotification.vue | 76 +++++++------------ .../Notifications/NotificationActions.vue | 4 +- 4 files changed, 46 insertions(+), 90 deletions(-) diff --git a/client/src/components/Notifications/Categories/Categories.test.ts b/client/src/components/Notifications/Categories/Categories.test.ts index f471dbaa6149..1e3664fe8375 100644 --- a/client/src/components/Notifications/Categories/Categories.test.ts +++ b/client/src/components/Notifications/Categories/Categories.test.ts @@ -52,11 +52,8 @@ describe("Notifications categories", () => { notification, }); - expect(wrapper.text()).toContain( - `${capitalizeFirstLetter(notification.content.item_type)} shared with you by ${ - notification.content.owner_name - }` - ); + expect(wrapper.text()).toContain(`${capitalizeFirstLetter(notification.content.item_type)}`); + expect(wrapper.text()).toContain(`shared with you by ${notification.content.owner_name}`); expect(wrapper.find("#notification-message").text()).toContain( `The user ${notification.content.owner_name} shared` diff --git a/client/src/components/Notifications/Categories/MessageNotification.vue b/client/src/components/Notifications/Categories/MessageNotification.vue index 9b6dcdfe1725..b313b961454b 100644 --- a/client/src/components/Notifications/Categories/MessageNotification.vue +++ b/client/src/components/Notifications/Categories/MessageNotification.vue @@ -40,47 +40,26 @@ const notificationVariant = computed(() => { diff --git a/client/src/components/Notifications/Categories/SharedItemNotification.vue b/client/src/components/Notifications/Categories/SharedItemNotification.vue index 9b52f9b8a05c..b141c87ed308 100644 --- a/client/src/components/Notifications/Categories/SharedItemNotification.vue +++ b/client/src/components/Notifications/Categories/SharedItemNotification.vue @@ -34,6 +34,7 @@ const sharedItemType = computed(() => { return "Item"; } }); + const notificationVariant = computed(() => { switch (props.notification.variant) { case "urgent": @@ -53,60 +54,37 @@ function markNotificationAsSeen() { diff --git a/client/src/components/Notifications/NotificationActions.vue b/client/src/components/Notifications/NotificationActions.vue index dd6251cadfc7..ebcd9a469893 100644 --- a/client/src/components/Notifications/NotificationActions.vue +++ b/client/src/components/Notifications/NotificationActions.vue @@ -75,7 +75,9 @@ function getNotificationExpirationTitle(notification: UserNotification) {