Skip to content
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
99 changes: 99 additions & 0 deletions src/apis/apis/poll.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { VoterPollInfo } from '../../type/type';
import { ApiUrl } from '../endpoints';
import { request } from '../primitives';
import {
GetPollResponseType,
GetVoterPollInfoResponseType,
PatchPollResponseType,
PostPollResponseType,
PostVoterPollInfoResponseType,
} from '../responses/poll';

// Template
/*
export async function apiFunc(

): Promise<ReturnType> {
const requestUrl: string = ApiUrl.
const response = await request<ReturnType>(
method,
requestUrl,
data,
params,
);

return response.data;
}
*/

// POST /api/polls/{tableId}
export async function postPoll(tableId: number): Promise<PostPollResponseType> {
const requestUrl: string = ApiUrl.poll;
const response = await request<PostPollResponseType>(
'POST',
requestUrl + `/${tableId}`,
null,
null,
);

return response.data;
}

// GET /api/polls/{pollId}
export async function getPollInfo(
pollId: number,
): Promise<GetPollResponseType> {
const requestUrl: string = ApiUrl.poll;
const response = await request<GetPollResponseType>(
'GET',
requestUrl + `/${pollId}`,
null,
null,
);
return response.data;
}

// PATCH /api/polls/{pollId}
export async function patchEndPoll(
pollId: number,
): Promise<PatchPollResponseType> {
const requestUrl: string = ApiUrl.poll;
const response = await request<PatchPollResponseType>(
'PATCH',
requestUrl + `/${pollId}`,
null,
null,
);
return response.data;
}

// GET /api/polls/{pollId}/votes
export async function getVoterPollInfo(
pollId: number,
): Promise<GetVoterPollInfoResponseType> {
const requestUrl: string = ApiUrl.poll;
const response = await request<GetVoterPollInfoResponseType>(
'GET',
requestUrl + `/${pollId}/votes`,
null,
null,
);

return response.data;
}

// POST /api/polls/{pollId}/votes
export async function postVoterPollInfo(
pollId: number,
voterInfo: VoterPollInfo,
): Promise<PostVoterPollInfoResponseType> {
const requestUrl: string = ApiUrl.poll;
const response = await request<PostVoterPollInfoResponseType>(
'POST',
requestUrl + `/${pollId}/votes`,
voterInfo,
null,
);

return response.data;
}
1 change: 1 addition & 0 deletions src/apis/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export const ApiUrl = {
table: makeUrl('/table'),
parliamentary: makeUrl('/table/parliamentary'),
customize: makeUrl('/table/customize'),
poll: makeUrl('/polls'),
};
28 changes: 28 additions & 0 deletions src/apis/responses/poll.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { BasePollInfo, PollInfo, VoterPollInfo } from '../../type/type';

// POST /api/polls/{tableId}
export interface PostPollResponseType extends BasePollInfo {
id: number;
}

// GET /api/polls/{pollId}
export interface GetPollResponseType extends PollInfo {
id: number;
}

// PATCH /api/polls/{pollId}
export interface PatchPollResponseType extends PollInfo {
id: number;
}

// GET /api/polls/{pollId}/votes
export interface GetVoterPollInfoResponseType extends PollInfo {
id: number;
participateCode: string;
}

// POST /api/polls/{pollId}/votes

export interface PostVoterPollInfoResponseType extends VoterPollInfo {
id: number;
}
9 changes: 9 additions & 0 deletions src/assets/debateEnd/crown.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/template_logo/kondae_time.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/template_logo/mcu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/components/GoToHomeButton/GoToHomeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export default function GoToHomeButton() {
type="button"
aria-label="홈으로 돌아가기"
onClick={handleClick}
className="flex h-[72px] w-[492px] items-center justify-center gap-[12px] rounded-full border-[2px] border-default-disabled/hover bg-default-white px-[16px] py-[11px] font-semibold text-default-black opacity-80 transition-colors duration-200 hover:bg-default-disabled/hover"
className="button enabled neutral flex w-[492px] flex-row space-x-[12px] rounded-full p-[24px]"
>
<span>홈으로 돌아가기 →</span>
홈으로 돌아가기 →
</button>
);
}
37 changes: 37 additions & 0 deletions src/components/icons/CheckBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import DTCheck from './Check';
import clsx from 'clsx';

interface CheckBoxProps {
checked?: boolean;
size?: number | string;
className?: string;
}

/**
*text-* 클래스가 포함되면 자동으로 DTCheck로 전달
*/
export default function CheckBox({
checked = false,
size = 24,
className = '',
}: CheckBoxProps) {
// text-로 시작하는 클래스만 추출
const textClass =
className.split(' ').find((c) => c.startsWith('text-')) ?? '';

return (
<div
className={clsx(
'flex items-center justify-center rounded-md border',
checked ? 'border-transparent' : 'border-neutral-400',
className,
)}
style={{
width: size,
height: size,
}}
>
{checked && <DTCheck className={clsx('w-2/3', textClass)} />}
</div>
);
}
12 changes: 7 additions & 5 deletions src/components/icons/Help.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,26 @@ export default function DTHelp({
}: IconProps) {
return (
<svg
viewBox="0 0 45 44"
viewBox="0 0 31 32"
fill="none"
className={`
aspect-[45/44]
aspect-[31/32]
${className}
`}
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
d="M22.7693 38C31.6058 38 38.7693 30.8366 38.7693 22C38.7693 13.1634 31.6058 6 22.7693 6C13.9327 6 6.76929 13.1634 6.76929 22C6.76929 30.8366 13.9327 38 22.7693 38Z"
d="M15.7693 29.8182C23.4009 29.8182 29.5875 23.6316 29.5875 16C29.5875 8.36843 23.4009 2.18182 15.7693 2.18182C8.13771 2.18182 1.9511 8.36843 1.9511 16C1.9511 23.6316 8.13771 29.8182 15.7693 29.8182Z"
stroke={color}
strokeWidth="4.21053"
strokeWidth="2.7"
strokeMiterlimit="10"
/>
<path
d="M20.6414 25.3928C20.6414 22.2696 21.4862 21.3224 22.9966 20.3752C24.0718 19.684 24.891 18.916 24.891 17.764C24.891 16.484 23.9182 15.6904 22.6894 15.6648C21.6319 15.6883 20.6391 16.3374 20.424 17.5726C20.3906 17.7642 20.233 17.9176 20.0385 17.9176H17.2264C17.0213 17.9176 16.8552 17.7481 16.8709 17.5436C17.1194 14.2902 19.6565 12.7217 22.7406 12.7464C26.2222 12.7208 28.6798 14.5384 28.6798 17.6104C28.6798 19.684 27.6302 20.9896 25.9662 21.9624C24.5838 22.8072 23.9438 23.6264 23.9182 25.3928C23.9182 25.5342 23.8036 25.6488 23.6622 25.6488H20.8974C20.756 25.6488 20.6414 25.5342 20.6414 25.3928ZM20.283 29.1816C20.2318 28.0552 21.2046 27.108 22.3822 27.1336C23.483 27.108 24.4558 28.0552 24.4814 29.1816C24.4558 30.3592 23.483 31.3064 22.3822 31.2808C21.2046 31.3064 20.2318 30.3592 20.283 29.1816Z"
d="M15.4339 20.4836H15.4358C16.3579 20.4621 17.176 21.2572 17.1975 22.2033C17.1749 23.1934 16.3565 23.9864 15.4358 23.965H15.4339C14.5061 23.9852 13.7318 23.2873 13.6741 22.3869L13.6721 22.2043V22.2004C13.632 21.3177 14.3449 20.5617 15.2503 20.4885L15.4339 20.4836ZM15.7444 8.0578H15.7454C17.2403 8.04689 18.5103 8.43236 19.4055 9.14471C20.2996 9.8562 20.8235 10.8973 20.8235 12.2092C20.8235 13.0954 20.5998 13.8153 20.1995 14.4172C19.7988 15.0196 19.2193 15.5065 18.5051 15.924L18.5042 15.925C17.9047 16.2913 17.4605 16.6552 17.1643 17.1232C16.8678 17.5921 16.7223 18.1611 16.7112 18.9299L16.6985 18.9963C16.6727 19.058 16.6114 19.1008 16.5403 19.1008H14.1526C14.0581 19.1007 13.9817 19.0243 13.9817 18.9299C13.9817 17.5851 14.1634 16.7157 14.5032 16.0822C14.8002 15.5286 15.2205 15.151 15.7561 14.7922L15.9924 14.6389C16.9222 14.0412 17.6515 13.3649 17.6516 12.342C17.6516 11.7757 17.4357 11.3145 17.0823 10.9924C16.7294 10.6708 16.2423 10.49 15.7014 10.4787H15.6995C14.7663 10.4994 13.8851 11.0742 13.6946 12.1682C13.6691 12.3133 13.5503 12.424 13.4104 12.424H10.9827C10.833 12.424 10.7139 12.3012 10.7249 12.1555C10.8312 10.7641 11.426 9.73588 12.3215 9.0578C13.2182 8.37884 14.4207 8.04721 15.7444 8.0578Z"
fill={color}
stroke={color}
strokeWidth="0.1"
/>
</svg>
);
Expand Down
8 changes: 4 additions & 4 deletions src/components/icons/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ export default function DTHome({
}: IconProps) {
return (
<svg
viewBox="0 0 45 44"
viewBox="0 0 31 32"
fill="none"
className={`
aspect-[45/44]
aspect-[31/32]
${className}
`}
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
d="M6.42554 21.7278V36.2518C6.42554 37.2196 7.18999 38 8.13791 38H16.868C17.8159 38 18.5803 37.2196 18.5803 36.2518V29.3137C18.5803 28.346 19.3448 27.5655 20.2927 27.5655H24.5584C25.5063 27.5655 26.2707 28.346 26.2707 29.3137V36.2518C26.2707 37.2196 27.0352 38 27.9831 38H36.7132C37.6611 38 38.4255 37.2196 38.4255 36.2518V21.7278C38.4255 21.2518 38.2344 20.7991 37.8981 20.4635L23.6104 6.48582C22.9454 5.83806 21.9057 5.83806 21.2406 6.48582L6.95301 20.4713C6.61665 20.7991 6.42554 21.2596 6.42554 21.7356V21.7278Z"
d="M1.60736 15.7649V28.3084C1.60736 29.1442 2.26756 29.8182 3.08622 29.8182H10.6258C11.4445 29.8182 12.1047 29.1442 12.1047 28.3084V22.3164C12.1047 21.4806 12.7649 20.8066 13.5836 20.8066H17.2675C18.0862 20.8066 18.7464 21.4806 18.7464 22.3164V28.3084C18.7464 29.1442 19.4066 29.8182 20.2253 29.8182H27.7648C28.5835 29.8182 29.2437 29.1442 29.2437 28.3084V15.7649C29.2437 15.3538 29.0787 14.9629 28.7882 14.673L16.4489 2.6014C15.8745 2.04197 14.9766 2.04197 14.4022 2.6014L2.0629 14.6798C1.77241 14.9629 1.60736 15.3605 1.60736 15.7717V15.7649Z"
stroke={color}
strokeWidth="4.21053"
strokeWidth="2.7"
strokeMiterlimit="10"
/>
</svg>
Expand Down
20 changes: 10 additions & 10 deletions src/components/icons/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,40 @@ export default function DTLogin({
}: IconProps) {
return (
<svg
viewBox="0 0 45 44"
viewBox="0 0 28 30"
fill="none"
className={`
aspect-[45/44]
aspect-[28/30]
${className}
`}
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
d="M33.7567 32.464V35.681C33.7567 36.7666 33.1532 37.6466 32.4007 37.6466H9.78112C9.03607 37.6466 8.42514 36.7666 8.42514 35.681V8.31899C8.42514 7.23339 9.02862 6.35339 9.78112 6.35339H32.4081C33.1532 6.35339 33.7641 7.23339 33.7641 8.31899V11.536"
d="M24.2115 24.0371V26.8155C24.2115 27.753 23.6903 28.513 23.0404 28.513H3.50533C2.86189 28.513 2.33426 27.753 2.33426 26.8155V3.18459C2.33426 2.24702 2.85545 1.48703 3.50533 1.48703H23.0468C23.6903 1.48703 24.2179 2.24702 24.2179 3.18459V5.96294"
stroke={color}
strokeWidth="4.11753"
strokeWidth="2.7"
strokeMiterlimit="10"
strokeLinecap="round"
/>
<path
d="M36.4256 22.0014L30.0853 26.9688"
d="M26.5165 15.0012L21.0407 19.2913"
stroke={color}
strokeWidth="4.11753"
strokeWidth="2.7"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M36.4256 21.9977L30.0853 17.0385"
d="M26.5165 14.998L21.0407 10.715"
stroke={color}
strokeWidth="4.11753"
strokeWidth="2.7"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M16.4389 22.0014H34.2827"
d="M9.25525 15.0012H24.6658"
stroke={color}
strokeWidth="4.11753"
strokeWidth="2.7"
strokeMiterlimit="10"
strokeLinecap="round"
/>
Expand Down
20 changes: 20 additions & 0 deletions src/constants/debate_template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import seobangjeongto from '../assets/template_logo/seobangjeongto.png';
import osansi from '../assets/template_logo/osansi.png';
import nogotte from '../assets/template_logo/nogotte.png';
import kogito from '../assets/template_logo/kogito.png';
import mcu from '../assets/template_logo/mcu.png';
import { DebateTemplate } from '../type/type';
function createTableShareUrl(encodeData: string): string {
return `${import.meta.env.VITE_SHARE_BASE_URL}/share?data=${encodeData}`;
Expand Down Expand Up @@ -189,6 +190,25 @@ export const DEBATE_TEMPLATE: DebateTemplateList = {
},
],
},
{
title: '목포카톨릭대',
subtitle: '',
logoSrc: mcu,
actions: [
{
label: 'A형 토론(20분)',
href: createTableShareUrl(
'eJzNkkFLwzAUx79KyUmhYplTsLdu9jBw7Vi7iyKSbdlW7NLSTlTGwMO2k6AXZYcxpgdRmVBBRT9T0%2B%2Fgy6rSycTb8Jb8wnv%2FX17SRlYVyen1NRFZtOYguY0obhIko%2FDhPjqfsPfnqH8X3j6GZ6fCiqBEg0sh6o%2FD6%2FFSSgpfu8tIRK0TlxdkS4ap53M7KiBcJ7SKAcLa9RzfJLipxX1ZMGHdJ%2BAVhyZ5GAwgA%2FgR9qhF6xli20iuYdsnIqpZ1PIbCdSBWFy2oXC3jfwWphXeo1DUDejgu4RUGmasxUY9sAVado4%2FkaYX88o2N7d49KYEh9PW9NC2Y1ogHnf7gQyX4ANw%2B8I%2B3xOP37MjJjyyuvYvPDS1ZBanCbMqwWQVxi2w0QUbjuPnnBEzc3l1P6MY6ta3XBz0q146Jc2x25ASbrzq7ym9DNlNTwiDIbt6W%2Byw5n6exersdT4Avp5JzQ%3D%3D',
),
},
{
label: 'B형 토론(25분)',
href: createTableShareUrl(
'eJyrVspMUbIyMTXRUcrMS8tXsqpWykvMTVWyUnq9auXb%2FjVvdm5527bi9bK1r3saFHQVnN7OmKrwtm3B64ULNIxMX29r0VTSUSqpLABpcA4NDvH39YxyBQolpqfmpSQCBYHsgqL84pDUxFw%2FiLlvNqx507IRKJ6cn4cs%2FnrDDKAdQPHyxKK8zLx0p9ScHCWrtMSc4lQdpbTMvMziDCShWqC1iUk5QI3R1UrFJYl5ySAzAoL8g4EmFBekpiZnhECc9WZeK9C1QNGk%2FAqokJ9%2FkK%2BjD8jlmSCrLQ2AkmCj80pzciCiAalFILehCQUXpCZmA90GEy4G8VOLQP6s1UFyh7O%2F36Bwh59raEgQ2AY0p0x4M2cBJBpRHBTi6esa7%2BQY7OoCdxTEApzOMjU3wOIqMwMkN4F0EQ6drXPeLGpVeL1hzptpO%2BgbSFgTDX2dE1sLAJl%2BRRA%3D',
),
},
],
},
],
THREE: [
{
Expand Down
12 changes: 12 additions & 0 deletions src/hooks/mutations/useCreatePoll.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { postPoll } from '../../apis/apis/poll';
import { PostPollResponseType } from '../../apis/responses/poll';
import { usePreventDuplicateMutation } from './usePreventDuplicateMutation';

export default function usePostPoll(onSuccess: (id: number) => void) {
return usePreventDuplicateMutation({
mutationFn: (id: number) => postPoll(id),
onSuccess: (response: PostPollResponseType) => {
onSuccess(response.id);
},
});
}
12 changes: 12 additions & 0 deletions src/hooks/mutations/useFetchEndPoll.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { patchEndPoll } from '../../apis/apis/poll';
import { PatchPollResponseType } from '../../apis/responses/poll';
import { usePreventDuplicateMutation } from './usePreventDuplicateMutation';

export default function useFetchEndPoll(onSuccess: (id: number) => void) {
return usePreventDuplicateMutation({
mutationFn: (pollId: number) => patchEndPoll(pollId),
onSuccess: (response: PatchPollResponseType) => {
onSuccess(response.id);
},
});
}
18 changes: 18 additions & 0 deletions src/hooks/mutations/usePostVoterPollInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { postVoterPollInfo } from '../../apis/apis/poll';
import { VoterPollInfo } from '../../type/type';
import { usePreventDuplicateMutation } from './usePreventDuplicateMutation';

export default function usePostVoterPollInfo(onSuccess: () => void) {
return usePreventDuplicateMutation({
mutationFn: ({
pollId,
voterInfo,
}: {
pollId: number;
voterInfo: VoterPollInfo;
}) => postVoterPollInfo(pollId, voterInfo),
onSuccess: () => {
onSuccess();
},
});
}
15 changes: 15 additions & 0 deletions src/hooks/query/useGetPollInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { useQuery } from '@tanstack/react-query';
import { getPollInfo } from '../../apis/apis/poll';
import { GetPollResponseType } from '../../apis/responses/poll';

export function useGetPollInfo(
pollId: number,
options?: { refetchInterval?: number | false; enabled?: boolean },
) {
return useQuery<GetPollResponseType>({
queryKey: ['Poll', pollId],
queryFn: () => getPollInfo(pollId),
refetchInterval: options?.refetchInterval ?? false,
enabled: options?.enabled,
});
}
Loading