-
Notifications
You must be signed in to change notification settings - Fork 37
[김찬기] Sprint 11 #314
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
Merged
Lanace
merged 24 commits into
codeit-bootcamp-frontend:Next-김찬기
from
cksrlcks:Next-김찬기-sprint11
Jan 28, 2025
The head ref may contain hidden characters: "Next-\uAE40\uCC2C\uAE30-sprint11"
Merged
[김찬기] Sprint 11 #314
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
04eeca5
refactor(mentor): form을 사용하는쪽에서 주입해서 기능이 변하도록 수정
cksrlcks b11110c
refactor(mentor): Form컴포넌트 타입 개선
cksrlcks cb1d137
refactor(mentor): message 타입 개선
cksrlcks 63e3b83
refactor: 이미지 업로드 컴포넌트 리팩토링
cksrlcks 5abc252
refactor: tags 인풋 컴포넌트 리팩토링
cksrlcks 38fddfa
refactor: useActionState 제거 및 react hook form의 submit에서 server action 사용
cksrlcks a146ec4
refactor: react-query queryclient 생성 방법 변경
cksrlcks bccb719
refactor: 자유게시판 리스트 레이아웃 컴포넌트명 수정
cksrlcks 7be290d
feat: 내정보 페이지 작업
cksrlcks 7a5d3d2
feat: 헤더 프로필 드롭메뉴에 내정보페이지 링크 추가
cksrlcks f3a4d46
refactor: 유저정보조회를 auth service에서 분리
cksrlcks 18d27a2
feat: 아바타 컴포넌트 개선 (추가 classname을 받도록)
cksrlcks 227b753
feat: 유저활동 컴포넌트 작업
cksrlcks 60deb35
fix: 서버용 axios 인터셉터 위치 수정
cksrlcks 5ae77e0
feat: 비밀번호 수정 페이지 작업
cksrlcks b99bb77
feat: 프로필 변경 기능 작업
cksrlcks 83949da
fix: 헤더 프로필 버튼 수정
cksrlcks 1ac3032
feat: 미들웨어 추가 (비밀번호 변경, 프로필 변경 페이지)
cksrlcks 1e7c814
refactor: axios 인터셉터 리팩토링
cksrlcks c09aded
refactor: 불필요한 코드 지우기
cksrlcks 1184ac3
fix: 서버액션에서 로그인후 클라이언트 세션이 업데이트 안되는 현상 수정
cksrlcks 3ee9121
feat: 마이페이지 로딩 추가
cksrlcks fe90213
feat: 마이페이지 버튼구역 컴포넌트 추가
cksrlcks 877251e
feat: 프로필 사진을 교체 안했으면, 제출 못하도록 수정
cksrlcks 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,10 @@ | ||
"use client"; | ||
|
||
import ArticleForm from "./ArticleForm"; | ||
import useArticleActions from "./useArticleActions"; | ||
|
||
export default function ArticleAddForm() { | ||
const { handleArticleAdd } = useArticleActions(); | ||
|
||
return <ArticleForm mode="add" onFormSubmit={handleArticleAdd} />; | ||
} |
This file contains hidden or 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 |
---|---|---|
|
@@ -14,24 +14,24 @@ import { zodResolver } from "@hookform/resolvers/zod"; | |
import { Article } from "@/types/article"; | ||
import { FieldAdapter } from "@components/adaptor/rhf"; | ||
import { useRouter } from "next/navigation"; | ||
import useArticleActions from "./useArticleActions"; | ||
import { ArticleFormSchema, ArticleFormType } from "@/schemas/article"; | ||
|
||
interface ArticleFormProps { | ||
initialData?: Article; | ||
mode?: "add" | "edit"; | ||
articleId?: number; | ||
interface ArticleAddFormProps { | ||
mode: "add"; | ||
onFormSubmit: (data: ArticleFormType) => Promise<Article | undefined>; | ||
} | ||
interface ArticleModifyFormProps { | ||
initialData: Article; | ||
mode: "edit"; | ||
onFormSubmit: (data: ArticleFormType) => Promise<Article | undefined>; | ||
} | ||
|
||
type ArticleFormProps = ArticleAddFormProps | ArticleModifyFormProps; | ||
Comment on lines
+19
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 타입스크립트가 잘 추론해서 사용할 수 있도록 해주셨네요ㅎㅎ! |
||
|
||
export default function ArticleForm({ | ||
initialData, | ||
mode = "add", | ||
articleId, | ||
}: ArticleFormProps) { | ||
export default function ArticleForm(props: ArticleFormProps) { | ||
const { mode, onFormSubmit } = props; | ||
const initialData = mode === "edit" ? props.initialData : undefined; | ||
const router = useRouter(); | ||
const { handleArticleAdd, handleArticleModify } = | ||
useArticleActions(articleId); | ||
const onFormSubmit = mode === "add" ? handleArticleAdd : handleArticleModify; | ||
|
||
const { | ||
control, | ||
|
@@ -103,7 +103,16 @@ export default function ArticleForm({ | |
<FieldAdapter | ||
name="image" | ||
control={control} | ||
render={(props) => <ImageUpload {...props} />} | ||
render={(props) => ( | ||
<ImageUpload | ||
{...props} | ||
value={props.value} | ||
onChange={(file) => { | ||
props.onChange(file); | ||
props.onBlur(); | ||
}} | ||
/> | ||
)} | ||
/> | ||
</FieldItem> | ||
</Section.Content> | ||
|
21 changes: 21 additions & 0 deletions
21
src/app/(common)/(board)/_components/ArticleModifyForm.tsx
This file contains hidden or 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,21 @@ | ||
"use client"; | ||
|
||
import { Article } from "@/types/article"; | ||
import ArticleForm from "./ArticleForm"; | ||
import useArticleActions from "./useArticleActions"; | ||
|
||
export default function ArticleModifyForm({ | ||
initialData, | ||
}: { | ||
initialData: Article; | ||
}) { | ||
const { handleArticleModify } = useArticleActions(initialData.id); | ||
|
||
return ( | ||
<ArticleForm | ||
mode="edit" | ||
onFormSubmit={handleArticleModify} | ||
initialData={initialData} | ||
/> | ||
); | ||
} |
This file contains hidden or 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,10 +1,10 @@ | ||
import { PageWrapper } from "@/components/Page"; | ||
import ArticleForm from "../_components/ArticleForm"; | ||
import ArticleAddForm from "../_components/ArticleAddForm"; | ||
|
||
export default function AddBoardPage() { | ||
return ( | ||
<PageWrapper> | ||
<ArticleForm mode="add" /> | ||
<ArticleAddForm /> | ||
</PageWrapper> | ||
); | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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,10 @@ | ||
"use client"; | ||
|
||
import ProductForm from "./ProductForm"; | ||
import useProductActions from "./useProductActions"; | ||
|
||
export default function ProductAddForm() { | ||
const { handleProductAdd } = useProductActions(); | ||
|
||
return <ProductForm mode="add" onFormSubmit={handleProductAdd} />; | ||
} |
Oops, something went wrong.
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.
오.... Form 공통화를 이렇게 해두니 사용하기 편하게 잘 하셨네요ㅎㅎ!