import { View, Image, Pressable, useColorScheme } from "react-native"; import { Text } from "@/components/ui/text"; import { ArrowLeft, Bell, Settings, Info, Search, } from "@/lib/icons"; import { useAuthStore } from "@/lib/auth-store"; import { useSirouRouter } from "@sirou/react-native"; import { AppRoutes } from "@/lib/routes"; import { Edit } from "lucide-react-native"; interface StandardHeaderProps { title?: string; showBack?: boolean; showSearch?: boolean; onSearchPress?: () => void; rightAction?: "notificationsSettings" | "companyInfo" | "edit"; onRightActionPress?: () => void; right?: React.ReactNode; } export function StandardHeader({ title, showBack, showSearch, onSearchPress, rightAction, onRightActionPress, right, }: StandardHeaderProps) { const user = useAuthStore((state) => state.user); const colorScheme = useColorScheme(); const isDark = colorScheme === "dark"; const nav = useSirouRouter(); // Fallback avatar if user has no profile picture const avatarUri = user?.avatar || "https://ui-avatars.com/api/?name=" + encodeURIComponent(`${user?.firstName} ${user?.lastName}`) + "&background=ea580c&color=fff"; const iconColor = isDark ? "#f1f5f9" : "#0f172a"; return ( {!title ? ( nav.go("profile")} className="h-[40px] w-[40px] rounded-full overflow-hidden" > Welcome back, {user?.firstName + " " + user?.lastName || "User"} {showSearch && ( )} nav.go("notifications/index")} > ) : ( {showBack && ( nav.back()} className="h-10 w-10 rounded-[10px] bg-card items-center justify-center border border-border" > )} {title} {showSearch && ( )} {right ? ( right ) : rightAction === "notificationsSettings" ? ( onRightActionPress ? onRightActionPress() : nav.go("notifications/settings") } > ) : rightAction === "companyInfo" ? ( onRightActionPress ? onRightActionPress() : nav.go("company-details") } > ) : rightAction === "edit" ? ( ) : null} )} ); }