bb-plane-fork/apps/web/ce/components/workspace-notifications/notification-card/root.tsx
darkingtail d9695afcdc fix: remove unused imports and variables (part 1 — packages & non-web-core) (#8751)
* fix: remove unused imports and variables (part 1)

Resolve oxlint no-unused-vars warnings in packages/*, apps/admin,
apps/space, apps/live, and apps/web (non-core).

* fix: resolve CI check failures

* fix: resolve check:types failures

* fix: resolve check:types and check:format failures

- Use destructuring alias for activeCycleResolvedPath
- Format propel tab-navigation file

* fix: format propel button helper with oxfmt

Reorder Tailwind classes to match oxfmt canonical ordering.
2026-03-25 02:04:20 +05:30

61 lines
2.2 KiB
TypeScript

/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { observer } from "mobx-react";
// plane imports
import { ENotificationLoader, ENotificationQueryParamType } from "@plane/constants";
import { useTranslation } from "@plane/i18n";
// components
import { NotificationItem } from "@/components/workspace-notifications/sidebar/notification-card/item";
// hooks
import { useWorkspaceNotifications } from "@/hooks/store/notifications";
type TNotificationCardListRoot = {
workspaceSlug: string;
workspaceId: string;
};
export const NotificationCardListRoot = observer(function NotificationCardListRoot(props: TNotificationCardListRoot) {
const { workspaceSlug, workspaceId } = props;
// hooks
const { loader, paginationInfo, getNotifications, notificationIdsByWorkspaceId } = useWorkspaceNotifications();
const notificationIds = notificationIdsByWorkspaceId(workspaceId);
const { t } = useTranslation();
const getNextNotifications = async () => {
try {
await getNotifications(workspaceSlug, ENotificationLoader.PAGINATION_LOADER, ENotificationQueryParamType.NEXT);
} catch (error) {
console.error(error);
}
};
if (!workspaceSlug || !workspaceId || !notificationIds) return <></>;
return (
<div>
{notificationIds.map((notificationId: string) => (
<NotificationItem key={notificationId} workspaceSlug={workspaceSlug} notificationId={notificationId} />
))}
{/* fetch next page notifications */}
{paginationInfo && paginationInfo?.next_page_results && (
<>
{loader === ENotificationLoader.PAGINATION_LOADER ? (
<div className="flex items-center justify-center py-4 text-13 font-medium">
<div className="text-accent-secondary">{t("loading")}...</div>
</div>
) : (
<div className="flex items-center justify-center py-4 text-13 font-medium" onClick={getNextNotifications}>
<div className="cursor-pointer text-accent-secondary transition-all hover:text-accent-primary">
{t("load_more")}
</div>
</div>
)}
</>
)}
</div>
);
});