mirror of
https://github.com/multica-ai/multica.git
synced 2026-08-03 11:10:23 +02:00
- Add explicit type="button" to 61 <button> elements missing the attribute - Replace useContext() with React 19 use() across 16 context consumers - Replace [...arr].sort() with arr.toSorted() in 12 web/desktop files (mobile excluded — Hermes lacks toSorted support) - Fix rules-of-hooks violation: useSidebar try/catch → useSidebarSafe null check - Fix nested component definition: useMemo wrapping HeaderRight → useCallback - Fix missing ARIA: add aria-expanded + aria-controls to combobox in create-squad React Doctor score: 23 → 30. No behavioral changes, no business logic modified. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
31 lines
667 B
TypeScript
31 lines
667 B
TypeScript
"use client";
|
|
|
|
import { createContext, use, type ReactNode } from "react";
|
|
import type { LocaleAdapter } from "./types";
|
|
|
|
const LocaleAdapterContext = createContext<LocaleAdapter | null>(null);
|
|
|
|
export function LocaleAdapterProvider({
|
|
adapter,
|
|
children,
|
|
}: {
|
|
adapter: LocaleAdapter;
|
|
children: ReactNode;
|
|
}) {
|
|
return (
|
|
<LocaleAdapterContext.Provider value={adapter}>
|
|
{children}
|
|
</LocaleAdapterContext.Provider>
|
|
);
|
|
}
|
|
|
|
export function useLocaleAdapter(): LocaleAdapter {
|
|
const ctx = use(LocaleAdapterContext);
|
|
if (!ctx) {
|
|
throw new Error(
|
|
"useLocaleAdapter must be used within <LocaleAdapterProvider>",
|
|
);
|
|
}
|
|
return ctx;
|
|
}
|