feature/IO-3096-GlobalNotifications - Checkpoint
This commit is contained in:
@@ -27,7 +27,7 @@ import Icon, {
|
||||
UserOutlined
|
||||
} from "@ant-design/icons";
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
import { Badge, Layout, Menu, Space } from "antd";
|
||||
import { Badge, Layout, Menu, Space, Spin } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { BsKanban } from "react-icons/bs";
|
||||
import { FaCalendarAlt, FaCarCrash, FaCreditCard, FaFileInvoiceDollar, FaTasks } from "react-icons/fa";
|
||||
@@ -50,6 +50,7 @@ import { debounce } from "lodash";
|
||||
import { useQuery } from "@apollo/client";
|
||||
import { GET_UNREAD_COUNT } from "../../graphql/notifications.queries.js";
|
||||
import { NotificationCenterContainer } from "../notification-center/notification-center.container.jsx";
|
||||
import { useSocket } from "../../contexts/SocketIO/socketContext.jsx";
|
||||
|
||||
// Used to Determine if the Header is in Mobile Mode, and to toggle the multiple menus
|
||||
const HEADER_MOBILE_BREAKPOINT = 576;
|
||||
@@ -125,6 +126,57 @@ function Header({
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { isConnected } = useSocket(bodyshop);
|
||||
const [notificationVisible, setNotificationVisible] = useState(false);
|
||||
const [displayCount, setDisplayCount] = useState(0); // Explicit state for badge
|
||||
|
||||
const {
|
||||
data: unreadData,
|
||||
refetch: refetchUnread,
|
||||
loading: unreadLoading
|
||||
} = useQuery(GET_UNREAD_COUNT, {
|
||||
fetchPolicy: "network-only",
|
||||
pollInterval: isConnected ? 0 : 30000 // Poll only if socket is down
|
||||
});
|
||||
|
||||
const unreadCount = unreadData?.notifications_aggregate?.aggregate?.count ?? 0;
|
||||
|
||||
// Update displayCount when unreadCount changes
|
||||
useEffect(() => {
|
||||
console.log("Updating displayCount with unreadCount:", unreadCount);
|
||||
setDisplayCount(unreadCount);
|
||||
}, [unreadCount]);
|
||||
|
||||
// Initial fetch and socket status handling
|
||||
useEffect(() => {
|
||||
console.log("Running initial refetchUnread");
|
||||
refetchUnread();
|
||||
}, [refetchUnread]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isConnected && !unreadLoading) {
|
||||
console.log("Socket disconnected, refetching unread count");
|
||||
refetchUnread();
|
||||
}
|
||||
}, [isConnected, unreadLoading, refetchUnread]);
|
||||
|
||||
// Debug logging
|
||||
useEffect(() => {
|
||||
console.log("Unread Count State:", {
|
||||
unreadCount,
|
||||
displayCount,
|
||||
unreadLoading,
|
||||
isConnected,
|
||||
unreadData: unreadData?.notifications_aggregate,
|
||||
rawUnreadData: unreadData
|
||||
});
|
||||
}, [unreadCount, displayCount, unreadLoading, isConnected, unreadData]);
|
||||
|
||||
const handleNotificationClick = (e) => {
|
||||
setNotificationVisible(!notificationVisible);
|
||||
if (handleMenuClick) handleMenuClick(e);
|
||||
};
|
||||
|
||||
const [isMobile, setIsMobile] = useState(() => {
|
||||
const effectiveWidth = window.innerWidth / (window.devicePixelRatio || 1);
|
||||
return effectiveWidth <= HEADER_MOBILE_BREAKPOINT;
|
||||
@@ -135,39 +187,6 @@ function Header({
|
||||
setIsMobile(effectiveWidth <= HEADER_MOBILE_BREAKPOINT);
|
||||
}, 200);
|
||||
|
||||
const [notificationVisible, setNotificationVisible] = useState(false);
|
||||
|
||||
const {
|
||||
data: unreadData,
|
||||
error: unreadError,
|
||||
refetch: refetchUnread,
|
||||
loading: unreadLoading
|
||||
} = useQuery(GET_UNREAD_COUNT, {
|
||||
fetchPolicy: "network-only", // Force network request for fresh data
|
||||
pollInterval: 30000, // Poll every 30 seconds to ensure updates
|
||||
onError: (err) => {
|
||||
console.error("Error fetching unread count:", err);
|
||||
console.log("Unread data state:", unreadData, "Error details:", err);
|
||||
}
|
||||
});
|
||||
|
||||
const unreadCount = unreadData?.notifications_aggregate?.aggregate?.count || 0;
|
||||
|
||||
// Refetch unread count when the component mounts, updates, or on specific events
|
||||
useEffect(() => {
|
||||
refetchUnread();
|
||||
}, [refetchUnread, bodyshop, currentUser]); // Add dependencies to trigger refetch on user or shop changes
|
||||
|
||||
// Log unread count for debugging
|
||||
useEffect(() => {
|
||||
console.log("Unread count updated:", unreadCount, "Loading:", unreadLoading, "Error:", unreadError);
|
||||
}, [unreadCount, unreadLoading, unreadError]);
|
||||
|
||||
const handleNotificationClick = (e) => {
|
||||
setNotificationVisible(!notificationVisible);
|
||||
if (handleMenuClick) handleMenuClick(e);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener("resize", handleResize);
|
||||
window.addEventListener("orientationchange", handleResize);
|
||||
@@ -688,8 +707,10 @@ function Header({
|
||||
// Right-aligned items on desktop, merged on mobile
|
||||
{
|
||||
key: "notifications",
|
||||
icon: (
|
||||
<Badge count={unreadCount}>
|
||||
icon: unreadLoading ? (
|
||||
<Spin size="small" />
|
||||
) : (
|
||||
<Badge count={displayCount}>
|
||||
<BellFilled />
|
||||
</Badge>
|
||||
),
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
// notification-center.component.jsx
|
||||
import React from "react";
|
||||
import { Virtuoso } from "react-virtuoso";
|
||||
import { Button, Checkbox, List, Badge, Typography, Alert } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import "./notification-center.styles.scss";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
const { Text } = Typography;
|
||||
const { Text, Title } = Typography;
|
||||
|
||||
const NotificationCenterComponent = ({
|
||||
visible,
|
||||
@@ -14,25 +16,35 @@ const NotificationCenterComponent = ({
|
||||
error,
|
||||
showUnreadOnly,
|
||||
toggleUnreadOnly,
|
||||
markAllRead
|
||||
markAllRead,
|
||||
loadMore
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const renderNotification = (index, notification) => {
|
||||
console.log(`Rendering notification ${index}:`, {
|
||||
id: notification.id,
|
||||
scenarioTextLength: notification.scenarioText.length,
|
||||
read: notification.read,
|
||||
created_at: notification.created_at,
|
||||
associationid: notification.associationid
|
||||
});
|
||||
console.log("Rendering notification at index:", index, notification);
|
||||
return (
|
||||
<List.Item
|
||||
key={`${notification.id}-${index}`} // Ensure unique key per render
|
||||
key={`${notification.id}-${index}`}
|
||||
className={notification.read ? "notification-read" : "notification-unread"}
|
||||
>
|
||||
<Badge dot={!notification.read}>
|
||||
<div>
|
||||
{/* RO number as title/link */}
|
||||
<Title
|
||||
level={5}
|
||||
style={{
|
||||
margin: "0 0 8px 0",
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center"
|
||||
}}
|
||||
>
|
||||
<Link to={`/manage/jobs/${notification.jobid}`} target="_blank">
|
||||
RO #{notification.roNumber}
|
||||
</Link>
|
||||
<Text type="secondary">{new Date(notification.created_at).toLocaleString()}</Text>
|
||||
</Title>
|
||||
<Text strong={!notification.read}>
|
||||
<ul>
|
||||
{notification.scenarioText.map((text, idx) => (
|
||||
@@ -40,48 +52,37 @@ const NotificationCenterComponent = ({
|
||||
))}
|
||||
</ul>
|
||||
</Text>
|
||||
<Text type="secondary">{new Date(notification.created_at).toLocaleString()}</Text>
|
||||
{notification.associationid && <Text type="secondary">Association ID: {notification.associationid}</Text>}
|
||||
</div>
|
||||
</Badge>
|
||||
</List.Item>
|
||||
);
|
||||
};
|
||||
|
||||
console.log(
|
||||
"Rendering NotificationCenter with notifications:",
|
||||
notifications.length,
|
||||
notifications.map((n) => ({
|
||||
id: n.id,
|
||||
read: n.read,
|
||||
created_at: n.created_at,
|
||||
associationid: n.associationid
|
||||
}))
|
||||
);
|
||||
console.log("NotificationCenterComponent render:", { notifications, loading, error, showUnreadOnly });
|
||||
|
||||
return (
|
||||
<div className={`notification-center ${visible ? "visible" : ""}`}>
|
||||
<div className="notification-header">
|
||||
<h3>{t("notifications.title", "Notifications")}</h3>
|
||||
<h3>{t("notifications.labels.new-notification-title")}</h3>
|
||||
<div className="notification-controls">
|
||||
<Checkbox checked={showUnreadOnly} onChange={(e) => toggleUnreadOnly(e.target.checked)}>
|
||||
{t("notifications.showUnreadOnly", "Show Unread Only")}
|
||||
{t("notifications.labels.show-unread-only")}
|
||||
</Checkbox>
|
||||
<Button type="link" onClick={markAllRead} disabled={!notifications.some((n) => !n.read)}>
|
||||
{t("notifications.markAllRead", "Mark All Read")}
|
||||
{t("notifications.labels.mark-all-read")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{error && <Alert message="Error" description={error} type="error" closable onClose={() => onClose()} />}
|
||||
<Virtuoso
|
||||
style={{ height: "400px", width: "100%", overflow: "auto" }} // Default Virtuoso styling
|
||||
style={{ height: "400px", width: "100%" }}
|
||||
data={notifications}
|
||||
totalCount={notifications.length}
|
||||
overscan={20}
|
||||
increaseViewportBy={200}
|
||||
overscan={200}
|
||||
endReached={loadMore}
|
||||
itemContent={renderNotification}
|
||||
/>
|
||||
{loading && !error && <div>{t("notifications.loading", "Loading...")}</div>}
|
||||
{loading && !error && <div>{t("notifications.labels.loading")}</div>}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
// notification-center.container.jsx
|
||||
import { useState, useEffect, useCallback } from "react";
|
||||
import { useQuery, useMutation } from "@apollo/client";
|
||||
import { connect } from "react-redux";
|
||||
import NotificationCenterComponent from "./notification-center.component";
|
||||
import { GET_NOTIFICATIONS, MARK_ALL_NOTIFICATIONS_READ } from "../../graphql/notifications.queries";
|
||||
import { useSocket } from "../../contexts/SocketIO/socketContext.jsx";
|
||||
|
||||
export function NotificationCenterContainer({ visible, onClose }) {
|
||||
export function NotificationCenterContainer({ visible, onClose, bodyshop }) {
|
||||
const [showUnreadOnly, setShowUnreadOnly] = useState(false);
|
||||
const [notifications, setNotifications] = useState([]);
|
||||
const [error, setError] = useState(null);
|
||||
const { isConnected } = useSocket();
|
||||
|
||||
const {
|
||||
data,
|
||||
@@ -19,106 +22,115 @@ export function NotificationCenterContainer({ visible, onClose }) {
|
||||
variables: {
|
||||
limit: 20,
|
||||
offset: 0,
|
||||
where: showUnreadOnly ? { read: { _is_null: true } } : {} // Default to all notifications
|
||||
where: showUnreadOnly ? { read: { _is_null: true } } : {}
|
||||
},
|
||||
fetchPolicy: "cache-and-network", // Ensure reactivity to cache updates
|
||||
fetchPolicy: "cache-and-network",
|
||||
notifyOnNetworkStatusChange: true,
|
||||
pollInterval: isConnected ? 0 : 30000,
|
||||
skip: false,
|
||||
onError: (err) => {
|
||||
setError(err.message);
|
||||
console.error("GET_NOTIFICATIONS error:", err);
|
||||
setTimeout(() => refetch(), 2000);
|
||||
},
|
||||
onCompleted: (data) => {
|
||||
console.log("GET_NOTIFICATIONS completed:", data?.notifications);
|
||||
}
|
||||
});
|
||||
|
||||
const [markAllReadMutation, { error: mutationError }] = useMutation(MARK_ALL_NOTIFICATIONS_READ, {
|
||||
update: (cache, { data: mutationData }) => {
|
||||
const timestamp = new Date().toISOString();
|
||||
cache.modify({
|
||||
fields: {
|
||||
notifications(existing = [], { readField }) {
|
||||
return existing.map((notif) => {
|
||||
if (readField("read", notif) === null) {
|
||||
return { ...notif, read: timestamp };
|
||||
}
|
||||
return notif;
|
||||
});
|
||||
},
|
||||
notifications_aggregate() {
|
||||
return { aggregate: { count: 0, __typename: "notifications_aggregate_fields" } };
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (isConnected) {
|
||||
const cachedNotifications = cache.readQuery({
|
||||
query: GET_NOTIFICATIONS,
|
||||
variables: {
|
||||
limit: 20,
|
||||
offset: 0,
|
||||
where: showUnreadOnly ? { read: { _is_null: true } } : {}
|
||||
}
|
||||
});
|
||||
|
||||
if (cachedNotifications?.notifications) {
|
||||
cache.writeQuery({
|
||||
query: GET_NOTIFICATIONS,
|
||||
variables: {
|
||||
limit: 20,
|
||||
offset: 0,
|
||||
where: showUnreadOnly ? { read: { _is_null: true } } : {}
|
||||
},
|
||||
data: {
|
||||
notifications: cachedNotifications.notifications.map((notif) =>
|
||||
notif.read === null ? { ...notif, read: timestamp } : notif
|
||||
)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
onError: (err) => {
|
||||
setError(err.message);
|
||||
console.error("MARK_ALL_NOTIFICATIONS_READ error:", err);
|
||||
}
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
console.log(
|
||||
"Notifications data updated:",
|
||||
data?.notifications?.map((n) => ({
|
||||
id: n.id,
|
||||
read: n.read,
|
||||
created_at: n.created_at,
|
||||
associationid: n.associationid
|
||||
}))
|
||||
);
|
||||
}, [data]);
|
||||
|
||||
const [markAllReadMutation, { error: mutationError }] = useMutation(MARK_ALL_NOTIFICATIONS_READ, {
|
||||
update: (cache) => {
|
||||
cache.modify({
|
||||
fields: {
|
||||
notifications(existing = []) {
|
||||
return existing.map((notif) => ({
|
||||
...notif,
|
||||
read: notif.read || new Date().toISOString()
|
||||
}));
|
||||
},
|
||||
notifications_aggregate() {
|
||||
return { aggregate: { count: 0 } };
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onError: (err) => setError(err.message)
|
||||
});
|
||||
|
||||
// Remove refetchNotifications function and useEffect/context logic
|
||||
useEffect(() => {
|
||||
console.log("Data changed:", data);
|
||||
if (data?.notifications) {
|
||||
const processedNotifications = data.notifications
|
||||
.map((notif) => {
|
||||
let scenarioText;
|
||||
let scenarioMeta;
|
||||
try {
|
||||
scenarioText =
|
||||
typeof notif.scenario_text === "string" ? JSON.parse(notif.scenario_text) : notif.scenario_text || [];
|
||||
scenarioMeta =
|
||||
typeof notif.scenario_meta === "string" ? JSON.parse(notif.scenario_meta) : notif.scenario_meta || [];
|
||||
scenarioText = notif.scenario_text ? JSON.parse(notif.scenario_text) : [];
|
||||
scenarioMeta = notif.scenario_meta ? JSON.parse(notif.scenario_meta) : {};
|
||||
} catch (e) {
|
||||
console.error("Error parsing JSON for notification:", notif.id, e);
|
||||
scenarioText = [notif.fcm_text || "Invalid notification data"];
|
||||
scenarioMeta = [];
|
||||
scenarioMeta = {};
|
||||
}
|
||||
|
||||
if (!Array.isArray(scenarioText)) scenarioText = [scenarioText];
|
||||
// Derive RO number from scenario_meta or assume it's available in notif
|
||||
const roNumber = notif.job.ro_number || "RO Not Found"; // Adjust based on your data structure
|
||||
if (!Array.isArray(scenarioMeta)) scenarioMeta = [scenarioMeta];
|
||||
|
||||
console.log("Processed notification:", {
|
||||
id: notif.id,
|
||||
scenarioText,
|
||||
scenarioMeta,
|
||||
read: notif.read,
|
||||
created_at: notif.created_at,
|
||||
associationid: notif.associationid,
|
||||
raw: notif
|
||||
});
|
||||
return {
|
||||
const processed = {
|
||||
id: notif.id,
|
||||
jobid: notif.jobid,
|
||||
associationid: notif.associationid,
|
||||
scenarioText,
|
||||
scenarioMeta,
|
||||
roNumber, // Add RO number to notification object
|
||||
created_at: notif.created_at,
|
||||
read: notif.read,
|
||||
__typename: notif.__typename
|
||||
};
|
||||
console.log("Processed notification with RO:", processed);
|
||||
return processed;
|
||||
})
|
||||
.sort((a, b) => new Date(b.created_at) - new Date(a.created_at)); // Explicitly sort by created_at desc
|
||||
|
||||
console.log(
|
||||
"Processed Notifications:",
|
||||
processedNotifications.map((n) => ({
|
||||
id: n.id,
|
||||
read: n.read,
|
||||
created_at: n.created_at,
|
||||
associationid: n.associationid
|
||||
}))
|
||||
);
|
||||
console.log("Number of notifications to render:", processedNotifications.length);
|
||||
.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
|
||||
console.log("Setting notifications with RO:", processedNotifications);
|
||||
setNotifications(processedNotifications);
|
||||
setError(null);
|
||||
} else {
|
||||
console.log("No data yet or error in data:", data, queryError);
|
||||
console.log("No notifications in data:", data);
|
||||
}
|
||||
}, [data, queryError]);
|
||||
}, [data]);
|
||||
|
||||
useEffect(() => {
|
||||
if (queryError || mutationError) {
|
||||
@@ -126,56 +138,61 @@ export function NotificationCenterContainer({ visible, onClose }) {
|
||||
}
|
||||
}, [queryError, mutationError]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("Notifications state updated:", notifications);
|
||||
}, [notifications]);
|
||||
|
||||
const loadMore = useCallback(() => {
|
||||
if (!loading && data?.notifications.length) {
|
||||
console.log("Loading more notifications, current length:", data.notifications.length);
|
||||
fetchMore({
|
||||
variables: { offset: data.notifications.length },
|
||||
updateQuery: (prev, { fetchMoreResult }) => {
|
||||
if (!fetchMoreResult) return prev;
|
||||
console.log("Fetched more:", fetchMoreResult.notifications);
|
||||
return {
|
||||
notifications: [...prev.notifications, ...fetchMoreResult.notifications]
|
||||
};
|
||||
}
|
||||
}).catch((err) => setError(err.message));
|
||||
}).catch((err) => {
|
||||
setError(err.message);
|
||||
console.error("Fetch more error:", err);
|
||||
});
|
||||
}
|
||||
}, [data?.notifications?.length, fetchMore, loading]);
|
||||
|
||||
const handleToggleUnreadOnly = (value) => {
|
||||
setShowUnreadOnly(value);
|
||||
console.log("Toggled showUnreadOnly:", value);
|
||||
};
|
||||
|
||||
const handleMarkAllRead = () => {
|
||||
markAllReadMutation().catch((e) =>
|
||||
console.error(`Something went wrong marking all notifications read: ${e?.message || ""}`)
|
||||
);
|
||||
console.log("Marking all notifications as read");
|
||||
markAllReadMutation()
|
||||
.then(() => {
|
||||
const timestamp = new Date().toISOString();
|
||||
setNotifications((prev) => {
|
||||
const updatedNotifications = prev.map((notif) =>
|
||||
notif.read === null ? { ...notif, read: timestamp } : notif
|
||||
);
|
||||
console.log("Updated notifications after mark all read:", updatedNotifications);
|
||||
return [...updatedNotifications];
|
||||
});
|
||||
})
|
||||
.catch((e) => console.error(`Error marking all notifications read: ${e?.message || ""}`));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
const virtuosoRef = { current: null };
|
||||
virtuosoRef.current?.scrollTo({ top: 0 });
|
||||
const handleScroll = () => {
|
||||
if (virtuosoRef.current && virtuosoRef.current.scrollTop + 400 >= virtuosoRef.current.scrollHeight) {
|
||||
loadMore();
|
||||
}
|
||||
};
|
||||
window.addEventListener("scroll", handleScroll);
|
||||
return () => window.removeEventListener("scroll", handleScroll);
|
||||
if (visible && !isConnected) {
|
||||
console.log("Notification Center opened, socket disconnected, refetching...");
|
||||
refetch();
|
||||
} else if (visible && isConnected) {
|
||||
console.log("Notification Center opened, socket connected, relying on cache...");
|
||||
refetch(); // Ensure fresh data even with socket
|
||||
}
|
||||
}, [visible, loading, data, loadMore]);
|
||||
|
||||
console.log(
|
||||
"Rendering NotificationCenter with notifications:",
|
||||
notifications.length,
|
||||
notifications.map((n) => ({
|
||||
id: n.id,
|
||||
read: n.read,
|
||||
created_at: n.created_at
|
||||
}))
|
||||
);
|
||||
}, [visible, isConnected, refetch]);
|
||||
|
||||
return (
|
||||
// Remove NotificationContext.Provider
|
||||
<NotificationCenterComponent
|
||||
visible={visible}
|
||||
onClose={onClose}
|
||||
@@ -185,8 +202,9 @@ export function NotificationCenterContainer({ visible, onClose }) {
|
||||
showUnreadOnly={showUnreadOnly}
|
||||
toggleUnreadOnly={handleToggleUnreadOnly}
|
||||
markAllRead={handleMarkAllRead}
|
||||
loadMore={loadMore}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(null, null)(NotificationCenterContainer);
|
||||
export default connect((state) => ({ bodyshop: state.user.bodyshop }), null)(NotificationCenterContainer);
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
position: absolute;
|
||||
top: 64px;
|
||||
right: 0;
|
||||
width: 400px;
|
||||
background: #2a2d34;
|
||||
color: #d9d9d9;
|
||||
border: 1px solid #434343;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
||||
width: 600px;
|
||||
background: #fff; /* White background, Ant’s default */
|
||||
color: rgba(0, 0, 0, 0.85); /* Primary text color in Ant 5 */
|
||||
border: 1px solid #d9d9d9; /* Neutral gray border */
|
||||
border-radius: 6px; /* Slightly larger radius per Ant 5 */
|
||||
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08), 0 3px 6px rgba(0, 0, 0, 0.06); /* Subtle Ant 5 shadow */
|
||||
z-index: 1000;
|
||||
display: none;
|
||||
|
||||
@@ -17,16 +17,16 @@
|
||||
|
||||
.notification-header {
|
||||
padding: 16px;
|
||||
border-bottom: 1px solid #434343;
|
||||
border-bottom: 1px solid #f0f0f0; /* Light gray border from Ant 5 */
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background: #1f2229;
|
||||
background: #fafafa; /* Light gray background for header */
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
color: #ffffff;
|
||||
color: rgba(0, 0, 0, 0.85); /* Primary text color */
|
||||
}
|
||||
|
||||
.notification-controls {
|
||||
@@ -35,60 +35,79 @@
|
||||
gap: 16px;
|
||||
|
||||
.ant-checkbox-wrapper {
|
||||
color: #d9d9d9;
|
||||
color: rgba(0, 0, 0, 0.85); /* Match Ant’s text color */
|
||||
}
|
||||
|
||||
.ant-btn-link {
|
||||
color: #40c4ff;
|
||||
&:hover { color: #80deea; }
|
||||
&:disabled { color: #616161; }
|
||||
color: #1677ff; /* Ant 5 primary blue */
|
||||
&:hover {
|
||||
color: #69b1ff; /* Lighter blue on hover */
|
||||
}
|
||||
&:disabled {
|
||||
color: rgba(0, 0, 0, 0.25); /* Disabled text color from Ant 5 */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.notification-read {
|
||||
background: #2a2d34;
|
||||
color: #b0b0b0;
|
||||
background: #fff; /* White background for read items */
|
||||
color: rgba(0, 0, 0, 0.65); /* Secondary text color */
|
||||
}
|
||||
|
||||
.notification-unread {
|
||||
background: #353942;
|
||||
color: #ffffff;
|
||||
background: #f5f5f5; /* Very light gray for unread items */
|
||||
color: rgba(0, 0, 0, 0.85); /* Primary text color */
|
||||
}
|
||||
|
||||
.ant-list {
|
||||
overflow: auto; // Match Virtuoso’s default scrolling behavior
|
||||
max-height: 100%; // Allow full height, let Virtuoso handle virtualization
|
||||
overflow: auto; /* Match Virtuoso’s default scrolling behavior */
|
||||
max-height: 100%; /* Allow full height, let Virtuoso handle virtualization */
|
||||
}
|
||||
|
||||
.ant-list-item {
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid #434343;
|
||||
display: block; // Ensure visibility
|
||||
overflow: visible; // Prevent clipping within items
|
||||
min-height: 80px; // Minimum height to ensure visibility of multi-line content
|
||||
padding: 2px 16px;
|
||||
border-bottom: 1px solid #f0f0f0; /* Light gray border */
|
||||
display: block; /* Ensure visibility */
|
||||
overflow: visible; /* Prevent clipping within items */
|
||||
min-height: 80px; /* Minimum height for multi-line content */
|
||||
|
||||
.ant-typography { color: inherit; }
|
||||
.ant-typography-secondary { font-size: 12px; color: #b0b0b0; }
|
||||
.ant-badge-dot { background: #ff4d4f; }
|
||||
.ant-typography {
|
||||
color: inherit; /* Inherit from parent (read/unread) */
|
||||
}
|
||||
|
||||
.ant-typography-secondary {
|
||||
font-size: 12px;
|
||||
color: rgba(0, 0, 0, 0.45); /* Ant 5 secondary text color */
|
||||
}
|
||||
|
||||
.ant-badge-dot {
|
||||
background: #ff4d4f; /* Keep red dot for unread, consistent with Ant */
|
||||
}
|
||||
|
||||
ul {
|
||||
margin: 0;
|
||||
padding-left: 20px; // Standard list padding
|
||||
list-style-type: disc; // Ensure bullet points
|
||||
padding-left: 20px; /* Standard list padding */
|
||||
list-style-type: disc; /* Ensure bullet points */
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: 4px; // Space between list items
|
||||
margin-bottom: 4px; /* Space between list items */
|
||||
}
|
||||
}
|
||||
|
||||
.ant-alert {
|
||||
margin: 8px;
|
||||
background: #ff4d4f;
|
||||
color: #fff;
|
||||
border: none;
|
||||
background: #fff1f0; /* Light red background for error per Ant 5 */
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
border: 1px solid #ffa39e; /* Light red border */
|
||||
|
||||
.ant-alert-message { color: #fff; }
|
||||
.ant-alert-description { color: #ffebee; }
|
||||
.ant-alert-message {
|
||||
color: #ff4d4f; /* Red text for message */
|
||||
}
|
||||
|
||||
.ant-alert-description {
|
||||
color: rgba(0, 0, 0, 0.65); /* Slightly muted description */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user