Barazo default frontend
barazo.forum
1import type { ComponentType } from 'react'
2
3export type SlotName =
4 | 'settings-community'
5 | 'settings-global'
6 | 'post-content'
7 | 'admin-dashboard'
8 | 'topic-sidebar'
9 | 'user-profile'
10
11export interface PluginRegistration {
12 pluginName: string
13 component: ComponentType<Record<string, unknown>>
14}
15
16const registry = new Map<SlotName, PluginRegistration[]>()
17
18export function registerPluginComponent(
19 slot: SlotName,
20 pluginName: string,
21 component: ComponentType<Record<string, unknown>>
22): void {
23 const existing = registry.get(slot) ?? []
24 // Prevent duplicate registration
25 if (existing.some((r) => r.pluginName === pluginName)) return
26 registry.set(slot, [...existing, { pluginName, component }])
27}
28
29export function getPluginComponents(slot: SlotName): PluginRegistration[] {
30 return registry.get(slot) ?? []
31}
32
33export function clearPluginRegistry(): void {
34 registry.clear()
35}