Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Add optional click tracking to clickable components

Aperta
#49 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
react, typescript

Direzione di ricerca

Inizia esaminando i componenti interattivi elencati—BBButton, BBBCheckbox, BBBToggle, BBBAccordion, BBBNavigation, BBBSelect, BBBSearch e BBBModal—e il modo in cui sono implementate le loro callback di interazione. Usa il modulo proposto src/clickTracker.ts e ispeziona il percorso di export della libreria. Il lavoro è completo quando le interazioni con id producono il report richiesto, resetClickReport lo cancella e i componenti senza ids mantengono il comportamento esistente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Is your feature request related to a problem? Please describe.
Consumers of this library often need to track which components are being interacted with for analytics or usage telemetry purposes. Currently, they must manually wrap every component's onClick to collect this data, which is repetitive boilerplate that has to be maintained outside the library.

Describe the solution you'd like
An opt-in, zero-configuration click tracking system built into the library. When a consumer passes an id prop to any clickable component, clicks are automatically counted in an internal store. The consumer retrieves the report by calling a single exported function whenever needed.

// src/clickTracker.ts (new module)
export function getClickReport(): Record<string, number>
export function resetClickReport(): void

// internal — called by components
function trackClick(id: string): void

Describe alternatives you've considered

  • Base class / class inheritance: Discarded — this library uses functional components with hooks throughout. A class hierarchy would require rewriting all components and goes against React's compositional model.
  • Higher-Order Component (HOC): Would work but adds unnecessary wrapping complexity for a use case that doesn't require it.
  • Context + Provider: Makes the system reactive (triggers re-renders), but requires consumers to wrap their app with a <ClickTrackerProvider>, which is unnecessary overhead for a simple analytics report.

Affected component(s)
All components that have meaningful user interaction:

  • BBButton
  • BBBCheckbox
  • BBBToggle
  • BBBAccordion (expand/collapse)
  • BBBNavigation (item clicks)
  • BBBSelect (option selection)
  • BBBSearch (search action)
  • BBBModal (action buttons)

Proposed API / Usage Example

import { BBButton, BBBToggle, getClickReport, resetClickReport } from '@mconf/bbb-ui-components-react';

// No setup required — tracking activates automatically when id is passed
function App() {
  return (
    <>
      <BBButton id="confirm-btn" onClick={handleConfirm} label="Confirm" />
      <BBBToggle id="notifications-toggle" onChange={handleToggle} />
    </>
  );
}

// Retrieve the report whenever needed (e.g. on page unload, on user logout)
const report = getClickReport();
// → { "confirm-btn": 14, "notifications-toggle": 3 }

sendToAnalytics(report);
resetClickReport(); // optional: reset counters

Components without an id prop are silently ignored — zero behavior change for existing consumers.

Screenshots or mockups
N/A

Additional context

  • TypeScript type ClickReport = Record<string, number> should be exported alongside the functions.
  • resetClickReport() enables consumers to segment data by session or time window.
  • The module is a singleton (module-level Map<string, number>), so it works across the entire component tree without any provider or context setup.
  • Easily testable: call resetClickReport() between tests to isolate state.
Lingua principale
TypeScript
Stelle
2
Fork
5
Merge medio
2g 5h
PR unite (30g)
9

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bigbluebutton/bbb-ui-components-react

Tutte le issue di bigbluebutton/bbb-ui-components-react

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.