notifs style

This commit is contained in:
Martti Malmi 2024-02-02 15:22:38 +02:00
parent 1fd37a42d2
commit 523fd1a0ba
3 changed files with 14 additions and 18 deletions

View File

@ -104,7 +104,17 @@ export function NotificationGroup({
}; };
return ( return (
<div className="card notification-group" ref={ref}> <div
className="card notification-group cursor-pointer hover:bg-nearly-bg-color"
ref={ref}
onClick={() => {
if (!context) return;
if (onClick) {
onClick(context);
} else {
navigate(`/${context.encode(CONFIG.eventLinkPrefix)}`);
}
}}>
{inView && ( {inView && (
<> <>
<div className="flex flex-col g12"> <div className="flex flex-col g12">
@ -137,18 +147,7 @@ export function NotificationGroup({
)} )}
</div> </div>
)} )}
{context && ( {context && <NotificationContext link={context} />}
<NotificationContext
link={context}
onClick={() => {
if (onClick) {
onClick(context);
} else {
navigate(`/${context.encode(CONFIG.eventLinkPrefix)}`);
}
}}
/>
)}
</div> </div>
</> </>
)} )}

View File

@ -32,9 +32,7 @@ export default function NotificationsPage({ onClick }: { onClick?: (link: NostrL
}; };
const myNotifications = useMemo(() => { const myNotifications = useMemo(() => {
return notifications.filter( return notifications.filter(a => !isMuted(a.pubkey) && a.tags.some(b => b[0] === "p" && b[1] === login.publicKey));
a => !isMuted(a.pubkey) && a.tags.some(b => b[0] === "p" && b[1] === login.publicKey),
);
}, [notifications, login.publicKey]); }, [notifications, login.publicKey]);
const timeGrouped = useMemo(() => { const timeGrouped = useMemo(() => {

View File

@ -5,7 +5,7 @@ import { LiveEvent } from "@/Components/LiveStream/LiveEvent";
import Text from "@/Components/Text/Text"; import Text from "@/Components/Text/Text";
import ProfilePreview from "@/Components/User/ProfilePreview"; import ProfilePreview from "@/Components/User/ProfilePreview";
export function NotificationContext({ link, onClick }: { link: NostrLink; onClick: () => void }) { export function NotificationContext({ link }: { link: NostrLink }) {
const ev = useEventFeed(link); const ev = useEventFeed(link);
if (link.type === NostrPrefix.PublicKey) { if (link.type === NostrPrefix.PublicKey) {
return <ProfilePreview pubkey={link.id} actions={<></>} />; return <ProfilePreview pubkey={link.id} actions={<></>} />;
@ -23,7 +23,6 @@ export function NotificationContext({ link, onClick }: { link: NostrLink; onClic
truncate={120} truncate={120}
disableLinkPreview={true} disableLinkPreview={true}
className="content" className="content"
onClick={onClick}
/> />
); );
} }