-
Notifications
You must be signed in to change notification settings - Fork 116
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
[김유경] Week21 #1090
Open
codingaring
wants to merge
65
commits into
codeit-bootcamp-frontend:part3-김유경
Choose a base branch
from
codingaring:part4-김유경-week21
base: part3-김유경
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
The head ref may contain hidden characters: "part4-\uAE40\uC720\uACBD-week21"
Open
[김유경] Week21 #1090
Changes from 59 commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
dc12647
🔥 Delete : delete unnecessary files
codingaring 14eb7b6
✨ Faet : add handleToken function
codingaring a50c45d
♻️ Refactor : refactor getCategory function
codingaring f8fbe8b
🚚 Rename : data -> folderInfo
codingaring 31491e5
✨ Feat : install react-query
codingaring 511db2a
✨ Feat : use react-query
codingaring 5cd40de
✏️ Fix : 페이지 첫 로드시, 카테고리 목록이 안뜨던 문제 해결
codingaring ca8145c
🚚 Rename : AddFolderContent -> AddFolder
codingaring 44cebb4
✨ feat : add customhook : useModal
codingaring 386a2e2
♻️ Refactor : modal change AddToFolderModal
codingaring 8248ffb
💄 UI : modify addToFolder Button text 삭제하기 -> 추가하기
codingaring 39b93fb
♻️ Refactor : completed Modal Refactor
codingaring bee3b7e
🐛 Fix : disabled kebab button in folder page
codingaring ab543d3
♻️ Refactor : changeModal Button
codingaring 10950ac
💄 style : extends PrimaryButton to AddToFolderButton
codingaring c5a0a45
✨ Feat : posible rename Modal
codingaring 35f7adc
✨ Feat : createFolder
codingaring f5c866d
✨ Feat : add postAddToFolder
codingaring 345513f
🐛Fix : 폴더 데이터가 안불러와지던 문제 해결
codingaring fc2cb45
🐛 Fix : 링크 목록이 보이지 않던 문제 해결
codingaring 590111b
✨ Feat : change API url
codingaring 5f637c9
✨ Feat : sharedPage change API function
codingaring be5db32
✨ Feat : folderPage data api change
codingaring 40d9659
✨ Feat : add function deleteFolder Modal
codingaring 43b5bf7
✨ Feat : deleteLink
codingaring 7e17707
♻️ Refactor : change signin api url and modify handleToken
codingaring 64c61be
♻️ Refactor : modify change api url : checkSignin
codingaring b4a2da1
♻️ Refactor : change signup api url
codingaring d99735f
♻️ Refactor : change currentUserProfile api url
codingaring 8f92b5d
💚 Build : resolved build error
codingaring e1c5d03
♻️ Refactor : modify landing header button event
codingaring fd3e932
♻️ Refactor : change fetch -> mutation
codingaring a230069
♻️ Refactor : change modal event type
codingaring 97225a8
🐛 Fix & Refactor : modify prop and type and arguments
codingaring 4d6f407
🐛 Fix : modify Navigation Bar profile state initialValue
codingaring f6bb994
♻️ Refactor : modify router url
codingaring 0edfd94
♻️ Fix : resole error
codingaring 6924ca3
🐛 Fix : resolve conflict
codingaring 3b028ab
🐛 fix : modify router url
codingaring 467675b
♻️ Refactor : modify modal event type
codingaring a9afb09
🎨 Design : add scroll folder Category
codingaring 2ab550a
🎨 Design : Empty cardList position : static -> absolute
codingaring 1707116
♻️ Refactor : add invalidateQueries addFolderModal
codingaring 2fcce17
♻️ Refactor : add invalidateQueries deleteFolderModal
codingaring e0a887a
♻️ Refactor : add invalidateQueries in addToFolder
codingaring 5cfae1a
♻️ Refactor : add invalidateQueries renameModal
codingaring ed70b60
♻️ Refactor : Functional update usePortalContents
codingaring 34d3ffa
♻️ refactor : modify initialValue and remove unnecessary value
codingaring 963a74a
remove unnecessary files
codingaring d600a2e
🐛 Fix : resolve import error
codingaring 9b2ba6d
✨ Feat : add wishList API function
codingaring 33b7f50
✨ Feat : add wishList function
codingaring d2ef71f
💄 styled : modify styled components
codingaring 053cadd
💄 style : modify styled components
codingaring aae0342
🚚 Rename : rename data -> folderNameList
codingaring 5199740
♻️ Refactor : add createHttpClient
codingaring da6f616
🚧work : modify base URL
codingaring 3626d2c
🐛 Fix : resolve data fetch error
codingaring 1486988
🐛 Fix : resolve shared page error
codingaring d2529b8
🛂 Authorization : check validateAccessToken
codingaring deaeb35
♻️ Refactor : add authAPI
codingaring 460fade
🔧 Chore : add eslint, prettier files
codingaring 3477de0
🐛 Fix : resolve build error
codingaring c97a5ce
♻️ Refactor : add AddToFolder else if
codingaring 711d90f
♻️ Refactor : handleToken window === undefined , throw error
codingaring File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { ModalInput } from "../ModalElements/ModalInput"; | ||
import Modal from "../Modal"; | ||
import { BaseModalProps } from "../ModalProp"; | ||
import { PrimaryButton } from "@styles/common/PrimaryButton"; | ||
import { useMutation, useQueryClient } from "@tanstack/react-query"; | ||
import { useInputValue } from "@hooks/useInputValue"; | ||
import { MouseEvent } from "react"; | ||
import { postNewFolder } from "@data-access/postNewFolder"; | ||
|
||
export function AddFolder({ handleCloseModal }: BaseModalProps) { | ||
const { insertValue, onChange } = useInputValue(); | ||
const queryClient = useQueryClient(); | ||
const createFolderMutation = useMutation({ | ||
mutationFn: (createFolderName: string) => | ||
postNewFolder({ folderName: createFolderName }), | ||
onSuccess: () => { | ||
queryClient.invalidateQueries({ | ||
queryKey: ["folderList"], | ||
}); | ||
}, | ||
}); | ||
|
||
const handleCreateNewFolder = async ( | ||
event: MouseEvent<HTMLButtonElement> | ||
) => { | ||
const createFolderName = insertValue; | ||
|
||
createFolderMutation.mutate(createFolderName); | ||
handleCloseModal(event); | ||
}; | ||
|
||
return ( | ||
<Modal title={"폴더 추가"} handleCloseModal={handleCloseModal}> | ||
<ModalInput | ||
value={insertValue} | ||
onChange={onChange} | ||
placeholder="내용 입력" | ||
type="text" | ||
></ModalInput> | ||
<PrimaryButton type="button" onClick={handleCreateNewFolder}> | ||
추가하기 | ||
</PrimaryButton> | ||
</Modal> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./AddFolder"; |
11 changes: 0 additions & 11 deletions
11
components/common/Modals/AddFolderContent/AddFolderContent.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,67 @@ | ||
import { ModalButtonBlue } from "../ModalElements/ModalButtonBlue"; | ||
import * as S from "./AddToFolderStyled"; | ||
import Modal from "../Modal"; | ||
import { AddToFolderProps } from "../ModalProp"; | ||
import { PrimaryButton } from "@styles/common/PrimaryButton"; | ||
import { useMutation, useQueryClient } from "@tanstack/react-query"; | ||
import { MouseEvent, useEffect, useState } from "react"; | ||
import { postAddToFolder } from "@data-access/postAddToFolder"; | ||
|
||
export function AddToFolder({ | ||
linkURL, | ||
folderList, | ||
handleCloseModal, | ||
handleReset, | ||
}: AddToFolderProps) { | ||
const [selectFolderId, setSelectFolderId] = useState<number>(); | ||
const queryClient = useQueryClient(); | ||
const addToFolderMutation = useMutation({ | ||
mutationFn: ({ url, folderId }: { url: string; folderId: number }) => | ||
postAddToFolder({ url, folderId }), | ||
onSuccess: () => { | ||
queryClient.invalidateQueries({ | ||
queryKey: [`folderContents-${selectFolderId}`], | ||
}); | ||
queryClient.invalidateQueries({ | ||
queryKey: [`folderContents-${""}`], | ||
}); | ||
}, | ||
}); | ||
|
||
const handleFolderId = (event: MouseEvent<HTMLButtonElement>) => { | ||
setSelectFolderId(Number(event.currentTarget.id)); | ||
}; | ||
|
||
const handleAddToFolder = async (event: MouseEvent<HTMLButtonElement>) => { | ||
if (linkURL && selectFolderId) { | ||
addToFolderMutation.mutate({ url: linkURL, folderId: selectFolderId }); | ||
handleCloseModal(event); | ||
handleReset(); | ||
} | ||
codingaring marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
|
||
export function AddToFolder({ linkURL, data }: AddToFolderProps) { | ||
return ( | ||
<> | ||
<Modal handleCloseModal={handleCloseModal} title={"폴더에 추가"}> | ||
<S.SelectLink>{linkURL}</S.SelectLink> | ||
<S.FolderListContainer> | ||
{data?.map((folder) => ( | ||
<S.SelectFolder key={folder.id}> | ||
<S.FolderName>{folder.name}</S.FolderName> | ||
<S.FolderCount>{folder.link.count}개 링크</S.FolderCount> | ||
<S.SelectFolderIcon /> | ||
</S.SelectFolder> | ||
))} | ||
{folderList?.map((folder) => { | ||
console.log(selectFolderId === folder.id); | ||
return ( | ||
<S.SelectFolder | ||
id={folder.id} | ||
key={folder.id} | ||
onClick={handleFolderId} | ||
isSelect={selectFolderId === Number(folder.id)} | ||
> | ||
<S.FolderName>{folder.name}</S.FolderName> | ||
<S.FolderCount>{folder.link_count}개 링크</S.FolderCount> | ||
<S.SelectFolderIcon /> | ||
</S.SelectFolder> | ||
); | ||
})} | ||
</S.FolderListContainer> | ||
<ModalButtonBlue type="button">삭제하기</ModalButtonBlue> | ||
</> | ||
<PrimaryButton type="button" onClick={handleAddToFolder}> | ||
추가하기 | ||
</PrimaryButton> | ||
</Modal> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,36 @@ | ||
import * as S from "./DeleteFolderStyled"; | ||
import { ModalButtonRed } from "../ModalElements/ModalButtonRed"; | ||
import { DeleteFolderProps } from "../ModalProp"; | ||
import Modal from "../Modal"; | ||
import { useMutation, useQueryClient } from "@tanstack/react-query"; | ||
import { MouseEvent } from "react"; | ||
import { deleteFolder } from "@data-access/deleteFolder"; | ||
|
||
export default function DeleteFolder({ | ||
selectFolder, | ||
folderId, | ||
handleCloseModal, | ||
}: DeleteFolderProps) { | ||
const queryClient = useQueryClient(); | ||
const deleteFolderMutation = useMutation({ | ||
mutationFn: ({ folderId }: { folderId: number | string }) => | ||
deleteFolder({ folderId }), | ||
onSuccess: () => { | ||
queryClient.invalidateQueries({ | ||
queryKey: ["folderList"], | ||
}); | ||
}, | ||
}); | ||
|
||
const handleDeleteFolder = (event: MouseEvent<HTMLButtonElement>) => { | ||
deleteFolderMutation.mutate({ folderId: folderId }); | ||
handleCloseModal(event); | ||
}; | ||
|
||
export default function DeleteFolder({ selectFolder }: DeleteFolderProps) { | ||
return ( | ||
<> | ||
<Modal title="폴더 삭제" handleCloseModal={handleCloseModal}> | ||
<S.DeleteFolderSubtitle>{selectFolder}</S.DeleteFolderSubtitle> | ||
<ModalButtonRed>삭제하기</ModalButtonRed> | ||
</> | ||
<ModalButtonRed onClick={handleDeleteFolder}>삭제하기</ModalButtonRed> | ||
</Modal> | ||
); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Query Key 관리하는건 tkdodo 형님의 이 글이 바이블처럼 여겨지는거 같아서 읽어보시고 적용해보시는걸 추천드립니다!