...llo this is the content of a post or whatever here it comes{" "}
@celine and here it
diff --git a/app/(home-pages)/notifications/Notification.tsx b/app/(home-pages)/notifications/Notification.tsx
index 5ca9d9ef..a20f27bb 100644
--- a/app/(home-pages)/notifications/Notification.tsx
+++ b/app/(home-pages)/notifications/Notification.tsx
@@ -1,6 +1,10 @@
import { Avatar } from "components/Avatar";
import { BaseTextBlock } from "app/lish/[did]/[publication]/[rkey]/BaseTextBlock";
-import { PubLeafletRichtextFacet } from "lexicons/api";
+import {
+ PubLeafletDocument,
+ PubLeafletPublication,
+ PubLeafletRichtextFacet,
+} from "lexicons/api";
export const Notification = (props: {
icon: React.ReactNode;
@@ -26,6 +30,7 @@ export const Notification = (props: {
export const ContentLayout = (props: {
children: React.ReactNode;
postTitle: string;
+ publication: PubLeafletPublication.Record;
}) => {
return (
@@ -36,8 +41,7 @@ export const ContentLayout = (props: {
-
- Pub Name Here
+ {props.publication.name}
);
diff --git a/app/(home-pages)/notifications/NotificationList.tsx b/app/(home-pages)/notifications/NotificationList.tsx
new file mode 100644
index 00000000..8c22f80a
--- /dev/null
+++ b/app/(home-pages)/notifications/NotificationList.tsx
@@ -0,0 +1,36 @@
+"use client";
+
+import { HydratedNotification } from "src/notifications";
+import { CommentNotification } from "./CommentNotication";
+import { useEntity, useReplicache } from "src/replicache";
+import { useEffect } from "react";
+import { markAsRead } from "./getNotifications";
+
+export function NotificationList({
+ notifications,
+}: {
+ notifications: HydratedNotification[];
+}) {
+ useEffect(() => {
+ setTimeout(() => {
+ markAsRead();
+ }, 500);
+ }, []);
+ let { rootEntity } = useReplicache();
+
+ let showPageBackground = !useEntity(rootEntity, "theme/card-border-hidden")
+ ?.data.value;
+
+ return (
+
+
+ {notifications.map((n) => {
+ if (n.type === "comment") {
+ n;
+ return ;
+ }
+ })}
+
+
+ );
+}
diff --git a/app/(home-pages)/notifications/ReplyNotification.tsx b/app/(home-pages)/notifications/ReplyNotification.tsx
index f272905e..dd806220 100644
--- a/app/(home-pages)/notifications/ReplyNotification.tsx
+++ b/app/(home-pages)/notifications/ReplyNotification.tsx
@@ -13,7 +13,10 @@ export const DummyReplyNotification = () => {
icon={
}
actionText={<>jared replied to your comment>}
content={
-
+
{
.select("*")
.eq("recipient", identity.atp_did);
let notifications = await hydrateNotifications(data || []);
- return (
-
-
- {notifications.map((n) => {
- if (n.type === "comment") {
- n;
- return ;
- }
- })}
-
-
- );
+ return ;
};
diff --git a/components/ActionBar/Navigation.tsx b/components/ActionBar/Navigation.tsx
index b1c0b245..5f8b8a50 100644
--- a/components/ActionBar/Navigation.tsx
+++ b/components/ActionBar/Navigation.tsx
@@ -33,6 +33,12 @@ import {
DummyPostMentionNotification,
DummyUserMentionNotification,
} from "app/(home-pages)/notifications/MentionNotification";
+import useSWR from "swr";
+import {
+ getNotifications,
+ markAsRead,
+} from "app/(home-pages)/notifications/getNotifications";
+import { DotLoader } from "components/utils/DotLoader";
export type navPages = "home" | "reader" | "pub" | "discover" | "notifications";
@@ -40,11 +46,14 @@ export const DesktopNavigation = (props: {
currentPage: navPages;
publication?: string;
}) => {
+ let { identity } = useIdentityData();
return (
-
-
-
+ {identity?.atp_did && (
+
+
+
+ )}
-
-
+ {identity?.atp_did && (
+ <>
+
+
+ >
+ )}
);
};
@@ -161,8 +174,12 @@ const DiscoverButton = (props: { current?: boolean }) => {
};
export function NotificationButton(props: { current?: boolean }) {
- let unreads = true;
+ let { identity, mutate } = useIdentityData();
+ let unreads = identity?.notifications[0]?.count;
let isMobile = useIsMobile();
+ let { data: notifications, isLoading } = useSWR("notifications", () =>
+ getNotifications(3),
+ );
// let identity = await getIdentityData();
// if (!identity?.atp_did) return;
// let { data } = await supabaseServerClient
@@ -173,6 +190,13 @@ export function NotificationButton(props: { current?: boolean }) {
return (
{
+ if (open) {
+ console.log(open);
+ await markAsRead();
+ mutate();
+ }
+ }}
asChild
side={isMobile ? "top" : "right"}
align={isMobile ? "center" : "start"}
@@ -194,11 +218,19 @@ export function NotificationButton(props: { current?: boolean }) {
}
>
-
-
-
-
-
+ {isLoading ? (
+
+ loading
+
+
+ ) : (
+ notifications?.map((n) => {
+ if (n.type === "comment") {
+ n;
+ return
;
+ }
+ })
+ )}
> {
// Call all hydrators in parallel
const [commentNotifications, subscribeNotifications] = await Promise.all([
hydrateCommentNotifications(notifications),
@@ -56,7 +61,9 @@ async function hydrateCommentNotifications(notifications: NotificationRow[]) {
const commentUris = commentNotifications.map((n) => n.data.comment_uri);
const { data: comments } = await supabaseServerClient
.from("comments_on_documents")
- .select("*,bsky_profiles(*), documents(*)")
+ .select(
+ "*,bsky_profiles(*), documents(*, documents_in_publications(publications(*)))",
+ )
.in("uri", commentUris);
return commentNotifications.map((notification) => ({