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

Refactor/이의신청 #88

Merged
merged 11 commits into from
Jan 21, 2025
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
50 changes: 25 additions & 25 deletions src/app/(afterLogin)/workspace-list/_components/AllGroupTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,12 @@ export default function AllGroupTabs() {
e.preventDefault();
try {
//워크스페이스 아이디 받아서 전해주기
if (password.length === 4) {
const res = await joinWorkspace({
password,
workspaceId: currentWorkspaceId,
});
if (res.status === 200) {
router.push(`/workspace/${currentWorkspaceId}`);
}
const res = await joinWorkspace({
password,
workspaceId: currentWorkspaceId,
});
if (res.status === 200) {
router.push(`/workspace/${currentWorkspaceId}`);
}
} catch (error: any) {
if (error.response.status === 400) {
Expand All @@ -86,16 +84,20 @@ export default function AllGroupTabs() {
};

const handleAlreadyIn = async (workspaceId: number) => {
const res = await alreadyIn(workspaceId);
try {
const res = await alreadyIn(workspaceId);

if (res.data.isWorker === true) {
setIsFirstDialogOpen(false);
router.push(`/workspace/${workspaceId}`);
return;
}
if (res.data.isFull) {
setIsFirstDialogOpen(false);
alert('방 인원이 전부 찼습니다!');
if (res.data.isWorker === true) {
setIsFirstDialogOpen(false);
router.push(`/workspace/${workspaceId}`);
return;
}
if (res.data.isFull) {
setIsFirstDialogOpen(false);
alert('방 인원이 전부 찼습니다!');
}
} catch (error) {
setIsFirstDialogOpen(true);
}
};

Expand Down Expand Up @@ -266,17 +268,15 @@ export default function AllGroupTabs() {
setCurrentWorkspaceId(item.id); // workspaceId 저장
}}
>
<DialogTrigger
asChild
<div
onClick={() => handleAlreadyIn(item.id)}
className='w-full h-20 bg-[#FEF9C3] rounded-lg flex justify-between items-center px-3.5 my-6'
>
<div className='w-full h-20 bg-[#FEF9C3] rounded-lg flex justify-between items-center px-3.5 my-6'>
<h1 className='text-[22px]'>{item.name}</h1>
<div>
<Image src={nextArrow} alt='next-arrow' />
</div>
<h1 className='text-[22px]'>{item.name}</h1>
<div>
<Image src={nextArrow} alt='next-arrow' />
</div>
</DialogTrigger>
</div>
<DialogContent className='w-9/12 rounded-lg h-44 p-0'>
<DialogHeader className='flex justify-end'>
<DialogTitle className='text-xs'>
Expand Down
4 changes: 0 additions & 4 deletions src/app/(afterLogin)/workspace/[workspaceId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogTrigger,
} from '@/components/ui/dialog';

Expand All @@ -36,7 +35,6 @@ import { DialogTitle } from '@radix-ui/react-dialog';
type THistoryType = {
workspaceId: number;
userId: number | null;
name: string;
workout: boolean;
achievementScore: number;
};
Expand Down Expand Up @@ -64,7 +62,6 @@ export default function Page() {
clickPageMove({
workspaceId: workspaceIdNumber,
userId: user.userId,
name: infoWork?.data.name,
workout,
achievementScore,
});
Expand Down Expand Up @@ -96,7 +93,6 @@ export default function Page() {
const clickPageMove = ({
workspaceId,
userId,
name,
workout,
achievementScore,
}: THistoryType) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function ConfirmationCompoConfirm({
<div id={`confirmation-${workoutConfirmationPage.objectionId}`}>
<Link
href={{
pathname: `/workspace/${workspaceId}/workspaceConfirmation/workspaceConfirmaionDetail`,
pathname: `/workspace/${workspaceId}/workspaceConfirmation/workspaceConfirmationDetail`,
query: {
workoutConfirmationId:
workoutConfirmationPage.workoutConfirmationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ export default function ObjectionBell({
<div className='fixed bottom-14 right-2 z-50'>
{voteInCompeletionCount ? (
<div className='relative'>
<div className='h-5 w-5 absolute right-1 bottom-10 rounded-full bg-[#ffffff]'>
<span className='pl-[5px]'>{voteInCompeletionCount}</span>
<div className='h-5 w-5 absolute right-1 bottom-9 rounded-full bg-[#ffffff] drop-shadow-md'>
<span className='text-sm absolute right-2 left-1'>
{voteInCompeletionCount}
</span>
</div>
<Image
src={objectionBellFilled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function ProgressBar({
<div
className={`text-sm
${isObjectionVote ? 'text-[#374151]' : 'text-[#848D99]'}
w-5/6 absolute left-5 inset-y-2.5 flex justify-between`}
w-[295px] absolute left-5 inset-y-2.5 flex justify-between`}
>
<div>{comment}</div>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ export default function ConfirmationObjectionCompo({
: '이의 신청 투표'}
</span>
</div>
<p className='text-[10px] text-[#1F2937] my-2'>
<p className='text-xs font-medium text-[#1F2937] my-2'>
{workoutObjection?.data.reason}
</p>
<div className='flex justify-end mb-2'>
<div className='flex justify-end mb-2 mr-3'>
<span className='text-[10px] text-[#848D99]'>
{!workoutObjection?.data.inInProgress ? (
'투표 종료'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
'use client';

import Image from 'next/image';
import Link from 'next/link';

import objectionBellFill from '@/../public/svgs/workspace/workspaceConfirmaion/objectionBellFill.svg';
import { IWorkoutConfirmationObjectionListPageProps } from '@/types/workoutConfirmation';
import { useMutation } from '@tanstack/react-query';
import { confirmationDetailVoteMutationFn } from '@/api/workspaceConfirmaion';

interface IWorkoutConfirmationObjectionList {
workoutConfirmationObjectionListPages:
Expand All @@ -15,8 +19,18 @@ export default function WorkoutConfirmationObjectionList({
workoutConfirmationObjectionListPages,
workspaceId,
}: IWorkoutConfirmationObjectionList) {
const confirmationDetailVoteMutation = useMutation({
mutationFn: () => confirmationDetailVoteMutationFn({ workspaceId }),
onSuccess: () => {
console.log('상세 인증 투표 상태 요청 성공');
},
onError: () => {
console.error('상세 인증 투표 상태 에러 발생');
},
});

return (
<div>
<div onClick={() => confirmationDetailVoteMutation.mutate()}>
{workoutConfirmationObjectionListPages?.map(
(
workoutConfirmationObjectionListPage: IWorkoutConfirmationObjectionListPageProps
Expand All @@ -31,7 +45,7 @@ export default function WorkoutConfirmationObjectionList({
>
<Link
href={{
pathname: `/workspace/${workspaceId}/workspaceConfirmation/workspaceConfirmaionDetail`,
pathname: `/workspace/${workspaceId}/workspaceConfirmation/workspaceConfirmationDetail`,
query: {
workoutConfirmationId:
workoutConfirmationObjectionListPage.workoutConfirmationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export default function Page() {

return (
<div className='h-max pb-3'>
<span className='text-2xl text-[#374151]'>이의 신청 알림 목록</span>
<span className='text-2xl font-semibold text-[#374151]'>
이의 신청 알림 목록
</span>
<hr className='border-1 border-[#E5E7EB] w-screen -mx-4 mt-6' />
<div className='flex my-4'>
<ObjectionListButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ import { cheerUpMessages } from '@/constants/cheerUpMessage';

type TWorkspaceGimmiTitleTypes = {
queryData: TQueryTypes | null;
personNickName: string;
};

function WorkspaceGimmiTitle({ queryData }: TWorkspaceGimmiTitleTypes) {
function WorkspaceGimmiTitle({
queryData,
personNickName,
}: TWorkspaceGimmiTitleTypes) {
const [randomMessage, setRandomMessage] = useState(``);

useEffect(() => {
Expand All @@ -29,7 +33,7 @@ function WorkspaceGimmiTitle({ queryData }: TWorkspaceGimmiTitleTypes) {
<div>
{queryData && (
<>
<WorkspaceTitle name={queryData.name} workout={queryData.workout} />
<WorkspaceTitle name={personNickName} workout={queryData.workout} />
<div className='flex justify-center items-end gap-x-2 h-48 mb-5'>
<WorkspaceGimmi
workout={queryData.workout}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import ScrollTop from '../workspaceConfirmation/_components/ScrollTop';
function useUserInfo(): TQueryTypes {
const searchParams = useSearchParams();
const userId = parseInt(searchParams.get('userId') || '0', 10);
const name = searchParams.get('name');
const workout = searchParams.get('workout') === 'false';
const achievementScore = parseInt(
searchParams.get('achievementScore') || '0',
Expand All @@ -30,7 +29,6 @@ function useUserInfo(): TQueryTypes {

return {
userId,
name: name || '',
workout,
achievementScore,
};
Expand Down Expand Up @@ -59,7 +57,10 @@ function Page() {
return (
<div className='h-screen'>
<ScrollTop />
<WorkspaceGimmiTitle queryData={queryData} />
<WorkspaceGimmiTitle
queryData={queryData}
personNickName={workspaceHistoryDatas?.data.nickname}
/>

<WorkspaceScoreBoard
workspaceHistoryDatas={workspaceHistoryDatas?.data}
Expand Down
2 changes: 1 addition & 1 deletion src/app/(afterLogin)/workspace/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function Layout({ children }: Props) {
{currentSegment !== 'workspaceConfirmationObjectionList' && (
<hr className='border-1 border-[#E5E7EB] w-screen -mx-4' />
)}
{currentSegment === 'workspaceConfirmaionDetail' ||
{currentSegment === 'workspaceConfirmationDetail' ||
currentSegment === 'workspaceConfirmationObjectionList' ? (
<></>
) : (
Expand Down
27 changes: 15 additions & 12 deletions src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
'use client';

import { NextPage } from 'next';
import Link from 'next/link';
import Image from 'next/image';
// import { notFound } from 'next/navigation';
import { useRouter } from 'next/navigation';

import notFound from '@/../public/svgs/notFound.svg';

const NotFound: NextPage = () => {
const router = useRouter();
return (
<div className="flex flex-col items-center justify-center h-screen py-11">
<div className="flex flex-col justify-around items-center">
<div className="mb-8">
<Image src={notFound} alt="not-found" />
<div className='flex flex-col items-center justify-center h-screen py-11'>
<div className='flex flex-col justify-around items-center'>
<div className='mb-8'>
<Image src={notFound} alt='not-found' />
</div>
<h3 className="text-[#EF4444] ">존재하지 않는 페이지입니다.</h3>
<h3 className="text-[#9CA3AF] ">홈으로 돌아가세용.</h3>
<h3 className='text-[#EF4444] '>존재하지 않는 페이지입니다.</h3>
<h3 className='text-[#9CA3AF] '>홈으로 돌아가세용.</h3>
</div>

<Link href="/" className="fixed bottom-10">
<button className="bg-main text-white rounded-sm py-2.5 px-28">
<div onClick={() => router.back()} className='fixed bottom-10'>
<button className='bg-main text-white rounded-sm py-2.5 px-28'>
홈으로 돌아가기
</button>
</Link>
<div className="h-10"></div>
</div>
<div className='h-10'></div>
</div>
);
};
Expand Down
1 change: 0 additions & 1 deletion src/types/workspaceHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type THistorys = {

type TQueryTypes = {
userId: number;
name: string;
workout: boolean;
achievementScore: number;
};
Expand Down