v3: correctly using SITE_NAME across the app, added notifications on comments
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 44s
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 44s
This commit is contained in:
@@ -10,6 +10,7 @@ import { ErrorCard } from "../components/ErrorCard.tsx";
|
||||
import { Tooltip } from "../components/Tooltip.tsx";
|
||||
import { useWS } from "../hooks/useWS.ts";
|
||||
import type {
|
||||
DumpCommentedData,
|
||||
DumpUpvotedData,
|
||||
Notification,
|
||||
NotificationData,
|
||||
@@ -36,7 +37,13 @@ type State =
|
||||
loadingMore: boolean;
|
||||
};
|
||||
|
||||
type NotifIconKind = "upvote" | "follow" | "dump" | "playlist" | "mention";
|
||||
type NotifIconKind =
|
||||
| "upvote"
|
||||
| "follow"
|
||||
| "dump"
|
||||
| "playlist"
|
||||
| "mention"
|
||||
| "comment";
|
||||
|
||||
function notifIconKind(type: Notification["type"]): NotifIconKind {
|
||||
switch (type) {
|
||||
@@ -52,6 +59,8 @@ function notifIconKind(type: Notification["type"]): NotifIconKind {
|
||||
return "playlist";
|
||||
case "user_mentioned":
|
||||
return "mention";
|
||||
case "dump_commented":
|
||||
return "comment";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +84,7 @@ function NotifIcon({ type }: { type: Notification["type"] }) {
|
||||
dump: "🚚",
|
||||
playlist: "📜",
|
||||
mention: "@",
|
||||
comment: "💬",
|
||||
};
|
||||
return (
|
||||
<span className={`notif-icon notif-icon--${kind}`}>
|
||||
@@ -96,6 +106,10 @@ function notificationLink(n: Notification): string {
|
||||
return `/dumps/${(data as PlaylistDumpAddedData).dumpId}`;
|
||||
case "dump_upvoted":
|
||||
return `/dumps/${(data as DumpUpvotedData).dumpId}`;
|
||||
case "dump_commented":
|
||||
return `/dumps/${(data as DumpCommentedData).dumpId}#comment-${
|
||||
(data as DumpCommentedData).commentId
|
||||
}`;
|
||||
case "user_mentioned": {
|
||||
const d = data as UserMentionedData;
|
||||
if (d.contextType === "comment") {
|
||||
@@ -159,6 +173,16 @@ function notificationContent(n: Notification): React.ReactNode {
|
||||
</Trans>
|
||||
);
|
||||
}
|
||||
case "dump_commented": {
|
||||
const d = data as DumpCommentedData;
|
||||
return (
|
||||
<Trans>
|
||||
<strong>{d.commenterUsername}</strong>
|
||||
{" commented on "}
|
||||
<strong>{d.dumpTitle}</strong>
|
||||
</Trans>
|
||||
);
|
||||
}
|
||||
case "user_mentioned": {
|
||||
const d = data as UserMentionedData;
|
||||
const where = d.contextTitle ||
|
||||
|
||||
Reference in New Issue
Block a user