Skip to content

Commit

Permalink
Merge pull request #276 from boostcampwm-2022/develop
Browse files Browse the repository at this point in the history
v0.1.5 배포
  • Loading branch information
Yaminyam authored Dec 12, 2022
2 parents 75b80a1 + 14904a4 commit 3b76e71
Show file tree
Hide file tree
Showing 23 changed files with 489 additions and 56 deletions.
3 changes: 1 addition & 2 deletions backend/src/batch/batch.service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { logger } from '@libs/utils';
import { Injectable, Logger } from '@nestjs/common';
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { Cron } from '@nestjs/schedule';
import { UserService } from '../user/user.service';

@Injectable()
export class BatchService {
private readonly logger = new Logger(BatchService.name);
constructor(private readonly userService: UserService, private readonly configService: ConfigService) {}

@Cron('0 0 0 * * *', { name: 'cronTask' })
Expand Down
2 changes: 1 addition & 1 deletion backend/src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class UserService {
if (!updatedUser.scoreHistory) updatedUser.scoreHistory = [];
updatedUser.scoreHistory.push({
date: new Date(),
score: user.score,
score: updatedUser.score,
});
if (updatedUser.scoreHistory.length > 1) {
updatedUser.scoreDifference =
Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@types/react": "18.0.25",
"@types/react-dom": "18.0.8",
"@types/styled-components": "^5.1.26",
"@vercel/og": "^0.0.21",
"axios": "^1.1.3",
"eslint": "8.27.0",
"eslint-config-next": "13.0.3",
Expand Down
Binary file added frontend/public/fonts/line-seed-kr-regular.woff
Binary file not shown.
3 changes: 0 additions & 3 deletions frontend/public/icons/devrank-logo-large.svg

This file was deleted.

8 changes: 8 additions & 0 deletions frontend/public/icons/ranking-1st.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions frontend/public/icons/ranking-2nd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions frontend/public/icons/ranking-3rd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/public/locales/en/header.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"navigate-about": "About",
"navigate-about": "Intro",
"navigate-ranking": "Leaderboard"
}
2 changes: 1 addition & 1 deletion frontend/public/locales/ko/header.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"navigate-about": "About",
"navigate-about": "소개",
"navigate-ranking": "랭킹"
}
2 changes: 1 addition & 1 deletion frontend/public/locales/ko/profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"register-wakatime-button-label": "등록",
"maximum-continuous-commit-history": "최대 연속 커밋 일수",
"day": "",
"total": "전체 등수",
"total": "전체",
"rank": "등급"
}
33 changes: 17 additions & 16 deletions frontend/src/components/Profile/CommitHistory/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import styled from 'styled-components';
import { CommitLevelType, HistoryType, RANK } from '@type/common';
import { HistoryType, RANK } from '@type/common';
import { colors } from '@styles/theme';
import { MONTH_LABEL_MAPPING } from '@utils/constants';
import { getDate } from '@utils/utils';

const COMMIT_LEFT_BOUNDARY = 5;

const COMMIT_RIGHT_BOUNDARY = 48;

interface CommitHistoryProps {
history: HistoryType;
tier: RANK;
}
interface StyledHistoryBlockProps {
level: CommitLevelType;
tier: RANK;
}
interface StyledTooltipProps {
weeks: number;
}
Expand All @@ -39,7 +37,10 @@ function CommitHistory({ history, tier }: CommitHistoryProps) {
prevMonth = month;
}
return (
<CommitHistoryBlock key={idx} tier={tier} level={level}>
<CommitHistoryBlock
key={dateString}
style={{ backgroundColor: level === 0 ? colors.commit0 : colors[`${tier}${level}`] }}
>
{date < 24 && day === 0 && isMonthLabelChange ? (
<MonthLabel>{MONTH_LABEL_MAPPING[month]}</MonthLabel>
) : null}
Expand All @@ -49,19 +50,20 @@ function CommitHistory({ history, tier }: CommitHistoryProps) {
</CommitHistoryBlock>
);
})}
<DayLabel>
<div>Mon</div>
<div>Wed</div>
<div>Fri</div>
</DayLabel>
</CommitHistoryGroup>
<DayLabel>
<li>Mon</li>
<li>Wed</li>
<li>Fri</li>
</DayLabel>
</Container>
);
}

export default CommitHistory;

const Container = styled.div`
position: relative;
${({ theme }) => theme.common.flexCenterColumn};
width: 100%;
padding-top: 20px;
Expand All @@ -77,12 +79,10 @@ const CommitHistoryGroup = styled.ul`
width: 100%;
`;

const CommitHistoryBlock = styled.li<StyledHistoryBlockProps>`
const CommitHistoryBlock = styled.li`
width: 16px;
aspect-ratio: 1;
position: relative;
background-color: ${({ theme, level, tier }) =>
level === 0 ? theme.colors.commit0 : `${theme.colors[`${tier}${level}`]}`};
border-radius: 2px;
&:hover .tooltip {
display: block;
Expand Down Expand Up @@ -162,9 +162,10 @@ const MonthLabel = styled.div`
pointer-events: none;
`;

const DayLabel = styled.div`
const DayLabel = styled.ul`
position: absolute;
left: -45px;
top: 0;
left: -20px;
font-size: 16px;
height: 100%;
${({ theme }) => theme.common.flexCenterColumn};
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/Profile/EXPbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function EXPbar({ tier, exp, startExp, needExp }: EXPbarProps) {
export default EXPbar;

const Score = styled.div`
font-size: 20px;
margin-top: 10px;
margin-left: 10px;
`;
Expand Down
40 changes: 23 additions & 17 deletions frontend/src/components/Profile/ProfileCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import styled from 'styled-components';
import ProfileRefreshButton from '../ProfileRefreshButton';
import { OrganizationType, RANK } from '@type/common';
import { ProfileLabel } from '@components/Profile';
import { Avatar, CubeIcon, Paper } from '@components/common';
import { Avatar, Paper } from '@components/common';
import CubeLogo from '@components/common/CubeLogo';
import { CUBE_COLOR_MAP } from '@utils/constants';
import { getRankingUnit } from '@utils/utils';

interface ProfileCardProps {
Expand All @@ -29,7 +31,7 @@ interface ProfileCardProps {
}

interface StyledColorProps {
tier: RANK;
color: string;
}

function ProfileCard({ profileData }: ProfileCardProps) {
Expand Down Expand Up @@ -110,16 +112,18 @@ function ProfileCard({ profileData }: ProfileCardProps) {
)}
</ProfileInfos>
<ProfileRank>
<CubeIcon tier={tier} size={160} />
<p>
{t('profile:total')}&nbsp;{totalRank}
{getRankingUnit(locale, totalRank)}
</p>
<p>
<ColorPoint tier={tier}>{t(`tier:${tier}`)}</ColorPoint>
&nbsp;{tierRank}
{getRankingUnit(locale, tierRank)}
</p>
<CubeLogo tier={tier} size={'sm'} />
<div>
<p>
{t('profile:total')}&nbsp;{totalRank}
{getRankingUnit(locale, totalRank)}
</p>
<p>
<ColorPoint color={CUBE_COLOR_MAP[tier]}>{t(`tier:${tier}`)}</ColorPoint>
&nbsp;{tierRank}
{getRankingUnit(locale, tierRank)}
</p>
</div>
</ProfileRank>
</Paper>
);
Expand All @@ -128,7 +132,7 @@ function ProfileCard({ profileData }: ProfileCardProps) {
export default ProfileCard;

const ColorPoint = styled.span<StyledColorProps>`
color: ${({ theme, tier }) => theme.colors[`${tier}2`]};
color: ${({ color }) => color};
`;

const ProfileInfos = styled.ul`
Expand Down Expand Up @@ -159,12 +163,14 @@ const ProfileInfos = styled.ul`
`;

const ProfileRank = styled.div`
${({ theme }) => theme.common.flexCenterColumn};
max-width: 300px;
width: 100%;
p {
margin-top: 8px;
div {
margin-top: 20px;
${({ theme }) => theme.common.flexCenterColumn};
p {
margin-top: 8px;
}
}
transform: translateZ(-50);
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/Ranking/OverallRanking/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { useTranslation } from 'next-i18next';
import Image from 'next/image';
import { useQuery } from '@tanstack/react-query';
import { RankingPaginationResponse } from '@type/response';
import { RankingTable } from '@components/Ranking';
import { Avatar, CubeIcon } from '@components/common';
import { requestTopRankingByScore } from '@apis/ranking';
import { MAIN_PAGE_RANK_COUNT } from '@utils/constants';
import { MAIN_PAGE_RANK_COUNT, MEDAL_IMG } from '@utils/constants';

interface OverallRankingProps {
searchUser: (username: string) => void;
Expand Down Expand Up @@ -33,13 +34,13 @@ function OverallRanking({ searchUser }: OverallRankingProps) {
<RankingTable.Element>{t('common:table-user')}</RankingTable.Element>
<RankingTable.Element>{t('common:table-score')}</RankingTable.Element>
</RankingTable.Head>
{rankingByScore?.users.map(({ id, tier, avatarUrl, username, score }, index) => (
{rankingByScore?.users.map(({ id, tier, avatarUrl, username, score }, idx) => (
<RankingTable.Row key={id} onClick={() => searchUser(username)}>
<RankingTable.Element>
<CubeIcon tier={tier} />
</RankingTable.Element>
<RankingTable.Element>
<span>{index + 1}</span>
<span> {idx < 3 ? <Image src={MEDAL_IMG[idx]} width={20} height={30} alt='medal' /> : idx + 1}</span>
</RankingTable.Element>
<RankingTable.Element>
<Avatar src={avatarUrl} name={username} />
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Ranking/ViewsRanking/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ function ViewsRanking({ searchUser }: ViewsRankingProps) {
<RankingTable.Element>{t('common:table-user')}</RankingTable.Element>
<RankingTable.Element>{t('common:table-views')}</RankingTable.Element>
</RankingTable.Head>
{rankingByViews?.map(({ id, tier, username, avatarUrl, dailyViews }, index) => (
{rankingByViews?.map(({ id, tier, username, avatarUrl, dailyViews }, idx) => (
<RankingTable.Row key={id} onClick={() => searchUser(username)}>
<RankingTable.Element>
<CubeIcon tier={tier} />
</RankingTable.Element>
<RankingTable.Element>
<span>{index + 1}</span>
<span>{idx + 1}</span>
</RankingTable.Element>
<RankingTable.Element>
<Avatar src={avatarUrl} name={username} />
Expand Down
Loading

0 comments on commit 3b76e71

Please sign in to comment.