Skip to content

Commit

Permalink
merge :: 파일 업로드 버그 픽스
Browse files Browse the repository at this point in the history
  • Loading branch information
KANGYONGSU23 authored Apr 9, 2024
2 parents 44c31cb + 10055d4 commit 9f67a43
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/app/recruitments/apply/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export default function Apply() {
※ 파일 첨부 시 파일 확장자를 확인해 주시기 바랍니다.
</p>
<p className="text-caption leading-caption font-r text-[#7f7f7f]">
pdf, ppt, pptx, hwp, jpg, png, zip, txt, mp4, png, jpg, svg
pdf, ppt, pptx, hwp, zip, txt, mp4, png, jpg, svg
</p>
</div>
<GhostBtn
Expand Down
2 changes: 1 addition & 1 deletion src/components/mypage/AppliedICompanyItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function APpliedCompanyItem({
2023.11.25
</p> */}
</div>
<div className="absolute bottom-[12px] left-[22.5vw]">
<div className="absolute bottom-[12px] left-[50%] translate-x-[-50%]">
<Icon
icon="Chevron"
color="gray60"
Expand Down
19 changes: 16 additions & 3 deletions src/components/recruitments/apply/FileUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,21 @@ export default function FileUploader({

const addFileList = () => {
if (fileRef.current?.files?.length) {
const files = Array.from(fileRef.current?.files);
setFileList(prev => [...prev, ...files]);
const files = removeOverlap([...fileList, ...(Array.from(fileRef.current?.files))]);
setFileList(files);
}
};

const removeOverlap = (array: File[]) => {
let uniqueObjects:{[key:string]:File} = {}
array.forEach(obj => {
const { name, lastModified } = obj
const key = JSON.stringify({name, lastModified});
uniqueObjects[key] = obj;
});
return Object.values(uniqueObjects);
}

const prependFileItem = (fileName: string) => {
setFileList(prev => prev.filter(file => file.name !== fileName));
};
Expand All @@ -42,7 +52,10 @@ export default function FileUploader({
ref={fileRef}
type="file"
multiple={multiple}
onChange={addFileList}
onChange={(e)=>{
addFileList();
e.target.value = "";
}}
/>
<div
onMouseEnter={() => {
Expand Down
1 change: 0 additions & 1 deletion src/util/object/kebabMenuItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export const getMypageKebabItems = (): KebabItemType[] => {
{
label: "로그아웃",
onClick: () => {
console.log("로그아웃");
cookies.remove("access_token", { path: "/" });
cookies.remove("refresh_token", { path: "/" });
navigator.push("/account/login");
Expand Down

0 comments on commit 9f67a43

Please sign in to comment.