fix: update NotificationButton styling and integrate useNavigator in NotificationPage

This commit is contained in:
2025-11-30 19:49:29 +08:00
parent 96cdd2c41c
commit ae547522ed
2 changed files with 7 additions and 6 deletions

View File

@@ -568,11 +568,9 @@ function NotificationButton() {
return ( return (
<div className="indicator"> <div className="indicator">
{count > 0 && ( {count > 0 && <span className="bg-error text-white text-xs rounded-full px-1 indicator-item">
<span className="indicator-item badge badge-secondary badge-sm"> {count > 99 ? "99+" : count}
{count > 99 ? "99+" : count} </span>}
</span>
)}
<button <button
className="btn btn-ghost btn-circle" className="btn btn-ghost btn-circle"
onClick={() => { onClick={() => {

View File

@@ -11,6 +11,7 @@ import Badge from "../components/badge.tsx";
import Markdown from "react-markdown"; import Markdown from "react-markdown";
import { ErrorAlert } from "../components/alert.tsx"; import { ErrorAlert } from "../components/alert.tsx";
import { app } from "../app.ts"; import { app } from "../app.ts";
import { useNavigator } from "../components/navigator.tsx";
export default function NotificationPage() { export default function NotificationPage() {
const [activities, setActivities] = useState<Activity[]>([]); const [activities, setActivities] = useState<Activity[]>([]);
@@ -18,6 +19,7 @@ export default function NotificationPage() {
const maxPageRef = useRef(1); const maxPageRef = useRef(1);
const isLoadingRef = useRef(false); const isLoadingRef = useRef(false);
const { t } = useTranslation(); const { t } = useTranslation();
const navigator = useNavigator();
const fetchNextPage = useCallback(async () => { const fetchNextPage = useCallback(async () => {
if (isLoadingRef.current || pageRef.current >= maxPageRef.current) return; if (isLoadingRef.current || pageRef.current >= maxPageRef.current) return;
@@ -42,7 +44,8 @@ export default function NotificationPage() {
useEffect(() => { useEffect(() => {
network.resetUserNotificationsCount(); network.resetUserNotificationsCount();
}, []); navigator.refresh();
}, [navigator]);
useEffect(() => { useEffect(() => {
document.title = t("Notifications"); document.title = t("Notifications");