mirror of
https://github.com/wgh136/nysoure.git
synced 2025-12-16 15:51:14 +00:00
fix: update NotificationButton styling and integrate useNavigator in NotificationPage
This commit is contained in:
@@ -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={() => {
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|||||||
Reference in New Issue
Block a user