mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 07:43:16 +10:00
* feat: update document table layout - Removed dashboard page - Removed redundant ID column - Moved date to first column - Added estimated locales for SSR dates
38 lines
656 B
TypeScript
38 lines
656 B
TypeScript
'use client';
|
|
|
|
import { createContext, useContext } from 'react';
|
|
|
|
export type LocaleContextValue = {
|
|
locale: string;
|
|
};
|
|
|
|
export const LocaleContext = createContext<LocaleContextValue | null>(null);
|
|
|
|
export const useLocale = () => {
|
|
const context = useContext(LocaleContext);
|
|
|
|
if (!context) {
|
|
throw new Error('useLocale must be used within a LocaleProvider');
|
|
}
|
|
|
|
return context;
|
|
};
|
|
|
|
export function LocaleProvider({
|
|
children,
|
|
locale,
|
|
}: {
|
|
children: React.ReactNode;
|
|
locale: string;
|
|
}) {
|
|
return (
|
|
<LocaleContext.Provider
|
|
value={{
|
|
locale: locale,
|
|
}}
|
|
>
|
|
{children}
|
|
</LocaleContext.Provider>
|
|
);
|
|
}
|