Skip to content

Commit 624102d

Browse files
authored
merge: UserLevel 활동 시 얻는 활동 점수 재조정
2 parents 1856973 + 14af3b5 commit 624102d

2 files changed

Lines changed: 42 additions & 38 deletions

File tree

src/pages/MyInfoPage/LevelModal.jsx

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,42 @@ import theme from 'styles/theme';
55

66
const { fontNormal, fontBlack, backgroundLight, fontDark } = theme.color;
77

8+
const LevelModal = ({ onClose }) => {
9+
return (
10+
<ModalContainer>
11+
<CloseButton name="CLOSE" size={30} onClick={onClose} />
12+
<Text fontSize={22} block strong style={{ marginTop: 30 }}>
13+
활동 점수
14+
</Text>
15+
<Text block fontSize={16} style={{ marginTop: 12 }}>
16+
활동 점수에 따라 등급이 부여됩니다.
17+
</Text>
18+
<ScoreDescription>
19+
게시물 등록 시 <Strong>+3점</Strong>, 댓글 등록 시 <Strong>+2점</Strong>,<br />
20+
다른 사람이 나를 팔로우 할 시 <Strong>+2점</Strong>
21+
</ScoreDescription>
22+
<LevelList>
23+
{levels.map((level, index) => (
24+
<LevelItem key={index}>
25+
<Avatar
26+
src={level.image}
27+
size={50}
28+
alt={level.name}
29+
style={{ backgroundColor: level.color, border: 0 }}
30+
/>
31+
<LevelInfo>
32+
<LevelName>{level.name}</LevelName>
33+
<LevelDescription>{level.description}</LevelDescription>
34+
</LevelInfo>
35+
</LevelItem>
36+
))}
37+
</LevelList>
38+
</ModalContainer>
39+
);
40+
};
41+
42+
export default LevelModal;
43+
844
const ModalContainer = styled.div`
945
width: 100%;
1046
background-color: white;
@@ -65,39 +101,3 @@ const Strong = styled.span`
65101
font-weight: bold;
66102
color: ${fontBlack};
67103
`;
68-
69-
const LevelModal = ({ onClose }) => {
70-
return (
71-
<ModalContainer>
72-
<CloseButton name="CLOSE" size={30} onClick={onClose} />
73-
<Text fontSize={22} block strong style={{ marginTop: 30 }}>
74-
활동 점수
75-
</Text>
76-
<Text block fontSize={16} style={{ marginTop: 12 }}>
77-
활동 점수에 따라 등급이 부여됩니다.
78-
</Text>
79-
<ScoreDescription>
80-
게시물 등록 시 <Strong>+2점</Strong>, 댓글 등록 시 <Strong>+1점</Strong>,<br />
81-
다른 사람이 나를 팔로우 할 시 <Strong>+1점</Strong>
82-
</ScoreDescription>
83-
<LevelList>
84-
{levels.map((level, index) => (
85-
<LevelItem key={index}>
86-
<Avatar
87-
src={level.image}
88-
size={50}
89-
alt={level.name}
90-
style={{ backgroundColor: level.color, border: 0 }}
91-
/>
92-
<LevelInfo>
93-
<LevelName>{level.name}</LevelName>
94-
<LevelDescription>{level.description}</LevelDescription>
95-
</LevelInfo>
96-
</LevelItem>
97-
))}
98-
</LevelList>
99-
</ModalContainer>
100-
);
101-
};
102-
103-
export default LevelModal;

src/utils/functions/userLevel/getUserLevel.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import levels from './levels';
33
/*
44
사용자의 점수와 레벨을 계산한다.
55
1. 점수
6-
포스트 개수(2점) + 댓글 개수(1점) + 팔로워 수(1점)
6+
포스트 개수(3점) + 댓글 개수(2점) + 팔로워 수(2점)
77
88
2. 레벨
99
1) 초린이: 점수 0 이상 30 미만
@@ -13,7 +13,11 @@ import levels from './levels';
1313
5) 태양신: 점수 500 이상
1414
*/
1515
export default function getUserLevel({ posts, comments, followers }) {
16-
const score = 2 * posts.length + comments.length + followers.length;
16+
const postScore = 3 * posts.length;
17+
const commentScore = 2 * comments.length;
18+
const followerScore = 2 * followers.length;
19+
const score = postScore + commentScore + followerScore;
20+
1721
let level;
1822
if (score >= 0 && score < 30) {
1923
level = levels[0];

0 commit comments

Comments
 (0)