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] 잡다하게 수정 #130

Merged
merged 4 commits into from
Aug 22, 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
19 changes: 3 additions & 16 deletions src/adminPage/features/comment/id/Comments.jsx
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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}`;
}

Comment on lines -30 to -43
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

편-안해졌습니다

function checkComment(id) {
if (checkedComments.has(id)) {
setCheckedComments((oldSet) => {
Expand Down Expand Up @@ -69,9 +56,9 @@ export default function Comments({
/>

<div className="place-self-center flex items-center gap-1 text-body-s">
<span>{getDate(comment.createdAt)}</span>
<span>{formatDate(comment.createdAt, "YY-MM-DD")}</span>

<span className="text-neutral-500">{getTime(comment.createdAt)}</span>
<span className="text-neutral-500">{formatDate(comment.createdAt, "hh:mm:ss")}</span>
</div>

<span className="pr-4 overflow-hidden text-body-s text-ellipsis">{comment.content}</span>
Expand Down
21 changes: 10 additions & 11 deletions src/adminPage/features/comment/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down
10 changes: 6 additions & 4 deletions src/adminPage/features/eventEdit/FcfsInput/FcfsItemInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -34,9 +35,10 @@ function FcfsItemInput({ uniqueKey, date, start, end, participantCount, prizeInf
) : (
<DateInput
date={date}
setDate={(date) =>
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"
/>
Expand Down
5 changes: 3 additions & 2 deletions src/mainPage/shared/auth/requestAuthCode.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
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,
});
return "";
} catch (e) {
return handleError({
400: "잘못된 요청 형식입니다.",
409: "등록된 참여자 정보가 있습니다.",
409: "이미 등록된 전화번호가 존재합니다. 하단의 '이미 정보를 입력하신 적이 있으신가요?'를 클릭하세요.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

친절해졌군요

})(e);
}
}
Expand Down