[cs] feat: 대시보드 페이지 실시간 알림 패널 작업
This commit is contained in:
@@ -34,6 +34,7 @@ export function NoticePopover() {
|
||||
queryKey: [ENDPOINT.CMS_SERVICE.NOTICE_USER],
|
||||
queryFn: () => getNoticeUserList(userId!),
|
||||
enabled: !!userId,
|
||||
select: (data) => data.content.filter((item) => item.notReadYn === "N"),
|
||||
});
|
||||
|
||||
const { data: unreadNoticeCount } = useQuery({
|
||||
@@ -53,11 +54,11 @@ export function NoticePopover() {
|
||||
};
|
||||
|
||||
const handleSelectAll = () => {
|
||||
if (noticeUserList?.content) {
|
||||
if (selectedNoticeIds.length === noticeUserList.content.length) {
|
||||
if (noticeUserList) {
|
||||
if (selectedNoticeIds.length === noticeUserList.length) {
|
||||
setSelectedNoticeIds([]);
|
||||
} else {
|
||||
const allIds = noticeUserList.content.map((item) => item.notiId);
|
||||
const allIds = noticeUserList.map((item) => item.notiId);
|
||||
setSelectedNoticeIds(allIds);
|
||||
}
|
||||
}
|
||||
@@ -79,9 +80,9 @@ export function NoticePopover() {
|
||||
}
|
||||
};
|
||||
|
||||
const isAllSelected = noticeUserList?.content
|
||||
? selectedNoticeIds.length === noticeUserList.content.length &&
|
||||
noticeUserList.content.length > 0
|
||||
const isAllSelected = noticeUserList
|
||||
? selectedNoticeIds.length === noticeUserList.length &&
|
||||
noticeUserList.length > 0
|
||||
: false;
|
||||
|
||||
useEffect(() => {
|
||||
@@ -107,7 +108,7 @@ export function NoticePopover() {
|
||||
</Label>
|
||||
</div>
|
||||
<ul>
|
||||
{noticeUserList?.content?.map((item) => (
|
||||
{noticeUserList?.map((item) => (
|
||||
<li
|
||||
key={item.notiId}
|
||||
className={cn(
|
||||
|
||||
Reference in New Issue
Block a user