tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
28
pulls
pipelines
add an empty state if no notifications
cozylittle.house
4 months ago
f58771d1
0749602a
+26
-27
2 changed files
expand all
collapse all
unified
split
app
(home-pages)
notifications
NotificationList.tsx
components
ActionBar
Navigation.tsx
+7
app/(home-pages)/notifications/NotificationList.tsx
···
19
19
let { rootEntity } = useReplicache();
20
20
let cardBorderHidden = useEntity(rootEntity, "theme/card-border-hidden")?.data
21
21
.value;
22
22
+
23
23
+
if (notifications.length === 0)
24
24
+
return (
25
25
+
<div className="w-full container italic text-tertiary text-center sm:p-4 p-3">
26
26
+
no notifications yet...
27
27
+
</div>
28
28
+
);
22
29
return (
23
30
<div className="max-w-prose mx-auto w-full">
24
31
<div className={`flex flex-col ${cardBorderHidden ? "gap-6" : "gap-2"}`}>
+19
-27
components/ActionBar/Navigation.tsx
···
26
26
markAsRead,
27
27
} from "app/(home-pages)/notifications/getNotifications";
28
28
import { DotLoader } from "components/utils/DotLoader";
29
29
+
import { NotificationList } from "app/(home-pages)/notifications/NotificationList";
29
30
30
31
export type navPages = "home" | "reader" | "pub" | "discover" | "notifications";
31
32
···
203
204
/>
204
205
}
205
206
>
206
206
-
<div className="flex flex-col gap-5 text-sm">
207
207
-
{isLoading ? (
208
208
-
<div className="flex items-center justify-center gap-1 text-tertiary italic text-sm mt-8">
209
209
-
<span>loading</span>
210
210
-
<DotLoader />
211
211
-
</div>
212
212
-
) : (
213
213
-
notifications?.map((n) => {
214
214
-
if (n.type === "comment") {
215
215
-
n;
216
216
-
return (
217
217
-
<CommentNotification
218
218
-
cardBorderHidden={true}
219
219
-
key={n.id}
220
220
-
{...n}
221
221
-
/>
222
222
-
);
223
223
-
}
224
224
-
})
225
225
-
)}
226
226
-
</div>
227
227
-
<SpeedyLink
228
228
-
className="flex justify-end pt-2 text-sm"
229
229
-
href={"/notifications"}
230
230
-
>
231
231
-
See All
232
232
-
</SpeedyLink>
207
207
+
{isLoading ? (
208
208
+
<div className="flex items-center justify-center gap-1 text-tertiary italic text-sm p-3 sm:p-4">
209
209
+
<span>loading</span>
210
210
+
<DotLoader />
211
211
+
</div>
212
212
+
) : (
213
213
+
<>
214
214
+
<NotificationList notifications={notifications!} />
215
215
+
{notifications && notifications.length > 0 && (
216
216
+
<SpeedyLink
217
217
+
className="flex justify-end pt-2 text-sm"
218
218
+
href={"/notifications"}
219
219
+
>
220
220
+
See All
221
221
+
</SpeedyLink>
222
222
+
)}
223
223
+
</>
224
224
+
)}
233
225
</Popover>
234
226
);
235
227
}