Initial role user app

This commit is contained in:
湛兮
2026-06-02 14:46:39 +08:00
commit 003dc60111
62 changed files with 7835 additions and 0 deletions
@@ -0,0 +1,27 @@
"use client";
import { useRouter } from "next/navigation";
import { useEffect, useRef } from "react";
type AnnouncementReadMarkerProps = {
id: string;
read: boolean;
};
export function AnnouncementReadMarker({ id, read }: AnnouncementReadMarkerProps) {
const router = useRouter();
const sentRef = useRef(false);
useEffect(() => {
if (read || sentRef.current) return;
sentRef.current = true;
void fetch(`/api/mobile/announcements/${encodeURIComponent(id)}/read`, { method: "POST" }).then((response) => {
if (response.ok) {
router.refresh();
}
});
}, [id, read, router]);
return null;
}