feat: notifications UI

minimal, but just works (tm)
This commit is contained in:
zkldi
2022-11-10 00:22:43 +00:00
parent 8d5dbe2ef3
commit 09c84c71a2
10 changed files with 188 additions and 66 deletions
@@ -0,0 +1,36 @@
import TimestampCell from "components/tables/cells/TimestampCell";
import Icon from "components/util/Icon";
import React from "react";
import { Link } from "react-router-dom";
import { NotificationDocument } from "tachi-common";
export default function NotificationRow({ notif }: { notif: NotificationDocument }) {
return (
<tr>
<td>
{notif.read ? (
<Icon type="envelope" regular colour="muted" />
) : (
<Icon type="envelope-open" />
)}
</td>
<td>
<strong>
<Link className="gentle-link" to={NotifToURL(notif)}>
{notif.title}
</Link>
</strong>
</td>
<TimestampCell time={notif.sentAt} />
</tr>
);
}
function NotifToURL(notif: NotificationDocument) {
switch (notif.body.type) {
case "QUEST_CHANGED":
return "/idkyet";
case "RIVALED_BY":
return `/dashboard/users/${notif.body.content.userID}/games${notif.body.content.game}/${notif.body.content.playtype}`;
}
}