refactor: simplify footer architecture by removing global footer pattern
Replace portal/registry pattern with direct rendering where each screen owns its footer. This eliminates FooterControlsContext indirection and makes the code follow standard React composition patterns. - Remove GlobalFooter and FooterControlsProvider from _layout.tsx - Add HomeFooter component rendered directly in home screen - Render AgentInputArea directly in agent screen (not via registration) - Add keyboard animation and safe area handling to AgentInputArea - Move FOOTER_HEIGHT constant to shared constants/layout.ts - Delete footer-controls-context.tsx and global-footer.tsx 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
import { createContext, useCallback, useContext, useMemo, useState } from "react";
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export const FOOTER_HEIGHT = 75;
|
||||
|
||||
interface FooterControlsContextValue {
|
||||
controls: ReactNode | null;
|
||||
registerFooterControls: (controls: ReactNode) => void;
|
||||
unregisterFooterControls: () => void;
|
||||
}
|
||||
|
||||
const FooterControlsContext = createContext<FooterControlsContextValue | undefined>(undefined);
|
||||
|
||||
export function FooterControlsProvider({ children }: { children: ReactNode }) {
|
||||
const [controls, setControls] = useState<ReactNode | null>(null);
|
||||
|
||||
const registerFooterControls = useCallback((nextControls: ReactNode) => {
|
||||
setControls(nextControls);
|
||||
}, []);
|
||||
|
||||
const unregisterFooterControls = useCallback(() => {
|
||||
setControls(null);
|
||||
}, []);
|
||||
|
||||
const value = useMemo(
|
||||
() => ({
|
||||
controls,
|
||||
registerFooterControls,
|
||||
unregisterFooterControls,
|
||||
}),
|
||||
[controls, registerFooterControls, unregisterFooterControls],
|
||||
);
|
||||
|
||||
return (
|
||||
<FooterControlsContext.Provider value={value}>
|
||||
{children}
|
||||
</FooterControlsContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export function useFooterControls() {
|
||||
const context = useContext(FooterControlsContext);
|
||||
|
||||
if (!context) {
|
||||
throw new Error("useFooterControls must be used within a FooterControlsProvider");
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
Reference in New Issue
Block a user