mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-07-10 03:46:01 +00:00
feat(preferencias): permite ocultar resumo do lancamento
This commit is contained in:
31
src/shared/components/providers/app-preferences-provider.tsx
Normal file
31
src/shared/components/providers/app-preferences-provider.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { createContext, useContext } from "react";
|
||||
import type { AppPreferences } from "@/shared/lib/preferences/queries";
|
||||
|
||||
const DEFAULT_APP_PREFERENCES: AppPreferences = {
|
||||
showTransactionSummary: true,
|
||||
};
|
||||
|
||||
const AppPreferencesContext = createContext<AppPreferences>(
|
||||
DEFAULT_APP_PREFERENCES,
|
||||
);
|
||||
|
||||
type AppPreferencesProviderProps = AppPreferences & {
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
export function AppPreferencesProvider({
|
||||
children,
|
||||
...preferences
|
||||
}: AppPreferencesProviderProps) {
|
||||
return (
|
||||
<AppPreferencesContext.Provider value={preferences}>
|
||||
{children}
|
||||
</AppPreferencesContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export function useAppPreferences() {
|
||||
return useContext(AppPreferencesContext);
|
||||
}
|
||||
Reference in New Issue
Block a user