MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / createBadgeIndicator

Function createBadgeIndicator

src/ui/taskCardIndicators.ts:47–69  ·  view source on GitHub ↗
(config: BadgeIndicatorConfig)

Source from the content-addressed store, hash-verified

45 * Returns the element, or null if visible is false.
46 */
47export function createBadgeIndicator(config: BadgeIndicatorConfig): HTMLElement | null {
48 const { container, className, icon, tooltip, ariaLabel, onClick, visible = true } = config;
49
50 if (!visible) return null;
51
52 const indicator = container.createEl("div", {
53 cls: className,
54 attr: { "aria-label": ariaLabel || tooltip },
55 });
56
57 setIcon(indicator, icon);
58 setTooltip(indicator, tooltip, { placement: "top" });
59
60 if (onClick) {
61 prepareInteractiveControl(indicator);
62 indicator.addEventListener("click", (e) => {
63 e.stopPropagation();
64 onClick(e);
65 });
66 }
67
68 return indicator;
69}
70
71/**
72 * Updates or creates a badge indicator, returning the element.

Callers 6

renderProjectBadgesFunction · 0.90
renderDependencyTogglesFunction · 0.90
updateProjectBadgesFunction · 0.90
updateBadgeIndicatorFunction · 0.85

Calls 3

setIconFunction · 0.90
setTooltipFunction · 0.90

Tested by

no test coverage detected