-
Notifications
You must be signed in to change notification settings - Fork 1
[FEAT] 강사 시안 페이지 퍼블리싱 #32
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
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4a9b19c
#31 [FEAT] 시안 제출 현황 행에 버튼 조건부 렌더링 및 동적 라우팅 추가
waldls 46f4d8d
#31 [FEAT] 시안 카드 컴포넌트 구현 및 사이드바 활성화 유지
waldls 560b826
#31 [FEAT] 시안 선택 상태 관리 및 제출하기 버튼 조건부 활성화[
waldls 5d2003a
#31 [FEAT] commissionId 기반 시안 목데이터 연결 및 동적 타이틀 표시
waldls 53eefba
#31 [FEAT] 시안 카드 자세히보기 클릭 시 DraftModal 연결 및 시안 상세 목데이터 추가
waldls e614da4
#31 [CHORE] 시안 선택, 수정사항 제출 버튼 활성화 시 홈으로 라우팅 추가
waldls e30f198
#31 [CHORE] index.ts 절대 경로를 상대 경로로 변경
waldls 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| "use client"; | ||
|
|
||
| import { notFound, useRouter } from "next/navigation"; | ||
| import { use, useState } from "react"; | ||
|
|
||
| import { commissionDraftsData } from "@/features/instructor/choose"; | ||
| import Button from "@/shared/ui/Button"; | ||
| import { DraftCheckSection } from "@/widgets/instructor/choose"; | ||
|
|
||
| interface PageProps { | ||
| params: Promise<{ commissionId: string }>; | ||
| } | ||
|
|
||
| const Page = ({ params }: PageProps) => { | ||
| const router = useRouter(); | ||
| const { commissionId } = use(params); | ||
| const [selectedIndex, setSelectedIndex] = useState<number | null>(null); | ||
|
|
||
| const commission = commissionDraftsData.find(c => c.commissionId === Number(commissionId)); | ||
|
|
||
| if (!commission) return notFound(); | ||
|
|
||
| return ( | ||
| <div className="mx-auto flex w-235 flex-col items-center gap-10 pt-16"> | ||
| <div> | ||
| <h1 className="text-title2-sb mb-6.5 w-full py-4 text-left text-black"> | ||
| {commission.title} | ||
| </h1> | ||
| <DraftCheckSection | ||
| drafts={commission.drafts} | ||
| selectedIndex={selectedIndex} | ||
| onSelect={setSelectedIndex} | ||
| /> | ||
| </div> | ||
| <Button | ||
| variant={selectedIndex !== null ? "medium_primary" : "medium_disabled"} | ||
| className="w-fit self-end" | ||
| onClick={selectedIndex !== null ? () => router.push("/instructor") : undefined} | ||
| > | ||
| 제출하기 | ||
| </Button> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default Page; |
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,3 @@ | ||
| export type { CommissionWithDrafts, Draft, DraftDetail } from "./model/choose"; | ||
| export { commissionDraftsData, draftDetailsData } from "./model/choose"; | ||
| export { default as DraftCard } from "./ui/DraftCard"; |
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,144 @@ | ||
| // [강사] 제출된 1차 시안 목록 조회 | ||
| export type Draft = { | ||
| draftId: number; | ||
| thumbnailUrl: string; | ||
| }; | ||
|
|
||
| export type CommissionWithDrafts = { | ||
| commissionId: number; | ||
| title: string; | ||
| drafts: Draft[]; | ||
| }; | ||
|
|
||
| export const commissionDraftsData: CommissionWithDrafts[] = [ | ||
| { | ||
| commissionId: 11, | ||
| title: "해커스톡 왕초보 영어 - 기초 문법편", | ||
| drafts: [ | ||
| { draftId: 41, thumbnailUrl: "/images/thumbnail_mock.jpg" }, | ||
| { draftId: 42, thumbnailUrl: "/images/thumbnail_mock.jpg" }, | ||
| { draftId: 43, thumbnailUrl: "/images/thumbnail_mock.jpg" }, | ||
| { draftId: 44, thumbnailUrl: "/images/thumbnail_mock.jpg" }, | ||
| ], | ||
| }, | ||
| { | ||
| commissionId: 15, | ||
| title: "고등 국어 문학 - 현대시 집중", | ||
| drafts: [ | ||
| { draftId: 51, thumbnailUrl: "/images/thumbnail_mock.jpg" }, | ||
| { draftId: 52, thumbnailUrl: "/images/thumbnail_mock.jpg" }, | ||
| { draftId: 53, thumbnailUrl: "/images/thumbnail_mock.jpg" }, | ||
| { draftId: 54, thumbnailUrl: "/images/thumbnail_mock.jpg" }, | ||
| { draftId: 55, thumbnailUrl: "/images/thumbnail_mock.jpg" }, | ||
| ], | ||
| }, | ||
| ]; | ||
|
|
||
| // [강사] 제출된 1차 시안 상세 조회 | ||
| export type DraftDetail = { | ||
| commissionId: number; | ||
| draftId: number; | ||
| fileUrls: string[]; | ||
| }; | ||
|
|
||
| export const draftDetailsData: Record<number, DraftDetail> = { | ||
| 41: { | ||
| commissionId: 11, | ||
| draftId: 41, | ||
| fileUrls: [ | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| ], | ||
| }, | ||
| 42: { | ||
| commissionId: 11, | ||
| draftId: 42, | ||
| fileUrls: [ | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| ], | ||
| }, | ||
| 43: { | ||
| commissionId: 11, | ||
| draftId: 43, | ||
| fileUrls: [ | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| ], | ||
| }, | ||
| 44: { | ||
| commissionId: 11, | ||
| draftId: 44, | ||
| fileUrls: [ | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| ], | ||
| }, | ||
| 51: { | ||
| commissionId: 15, | ||
| draftId: 51, | ||
| fileUrls: [ | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| ], | ||
| }, | ||
| 52: { | ||
| commissionId: 15, | ||
| draftId: 52, | ||
| fileUrls: [ | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| ], | ||
| }, | ||
| 53: { | ||
| commissionId: 15, | ||
| draftId: 53, | ||
| fileUrls: [ | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| ], | ||
| }, | ||
| 54: { | ||
| commissionId: 15, | ||
| draftId: 54, | ||
| fileUrls: [ | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| ], | ||
| }, | ||
| 55: { | ||
| commissionId: 15, | ||
| draftId: 55, | ||
| fileUrls: [ | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| "/images/thumbnail_mock.jpg", | ||
| ], | ||
| }, | ||
| }; | ||
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,56 @@ | ||
| "use client"; | ||
|
|
||
| import { useState } from "react"; | ||
|
|
||
| import { draftDetailsData } from "@/features/instructor/choose"; | ||
| import Button from "@/shared/ui/Button"; | ||
| import DraftModal from "@/shared/ui/modal/DraftModal"; | ||
| import Thumbnail from "@/shared/ui/Thumbnail"; | ||
|
|
||
| interface DraftCardProps { | ||
| index: number; | ||
| draftId: number; | ||
| thumbnailUrl: string; | ||
| isSelected: boolean; | ||
| onSelect: (index: number) => void; | ||
| } | ||
|
|
||
| const DraftCard = ({ index, draftId, thumbnailUrl, isSelected, onSelect }: DraftCardProps) => { | ||
| const [isModalOpen, setIsModalOpen] = useState(false); | ||
|
|
||
| const detail = draftDetailsData[draftId]; | ||
|
|
||
| return ( | ||
| <> | ||
| <div className="border-gray-30 rounded-12 border-[1.5px] bg-white p-4"> | ||
| <div className="flex justify-between pb-6"> | ||
| <span className="text-gray-70 text-body1-sb">시안 {index + 1}</span> | ||
| <Button | ||
| variant="choose" | ||
| aria-pressed={isSelected} | ||
| className="w-fit" | ||
| onClick={() => onSelect(index)} | ||
| > | ||
| 이 디자인으로 할게요 | ||
| </Button> | ||
| </div> | ||
| <Thumbnail | ||
| src={thumbnailUrl} | ||
| alt={`시안 ${draftId}`} | ||
| className="h-63.75 w-full shrink-0" | ||
| onDetailClick={() => setIsModalOpen(true)} | ||
| /> | ||
| </div> | ||
| {detail && ( | ||
| <DraftModal | ||
| isOpen={isModalOpen} | ||
| onClose={() => setIsModalOpen(false)} | ||
| title={`시안 ${index + 1}`} | ||
| fileUrls={detail.fileUrls} | ||
| /> | ||
| )} | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export default DraftCard; |
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,16 +1,12 @@ | ||
| export { getDDay } from "@/features/instructor/home/lib/getDDay"; | ||
| export type { | ||
| DraftSubmissionItem, | ||
| MatchingItem, | ||
| ModifyingItem, | ||
| } from "@/features/instructor/home/model/home"; | ||
| export { getDDay } from "./lib/getDDay"; | ||
| export type { DraftSubmissionItem, MatchingItem, ModifyingItem } from "./model/home"; | ||
| export { | ||
| CATEGORY_DISPLAY_MAP, | ||
| draftSubmissionStatusData, | ||
| matchingStatusData, | ||
| modifyingStatusData, | ||
| } from "@/features/instructor/home/model/home"; | ||
| export { default as CommissionsHeader } from "@/features/instructor/home/ui/CommissionsHeader"; | ||
| export { default as DraftSubmissionStatusRow } from "@/features/instructor/home/ui/DraftSubmissionStatusRow"; | ||
| export { default as MatchingCommissionsRow } from "@/features/instructor/home/ui/MatchingCommissionsRow"; | ||
| export { default as ModifyingCommissionsRow } from "@/features/instructor/home/ui/ModifyingCommissionsRow"; | ||
| } from "./model/home"; | ||
| export { default as CommissionsHeader } from "./ui/CommissionsHeader"; | ||
| export { default as DraftSubmissionStatusRow } from "./ui/DraftSubmissionStatusRow"; | ||
| export { default as MatchingCommissionsRow } from "./ui/MatchingCommissionsRow"; | ||
| export { default as ModifyingCommissionsRow } from "./ui/ModifyingCommissionsRow"; |
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 |
|---|---|---|
| @@ -1,8 +1,4 @@ | ||
| export type { CommissionHistoryItem } from "@/features/instructor/my/model/my"; | ||
| export { | ||
| CATEGORY_BADGE_MAP, | ||
| commissionHistoryData, | ||
| PLAN_DISPLAY_MAP, | ||
| } from "@/features/instructor/my/model/my"; | ||
| export { default as CommissionsHeader } from "@/features/instructor/my/ui/CommissionsHeader"; | ||
| export { default as CommissionsHistoryRow } from "@/features/instructor/my/ui/CommissionsHistoryRow"; | ||
| export type { CommissionHistoryItem } from "./model/my"; | ||
| export { CATEGORY_BADGE_MAP, commissionHistoryData, PLAN_DISPLAY_MAP } from "./model/my"; | ||
| export { default as CommissionsHeader } from "./ui/CommissionsHeader"; | ||
| export { default as CommissionsHistoryRow } from "./ui/CommissionsHistoryRow"; |
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.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
exported 상수는 SCREAMING_SNAKE_CASE 명명 규칙을 따라야 합니다.
commissionDraftsData와draftDetailsData는 exported 상수이므로 프로젝트의 명명 규칙에 따라COMMISSION_DRAFTS_DATA와DRAFT_DETAILS_DATA로 작성해야 합니다.♻️ 제안하는 수정
이 변경을 적용하는 경우, 해당 상수를 import하는 모든 파일도 함께 수정해야 합니다:
src/features/instructor/choose/index.tssrc/features/instructor/choose/ui/DraftCard.tsxsrc/app/instructor/choose/[commissionId]/page.tsxBased on learnings: "exported constants should be named in SCREAMING_SNAKE_CASE (e.g., BASIC_INFO_FIELDS, PAGE_OPTIONS)."
Also applies to: 44-144
🤖 Prompt for AI Agents
Source: Learnings