Skip to content

Commit d925956

Browse files
authored
modify: 배포 전 전체 코드 정리, 핫픽스 (#11)
1 parent 72ad44e commit d925956

File tree

10 files changed

+33
-18
lines changed

10 files changed

+33
-18
lines changed

.env.sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'.env.development (개발 환경), .env.production (배포 환경)'
22

33
NEXT_PUBLIC_BASE_URL=<'server url here'>
4+
NEXT_PUBLIC_VELOG_URL=https://velog.io
45
NEXT_PUBLIC_ABORT_MS=<'abort time(ms) for fetch here'>
56
SENTRY_AUTH_TOKEN=<'sentry auth token here'>
67
NEXT_PUBLIC_EVENT_LOG=<'Whether to send an event log here (true | false)'>

readme.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,13 @@ docker push nuung/velog-dashboard-v2-fe:latest
3737
docker pull nuung/velog-dashboard-v2-fe:latest
3838
docker run -p 3000:3000 nuung/velog-dashboard-v2-fe:latest
3939
```
40+
41+
## docker 관련, 이미지 정리
42+
43+
```shell
44+
# 사용하지 않는 모든 이미지 정리
45+
docker image prune -af
46+
47+
# 볼륨, 캐시, 컨테이너 포함 등 모든 사용하지 않는 리소스 정리
48+
docker system prune -af --volumes
49+
```

src/app/(with-tracker)/(auth-required)/leaderboards/Content.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { Dropdown, Ranker, Rank } from '@/components';
44
import { SCREENS } from '@/constants';
55
import { useResponsive, useSearchParam } from '@/hooks';
6-
import { trackUserEvent } from '@/utils/trackUtil';
6+
import { trackUserEvent, MessageEnum } from '@/utils/trackUtil';
77

88
const data = [
99
{ rank: 1, name: '정현우', count: 1235 },
@@ -26,7 +26,7 @@ export const Content = () => {
2626
['좋아요', 'likes'],
2727
]}
2828
onChange={(data) => {
29-
trackUserEvent('SORT_INTERACT_BOARD');
29+
trackUserEvent(MessageEnum.SORT_INTERACT_BOARD);
3030
setSearchParams({ type: data as string });
3131
}}
3232
defaultValue={'조회수'}

src/app/(with-tracker)/(auth-required)/main/Content.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import { postList, postSummary } from '@/apis';
1515
import { PATHS } from '@/constants';
1616
import { useSearchParam } from '@/hooks/useSearchParam';
17-
import { trackUserEvent } from '@/utils/trackUtil';
17+
import { trackUserEvent, MessageEnum } from '@/utils/trackUtil';
1818

1919
const sorts: Array<OptionType> = [
2020
['작성일순', ''],
@@ -68,7 +68,9 @@ export const Content = () => {
6868
<Button
6969
size="SMALL"
7070
disabled
71-
onClick={() => trackUserEvent('REFRESH_INTERACT_MAIN')}
71+
onClick={() =>
72+
trackUserEvent(MessageEnum.REFRESH_INTERACT_MAIN)
73+
}
7274
>
7375
새로고침
7476
</Button>
@@ -80,7 +82,7 @@ export const Content = () => {
8082
<div className="flex items-center gap-3">
8183
<Check
8284
onChange={() => {
83-
trackUserEvent('SORT_INTERACT_MAIN');
85+
trackUserEvent(MessageEnum.SORT_INTERACT_MAIN);
8486
setSearchParams({
8587
asc: `${!(searchParams.asc === 'true')}`,
8688
});
@@ -94,7 +96,7 @@ export const Content = () => {
9496
}
9597
options={sorts}
9698
onChange={(data) => {
97-
trackUserEvent('SORT_INTERACT_MAIN');
99+
trackUserEvent(MessageEnum.SORT_INTERACT_MAIN);
98100
setSearchParams({ sort: encodeURI(data as string) });
99101
}}
100102
/>

src/app/(with-tracker)/(login)/Content.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { useMutation } from '@tanstack/react-query';
77
import { Input, Button } from '@/components';
88
import { LoginVo } from '@/types';
99
import { login, sampleLogin } from '@/apis';
10-
import { trackUserEvent } from '@/utils/trackUtil';
10+
import { trackUserEvent, MessageEnum } from '@/utils/trackUtil';
1111

1212
const responsiveStyle =
1313
"flex items-center gap-5 max-MBI:before:inline-block max-MBI:before:bg-[url('/favicon.png')] max-MBI:before:[background-size:_100%_100%] max-MBI:before:w-16 max-MBI:before:h-16";
@@ -22,7 +22,7 @@ export const Content = () => {
2222
} = useForm<LoginVo>({ mode: 'all' });
2323

2424
const onSuccess = () => {
25-
trackUserEvent('LOGIN');
25+
trackUserEvent(MessageEnum.LOGIN);
2626
replace('/main?asc=false&sort=');
2727
};
2828

src/components/auth-required/header/Section.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Link from 'next/link';
22
import { usePathname } from 'next/navigation';
33
import { Icon, NameType } from '@/components';
44
import { COLORS } from '@/constants';
5-
import { trackUserEvent } from '@/utils/trackUtil';
5+
import { trackUserEvent, MessageEnum } from '@/utils/trackUtil';
66

77
export const defaultStyle =
88
'w-[180px] h-[65px] px-9 transition-all duration-300 shrink-0 max-MBI:w-[65px] max-MBI:px-0 ';
@@ -48,7 +48,7 @@ export const Section = <T extends clickType>({
4848
href={action}
4949
className={defaultStyle + navigateStyle}
5050
id="navigation"
51-
onClick={() => trackUserEvent('NAVIGATE')}
51+
onClick={() => trackUserEvent(MessageEnum.NAVIGATE)}
5252
>
5353
<Icon
5454
size={25}

src/components/auth-required/header/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { PATHS, SCREENS } from '@/constants';
88
import { NameType } from '@/components';
99
import { useResponsive } from '@/hooks';
1010
import { logout, me } from '@/apis';
11-
import { trackUserEvent } from '@/utils/trackUtil';
11+
import { trackUserEvent, MessageEnum } from '@/utils/trackUtil';
1212
import { defaultStyle, Section, textStyle } from './Section';
1313

1414
const PARAMS = {
@@ -114,7 +114,7 @@ export const Header = () => {
114114
className="text-DESTRUCTIVE-SUB text-I3 p-5 max-MBI:p-4 flex whitespace-nowrap w-auto"
115115
onClick={() => {
116116
out();
117-
trackUserEvent('LOGOUT');
117+
trackUserEvent(MessageEnum.LOGOUT);
118118
}}
119119
>
120120
로그아웃

src/components/auth-required/main/Section/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { parseNumber } from '@/utils/numberUtil';
66
import { COLORS, PATHS } from '@/constants';
77
import { Icon } from '@/components';
88
import { PostType, UserDto } from '@/types';
9-
import { trackUserEvent } from '@/utils/trackUtil';
9+
import { trackUserEvent, MessageEnum } from '@/utils/trackUtil';
1010
import { Graph } from './Graph';
1111

1212
export const Section = (p: PostType) => {
@@ -21,7 +21,7 @@ export const Section = (p: PostType) => {
2121
<div
2222
className={`p-[25px] h-fit cursor-pointer bg-BG-SUB flex justify-between items-center gap-4 ${!open ? 'rounded-[4px] max-MBI:pb-[35px_!important]' : 'rounded-t-[4px]'} max-xl:flex-col max-MBI:flex-col max-MBI:p-[20px]`}
2323
onClick={() => {
24-
trackUserEvent('SECTION_INTERACT_MAIN');
24+
trackUserEvent(MessageEnum.SECTION_INTERACT_MAIN);
2525
setOpen((prev) => !prev);
2626
}}
2727
>

src/components/auth-required/main/Summary/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { useState } from 'react';
44
import { Icon } from '@/components';
55
import { PostSummaryDto } from '@/types';
6-
import { trackUserEvent } from '@/utils/trackUtil';
6+
import { trackUserEvent, MessageEnum } from '@/utils/trackUtil';
77
import { SidebarContent } from './SidebarContent';
88
import { BarContent } from './BarContent';
99

@@ -38,7 +38,7 @@ export const Summary = ({ totalPostCount, stats }: PostSummaryDto) => {
3838
<section
3939
className={`flex flex-col w-full px-5 bg-BG-SUB rounded-[4px] cursor-pointer MBI:hidden`}
4040
onClick={() => {
41-
trackUserEvent('SECTION_INTERACT_MAIN');
41+
trackUserEvent(MessageEnum.SECTION_INTERACT_MAIN);
4242
setOpen((prev) => !prev);
4343
}}
4444
>

src/utils/trackUtil.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ export const MessageEnum = {
2121
const EVENT_LOG = process.env.NEXT_PUBLIC_EVENT_LOG || 'false';
2222
const STATUS = process.env.NODE_ENV;
2323

24-
export const trackUserEvent = (event_type: keyof typeof MessageEnum) => {
24+
export const trackUserEvent = (event: keyof typeof MessageEnum | number) => {
25+
const eventType = typeof event === 'number' ? event : MessageEnum[event];
26+
2527
if (EVENT_LOG === 'true') {
2628
instance('/event', {
27-
body: { eventType: MessageEnum[event_type] },
29+
body: { eventType },
2830
method: 'POST',
2931
});
3032
}

0 commit comments

Comments
 (0)