Skip to content
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

[fix] 자잘한 오류 수정 및 카드게임 스켈레톤 UI 추가 #101

Merged
merged 5 commits into from
Aug 16, 2024
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
26 changes: 25 additions & 1 deletion src/adminPage/features/eventEdit/FcfsInput.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
import { useState } from "react";
import { Input } from "@admin/components/SmallInput.jsx";
import Checkbox from "@common/components/Checkbox.jsx";

function FcfsInput() {
return <>선착순 이벤트임</>;
const [isOpenTimeBatch, SetOpenTimeBatch] = useState(false);
const [isCloseTimeBatch, SetCloseTimeBatch] = useState(false);

return <div>
<div>
<label>
<Checkbox checked={isOpenTimeBatch} onChange={SetOpenTimeBatch}/>
오픈시간 일괄 설정
<Input type="time" disabled={!isOpenTimeBatch}/>
</label>
<label>
<Checkbox checked={isCloseTimeBatch} onChange={SetCloseTimeBatch}/>
종료 시간 일괄 설정
<Input type="time" disabled={!isCloseTimeBatch}/>
</label>
<button>자동 채우기</button>
</div>
<div>
{}
</div>
</div>;
}

export default FcfsInput;
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function SearchResultItem({
<div className="flex justify-center items-center">{eventId}</div>
<div className="flex justify-center items-center overflow-hidden">
<Link
className="w-full font-bold text-ellipsis overflow-hidden whitespace-nowrap hover:underline"
className="w-full font-bold truncate hover:underline"
to={`./${eventId}`}
>
{name}
Expand Down
3 changes: 0 additions & 3 deletions src/common/dataFetch/fetchServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ async function fetchServerBase(url, options = {}) {
throw new HTTPError(response);
return await response.json();
} catch (e) {
if (e instanceof HTTPError) {
e.data = await e.response.json();
}
if (e instanceof TypeError && e.message === "Failed to fetch") {
throw new ServerCloseError();
}
Expand Down
1 change: 1 addition & 0 deletions src/common/dataFetch/getQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export function useMutation(key, promiseFn, { onSuccess, onError } = {}) {
const value = await promiseFn();
updateSubscribedQuery(key);
onSuccess?.(value);
return value;
} catch (e) {
onError?.(e);
if (onError === undefined) throw e;
Expand Down
30 changes: 30 additions & 0 deletions src/mainPage/features/fcfs/cardGame/CardGameSkeleton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Card from "./Card.jsx";
import DelaySkeleton from "@common/components/DelaySkeleton.jsx";

function CardGameSkeleton() {

return (
<>
<div className="h-32 flex justify-center items-center">
<DelaySkeleton>
<h3
className="text-head-l md:text-7xl font-bold text-center text-neutral-200"
>
로딩중...
</h3>
</DelaySkeleton>
</div>
<div className="relative grid grid-cols-2 min-[1140px]:grid-cols-4 gap-10">
{[1, 2, 3, 4].map((index) => (
<Card
index={index}
locked
key={`card ${index}`}
/>
))}
</div>
</>
);
}

export default CardGameSkeleton;
5 changes: 3 additions & 2 deletions src/mainPage/features/fcfs/cardGame/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ErrorBoundary from "@common/components/ErrorBoundary.jsx";
import useFcfsStore from "@main/realtimeEvent/store.js";
import useAuthStore from "@main/auth/store.js";
import CardGame from "./CardGame.jsx";
import CardGameSkeleton from "./CardGameSkeleton.jsx";

function CardGameInitializer() {
const getData = useFcfsStore((store) => store.getData);
Expand All @@ -23,8 +24,8 @@ function CardGamePariticipatedInitializer() {

function CardGameSection() {
return (
<ErrorBoundary fallback={<div>에러남</div>}>
<Suspense fallback={<div>로딩중</div>}>
<ErrorBoundary fallback={<CardGame offline />}>
<Suspense fallback={<CardGameSkeleton />}>
<CardGameInitializer />
<CardGamePariticipatedInitializer />
</Suspense>
Expand Down