Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions frontend/src/components/Board/BoardActions.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
}

.boardActions {
width: 100%;
width: 908px;
max-width: calc(100% - 20px);
padding-right: 20px;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: flex-end;
gap: var(--gap);
margin-left: auto;
margin-right: auto;
margin-bottom: 32px;
}

Expand Down
55 changes: 52 additions & 3 deletions frontend/src/components/Board/Modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,30 @@ import FolderIcon from '../../assets/boardFolder.svg';
import CloseIcon from '../../assets/boardCloseIcon.svg';
import DropdownArrowIcon from '../../assets/boardSelectArrow.svg';

const Modal = ({ title, setTitle, content, setContent, onSave, onClose }) => {
const Modal = ({
title,
setTitle,
content,
setContent,
selectedFiles,
onFileChange,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

props로 onFileChange를 받았는데 사용은 Modal 컴포넌트 바깥에서 하니까 정의되어 있지 않다고 나옵니다. 위치 옮겨주세요.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 수정했습니다.

onRemoveFile,
onSave,
onClose,
}) => {
const handleDragOver = (e) => {
e.preventDefault();
e.stopPropagation();
};

const handleDrop = (e) => {
e.preventDefault();
e.stopPropagation();

const droppedFiles = Array.from(e.dataTransfer.files);
onFileChange({ target: { files: droppedFiles } });
};
Comment on lines +22 to +28
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

드래그 앤 드롭 핸들러에서 가짜 이벤트 객체 생성

onFileChange{ target: { files: droppedFiles } } 형태의 객체를 전달하고 있습니다. 이 방식은 동작하지만, Board.jsxhandleFileChange에서 e.target.value = ''를 호출할 때 에러가 발생할 수 있습니다. 드롭된 파일의 경우 target.value가 존재하지 않기 때문입니다.

Board.jsxhandleFileChange에서 방어 코드 추가를 권장합니다:

// Board.jsx - handleFileChange 끝부분
if (e.target.value !== undefined) {
  e.target.value = '';
}
🤖 Prompt for AI Agents
In frontend/src/components/Board/Modal.jsx around lines 22–28, the synthetic
event passed to onFileChange lacks a target.value which causes an error when
Board.jsx's handleFileChange attempts to reset e.target.value; fix by either
including a value property on the fake event (so target has files and value) OR,
preferably, update Board.jsx's handleFileChange to defensively check that
e.target.value is defined before setting it (only clear it when present).


return (
<div className={styles.overlay} onClick={onClose}>
<div className={styles.modal} onClick={(e) => e.stopPropagation()}>
Expand Down Expand Up @@ -32,14 +55,18 @@ const Modal = ({ title, setTitle, content, setContent, onSave, onClose }) => {
<div
className={styles.fileSection}
onClick={() => document.getElementById('fileUpload').click()}
onDragOver={handleDragOver}
onDrop={handleDrop}
>
<img src={FolderIcon} alt="폴더" />
<span className={styles.fileText}>파일추가</span>
<span className={styles.fileText}>파일 추가</span>
<input
type="file"
id="fileUpload"
className={styles.fileInput}
style={{ display: 'none' }}
multiple
onChange={onFileChange}
/>
</div>
<div className={styles.divider}></div>
Expand All @@ -52,6 +79,28 @@ const Modal = ({ title, setTitle, content, setContent, onSave, onClose }) => {
</div>
</div>

{selectedFiles && selectedFiles.length > 0 && (
<div className={styles.fileList}>
<label className={styles.label}>
첨부 파일 ({selectedFiles.length})
</label>
{selectedFiles.map((file, index) => (
<div key={index} className={styles.fileItem}>
<span className={styles.fileName}>
{file.name} ({(file.size / 1024).toFixed(1)} KB)
</span>
<button
type="button"
className={styles.removeFileButton}
onClick={() => onRemoveFile(index)}
>
</button>
</div>
))}
</div>
)}

<div className={styles.accessField}>
<label className={styles.accessLabel}>접근 권한</label>
<div className={styles.selectWrapper}>
Expand All @@ -66,7 +115,7 @@ const Modal = ({ title, setTitle, content, setContent, onSave, onClose }) => {
</div>

<button className={styles.saveButton} onClick={onSave}>
저장
게시글 작성
</button>
</div>
</div>
Expand Down
Loading