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
14 changes: 9 additions & 5 deletions jobdri/src/app/apply/apply-type/ApplyTypePageClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,27 @@ export default function ApplyTypePageClient() {

const handleSubmit = () => {
if (selectedType === "real") {
router.push("/mock-application/jd-input");
router.push("/apply/virtual/new/jd-input");
return;
}

if (selectedType === "virtual") {
router.push("/apply/virtual/new/jd");
}
};

return (
<div className="min-h-screen bg-line-neutral-assistive px-6 py-6">
<div className="mx-auto flex min-h-[calc(100vh-48px)] w-[1280px] flex-col">
<div className="h-dvh overflow-hidden bg-line-neutral-assistive px-6 pt-6">
<div className="mx-auto flex h-full w-[1280px] flex-col">
<Header
currentStep={1}
leftAction={{
label: "돌아가기",
iconType: "HOME_S",
onClick: () => router.push("/mock-application"),
}}
/>

<section className="flex flex-1 flex-col items-center justify-start gap-8 self-stretch bg-bg-default px-[82px] pt-8 pb-20">
<section className="flex min-h-0 flex-1 flex-col items-center justify-start gap-8 self-stretch overflow-hidden bg-bg-default px-[82px] pt-8 pb-20">
<div className="flex max-w-[1440px] flex-col items-center gap-8 self-stretch">
<h2 className="text-center text-h24-bold text-text-neutral-title [font-feature-settings:'liga'_off,'clig'_off]">
유형을 선택해주세요.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ type ImageModalStep = "upload" | "reading" | "failed";

function isUrlFormat(value: string) {
const trimmedValue = value.trim();
if (!trimmedValue || /\s/.test(trimmedValue)) return false;

if (!trimmedValue || /\s/.test(trimmedValue)) {
return false;
}

const valueWithProtocol = /^[a-zA-Z][a-zA-Z\d+.-]*:\/\//.test(trimmedValue)
? trimmedValue
: `https://${trimmedValue}`;

try {
const url = new URL(valueWithProtocol);

return (
["http:", "https:"].includes(url.protocol) && url.hostname.includes(".")
);
Expand Down Expand Up @@ -59,21 +65,28 @@ const JdInputPageClient = forwardRef<
setIsLinkModalOpen(true);
return;
}

if (selectedMethod === "image") {
setSelectedImageFile(null);
setImageModalStep("upload");
setIsImageModalOpen(true);
return;
}

if (selectedMethod === "manual") {
router.push(manualJdReviewPath);
}
};

useImperativeHandle(ref, () => ({ handleCtaClick }));

const closeLinkModal = () => setIsLinkModalOpen(false);
const closeImageModal = () => setIsImageModalOpen(false);
const closeLinkModal = () => {
setIsLinkModalOpen(false);
};

const closeImageModal = () => {
setIsImageModalOpen(false);
};

const resetToUploadStart = () => {
setIsLinkModalOpen(false);
Expand All @@ -85,11 +98,14 @@ const JdInputPageClient = forwardRef<
setSelectedImageFile(null);
};

const returnToUploadedImage = () => {
const cancelImageReading = () => {
setIsLinkModalOpen(false);
setIsImageModalOpen(true);
onMethodChange("image");
setIsImageModalOpen(false);
setImageModalStep("upload");

if (document.fullscreenElement) {
void document.exitFullscreen();
}
};

const restartImageUpload = () => {
Expand All @@ -101,45 +117,45 @@ const JdInputPageClient = forwardRef<
};

const submitLinkInput = () => {
if (!hasLinkText) return;
if (!hasLinkText) {
return;
}

if (!isUrlFormat(jdLink)) {
setLinkModalStep("failed");
return;
}

setLinkModalStep("reading");
};

const selectMethodFromFailure = (method: JdInputMethod) => {
onMethodChange(method);

if (method === "link") {
setJdLink("");
setLinkModalStep("input");
setIsImageModalOpen(false);
setIsLinkModalOpen(true);
return;
}

if (method === "image") {
setSelectedImageFile(null);
setImageModalStep("upload");
setIsLinkModalOpen(false);
setIsImageModalOpen(true);
return;
}

router.push(manualJdReviewPath);
};

return (
<>
<div className="flex-1 bg-line-neutral-assistive px-6 py-6">
<div className="mx-auto flex w-[1280px] flex-col">
<Header
currentStep={2}
leftAction={{
label: "돌아가기",
iconType: "HOME_S",
onClick: () => router.push("/"),
}}
/>
<Header currentStep={2} />

<section className="flex flex-1 flex-col items-center gap-8 self-stretch bg-bg-default px-[82px] pt-8 pb-20">
<div className="flex w-[1116px] max-w-[1440px] flex-col items-center gap-8">
Expand Down Expand Up @@ -271,8 +287,8 @@ const JdInputPageClient = forwardRef<
value=""
onChange={() => undefined}
onSubmit={restartImageUpload}
onCancel={returnToUploadedImage}
onClose={returnToUploadedImage}
onCancel={cancelImageReading}
onClose={cancelImageReading}
title="이미지를 읽고 있습니다"
description="이미지가 부적절한 경우 제대로 추출되지 않을 수 있습니다"
submitLabel="다시 입력하기"
Expand Down
21 changes: 9 additions & 12 deletions jobdri/src/app/apply/virtual/[id]/questions/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@
import { use, useState } from "react";
import { useRouter } from "next/navigation";
import { Footer } from "@/components/common/footer";
import SelectQuestion from "@/components/apply/SelectQuestion";
import SelectQuestion, { type Question } from "@/components/apply/SelectQuestion";
import Header from "@/components/common/header/Header";

interface Question {
id: string;
question: string;
maxLength?: number;
}

interface QuestionsPageProps {
params: Promise<{ id: string }>;
}
Expand All @@ -22,22 +16,25 @@ export default function QuestionsPage({ params }: QuestionsPageProps) {
const [selectedQuestions, setSelectedQuestions] = useState<Question[]>([]);

const handleConfirm = () => {
sessionStorage.setItem("selectedQuestions", JSON.stringify(selectedQuestions));
sessionStorage.setItem(
"selectedQuestions",
JSON.stringify(selectedQuestions),
);
router.push(`/apply/virtual/${id}/write`);
};

return (
<div className="min-h-screen flex flex-col bg-bg-default">
<div className="flex min-h-screen flex-col bg-bg-default">
<Header currentStep={4} />
<main className="flex-1 max-w-[1116px] w-full mx-auto">
<main className="mx-auto w-full max-w-[1116px] flex-1">
<SelectQuestion
onSelectionChange={() => {}}
onSelectionChange={() => undefined}
onQuestionsChange={setSelectedQuestions}
/>
</main>
<Footer
ctaLabel="확정하기"
backAction={{ href: `/apply/virtual/${id}/jd` }}
backAction={{ href: `/apply/virtual/${id}/jd-review` }}
ctaAction={{
disabled: selectedQuestions.length === 0,
onClick: handleConfirm,
Expand Down
18 changes: 9 additions & 9 deletions jobdri/src/app/apply/virtual/[id]/write/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,17 @@ export default function WritePage({ params }: WritePageProps) {
const handleSubmit = () => {
if (inputRef.current?.hasUnderThreshold()) {
setShowModal(true);
} else {
router.push(`/apply/virtual/${id}/result`);
return;
}

router.push(`/apply/virtual/${id}/result`);
};

return (
<div className="min-h-screen flex flex-col bg-bg-default">
<div className="flex min-h-screen flex-col bg-bg-default">
<Header currentStep={5} />
<main className="flex-1 max-w-[1116px] w-full mx-auto">
<InputSection
ref={inputRef}
onAllCompleteChange={setAllComplete}
/>
<main className="mx-auto w-full max-w-[1116px] flex-1">
<InputSection ref={inputRef} onAllCompleteChange={setAllComplete} />
</main>
<Footer
ctaLabel="제출하기"
Expand All @@ -51,7 +49,9 @@ export default function WritePage({ params }: WritePageProps) {
<ModalNotice
variant="double"
title="글자 수가 부족합니다."
description={"글자 수가 부족하면 채점 결과에\n부정적인 영향을 줄 수 있습니다."}
description={
"글자 수가 부족하면 채점 결과에\n부정적인 영향을 줄 수 있습니다."
}
onClose={() => setShowModal(false)}
secondaryAction={{
label: "계속 작성하기",
Expand Down
Loading