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
3 changes: 1 addition & 2 deletions apps/service/src/app/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Button } from '@components';
import { IcCalendar } from '@svg';
import { useGetHomeFeed } from '@apis';
import { DailyProgress } from '@types';
import { useTrackEvent } from '@hooks';
import { trackEvent } from '@utils';
import {
GuideButton,
HomeHeader,
Expand All @@ -17,7 +17,6 @@ import {

const Page = () => {
const router = useRouter();
const { trackEvent } = useTrackEvent();
const { data } = useGetHomeFeed();
const homeFeedData = data?.data;

Expand Down
4 changes: 1 addition & 3 deletions apps/service/src/app/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';

import { useTrackEvent } from '@hooks';
import { getAccessToken } from '@utils';
import { getAccessToken, trackEvent } from '@utils';
import { LogoLogin } from '@/assets/svg/logo';
import { KakaoButton } from '@/components/login';

const Page = () => {
const { trackEvent } = useTrackEvent();
const router = useRouter();
const kakaoLoginUrl = `https://kauth.kakao.com/oauth/authorize?client_id=${
process.env.NEXT_PUBLIC_REST_API_KEY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { useRouter } from 'next/navigation';

import { SolveButton } from '@components';
import { useGetChildData, postChildProblemSubmit, postProblemSubmit } from '@apis';
import { useInvalidate, useTrackEvent } from '@hooks';
import { useInvalidate } from '@hooks';
import { trackEvent } from '@utils';

interface SolveButtonsClientProps {
publishId: string;
Expand All @@ -13,7 +14,6 @@ interface SolveButtonsClientProps {
const SolveButtonsClient = ({ publishId, problemId }: SolveButtonsClientProps) => {
const router = useRouter();
const { invalidateAll } = useInvalidate();
const { trackEvent } = useTrackEvent();
const { data } = useGetChildData(publishId, problemId);
const childProblemId = data?.data?.childProblemIds[0];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ import {
Tag,
ImageContainer,
} from '@components';
import { useInvalidate, useModal, useTrackEvent } from '@hooks';
import { useInvalidate, useModal } from '@hooks';
import { components } from '@schema';
import { useChildProblemContext } from '@/hooks/problem';
import { trackEvent } from '@utils';

type ChildProblemSubmitUpdateResponse = components['schemas']['ChildProblemSubmitUpdateResponse'];

Expand All @@ -32,7 +33,6 @@ const Page = () => {
childProblemId: string;
}>();
const router = useRouter();
const { trackEvent } = useTrackEvent();
const { childProblemLength, mainProblemImageUrl, onPrev, onNext } = useChildProblemContext();
const { invalidateAll } = useInvalidate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ import {
TimeTag,
ImageContainer,
} from '@components';
import { useInvalidate, useModal, useTrackEvent } from '@hooks';
import { useInvalidate, useModal } from '@hooks';
import { ProblemStatus } from '@types';
import { useChildProblemContext } from '@/hooks/problem';
import { trackEvent } from '@utils';

const statusLabel: Record<string, string> = {
CORRECT: '정답',
Expand All @@ -38,7 +39,6 @@ const statusColor: Record<string, 'green' | 'red' | 'gray'> = {
const Page = () => {
const { publishId, problemId } = useParams<{ publishId: string; problemId: string }>();
const router = useRouter();
const { trackEvent } = useTrackEvent();
const { childProblemLength } = useChildProblemContext();
const { invalidateAll } = useInvalidate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import { useParams, useRouter } from 'next/navigation';
import Image from 'next/image';

import { NavigationFooter, SmallButton, ProgressHeader, ImageContainer } from '@components';
import { useTrackEvent } from '@hooks';
import { trackEvent } from '@utils';
import { useReportContext } from '@/hooks/report';

const Page = () => {
const { publishId, problemId } = useParams();
const router = useRouter();
const { trackEvent } = useTrackEvent();

const { problemNumber, seniorTipImageUrl, prescription } = useReportContext();

Expand All @@ -21,17 +20,13 @@ const Page = () => {
};

const handleClickPrev = () => {
trackEvent('report_advanced_prev_button_click', {
buttonLabel: '해설',
});
router.push(`/report/${publishId}/${problemId}/analysis`);
trackEvent('report_advanced_prev_button_click_to_prescription');
router.push(`/report/${publishId}/${problemId}/prescription`);
};

const handleClickNext = () => {
trackEvent('report_advanced_next_button_click', {
buttonLabel: '포인팅',
});
router.push(`/report/${publishId}/${problemId}/prescription`);
trackEvent('report_advanced_next_button_click_to_list');
router.push(`/problem/list/${publishId}`);
};

if (!seniorTipImageUrl) {
Expand All @@ -40,7 +35,7 @@ const Page = () => {

return (
<>
<ProgressHeader progress={66} />
<ProgressHeader progress={100} />
<main className='px-[2rem] py-[8rem]'>
<div className='flex items-center justify-between'>
<h1 className='font-bold-18 text-main my-[0.8rem]'>한 걸음 더</h1>
Expand All @@ -57,16 +52,16 @@ const Page = () => {
<Image
src={seniorTipImageUrl ?? ''}
alt='advanced'
className={`w-full rounded-[1.6rem] object-contain`}
className={`w-full object-contain`}
width={700}
height={200}
priority
/>
</ImageContainer>
</div>
<NavigationFooter
prevLabel='해설'
nextLabel='포인팅'
prevLabel='포인팅'
nextLabel='리스트로'
onClickPrev={handleClickPrev}
onClickNext={handleClickNext}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import Image from 'next/image';

import { IcRight, IcThumbtack } from '@svg';
import { ImageContainer, NavigationFooter, ProgressHeader } from '@components';
import { useTrackEvent } from '@hooks';
import { trackEvent } from '@utils';
import { useReportContext } from '@/hooks/report';
import { TabMenu } from '@/components/report';

const Page = () => {
const router = useRouter();
const { publishId, problemId } = useParams();
const { trackEvent } = useTrackEvent();
const {
problemNumber,
answerType,
Expand All @@ -35,10 +34,8 @@ const Page = () => {
};

const handleClickNext = () => {
trackEvent('report_analysis_next_button_click', {
buttonLabel: '한 걸음 더',
});
router.push(`/report/${publishId}/${problemId}/advanced`);
trackEvent('report_analysis_next_button_click_to_prescription');
router.push(`/report/${publishId}/${problemId}/prescription`);
};

if (!mainAnalysisImageUrl || !mainHandwritingExplanationImageUrl) {
Expand Down Expand Up @@ -102,7 +99,7 @@ const Page = () => {
<IcRight width={24} height={24} />
</button>
</div>
<NavigationFooter nextLabel='한 걸음 더' onClickNext={handleClickNext} />
<NavigationFooter nextLabel='포인팅' onClickNext={handleClickNext} />
</main>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const Page = () => {

return (
<>
<Header title='진단 및 처방' iconType='back' />
<Header title='포인팅' iconType='back' />
<main className='px-[2rem] py-[8rem]'>
<h1 className='font-bold-18 text-main my-[0.8rem]'>{title}</h1>
<div className='mt-[1.6rem] flex flex-col gap-[1.6rem]'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
import { useParams, useRouter } from 'next/navigation';

import { Divider, NavigationFooter, ProgressHeader } from '@components';
import { useTrackEvent } from '@hooks';
import { trackEvent } from '@utils';
import { PrescriptionCard } from '@/components/report';
import { useReportContext } from '@/hooks/report';

const Page = () => {
const router = useRouter();
const { publishId, problemId } = useParams();
const { trackEvent } = useTrackEvent();

const { problemNumber, prescription } = useReportContext();
const childProblems = prescription?.childProblem ?? [];
Expand All @@ -32,22 +31,18 @@ const Page = () => {
};

const handleClickPrev = () => {
trackEvent('report_prescription_prev_button_click', {
buttonLabel: '한 걸음 더',
});
router.push(`/report/${publishId}/${problemId}/advanced`);
trackEvent('report_prescription_prev_button_click_to_analysis');
router.push(`/report/${publishId}/${problemId}/analysis`);
};

const handleClickNext = () => {
trackEvent('report_prescription_next_button_click', {
buttonLabel: '리스트로',
});
router.push(`/problem/list/${publishId}`);
trackEvent('report_prescription_next_button_click_to_advanced');
router.push(`/report/${publishId}/${problemId}/advanced`);
};

return (
<>
<ProgressHeader progress={100} />
<ProgressHeader progress={66} />
<main className='px-[2rem] py-[8rem]'>
<h1 className='font-bold-18 text-main my-[0.8rem]'>포인팅</h1>

Expand All @@ -71,8 +66,8 @@ const Page = () => {
</ul>

<NavigationFooter
prevLabel='한 걸음 더'
nextLabel='리스트로'
prevLabel='해설'
nextLabel='한 걸음 더'
onClickPrev={handleClickPrev}
onClickNext={handleClickNext}
/>
Expand Down
3 changes: 1 addition & 2 deletions apps/service/src/components/common/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';
import { useRouter } from 'next/navigation';

import { useTrackEvent } from '@hooks';
import { trackEvent } from '@utils';
import { IcHome, IcLeft } from '@svg';

interface HeaderProps {
Expand All @@ -11,7 +11,6 @@ interface HeaderProps {

const Header = ({ title, iconType = 'home' }: HeaderProps) => {
const router = useRouter();
const { trackEvent } = useTrackEvent();

const handleClickHome = () => {
trackEvent('header_home_button_click');
Expand Down
3 changes: 1 addition & 2 deletions apps/service/src/components/common/ProgressHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useParams, useRouter } from 'next/navigation';

import { ProgressBar } from '@components';
import { useTrackEvent } from '@hooks';
import { trackEvent } from '@utils';
import { IcList } from '@svg';

interface ProgressHeaderProps {
Expand All @@ -13,7 +13,6 @@ interface ProgressHeaderProps {
const ProgressHeader = ({ progress }: ProgressHeaderProps) => {
const router = useRouter();
const { publishId } = useParams();
const { trackEvent } = useTrackEvent();

const handleClickProblemList = () => {
trackEvent('progress_header_problem_list_button_click');
Expand Down
3 changes: 1 addition & 2 deletions apps/service/src/components/home/ProblemCard/ProblemCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Image from 'next/image';
import { useRouter } from 'next/navigation';

import { Button } from '@components';
import { useTrackEvent } from '@hooks';
import { trackEvent } from '@utils';
import { IcSolve } from '@svg';

interface Props {
Expand All @@ -15,7 +15,6 @@ interface Props {

const ProblemCard = ({ publishId, dateString, title, image, solvedCount }: Props) => {
const router = useRouter();
const { trackEvent } = useTrackEvent();

const handleClickProblem = () => {
trackEvent('home_carousel_problem_card_click', {
Expand Down
3 changes: 1 addition & 2 deletions apps/service/src/components/my-page/SettingList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import Link from 'next/link';
import { useRouter } from 'next/navigation';
import React from 'react';

import { useTrackEvent } from '@hooks';
import { trackEvent } from '@utils';

const SettingList = () => {
const { trackEvent } = useTrackEvent();
const router = useRouter();

const handleClickLogout = () => {
Expand Down
3 changes: 1 addition & 2 deletions apps/service/src/components/problem/ProblemCalandar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useState } from 'react';
import { IcMinus, IcMinusSmall, IcNextBlack, IcPrevBlack } from '@svg';
import { components } from '@schema';
import { useGetProblemAll } from '@apis';
import { useTrackEvent } from '@hooks';
import { trackEvent } from '@utils';

import DayProblemCard from './DayProblemCard';

Expand All @@ -14,7 +14,6 @@ type AllProblemGetResponse = components['schemas']['AllProblemGetResponse'];
const ProblemCalandar = () => {
const [currentDay, setCurrentDay] = useState(dayjs());
const [selectedDay, setSelectedDay] = useState<number | null>(null);
const { trackEvent } = useTrackEvent();
const year = currentDay.year();
const month = currentDay.month() + 1;

Expand Down
3 changes: 1 addition & 2 deletions apps/service/src/components/problem/ProblemStatusCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useRouter } from 'next/navigation';
import React, { useState } from 'react';

import { Button, StatusIcon, StatusTag } from '@components';
import { useTrackEvent } from '@hooks';
import { trackEvent } from '@utils';
import { components } from '@schema';
import { IcDown, IcUp } from '@svg';

Expand All @@ -23,7 +23,6 @@ const ProblemStatusCard = ({
}: ProblemStatusCardProps) => {
const { problemId, status, childProblemStatuses } = problemData;
const router = useRouter();
const { trackEvent } = useTrackEvent();
const [isOpen, setIsOpen] = useState(
!childProblemStatuses?.every((childStatus) => childStatus === 'NOT_STARTED')
);
Expand Down
2 changes: 1 addition & 1 deletion apps/service/src/components/report/PrescriptionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const PrescriptionCard = ({ status = 'NOT_STARTED', title, onClick }: Prescripti
{statusIcon(status)}
<p className='font-medium-16 text-black'>{title}</p>
</div>
<SmallButton onClick={onClick}>진단 및 처방</SmallButton>
<SmallButton onClick={onClick}>진단 받기</SmallButton>
</div>
);
};
Expand Down
3 changes: 1 addition & 2 deletions apps/service/src/hooks/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import useModal from './useModal';
import useInvalidate from './useInvalidate';
import useTrackEvent from './useTrackEvent';

export { useModal, useInvalidate, useTrackEvent };
export { useModal, useInvalidate };
18 changes: 0 additions & 18 deletions apps/service/src/hooks/common/useTrackEvent.ts

This file was deleted.

1 change: 1 addition & 0 deletions apps/service/src/utils/common/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './auth';
export * from './trackEvent';
Loading