fix: split collaboration request controllers

هذا الالتزام موجود في:
boutmoun123
2026-05-31 17:05:58 +03:00
الأصل 49e132909e
التزام 1973b8b904
10 ملفات معدلة مع 402 إضافات و18 حذوفات

عرض الملف

@@ -1,6 +1,6 @@
"use client";
import { useCallback, useEffect, useRef, useState } from "react";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { NoPermissionState } from "@/components/auth/no-permission-state";
import { useSuperAdminSession } from "@/components/auth/session-context";
@@ -82,6 +82,16 @@ export default function NotificationsPage() {
};
const items = getItems(response) as NotificationItem[];
const health = useMemo(() => {
const missingDeepLink = items.filter((item) => item.resourceType !== "system" && !item.deepLink).length;
const messageLinks = items.filter(
(item) => item.type === "message" && item.deepLink?.startsWith("/chat/conversations/"),
).length;
const postLinks = items.filter(
(item) => ["like", "comment", "reply", "mention"].includes(item.type) && item.deepLink?.startsWith("/posts/"),
).length;
return { missingDeepLink, messageLinks, postLinks };
}, [items]);
if (!canReadNotifications) {
return (
@@ -130,6 +140,9 @@ export default function NotificationsPage() {
<SelectItem value="save">save</SelectItem>
<SelectItem value="share">share</SelectItem>
<SelectItem value="mention">mention</SelectItem>
<SelectItem value="reply">reply</SelectItem>
<SelectItem value="system">system</SelectItem>
<SelectItem value="collaboration_request">collaboration_request</SelectItem>
</SelectContent>
</Select>
<Select value={resourceTypeFilter} onValueChange={setResourceTypeFilter}>
@@ -142,6 +155,7 @@ export default function NotificationsPage() {
<SelectItem value="comment">comment</SelectItem>
<SelectItem value="conversation">conversation</SelectItem>
<SelectItem value="user">user</SelectItem>
<SelectItem value="system">system</SelectItem>
</SelectContent>
</Select>
<Button variant="outline" onClick={applyFilters}>
@@ -150,6 +164,27 @@ export default function NotificationsPage() {
</CardContent>
</Card>
<section className="grid gap-4 md:grid-cols-3">
<Card>
<CardHeader>
<CardTitle>Missing deep links</CardTitle>
</CardHeader>
<CardContent className="text-3xl font-bold text-foreground">{health.missingDeepLink}</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Chat links</CardTitle>
</CardHeader>
<CardContent className="text-3xl font-bold text-foreground">{health.messageLinks}</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Post links</CardTitle>
</CardHeader>
<CardContent className="text-3xl font-bold text-foreground">{health.postLinks}</CardContent>
</Card>
</section>
<Card>
<CardHeader className="flex flex-row items-center justify-between">
<CardTitle>Notifications</CardTitle>