npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@getsupervisor/battle-arena-notifications-ui

v0.3.1

Published

Centro de notificaciones React aislado: feed + SSE en vivo + templates dinámicos con botonera. Portable a otros proyectos.

Readme

@getsupervisor/battle-arena-notifications-ui

Centro de notificaciones React aislado y portable: campana con badge, panel con feed, botonera por notificación y actualización en vivo por SSE. Cero dependencias de runtime más allá de React (sin MUI, sin react-query): estilos inline tematizables por tokens.

Es el cliente de referencia del módulo backend apps/public-api/src/notifications (cualquier backend que implemente ese contrato REST+SSE sirve).

Uso

import {
  NotificationsProvider,
  NotificationBell,
} from '@getsupervisor/battle-arena-notifications-ui';

<NotificationsProvider
  baseUrl="https://mi-api.com/v1" // prefijo donde vive /notifications
  recipient="[email protected]" // identificador del destinatario
  apiKey="opcional" // viaja como ?apiKey= (EventSource no admite headers)
  theme={{ accent: '#8b6cf6', panel: '#161922' }} // tokens de tu marca (todo opcional)
  labels={{ title: 'Notificaciones' }} // textos (i18n/whitelabel)
  onIncoming={(n) => toast(n.title)} // notificación llegando en vivo (tus toasts)
  onNavigate={(href) => router.push(href)} // acciones CON href (deep-links del template)
  onAction={(n, action) => {
    // acciones SIN href (callback por key)
    if (action.key === 'decline_challenge')
      declineChallenge(n.data.challengeId);
  }}
>
  <NotificationBell />
</NotificationsProvider>;

Integración real de ejemplo: apps/web/src/components/organisms/ArenaNotifications/ (teñido con el theme MUI del arena, toasts con notistack, navegación con next/router).

Piezas exportadas

  • NotificationsProvider / useNotifications() — estado del feed (items, unread, open), acciones (markRead, markAllRead, runAction) y conexión SSE (auto-reconexión del EventSource nativo).
  • NotificationBell — campana + badge + dropdown anclado (cierra con click afuera).
  • NotificationCenter, NotificationItem — usables sueltos si quieres tu propio anclaje (p. ej. página de historial).
  • NotificationsClient — cliente HTTP+SSE sin React, por si integras con otro framework.
  • feedReducer — reducer puro del estado (testeable).

Contrato esperado del backend

  • GET {baseUrl}/notifications?recipient=&limit={ items: Notification[], unread: number }
  • GET {baseUrl}/notifications/stream?recipient= → SSE con frames event: notification y el JSON de la notificación en data:.
  • POST {baseUrl}/notifications/:id/read · POST .../read-all ({recipient}) · POST .../:id/archive

Notification: ver src/types.ts (id, recipient, templateKey, category, icon, title, body, actions[], data, status, createdAt, readAt). La botonera viene YA renderizada del template del backend: la lib solo la pinta y enruta (hrefonNavigate; sin href → onAction).

Portar a otro proyecto

  1. Copia la carpeta apps/notifications-ui (o publícala en tu registry) y agrégala a los workspaces. yarn build genera dist/ (tsup, ESM+CJS+tipos).
  2. El consumidor agrega "@getsupervisor/battle-arena-notifications-ui": "0.1.0" (renómbrala si quieres).
  3. Monta el Provider donde el destinatario sea conocido (post-login) y la campana en tu header.
  4. Tematiza con theme (tokens en src/theme.ts) y traduce con labels.

Desarrollo

yarn test        # jest (jsdom): reducer, relativeTime, render con botonera
yarn typecheck   # tsc --noEmit
yarn build       # tsup → dist/