v3: added comment likes, added votes/likes list view, added db migrations mechanism, updated project dependencies
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 42s
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 42s
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 {
|
||||
CommentLikedData,
|
||||
DumpCommentedData,
|
||||
DumpUpvotedData,
|
||||
Notification,
|
||||
@@ -43,7 +44,8 @@ type NotifIconKind =
|
||||
| "dump"
|
||||
| "playlist"
|
||||
| "mention"
|
||||
| "comment";
|
||||
| "comment"
|
||||
| "like";
|
||||
|
||||
function notifIconKind(type: Notification["type"]): NotifIconKind {
|
||||
switch (type) {
|
||||
@@ -61,6 +63,8 @@ function notifIconKind(type: Notification["type"]): NotifIconKind {
|
||||
return "mention";
|
||||
case "dump_commented":
|
||||
return "comment";
|
||||
case "comment_liked":
|
||||
return "like";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +80,12 @@ const FollowSvg = () => (
|
||||
</svg>
|
||||
);
|
||||
|
||||
const HeartSvg = () => (
|
||||
<svg viewBox="0 0 10 10" width="10" height="10" fill="currentColor">
|
||||
<path d="M5 9 C2 6.5 0 5 0 2.8 C0 1.2 1.2 0 2.6 0 C3.6 0 4.5 0.6 5 1.5 C5.5 0.6 6.4 0 7.4 0 C8.8 0 10 1.2 10 2.8 C10 5 8 6.5 5 9 Z" />
|
||||
</svg>
|
||||
);
|
||||
|
||||
function NotifIcon({ type }: { type: Notification["type"] }) {
|
||||
const kind = notifIconKind(type);
|
||||
const glyphs: Record<NotifIconKind, React.ReactNode> = {
|
||||
@@ -85,6 +95,7 @@ function NotifIcon({ type }: { type: Notification["type"] }) {
|
||||
playlist: "📜",
|
||||
mention: "@",
|
||||
comment: "💬",
|
||||
like: <HeartSvg />,
|
||||
};
|
||||
return (
|
||||
<span className={`notif-icon notif-icon--${kind}`}>
|
||||
@@ -110,6 +121,10 @@ function notificationLink(n: Notification): string {
|
||||
return `/dumps/${(data as DumpCommentedData).dumpId}#comment-${
|
||||
(data as DumpCommentedData).commentId
|
||||
}`;
|
||||
case "comment_liked":
|
||||
return `/dumps/${(data as CommentLikedData).dumpId}#comment-${
|
||||
(data as CommentLikedData).commentId
|
||||
}`;
|
||||
case "user_mentioned": {
|
||||
const d = data as UserMentionedData;
|
||||
if (d.contextType === "comment") {
|
||||
@@ -183,6 +198,16 @@ function notificationContent(n: Notification): React.ReactNode {
|
||||
</Trans>
|
||||
);
|
||||
}
|
||||
case "comment_liked": {
|
||||
const d = data as CommentLikedData;
|
||||
return (
|
||||
<Trans>
|
||||
<strong>{d.likerUsername}</strong>
|
||||
{" liked your comment 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