mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 08:23:35 +00:00
Refactor AppProvider, AppConfig and presetRelays
This commit is contained in:
8 files changed
+46
-26
No files matched your search
@@ -5,10 +5,10 @@ import { AppContext, type AppContextType } from "@/contexts/AppContext";
|
||||
* Hook to access and update application configuration
|
||||
* @returns Application context with config and update methods
|
||||
*/
|
||||
export function useAppConfig(): AppContextType {
|
||||
export function useAppContext(): AppContextType {
|
||||
const context = useContext(AppContext);
|
||||
if (context === undefined) {
|
||||
throw new Error('useAppConfig must be used within an AppProvider');
|
||||
throw new Error('useAppContext must be used within an AppProvider');
|
||||
}
|
||||
return context;
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
import { type Theme } from "@/contexts/AppContext";
|
||||
import { useAppConfig } from "@/hooks/useAppConfig";
|
||||
import { useAppContext } from "@/hooks/useAppContext";
|
||||
|
||||
/**
|
||||
* Hook to get and set the active theme
|
||||
* @returns Theme context with theme and setTheme
|
||||
*/
|
||||
export function useTheme(): { theme: Theme; setTheme: (theme: Theme) => void } {
|
||||
const { config, updateConfig } = useAppConfig();
|
||||
const { config, updateConfig } = useAppContext();
|
||||
|
||||
return {
|
||||
theme: config.theme,
|
||||
|
||||
Reference in new issue
Block a user