import { useNavigate } from "react-router-dom"; import { MobileEditView } from "../mobile/mobile-edit-view"; import { Icon } from "../../icon"; import type { UserProfile } from "../../../api/profile"; interface ProfileMobileViewProps { profile: UserProfile; name: string; email: string; error: string | null; isSaving: boolean; avatarUrl: string | null; fileInputRef: React.RefObject; onNameChange: (value: string) => void; onEmailChange: (value: string) => void; onAvatarButtonClick: () => void; onAvatarChange: (event: React.ChangeEvent) => void; onSave: () => void; } export const ProfileMobileView = ({ profile, name, email, error, isSaving, avatarUrl, fileInputRef, onNameChange, onEmailChange, onAvatarButtonClick, onAvatarChange, onSave, }: ProfileMobileViewProps) => { const navigate = useNavigate(); return ( navigate(-1)} onSave={onSave} isSaving={isSaving} >
{avatarUrl ? ( Avatar ) : (
{profile.name.charAt(0).toUpperCase()}
)}
onNameChange(e.target.value)} placeholder="Your name" type="text" value={name} />
onEmailChange(e.target.value)} placeholder="your.email@example.com" type="email" value={email} />
{error && (

{error}

)}
); };