Skip to content

Commit cde334f

Browse files
authored
Merge pull request #346 from boostcampwm-2022/develop
v0.2.6 배포
2 parents 4d4d3a7 + 179b183 commit cde334f

File tree

6 files changed

+18
-28
lines changed

6 files changed

+18
-28
lines changed

frontend/src/components/Profile/CommitHistory/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import styled from 'styled-components';
22
import { HistoryType, RANK } from '@type/common';
33
import { colors } from '@styles/theme';
4-
import { MONTH_LABEL_MAPPING } from '@utils/constants';
5-
import { getDate } from '@utils/utils';
4+
import { getDate, getMonthLabel } from '@utils/utils';
65

76
const COMMIT_LEFT_BOUNDARY = 5;
87

@@ -31,6 +30,7 @@ function CommitHistory({ history, tier }: CommitHistoryProps) {
3130
{historyBlocks.map(([dateString, { level, count }], idx) => {
3231
const weeks = (idx + firstDay) / 7;
3332
const { month, date, day } = getDate(dateString);
33+
3434
let isMonthLabelChange = false;
3535
if (prevMonth !== month && day === 0) {
3636
isMonthLabelChange = true;
@@ -42,7 +42,7 @@ function CommitHistory({ history, tier }: CommitHistoryProps) {
4242
style={{ backgroundColor: level === 0 ? colors.commit0 : colors[`${tier}${level}`] }}
4343
>
4444
{date < 24 && day === 0 && isMonthLabelChange ? (
45-
<MonthLabel>{MONTH_LABEL_MAPPING[month]}</MonthLabel>
45+
<MonthLabel>{getMonthLabel(new Date(dateString))}</MonthLabel>
4646
) : null}
4747
<ToolTip className='tooltip' weeks={weeks}>
4848
<strong>{count || 'No'}</strong> contribution on <strong>{dateString}</strong>
@@ -164,7 +164,6 @@ const MonthLabel = styled.div`
164164

165165
const DayLabel = styled.ul`
166166
position: absolute;
167-
top: 0;
168167
left: -20px;
169168
font-size: 16px;
170169
height: 100%;

frontend/src/components/Profile/PinnedRepository/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Link from 'next/link';
33
import styled from 'styled-components';
44
import { PinnedRepositoryType } from '@type/common';
55
import { LanguageIcon } from '@components/common';
6-
import { numberCompactFormatter } from '@utils/utils';
6+
import { getCompactNumber } from '@utils/utils';
77

88
interface PinnedRepositoryProps {
99
repositories: PinnedRepositoryType[];
@@ -30,11 +30,11 @@ function PinnedRepository({ repositories }: PinnedRepositoryProps) {
3030
<Info>
3131
<li>
3232
<Image src={'/icons/star.svg'} alt='star' width={24} height={24} />
33-
{numberCompactFormatter(stargazerCount)}
33+
{getCompactNumber(stargazerCount)}
3434
</li>
3535
<li>
3636
<Image src={'/icons/fork.svg'} alt='star' width={24} height={24} />
37-
{numberCompactFormatter(forkCount)}
37+
{getCompactNumber(forkCount)}
3838
</li>
3939
</Info>
4040
</Meta>

frontend/src/components/Ranking/RisingRanking/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { RankingResponse } from '@type/response';
66
import { RankingTable } from '@components/Ranking';
77
import { Avatar, CubeIcon } from '@components/common';
88
import { requestTopRankingByRising } from '@apis/ranking';
9-
import { numberCompactFormatter } from '@utils/utils';
9+
import { getCompactNumber } from '@utils/utils';
1010

1111
interface RisingRankingProps {
1212
searchUser: (username: string) => void;
@@ -46,7 +46,7 @@ function RisingRanking({ searchUser }: RisingRankingProps) {
4646
{scoreDifference > 0 ? (
4747
<Change>
4848
<Image src='/icons/arrow-up.svg' width={16} height={16} alt='down' />
49-
<span>{numberCompactFormatter(scoreDifference)}</span>
49+
<span>{getCompactNumber(scoreDifference)}</span>
5050
</Change>
5151
) : (
5252
<NotChange src='/icons/arrow-bar.svg' width={10} height={10} alt='not change' />

frontend/src/utils/constants.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,6 @@ export const DEVELOPER_INFORMATION = [
8686
},
8787
];
8888

89-
export const MONTH_LABEL_MAPPING: {
90-
[key: string]: string;
91-
} = {
92-
1: 'Jan',
93-
2: 'Feb',
94-
3: 'Mar',
95-
4: 'Apr',
96-
5: 'May',
97-
6: 'Jun',
98-
7: 'Jul',
99-
8: 'Aug',
100-
9: 'Sep',
101-
10: 'Oct',
102-
11: 'Nov',
103-
12: 'Dec',
104-
};
105-
10689
export const CUBE_COLOR_MAP: {
10790
[key in RANK]: string;
10891
} = {

frontend/src/utils/utils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ export const languageToURL = (language: string): string => {
99
return `${LANGUAGE_ICON_URL}/file_type_${LANGUAGE_MAP[language] || language}.svg`;
1010
};
1111

12-
export const numberCompactFormatter = (num: number): string => {
13-
return new Intl.NumberFormat('en-US', { notation: 'compact' }).format(num);
12+
export const getCompactNumber = (num: number): string => {
13+
return Intl.NumberFormat('en', { notation: 'compact' }).format(num);
14+
};
15+
16+
export const getMonthLabel = (date: Date) => {
17+
return Intl.DateTimeFormat('en', { month: 'short' }).format(date);
1418
};
1519

1620
export const getDate = (dateString: string) => {

frontend/src/utils/wrapper.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
99
import { ParsedUrlQuery } from 'querystring';
1010
import { QueryClient, dehydrate } from '@tanstack/react-query';
11+
import axiosInstance from '@utils/axiosInstance';
1112

1213
interface Redirectable {
1314
url: string;
@@ -25,6 +26,9 @@ export function ssrWrapper(
2526
) => Promise<object | void>,
2627
): GetServerSideProps {
2728
return async (context) => {
29+
axiosInstance.defaults.headers.common['X-Forwarded-For'] = context.req.headers['X-Forwarded-For'];
30+
axiosInstance.defaults.headers.common['x-forwarded-for'] = context.req.headers['x-forwarded-for'];
31+
2832
try {
2933
const queryClient = new QueryClient();
3034
let propsData: object | void;

0 commit comments

Comments
 (0)