Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion src/features/home/components/HomeInfoList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const LOCKER_ASSIGNMENT_STATUSES: Record<
HomeLockerStatus,
LockerAssignmentStatus
> = {
APPLICABLE: "applicable",
ASSIGNED: "assigned",
EXPIRED: "expired",
NOT_APPLIED: "none",
Expand All @@ -36,7 +37,7 @@ function selectMyInfo({ studentFee, openFeedback, locker }: HomeResponse) {
interface InfoBadge {
label: string;
// 없으면 neutral(회색) 배지
color?: "orange" | "red" | "green";
color?: "blue" | "orange" | "red" | "green";
}

function InfoBadgeView({ badge }: { badge: InfoBadge }) {
Expand Down
5 changes: 3 additions & 2 deletions src/features/lockers/constants/lockers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ import type { LockerAssignmentStatus } from "@/shared/entities/lockers/lockersTy

// 사물함 배정 상태 배지 — 사물함 배정 상태 화면과 홈 내 정보 목록(HomeInfoList)이 같이 쓴다.
// color가 없으면 회색(neutral) 배지다.
// Figma: 사물함 배정 상태 뱃지 (nodeId 3147:146479)
// Figma: 사물함 배정 상태 뱃지 (nodeId 5365:90808)
// satisfies로 두어 상태별 값(예: 배정완료는 green)이 타입에 그대로 남는다
export const LOCKER_STATUS_BADGES = {
applicable: { color: "blue", label: "신청가능" },
assigned: { color: "green", label: "배정완료" },
expired: { color: "red", label: "기간종료" },
none: { label: "미신청" },
} as const satisfies Record<
LockerAssignmentStatus,
{ label: string; color?: "red" | "green" }
{ label: string; color?: "blue" | "red" | "green" }
>;

// 사물함 배정 상태·내 사물함(위치 보기) 화면 경로
Expand Down
4 changes: 2 additions & 2 deletions src/shared/entities/home/homeQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export const homeResponseSchema = z.looseObject({
// 작성한 열린피드백 질문 수
openFeedback: z.looseObject({ writtenCount: z.number() }),
locker: z.looseObject({
// 신청한 적이 없으면 NOT_APPLIED
status: z.enum(["NOT_APPLIED", "ASSIGNED", "EXPIRED"]),
// 신청이 시작된 가장 최근 회차 기준 — 신청 기간인데 신청하지 않았으면 APPLICABLE, 그 밖에 신청하지 않았으면 NOT_APPLIED
status: z.enum(["NOT_APPLIED", "APPLICABLE", "ASSIGNED", "EXPIRED"]),
// 배정된 사물함 이름. ASSIGNED일 때만 있다
lockerNumber: z.string().nullable(),
}),
Expand Down
10 changes: 7 additions & 3 deletions src/shared/entities/lockers/lockersTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
// 내 사물함 배정 — 신청하면 바로 확정이라 배정대기 상태가 없다. 신청하지 않았으면 null.
export interface LockerAssignment {
semester: string;
status: Exclude<LockerAssignmentStatus, "none">;
status: Exclude<LockerAssignmentStatus, "none" | "applicable">;
appliedAt: string;
usageStartDate: string;
usageEndDate: string;
Expand All @@ -24,8 +24,12 @@ export interface LockerAssignment {
sectionId: number;
}

// 홈 내 정보 목록의 사물함 배정 상태 — 미신청 · 배정완료 · 기간종료
export type LockerAssignmentStatus = "none" | "assigned" | "expired";
// 홈 내 정보 목록의 사물함 배정 상태 — 미신청 · 신청가능 · 배정완료 · 기간종료
export type LockerAssignmentStatus =
| "none"
| "applicable"
| "assigned"
| "expired";

export type LockerApplyStatus = (typeof LOCKER_APPLY_STATUSES)[number];
export type LockerAvailabilityStatus =
Expand Down
Loading