managarten/apps-archived/memoro/apps/mobile/features/menus/HeaderContext.tsx
Till-JS 61d181fbc2 chore: archive inactive projects to apps-archived/
Move inactive projects out of active workspace:
- bauntown (community website)
- maerchenzauber (AI story generation)
- memoro (voice memo app)
- news (news aggregation)
- nutriphi (nutrition tracking)
- reader (reading app)
- uload (URL shortener)
- wisekeep (AI wisdom extraction)

Update CLAUDE.md documentation:
- Add presi to active projects
- Document archived projects section
- Update workspace configuration

Archived apps can be re-activated by moving back to apps/

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 07:03:59 +01:00

78 lines
1.8 KiB
TypeScript

import React, { createContext, useContext, useState, ReactNode } from 'react';
// Interface für die Header-Konfiguration
export interface HeaderIcon {
name: string;
onPress?: () => void;
href?: string;
customElement?: React.ReactNode;
}
export interface TagItem {
id: string;
name: string;
color: string;
}
export interface HeaderConfig {
title?: string;
showBackButton?: boolean;
rightIcons?: HeaderIcon[];
showMenu?: boolean;
selectedTags?: TagItem[];
onTagRemove?: (tagId: string) => void;
isHomePage?: boolean;
scrollableTitle?: boolean;
showTitle?: boolean;
isMemoDetailPage?: boolean;
backgroundColor?: string;
}
// Context für die Header-Konfiguration
interface HeaderContextType {
config: HeaderConfig;
updateConfig: (newConfig: Partial<HeaderConfig>) => void;
resetConfig: () => void;
}
const defaultConfig: HeaderConfig = {
title: 'Memoro',
showBackButton: false,
rightIcons: [],
showMenu: true,
selectedTags: [],
isHomePage: false,
showTitle: true,
isMemoDetailPage: false,
};
const HeaderContext = createContext<HeaderContextType>({
config: defaultConfig,
updateConfig: () => {},
resetConfig: () => {},
});
// Hook für den Zugriff auf den Header-Context
export const useHeader = () => useContext(HeaderContext);
// Provider-Komponente für den Header-Context
export const HeaderProvider: React.FC<{ children: ReactNode }> = ({ children }) => {
const [config, setConfig] = useState<HeaderConfig>(defaultConfig);
const updateConfig = (newConfig: Partial<HeaderConfig>) => {
setConfig((prevConfig) => ({
...prevConfig,
...newConfig,
}));
};
const resetConfig = () => {
setConfig(defaultConfig);
};
return (
<HeaderContext.Provider value={{ config, updateConfig, resetConfig }}>
{children}
</HeaderContext.Provider>
);
};