diff --git a/src/adminPage/features/comment/id/Comments.jsx b/src/adminPage/features/comment/id/Comments.jsx index c307213d..42758649 100644 --- a/src/adminPage/features/comment/id/Comments.jsx +++ b/src/adminPage/features/comment/id/Comments.jsx @@ -1,5 +1,6 @@ import { useQuery } from "@common/dataFetch/getQuery.js"; import { fetchServer } from "@common/dataFetch/fetchServer.js"; +import { formatDate } from "@common/utils.js"; import Pagination from "@admin/components/Pagination"; import { useState } from "react"; @@ -27,20 +28,6 @@ export default function Comments({ [page, searchString], ); - function getDate(createdAt) { - const yy = createdAt.slice(2, 4); - const mm = createdAt.slice(5, 7); - const dd = createdAt.slice(8, 10); - return `${yy}-${mm}-${dd}`; - } - - function getTime(createdAt) { - const hh = createdAt.slice(11, 13); - const mm = createdAt.slice(14, 16); - const ss = createdAt.slice(17, 19); - return `${hh}:${mm}:${ss}`; - } - function checkComment(id) { if (checkedComments.has(id)) { setCheckedComments((oldSet) => { @@ -69,9 +56,9 @@ export default function Comments({ />
- {getDate(comment.createdAt)} + {formatDate(comment.createdAt, "YY-MM-DD")} - {getTime(comment.createdAt)} + {formatDate(comment.createdAt, "hh:mm:ss")}
{comment.content} diff --git a/src/adminPage/features/comment/index.jsx b/src/adminPage/features/comment/index.jsx index f55f36ef..a9df5623 100644 --- a/src/adminPage/features/comment/index.jsx +++ b/src/adminPage/features/comment/index.jsx @@ -20,12 +20,17 @@ export default function AdminComment() { } function onChangeForm(e) { - const newString = e.target.value.replace(/[^0-9]/g, ""); - const filteredFormString = formString.replace(/[^0-9]/g, ""); + let newString = e.target.value.replace(/[^0-9]/g, ""); - if (newString.length > 9) return; + if (!newString) { + newString = ""; + } else if (newString.length <= 6) { + newString = "HD_" + newString; + } else if (newString.length <= 9) { + newString = "HD_" + newString.slice(0, 6) + "_" + newString.slice(6); + } else return; - if (newString !== filteredFormString) { + if (newString !== formString) { if (newString.length >= 6) { setSelectedEvent(-1); setIsSpread(true); @@ -34,13 +39,7 @@ export default function AdminComment() { setIsSpread(false); } } - if (!newString) { - setFormString(""); - } else if (newString.length <= 6) { - setFormString("HD_" + newString); - } else { - setFormString("HD_" + newString.slice(0, 6) + "_" + newString.slice(6)); - } + setFormString(newString); } function searchEvent(e, eventId) { diff --git a/src/adminPage/features/eventEdit/FcfsInput/FcfsItemInput.jsx b/src/adminPage/features/eventEdit/FcfsInput/FcfsItemInput.jsx index 836b142f..94825ca5 100644 --- a/src/adminPage/features/eventEdit/FcfsInput/FcfsItemInput.jsx +++ b/src/adminPage/features/eventEdit/FcfsInput/FcfsItemInput.jsx @@ -3,8 +3,9 @@ import { EventEditDispatchContext } from "../businessLogic/context.js"; import { Input } from "@admin/components/SmallInput.jsx"; import DateInput from "@admin/components/DateInput"; import DeleteButton from "@admin/components/DeleteButton"; -import { formatDate, padNumber } from "@common/utils.js"; +import { formatDate, padNumber, getDayDifference } from "@common/utils.js"; import fcfsInputGridStyle from "./tableStyle.js"; +import serverTimeStore from "@admin/serverTime/store.js"; const MINUTE = 60; @@ -34,9 +35,10 @@ function FcfsItemInput({ uniqueKey, date, start, end, participantCount, prizeInf ) : ( - dispatch({ type: "modify_fcfs_item", key: uniqueKey, value: { date } }) - } + setDate={(date) => { + if (getDayDifference(serverTimeStore.getState().serverTime, date) <= 0) return; + dispatch({ type: "modify_fcfs_item", key: uniqueKey, value: { date } }); + }} required size="4" /> diff --git a/src/mainPage/shared/auth/requestAuthCode.js b/src/mainPage/shared/auth/requestAuthCode.js index 86abff61..69cd415e 100644 --- a/src/mainPage/shared/auth/requestAuthCode.js +++ b/src/mainPage/shared/auth/requestAuthCode.js @@ -1,9 +1,10 @@ import { fetchServer, handleError } from "@/common/dataFetch/fetchServer.js"; +import { EVENT_ID } from "@common/constants"; async function requestAuthCode(name, phoneNumber) { try { const body = { name, phoneNumber: phoneNumber.replace(/\D+/g, "") }; - await fetchServer("/api/v1/event-user/send-auth", { + await fetchServer(`/api/v1/event-user/send-auth/${EVENT_ID}`, { method: "post", body, }); @@ -11,7 +12,7 @@ async function requestAuthCode(name, phoneNumber) { } catch (e) { return handleError({ 400: "잘못된 요청 형식입니다.", - 409: "등록된 참여자 정보가 있습니다.", + 409: "이미 등록된 전화번호가 존재합니다. 하단의 '이미 정보를 입력하신 적이 있으신가요?'를 클릭하세요.", })(e); } }