import { withRegionalConfig } from "../../regional"
import type { RegionalRegistry } from "../../regional"
/**
* SettingsTab — demonstrates Pattern 2: HOC injection via withRegionalConfig.
*
* The base component receives the full registry as a `registry` prop,
* injected automatically by the HOC. Callers use with no
* registry prop — the HOC wires it from context.
*
* Compare with DetailsTab (Pattern 1) which calls useRegional() directly.
* Pattern 2 is useful for class components or third-party wrappers that
* cannot call hooks.
*/
// Props the caller passes in — none required here, but defined to show the pattern.
export interface SettingsTabOwnProps {}
// Props injected by withRegionalConfig — never passed by the caller.
export interface SettingsTabInjectedProps {
registry: RegionalRegistry
}
function SettingsTabBase({ registry }: SettingsTabOwnProps & SettingsTabInjectedProps) {
const { config } = registry
return (
)
}
// Exported wrapped version — callers use this; no `registry` prop needed.
export const SettingsTab = withRegionalConfig(SettingsTabBase)
// ── Helpers ──────────────────────────────────────────────────────────────────
function Row({ label, value }: { label: string; value: string }) {
return (
{label}
{value}
)
}
function FlagRow({ label, enabled }: { label: string; enabled: boolean }) {
return (
{label}
{enabled ? "Enabled" : "Disabled"}
)
}