Skip to content
Open
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
Empty file removed src/api/Visaclient.js
Empty file.
54 changes: 5 additions & 49 deletions src/api/visa.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,6 @@
// src/api/visa.js
const BASE = "https://crossbiz.store"; // or "https://www.crossbiz.store"
import axiosInstance from "@/lib/axiosInstance";

export async function fetchVisaRecommendWith() {
const payload = {
basicInfo: {
userId: 2,
age: 35,
bizStatus: "창업예정",
nationality: "미국",
status: "D-10",
bizCategory: "음식점업",
estimatePeriod: 24,
workExperience: 5,
degree: "석사",
koreanLevel: "TOPIK 5급",
},
withVisaInfo: {
stayPeriod: "2년",
visaType: "D-10",
issuedDate: "2023-06-01",
expiryDate: "2025-06-01",
businessRegNumber: "123-45-67890",
annualRevenue: 80000000,
employeeCount: 3,
},
};

try {
const res = await fetch(`${BASE}/api/visa/recommend/without`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});

// 상태코드 확인
if (!res.ok) {
const text = await res.text().catch(() => "");
throw new Error(`HTTP ${res.status} ${res.statusText} :: ${text}`);
}

const data = await res.json();
console.log("✅ /api/visa/recommend/with 응답:", data);
return data;
} catch (err) {
// CORS / 네트워크 오류 로그
console.error("❌ API 호출 실패:", err);
return null;
}
}
export const fetchVisaRecommendWith = async (payload)=> {
const response = await axiosInstance.post('/visa/recommend/with',payload);
return response.data;
};
22 changes: 3 additions & 19 deletions src/components/CardList.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// src/components/CardList.jsx
import React, { useEffect, useState, useCallback } from "react";
import { useNavigate, useLocation } from "react-router-dom";
import GoodIcon from "../assets/good.svg";
import WarnIcon from "../assets/warning.svg";
import HotBadge from "../assets/Hot.svg";
import PurpleIcon from "../assets/purpleIcon.svg";


export default function CardList({ items = [], from: fromProp }) {
const [selectedIdx, setSelectedIdx] = useState(null);
const [open, setOpen] = useState(false);
Expand All @@ -19,7 +17,6 @@ export default function CardList({ items = [], from: fromProp }) {
setOpen(true);
}, []);

// ESC 로 닫기
useEffect(() => {
const onKey = (e) => e.key === "Escape" && setOpen(false);
window.addEventListener("keydown", onKey);
Expand All @@ -28,13 +25,10 @@ export default function CardList({ items = [], from: fromProp }) {

const selectedItem = selectedIdx != null ? items[selectedIdx] : null;

// 상세로 이동 (from을 함께 전달)
const goDetail = (item) => {
const name = item?.code || item?.name || "";
const encoded = encodeURIComponent(name);
nav(`/visa-info?name=${encoded}`, { state: { from } });
// 필요하면 모달도 닫기
// setOpen(false);
};

return (
Expand All @@ -45,7 +39,7 @@ export default function CardList({ items = [], from: fromProp }) {

return (
<article
key={idx}
key={`${item.code}-${idx}`}
onClick={() => onSelect(idx)}
className={[
"cursor-pointer rounded-2xl shadow-[0_6px_24px_rgba(0,0,0,0.08)] overflow-visible border-2 transition-colors",
Expand All @@ -55,18 +49,15 @@ export default function CardList({ items = [], from: fromProp }) {
backgroundColor: isSelected ? "rgba(101,78,255,0.10)" : "#FFFFFF",
}}
>
{/* 헤더 + 배지 기준 컨테이너 */}
<div className="relative w-full">
{/* 🔥 인덱스 0일 때만, 헤더 왼쪽 ‘밖’ 중앙에 배치 */}
{idx === 0 && (
<img
src={HotBadge}
alt="가장 유력한 후보"
className="pointer-events-none absolute z-10 drop-shadow-md h-15 w-auto -left-6 -top-16"
/>
/>
)}

{/* 헤더: 1번 파랑, 나머지 회색 */}
<div
className={`w-full px-3 py-2 text-[15px] font-bold ${
idx === 0 ? "bg-[#4170FF] text-white" : "bg-[#6E6E6E] text-white"
Expand All @@ -76,9 +67,7 @@ export default function CardList({ items = [], from: fromProp }) {
</div>
</div>

{/* 본문 */}
<div className="p-2">
{/* 추천이유 */}
{item.reasons?.length > 0 && (
<section className="mt-2">
<header className="flex items-center gap-2 mb-1">
Expand All @@ -95,7 +84,6 @@ export default function CardList({ items = [], from: fromProp }) {
</section>
)}

{/* 주의 */}
{item.warnings?.length > 0 && (
<section className="mt-3">
<header className="flex items-center gap-2 mb-1">
Expand All @@ -117,7 +105,7 @@ export default function CardList({ items = [], from: fromProp }) {
})}
</div>

{/* --- 하단 모달 (fixed) --- */}
{/* 하단 모달 */}
<div
className={[
"fixed inset-x-0 bottom-0 z-[999]",
Expand All @@ -129,13 +117,11 @@ export default function CardList({ items = [], from: fromProp }) {
<div className="p-5">
{selectedItem ? (
<>
{/* 상단: 왼쪽 텍스트 / 오른쪽 아이콘 */}
<div className="flex items-center justify-between relative">
<h4 className="text-[15px] font-bold text-gray-900 self-center mt-2">
{selectedItem.code || selectedItem.name}
</h4>

{/* 아이콘 (클릭 시 상세로 이동 + from 전달) */}
<div className="shrink-0 flex ml-3 self-center">
<img
src={PurpleIcon}
Expand All @@ -146,15 +132,13 @@ export default function CardList({ items = [], from: fromProp }) {
</div>
</div>

{/* 링크 */}
<p
className="mt-1 inline-block text-[12px] font-medium"
style={{ color: "#654EFF" }}
>
상세 설명 및 준비서류 보러가기
</p>

{/* 요약 있으면 출력 */}
{selectedItem.summary && (
<p className="mt-3 text-[12px] leading-5 text-gray-700">
{selectedItem.summary}
Expand Down
Loading