Skip to content

Commit

Permalink
Refine notification center ui
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Wang <[email protected]>
  • Loading branch information
ruibaby committed Sep 22, 2023
1 parent 1fa425e commit 01eeb51
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 26 deletions.
4 changes: 2 additions & 2 deletions console/packages/components/src/icons/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import IconZoomOutLine from "~icons/ri/zoom-out-line";
import IconArrowLeftRightLine from "~icons/ri/arrow-left-right-line";
import IconArrowUpDownLine from "~icons/ri/arrow-up-down-line";
import IconRiUpload2Fill from "~icons/ri/upload-2-fill";
import IconNotification2Line from "~icons/ri/notification-2-line";
import IconNotificationBadgeLine from "~icons/ri/notification-badge-line";

export {
IconDashboard,
Expand Down Expand Up @@ -137,5 +137,5 @@ export {
IconArrowLeftRightLine,
IconArrowUpDownLine,
IconRiUpload2Fill,
IconNotification2Line,
IconNotificationBadgeLine,
};
51 changes: 29 additions & 22 deletions console/src/modules/dashboard/widgets/NotificationWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,29 +45,36 @@ const { data: notifications } = useQuery({
class="h-full w-full"
defer
>
<VEntity
v-for="notification in notifications"
:key="notification.metadata.name"
>
<template #start>
<VEntityField
:title="notification.spec?.title"
:route="{
name: 'UserNotifications',
query: { name: notification.metadata.name },
}"
/>
</template>
<template #end>
<VEntityField>
<template #description>
<span class="truncate text-xs tabular-nums text-gray-500">
{{ relativeTimeTo(notification.metadata.creationTimestamp) }}
</span>
<ul class="box-border h-full w-full divide-y divide-gray-100" role="list">
<li
v-for="notification in notifications"
:key="notification.metadata.name"
>
<VEntity>
<template #start>
<VEntityField
:title="notification.spec?.title"
:route="{
name: 'UserNotifications',
query: { name: notification.metadata.name },
}"
:description="notification.spec?.rawContent"
/>
</template>
<template #end>
<VEntityField>
<template #description>
<span class="truncate text-xs tabular-nums text-gray-500">
{{
relativeTimeTo(notification.metadata.creationTimestamp)
}}
</span>
</template>
</VEntityField>
</template>
</VEntityField>
</template>
</VEntity>
</VEntity>
</li>
</ul>
</OverlayScrollbarsComponent>
</VCard>
</template>
4 changes: 2 additions & 2 deletions console/src/modules/system/users/Notifications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { useUserStore } from "@/stores/user";
import { apiClient } from "@/utils/api-client";
import {
IconNotification2Line,
IconNotificationBadgeLine,
VCard,
VLoading,
VPageHeader,
Expand Down Expand Up @@ -43,7 +43,7 @@ const selectedNotification = computed(() => {
<template>
<VPageHeader title="消息">
<template #icon>
<IconNotification2Line class="mr-2 self-center" />
<IconNotificationBadgeLine class="mr-2 self-center" />
</template>
</VPageHeader>
<div class="m-0 md:m-4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ watch(
>
{{ notification.spec?.title }}
</div>
<div
v-if="notification.spec?.rawContent"
class="truncate text-xs text-gray-600"
>
{{ notification.spec.rawContent }}
</div>
<div class="flex h-7 items-end justify-between">
<div class="text-xs text-gray-600">
{{ relativeTimeTo(notification.metadata.creationTimestamp) }}
Expand Down

0 comments on commit 01eeb51

Please sign in to comment.