Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge :: 파일 업로드 버그 픽스 #67

Merged
merged 6 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
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
KANGYONGSU23 marked this conversation as resolved.
Show resolved Hide resolved
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
Loading