프로필 이미지 기능 수정

This commit is contained in:
hyeonsu
2025-08-28 10:05:06 +09:00
parent 00ce90a9f0
commit 49f812f444
8 changed files with 128 additions and 19 deletions

View File

@@ -204,6 +204,7 @@ export function AppLayout({ children }: AppLayoutProps) {
formData,
selectedImage,
isSaving,
departments,
alertModal,
closeAlert,
openProfileModal,
@@ -394,6 +395,7 @@ export function AppLayout({ children }: AppLayoutProps) {
formData={formData}
selectedImage={selectedImage}
isSaving={isSaving}
departments={departments}
alertModal={alertModal}
onClose={closeProfileModal}
onFormChange={updateFormData}

View File

@@ -53,6 +53,10 @@ interface ProfileModalProps {
formData: ProfileFormData;
selectedImage: string;
isSaving: boolean;
departments: Array<{
deptCode: string;
deptName: string;
}>;
alertModal: {
isOpen: boolean;
title: string;
@@ -76,6 +80,7 @@ export function ProfileModal({
formData,
selectedImage,
isSaving,
departments,
alertModal,
onClose,
onFormChange,
@@ -99,12 +104,14 @@ export function ProfileModal({
<Avatar className="h-24 w-24">
{selectedImage ? (
<AvatarImage src={selectedImage} alt="프로필 사진 미리보기" />
) : user?.photo ? (
<AvatarImage src={user.photo} alt="기존 프로필 사진" />
) : (
<AvatarFallback className="text-lg">{formData.userName?.substring(0, 1) || "U"}</AvatarFallback>
)}
</Avatar>
{selectedImage && (
{(selectedImage || user?.photo) && (
<Button
type="button"
variant="destructive"
@@ -171,12 +178,24 @@ export function ProfileModal({
<div className="grid grid-cols-2 gap-4">
<div className="space-y-2">
<Label htmlFor="deptName"></Label>
<Input
id="deptName"
value={formData.deptName}
onChange={(e) => onFormChange("deptName", e.target.value)}
placeholder="부서를 입력하세요"
/>
<Select value={formData.deptName} onValueChange={(value) => onFormChange("deptName", value)}>
<SelectTrigger>
<SelectValue placeholder="부서 선택" />
</SelectTrigger>
<SelectContent>
{Array.isArray(departments) && departments.length > 0 ? (
departments.map((department) => (
<SelectItem key={department.deptCode} value={department.deptName}>
{department.deptName}
</SelectItem>
))
) : (
<SelectItem value="no-data" disabled>
</SelectItem>
)}
</SelectContent>
</Select>
</div>
<div className="space-y-2">
<Label htmlFor="positionName"></Label>