diff --git a/.yarn/cache/@esbuild-darwin-x64-npm-0.24.2-c22048f235-10c0.zip b/.yarn/cache/@esbuild-win32-x64-npm-0.24.2-ebb554ef13-10c0.zip
similarity index 63%
rename from .yarn/cache/@esbuild-darwin-x64-npm-0.24.2-c22048f235-10c0.zip
rename to .yarn/cache/@esbuild-win32-x64-npm-0.24.2-ebb554ef13-10c0.zip
index b471e26..f43fccb 100644
Binary files a/.yarn/cache/@esbuild-darwin-x64-npm-0.24.2-c22048f235-10c0.zip and b/.yarn/cache/@esbuild-win32-x64-npm-0.24.2-ebb554ef13-10c0.zip differ
diff --git a/.yarn/cache/@rollup-rollup-darwin-x64-npm-4.34.8-ae395fd2ea-10c0.zip b/.yarn/cache/@rollup-rollup-darwin-x64-npm-4.34.8-ae395fd2ea-10c0.zip
deleted file mode 100644
index 6993fa1..0000000
Binary files a/.yarn/cache/@rollup-rollup-darwin-x64-npm-4.34.8-ae395fd2ea-10c0.zip and /dev/null differ
diff --git a/.yarn/cache/@rollup-rollup-win32-x64-msvc-npm-4.34.8-2047556725-10c0.zip b/.yarn/cache/@rollup-rollup-win32-x64-msvc-npm-4.34.8-2047556725-10c0.zip
new file mode 100644
index 0000000..2f23753
Binary files /dev/null and b/.yarn/cache/@rollup-rollup-win32-x64-msvc-npm-4.34.8-2047556725-10c0.zip differ
diff --git a/.yarn/cache/@swc-core-darwin-x64-npm-1.10.18-706d6e1278-10c0.zip b/.yarn/cache/@swc-core-win32-x64-msvc-npm-1.10.18-94664ff762-10c0.zip
similarity index 63%
rename from .yarn/cache/@swc-core-darwin-x64-npm-1.10.18-706d6e1278-10c0.zip
rename to .yarn/cache/@swc-core-win32-x64-msvc-npm-1.10.18-94664ff762-10c0.zip
index 06ba2c5..5249dec 100644
Binary files a/.yarn/cache/@swc-core-darwin-x64-npm-1.10.18-706d6e1278-10c0.zip and b/.yarn/cache/@swc-core-win32-x64-msvc-npm-1.10.18-94664ff762-10c0.zip differ
diff --git a/.yarn/cache/fsevents-patch-6b67494872-10c0.zip b/.yarn/cache/fsevents-patch-6b67494872-10c0.zip
deleted file mode 100644
index 996683a..0000000
Binary files a/.yarn/cache/fsevents-patch-6b67494872-10c0.zip and /dev/null differ
diff --git a/src/components/SearchBar.jsx b/src/components/SearchBar.jsx
index e8be1ee..bedac01 100644
--- a/src/components/SearchBar.jsx
+++ b/src/components/SearchBar.jsx
@@ -1,4 +1,4 @@
-import { useNavigate, Link } from "react-router-dom";
+import { useNavigate, Link, useSearchParams } from "react-router-dom"; // ✅ useSearchParams 추가
import "./SearchBar.css";
import BackButton from "./BackButton";
import Delete from "../assets/delete.svg";
@@ -7,11 +7,18 @@ import Random from "../assets/random.svg";
export default function SearchBar({ value, onChange }) {
const navigate = useNavigate();
+ const [searchParams] = useSearchParams();
+ const searchQuery = searchParams.get("name") || ""; // ✅ 기존 검색어 유지
+
+ const handleSearch = () => {
+ if (!value.trim()) return;
+ navigate(`/search?name=${encodeURIComponent(value)}`); // ✅ 항상 `?name=검색어` 유지
+ };
const handleKeyDown = (event) => {
if (event.key === "Enter") {
event.preventDefault();
- navigate(`/search/${value}`);
+ handleSearch();
}
};
@@ -23,7 +30,7 @@ export default function SearchBar({ value, onChange }) {
type="text"
value={value}
onChange={onChange}
- onKeyDown={handleKeyDown}
+ onKeyDown={handleKeyDown} // ✅ 엔터 키 입력 시 검색 실행
placeholder="검색어를 입력하세요"
/>
{value && (
@@ -34,9 +41,11 @@ export default function SearchBar({ value, onChange }) {
onClick={() => onChange({ target: { value: "" } })}
/>
)}
-
+ {/* ✅ 검색 버튼 클릭 시 `?name=검색어` 형식 유지 */}
+
+
diff --git a/src/pages/BoothHome.jsx b/src/pages/BoothHome.jsx
index a63c60a..71d225b 100644
--- a/src/pages/BoothHome.jsx
+++ b/src/pages/BoothHome.jsx
@@ -1,24 +1,79 @@
-import { isMobile } from "react-device-detect";
-import { useState } from "react";
+import { useState, useEffect } from "react";
import { Link, useNavigate } from "react-router-dom";
-import Home from "./Home";
-import "/src/pages/BoothHome.css";
-import "./Home.css";
+import axios from "axios"; // ✅ API 요청을 위한 axios 추가
import searchIcon from "../assets/search.svg";
import capsCircle from "../assets/caps-circle_3x.png";
import instagram from "../assets/instagram_3x.png";
import github from "../assets/github_3x.png";
import apply from "../assets/apply.svg";
import WikiMiniButton from "../components/WikiMiniButton";
+import Home from "./Home"; // ✅ PC 화면에서는 기존 Home 사용
+import "./BoothHome.css";
export default function BoothHome() {
- return isMobile ? : ;
+ const [isMobile, setIsMobile] = useState(window.innerWidth <= 768);
+ const [recentPeople, setRecentPeople] = useState([]); // ✅ 최근 수정된 위키 목록 상태 추가
+
+ useEffect(() => {
+ const handleResize = () => {
+ setIsMobile(window.innerWidth <= 768);
+ };
+
+ window.addEventListener("resize", handleResize);
+ return () => {
+ window.removeEventListener("resize", handleResize);
+ };
+ }, []);
+
+
+ return isMobile ? : ;
}
-function BoothMobileView() {
+function BoothMobileView({ recentPeople }) {
const [query, setQuery] = useState("");
const navigate = useNavigate();
+ const [errorMessage, setErrorMessage] = useState("");
+
+ const handleSearch = () => {
+ if (query.trim() === "") return;
+ navigate(`/search?name=${encodeURIComponent(query)}`);
+ };
+ const handleKeyDown = (event) => {
+ if (event.key === "Enter") {
+ event.preventDefault();
+ handleSearch();
+ }
+ };
+
+ //오류메세지 추가
+ useEffect(() => {
+ const fetchRecentWikis = async () => {
+ try {
+ console.log("🚀 API 요청 시작: 최근 수정된 위키 목록 가져오기...");
+ const response = await axios.get(
+ `${import.meta.env.VITE_API_URL}/api/wiki/history`
+ );
+ console.log("✅ API 응답:", response.data);
+
+ if (response.data.errorCode) {
+
+ console.warn("최근 수정된 목록 불러오기 실패:", response.data.message);
+ setRecentPeople([]); // 최근 목록 초기화
+ setErrorMessage(response.data.message); // 오류 메시지 저장
+ } else {
+ setRecentPeople(response.data.result.modifiedWikiList || []); // 정상 데이터 저장
+ setErrorMessage("");
+ }
+ } catch (error) {
+ console.error("최근 수정된 위키 불러오기 실패:", error);
+ setRecentPeople([]);
+ setErrorMessage("최근 수정된 위키를 불러오는 중 오류가 발생했습니다."); // 네트워크 오류 메시지
+ }
+ };
+
+ fetchRecentWikis();
+ }, []);
return (
@@ -29,18 +84,20 @@ function BoothMobileView() {
+
-

+
setQuery(e.target.value)}
- onKeyDown={(e) => {
- if (e.key === "Enter") {
- e.preventDefault();
- navigate(`/search/${query}`);
- }
- }}
+ onKeyDown={handleKeyDown}
placeholder="찾고 싶은 인물의 이름을 검색해주세요!"
/>
@@ -52,14 +109,15 @@ function BoothMobileView() {
+ {/* 최근 수정된 인물 리스트 */}
-
-
-
-
-
-
-
+ {recentPeople.length > 0 ? (
+ recentPeople.map((wiki) => (
+
+ ))
+ ) : (
+
최근 수정된 인물이 없습니다.
// ✅ API 응답이 없을 때 대비
+ )}
diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx
index d259ca2..bb18dca 100644
--- a/src/pages/Home.jsx
+++ b/src/pages/Home.jsx
@@ -28,6 +28,21 @@ export default function Home() {
}
function PcView() {
+ const [query, setQuery] = useState(""); // ✅ 검색어 상태 추가
+ const navigate = useNavigate(); // ✅ 페이지 이동 함수 추가
+
+ const handleSearch = () => {
+ if (query.trim() === "") return; // ✅ 빈 검색어 방지
+ navigate(`/search?name=${query}`); // ✅ 검색 페이지로 이동
+ };
+ const handleKeyDown = (event) => {
+ if (event.key === "Enter") { // ✅ Enter 키 입력 시 검색 실행
+ event.preventDefault();
+ handleSearch();
+ }
+ };
+
+
return (
@@ -40,12 +55,19 @@ function PcView() {
캡스위키를 동아리 박람회 용도에 맞게 배포했습니다.
-
-
-
+
setQuery(e.target.value)} // ✅ 입력 상태 업데이트
+ onKeyDown={handleKeyDown}
/>
@@ -64,12 +86,47 @@ function PcView() {
function PublicMobileView() {
const [query, setQuery] = useState("");
+ const [recentPeople, setRecentPeople] = useState([]);
const navigate = useNavigate();
+
+
+ useEffect(() => {
+ const fetchRecentWikis = async () => {
+ try {
+ console.log("API 요청 시작: 최근 수정된 위키 목록 가져오기...");
+ const response = await axios.get(
+ `${import.meta.env.VITE_API_URL}/api/wiki/history`
+ );
+ console.log("API 응답:", response.data);
+
+ if (response.data.errorCode) {
+
+ console.warn("최근 수정된 목록 불러오기 실패:", response.data.message);
+ setRecentPeople([]); // 최근 목록 초기화
+ setErrorMessage(response.data.message); // 오류 메시지 저장
+ } else {
+ setRecentPeople(response.data.result.modifiedWikiList || []); // 정상 데이터 저장
+ setErrorMessage("");
+ }
+ } catch (error) {
+ console.error("최근 수정된 위키 불러오기 실패:", error);
+ setRecentPeople([]);
+ setErrorMessage("최근 수정된 위키를 불러오는 중 오류가 발생했습니다."); // 네트워크 오류 메시지
+ }
+ };
+
+ fetchRecentWikis();
+ }, []);
+
+ const handleSearch = () => {
+ if (query.trim() === "") return;
+ navigate(`/search?name=${encodeURIComponent(query)}`);
+ };
const handleKeyDown = (event) => {
if (event.key === "Enter") {
event.preventDefault();
- navigate(`/search/${query}`);
+ handleSearch();
}
};
@@ -90,8 +147,15 @@ function PublicMobileView() {
동박위키는 실제 캡스에서 사용하는 캡스위키를 동아리 박람회 용도에
맞게 변형했습니다.
+
-

+
리스트 →
+
+ {/* ✅ 최근 수정된 인물 리스트 */}
-
-
-
-
-
-
-
+ {recentPeople.length > 0 ? (
+ recentPeople.map((wiki) => (
+
+ ))
+ ) : (
+
최근 수정된 인물이 없습니다.
+ )}
+
신입부원 모집 3월 5일 마감!
+