UNPKG

decentraland-ui

Version:

Decentraland's UI components and styles

54 lines (53 loc) 3.34 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var react_1 = __importStar(require("react")); var classnames_1 = __importDefault(require("classnames")); var NotificationsFeed_1 = __importDefault(require("./NotificationsFeed")); var NotificationBell_1 = __importDefault(require("../Icons/Notifications/NotificationBell")); var NotificationBellActive_1 = __importDefault(require("../Icons/Notifications/NotificationBellActive")); var CounterIcons_1 = __importDefault(require("../Icons/Notifications/CounterIcons")); require("./Notifications.css"); /** * @deprecated Should start using the same component migrated to UI2. */ function Notifications(_a) { var isOpen = _a.isOpen, items = _a.items, isLoading = _a.isLoading, locale = _a.locale, isOnboarding = _a.isOnboarding, activeTab = _a.activeTab, renderProfile = _a.renderProfile, onClick = _a.onClick, onChangeTab = _a.onChangeTab, onBegin = _a.onBegin, onClose = _a.onClose; var newNotificationsCount = (0, react_1.useMemo)(function () { return items.filter(function (notification) { return !notification.read; }).length; }, [items]); return (react_1.default.createElement("div", { className: "dcl notifications" }, react_1.default.createElement("button", { className: (0, classnames_1.default)('dcl notifications-bell', { 'notifications-active': newNotificationsCount > 0 }), onClick: onClick }, !isOpen ? react_1.default.createElement(NotificationBell_1.default, null) : react_1.default.createElement(NotificationBellActive_1.default, null), !isOpen && newNotificationsCount > 0 && (react_1.default.createElement("div", { className: "dcl notifications-counter" }, react_1.default.createElement(CounterIcons_1.default, { count: newNotificationsCount })))), isOpen && (react_1.default.createElement(NotificationsFeed_1.default, { isOpen: isOpen, items: items, isLoading: isLoading, locale: locale, isOnboarding: isOnboarding, activeTab: activeTab, onChangeTab: onChangeTab, onBegin: onBegin, onClose: onClose, renderProfile: renderProfile })))); } exports.default = Notifications;