Skip to content

Commit 42abc67

Browse files
authored
fix(notifications): single-line mobile header and improve empty state (frappe#2250)
* fix(notifications): single-line mobile header and improve empty state * fix(style): improve the notification content for mobile view and dark theme
1 parent 8100c67 commit 42abc67

1 file changed

Lines changed: 42 additions & 23 deletions

File tree

frontend/src/pages/Notifications.vue

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<template>
22
<header
3-
class="sticky top-0 z-10 flex flex-col md:flex-row md:items-center justify-between border-b bg-surface-white px-3 py-2.5 sm:px-5"
3+
class="sticky top-0 z-10 flex flex-row items-center justify-between border-b bg-surface-white px-3 py-2.5 sm:px-5"
44
>
5-
<Breadcrumbs :items="breadcrumbs" />
6-
<div class="flex items-center space-x-2">
5+
<div class="flex-1">
6+
<Breadcrumbs :items="breadcrumbs" />
7+
</div>
8+
<div class="flex items-center space-x-2 shrink-0">
79
<Button
810
@click="markAllAsRead.submit"
911
:loading="markAllAsRead.loading"
@@ -18,12 +20,12 @@
1820
/>
1921
</div>
2022
</header>
21-
<div class="w-full md:w-3/4 mx-auto px-5 pt-6 divide-y">
23+
<div class="w-full md:w-3/4 mx-auto px-3 sm:px-5 pt-4 sm:pt-6 divide-y">
2224
<div
2325
v-if="notifications?.length"
2426
v-for="log in notifications"
2527
:key="log.name"
26-
class="flex space-x-2 px-2 py-4"
28+
class="flex space-x-2 sm:space-x-3 px-1 sm:px-2 py-3 sm:py-4"
2729
:class="{
2830
'cursor-pointer': log.link,
2931
'items-center': !showDetails(log) && !isMentionOrComment(log),
@@ -35,15 +37,18 @@
3537
size="xl"
3638
:label="log.from_user_details.full_name"
3739
/>
38-
<div class="space-y-2 w-full">
39-
<div class="flex items-center justify-between">
40-
<div class="flex items-center">
41-
<div class="text-ink-gray-9" v-html="log.subject"></div>
42-
</div>
43-
<div class="flex items-center space-x-2">
44-
<div class="text-sm text-ink-gray-5">
40+
<div class="space-y-1.5 sm:space-y-2 w-full">
41+
<div class="flex items-start sm:items-center justify-between gap-2">
42+
<div class="flex-1 flex flex-row justify-between">
43+
<div
44+
class="text-ink-gray-9 text-sm sm:text-base"
45+
v-html="log.subject"
46+
></div>
47+
<div class="text-xs text-ink-gray-5 whitespace-nowrap">
4548
{{ dayjs(log.creation).fromNow() }}
4649
</div>
50+
</div>
51+
<div class="flex items-center space-x-2 shrink-0">
4752
<Button
4853
variant="ghost"
4954
v-if="!log.read"
@@ -62,23 +67,23 @@
6267
></div>
6368
<div
6469
v-else-if="showDetails(log)"
65-
class="flex items-stretch border border-outline-gray-2 space-x-2 rounded-md"
70+
class="flex flex-col sm:flex-row sm:items-stretch border border-outline-gray-2 sm:space-x-2 rounded-md"
6671
>
6772
<iframe
6873
v-if="
6974
log.document_type == 'LMS Course' &&
7075
log.document_details.video_link
7176
"
7277
:src="`https://www.youtube.com/embed/${log.document_details.video_link}`"
73-
class="rounded-l-md w-72"
78+
class="sm:rounded-l-md rounded-t-md w-full sm:w-72"
7479
/>
7580
<video
7681
v-else-if="
7782
log.document_type == 'LMS Batch' &&
7883
log.document_details.video_link
7984
"
8085
:src="log.document_details.video_link"
81-
class="rounded-l-md w-72"
86+
class="sm:rounded-l-md rounded-t-md w-full sm:w-72"
8287
/>
8388
<div class="p-3">
8489
<div
@@ -90,15 +95,15 @@
9095
: __('New Batch')
9196
}}
9297
</div>
93-
<div class="font-semibold mb-1">
98+
<div class="font-semibold mb-1 text-ink-gray-9">
9499
{{ __(log.document_details.title) }}
95100
</div>
96-
<div class="leading-5">
101+
<div class="leading-5 text-ink-gray-7">
97102
{{ __(log.document_details.short_introduction) }}
98103
</div>
99104
<div
100105
v-if="log.document_details.start_date"
101-
class="flex items-center space-x-2 text-sm mt-5"
106+
class="flex items-center space-x-2 text-sm mt-5 text-ink-gray-7"
102107
>
103108
<Calendar class="size-3 stroke-1.5" />
104109
<span>
@@ -109,7 +114,7 @@
109114
</div>
110115
<div
111116
v-if="log.document_details.start_time"
112-
class="flex items-center space-x-2 text-sm mt-2"
117+
class="flex items-center space-x-2 text-sm mt-2 text-ink-gray-7"
113118
>
114119
<Clock class="size-3 stroke-1.5" />
115120
<span>
@@ -130,7 +135,7 @@
130135
:image="instructor.user_image"
131136
:label="instructor.full_name"
132137
/>
133-
<span class="font-medium text-sm">
138+
<span class="font-medium text-sm text-ink-gray-9">
134139
{{ instructor.full_name }}
135140
</span>
136141
</div>
@@ -139,8 +144,22 @@
139144
</div>
140145
</div>
141146
</div>
142-
<div v-else class="text-ink-gray-5">
143-
{{ __('Nothing to see here.') }}
147+
<div v-else class="flex flex-col items-center justify-center mt-60">
148+
<Bell class="size-10 mx-auto stroke-1 text-ink-gray-5" />
149+
<p class="text-lg font-semibold text-ink-gray-7 mb-2.5">
150+
{{
151+
activeTab === 'Unread'
152+
? __('No unread notifications')
153+
: __('No read notifications')
154+
}}
155+
</p>
156+
<p class="text-p-base w-full md:w-2/5 text-center text-ink-gray-7">
157+
{{
158+
activeTab === 'Unread'
159+
? __("You're all caught up! Check back later for updates.")
160+
: __('Notifications you have read will appear here.')
161+
}}
162+
</p>
144163
</div>
145164
</div>
146165
</template>
@@ -158,7 +177,7 @@ import {
158177
import { sessionStore } from '../stores/session'
159178
import { computed, inject, ref, onMounted, onUnmounted } from 'vue'
160179
import { useRouter } from 'vue-router'
161-
import { Calendar, Clock, X } from 'lucide-vue-next'
180+
import { Bell, Calendar, Clock, X } from 'lucide-vue-next'
162181
import { formatTime } from '@/utils/'
163182
164183
const { brand } = sessionStore()

0 commit comments

Comments
 (0)