From dc2b0a726e379d1c6f72225cfca68f0c6aa865fb Mon Sep 17 00:00:00 2001 From: dongree Date: Wed, 18 Oct 2023 12:04:03 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20=EB=A9=94=EB=AA=A8=EC=B9=B4=EB=93=9C=20?= =?UTF-8?q?=EB=9E=AD=ED=81=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/icons/rank/bronze_0.svg | 14 ++++ src/assets/icons/rank/bronze_1.svg | 18 +++++ src/assets/icons/rank/bronze_2.svg | 20 ++++++ src/assets/icons/rank/bronze_3.svg | 21 ++++++ src/assets/icons/rank/bronze_4.svg | 19 +++++ src/assets/icons/rank/bronze_5.svg | 20 ++++++ src/assets/icons/rank/diamond_0.svg | 16 +++++ src/assets/icons/rank/diamond_1.svg | 20 ++++++ src/assets/icons/rank/diamond_2.svg | 22 ++++++ src/assets/icons/rank/diamond_3.svg | 23 ++++++ src/assets/icons/rank/diamond_4.svg | 21 ++++++ src/assets/icons/rank/diamond_5.svg | 22 ++++++ src/assets/icons/rank/gold_0.svg | 15 ++++ src/assets/icons/rank/gold_1.svg | 19 +++++ src/assets/icons/rank/gold_2.svg | 21 ++++++ src/assets/icons/rank/gold_3.svg | 22 ++++++ src/assets/icons/rank/gold_4.svg | 20 ++++++ src/assets/icons/rank/gold_5.svg | 21 ++++++ src/assets/icons/rank/infinity_0.svg | 20 ++++++ src/assets/icons/rank/infinity_1.svg | 24 +++++++ src/assets/icons/rank/infinity_2.svg | 26 +++++++ src/assets/icons/rank/infinity_3.svg | 27 +++++++ src/assets/icons/rank/infinity_4.svg | 25 +++++++ src/assets/icons/rank/infinity_5.svg | 26 +++++++ src/assets/icons/rank/platinum_0.svg | 15 ++++ src/assets/icons/rank/platinum_1.svg | 19 +++++ src/assets/icons/rank/platinum_2.svg | 21 ++++++ src/assets/icons/rank/platinum_3.svg | 22 ++++++ src/assets/icons/rank/platinum_4.svg | 20 ++++++ src/assets/icons/rank/platinum_5.svg | 21 ++++++ src/assets/icons/rank/silver_0.svg | 15 ++++ src/assets/icons/rank/silver_1.svg | 19 +++++ src/assets/icons/rank/silver_2.svg | 21 ++++++ src/assets/icons/rank/silver_3.svg | 22 ++++++ src/assets/icons/rank/silver_4.svg | 20 ++++++ src/assets/icons/rank/silver_5.svg | 21 ++++++ src/components/memo/MemoCard.tsx | 2 + src/components/memo/MemoCardHeader.tsx | 14 +++- src/service/rank.ts | 98 ++++++++++++++++++++++++++ src/types/memo.ts | 3 + src/types/rank.ts | 31 ++++++++ 41 files changed, 885 insertions(+), 1 deletion(-) create mode 100644 src/assets/icons/rank/bronze_0.svg create mode 100644 src/assets/icons/rank/bronze_1.svg create mode 100644 src/assets/icons/rank/bronze_2.svg create mode 100644 src/assets/icons/rank/bronze_3.svg create mode 100644 src/assets/icons/rank/bronze_4.svg create mode 100644 src/assets/icons/rank/bronze_5.svg create mode 100644 src/assets/icons/rank/diamond_0.svg create mode 100644 src/assets/icons/rank/diamond_1.svg create mode 100644 src/assets/icons/rank/diamond_2.svg create mode 100644 src/assets/icons/rank/diamond_3.svg create mode 100644 src/assets/icons/rank/diamond_4.svg create mode 100644 src/assets/icons/rank/diamond_5.svg create mode 100644 src/assets/icons/rank/gold_0.svg create mode 100644 src/assets/icons/rank/gold_1.svg create mode 100644 src/assets/icons/rank/gold_2.svg create mode 100644 src/assets/icons/rank/gold_3.svg create mode 100644 src/assets/icons/rank/gold_4.svg create mode 100644 src/assets/icons/rank/gold_5.svg create mode 100644 src/assets/icons/rank/infinity_0.svg create mode 100644 src/assets/icons/rank/infinity_1.svg create mode 100644 src/assets/icons/rank/infinity_2.svg create mode 100644 src/assets/icons/rank/infinity_3.svg create mode 100644 src/assets/icons/rank/infinity_4.svg create mode 100644 src/assets/icons/rank/infinity_5.svg create mode 100644 src/assets/icons/rank/platinum_0.svg create mode 100644 src/assets/icons/rank/platinum_1.svg create mode 100644 src/assets/icons/rank/platinum_2.svg create mode 100644 src/assets/icons/rank/platinum_3.svg create mode 100644 src/assets/icons/rank/platinum_4.svg create mode 100644 src/assets/icons/rank/platinum_5.svg create mode 100644 src/assets/icons/rank/silver_0.svg create mode 100644 src/assets/icons/rank/silver_1.svg create mode 100644 src/assets/icons/rank/silver_2.svg create mode 100644 src/assets/icons/rank/silver_3.svg create mode 100644 src/assets/icons/rank/silver_4.svg create mode 100644 src/assets/icons/rank/silver_5.svg create mode 100644 src/service/rank.ts create mode 100644 src/types/rank.ts diff --git a/src/assets/icons/rank/bronze_0.svg b/src/assets/icons/rank/bronze_0.svg new file mode 100644 index 00000000..a3d3d6f0 --- /dev/null +++ b/src/assets/icons/rank/bronze_0.svg @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/src/assets/icons/rank/bronze_1.svg b/src/assets/icons/rank/bronze_1.svg new file mode 100644 index 00000000..b83a9868 --- /dev/null +++ b/src/assets/icons/rank/bronze_1.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/bronze_2.svg b/src/assets/icons/rank/bronze_2.svg new file mode 100644 index 00000000..d5177f43 --- /dev/null +++ b/src/assets/icons/rank/bronze_2.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/bronze_3.svg b/src/assets/icons/rank/bronze_3.svg new file mode 100644 index 00000000..8f51aaff --- /dev/null +++ b/src/assets/icons/rank/bronze_3.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/bronze_4.svg b/src/assets/icons/rank/bronze_4.svg new file mode 100644 index 00000000..506f1bf5 --- /dev/null +++ b/src/assets/icons/rank/bronze_4.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/bronze_5.svg b/src/assets/icons/rank/bronze_5.svg new file mode 100644 index 00000000..4ce012c5 --- /dev/null +++ b/src/assets/icons/rank/bronze_5.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/diamond_0.svg b/src/assets/icons/rank/diamond_0.svg new file mode 100644 index 00000000..3f982e4d --- /dev/null +++ b/src/assets/icons/rank/diamond_0.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + diff --git a/src/assets/icons/rank/diamond_1.svg b/src/assets/icons/rank/diamond_1.svg new file mode 100644 index 00000000..2f07af94 --- /dev/null +++ b/src/assets/icons/rank/diamond_1.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/diamond_2.svg b/src/assets/icons/rank/diamond_2.svg new file mode 100644 index 00000000..b23f187b --- /dev/null +++ b/src/assets/icons/rank/diamond_2.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/diamond_3.svg b/src/assets/icons/rank/diamond_3.svg new file mode 100644 index 00000000..aff457a5 --- /dev/null +++ b/src/assets/icons/rank/diamond_3.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/diamond_4.svg b/src/assets/icons/rank/diamond_4.svg new file mode 100644 index 00000000..cf1357b2 --- /dev/null +++ b/src/assets/icons/rank/diamond_4.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/diamond_5.svg b/src/assets/icons/rank/diamond_5.svg new file mode 100644 index 00000000..3360a952 --- /dev/null +++ b/src/assets/icons/rank/diamond_5.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/gold_0.svg b/src/assets/icons/rank/gold_0.svg new file mode 100644 index 00000000..36535f1b --- /dev/null +++ b/src/assets/icons/rank/gold_0.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/src/assets/icons/rank/gold_1.svg b/src/assets/icons/rank/gold_1.svg new file mode 100644 index 00000000..ec1f2fcf --- /dev/null +++ b/src/assets/icons/rank/gold_1.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/gold_2.svg b/src/assets/icons/rank/gold_2.svg new file mode 100644 index 00000000..b1f8e9da --- /dev/null +++ b/src/assets/icons/rank/gold_2.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/gold_3.svg b/src/assets/icons/rank/gold_3.svg new file mode 100644 index 00000000..97576a75 --- /dev/null +++ b/src/assets/icons/rank/gold_3.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/gold_4.svg b/src/assets/icons/rank/gold_4.svg new file mode 100644 index 00000000..09d214bd --- /dev/null +++ b/src/assets/icons/rank/gold_4.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/gold_5.svg b/src/assets/icons/rank/gold_5.svg new file mode 100644 index 00000000..07023439 --- /dev/null +++ b/src/assets/icons/rank/gold_5.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/infinity_0.svg b/src/assets/icons/rank/infinity_0.svg new file mode 100644 index 00000000..f3535120 --- /dev/null +++ b/src/assets/icons/rank/infinity_0.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/infinity_1.svg b/src/assets/icons/rank/infinity_1.svg new file mode 100644 index 00000000..44070d8d --- /dev/null +++ b/src/assets/icons/rank/infinity_1.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/infinity_2.svg b/src/assets/icons/rank/infinity_2.svg new file mode 100644 index 00000000..dd5dbbb7 --- /dev/null +++ b/src/assets/icons/rank/infinity_2.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/infinity_3.svg b/src/assets/icons/rank/infinity_3.svg new file mode 100644 index 00000000..90dc6024 --- /dev/null +++ b/src/assets/icons/rank/infinity_3.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/infinity_4.svg b/src/assets/icons/rank/infinity_4.svg new file mode 100644 index 00000000..c7f4f7f3 --- /dev/null +++ b/src/assets/icons/rank/infinity_4.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/infinity_5.svg b/src/assets/icons/rank/infinity_5.svg new file mode 100644 index 00000000..c0a8fe0d --- /dev/null +++ b/src/assets/icons/rank/infinity_5.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/platinum_0.svg b/src/assets/icons/rank/platinum_0.svg new file mode 100644 index 00000000..65f198c2 --- /dev/null +++ b/src/assets/icons/rank/platinum_0.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/src/assets/icons/rank/platinum_1.svg b/src/assets/icons/rank/platinum_1.svg new file mode 100644 index 00000000..501d0663 --- /dev/null +++ b/src/assets/icons/rank/platinum_1.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/platinum_2.svg b/src/assets/icons/rank/platinum_2.svg new file mode 100644 index 00000000..8a3569e0 --- /dev/null +++ b/src/assets/icons/rank/platinum_2.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/platinum_3.svg b/src/assets/icons/rank/platinum_3.svg new file mode 100644 index 00000000..0eae7029 --- /dev/null +++ b/src/assets/icons/rank/platinum_3.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/platinum_4.svg b/src/assets/icons/rank/platinum_4.svg new file mode 100644 index 00000000..ac99189e --- /dev/null +++ b/src/assets/icons/rank/platinum_4.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/platinum_5.svg b/src/assets/icons/rank/platinum_5.svg new file mode 100644 index 00000000..9ee198ee --- /dev/null +++ b/src/assets/icons/rank/platinum_5.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/silver_0.svg b/src/assets/icons/rank/silver_0.svg new file mode 100644 index 00000000..dcbb9f0a --- /dev/null +++ b/src/assets/icons/rank/silver_0.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/src/assets/icons/rank/silver_1.svg b/src/assets/icons/rank/silver_1.svg new file mode 100644 index 00000000..60071a8b --- /dev/null +++ b/src/assets/icons/rank/silver_1.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/silver_2.svg b/src/assets/icons/rank/silver_2.svg new file mode 100644 index 00000000..8c5cde72 --- /dev/null +++ b/src/assets/icons/rank/silver_2.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/silver_3.svg b/src/assets/icons/rank/silver_3.svg new file mode 100644 index 00000000..b937b21f --- /dev/null +++ b/src/assets/icons/rank/silver_3.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/silver_4.svg b/src/assets/icons/rank/silver_4.svg new file mode 100644 index 00000000..bd490645 --- /dev/null +++ b/src/assets/icons/rank/silver_4.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/rank/silver_5.svg b/src/assets/icons/rank/silver_5.svg new file mode 100644 index 00000000..9fbc84aa --- /dev/null +++ b/src/assets/icons/rank/silver_5.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/src/components/memo/MemoCard.tsx b/src/components/memo/MemoCard.tsx index c581ac90..8eab3de7 100644 --- a/src/components/memo/MemoCard.tsx +++ b/src/components/memo/MemoCard.tsx @@ -22,6 +22,7 @@ export default function MemoCard({ memoTags, repliesCount, questionCount, + authorRank, }, }: Props) { return ( @@ -45,6 +46,7 @@ export default function MemoCard({ likes={likes} imagePath={authorProfileImagePath} authorId={authorId} + authorRank={authorRank} /> @@ -33,7 +37,15 @@ export default function MemoCardHeader({ />
-

{authorName}

+
+

{authorName}

+ rank +
diff --git a/src/service/rank.ts b/src/service/rank.ts new file mode 100644 index 00000000..c0b994bf --- /dev/null +++ b/src/service/rank.ts @@ -0,0 +1,98 @@ +import { Rank } from '@/types/rank'; +import bronze5 from '@/assets/icons/rank/bronze_5.svg'; +import bronze4 from '@/assets/icons/rank/bronze_4.svg'; +import bronze3 from '@/assets/icons/rank/bronze_3.svg'; +import bronze2 from '@/assets/icons/rank/bronze_2.svg'; +import bronze1 from '@/assets/icons/rank/bronze_1.svg'; +import silver5 from '@/assets/icons/rank/silver_5.svg'; +import silver4 from '@/assets/icons/rank/silver_4.svg'; +import silver3 from '@/assets/icons/rank/silver_3.svg'; +import silver2 from '@/assets/icons/rank/silver_2.svg'; +import silver1 from '@/assets/icons/rank/silver_1.svg'; +import gold5 from '@/assets/icons/rank/gold_5.svg'; +import gold4 from '@/assets/icons/rank/gold_4.svg'; +import gold3 from '@/assets/icons/rank/gold_3.svg'; +import gold2 from '@/assets/icons/rank/gold_2.svg'; +import gold1 from '@/assets/icons/rank/gold_1.svg'; +import platinum5 from '@/assets/icons/rank/platinum_5.svg'; +import platinum4 from '@/assets/icons/rank/platinum_4.svg'; +import platinum3 from '@/assets/icons/rank/platinum_3.svg'; +import platinum2 from '@/assets/icons/rank/platinum_2.svg'; +import platinum1 from '@/assets/icons/rank/platinum_1.svg'; +import diamond5 from '@/assets/icons/rank/diamond_5.svg'; +import diamond4 from '@/assets/icons/rank/diamond_4.svg'; +import diamond3 from '@/assets/icons/rank/diamond_3.svg'; +import diamond2 from '@/assets/icons/rank/diamond_2.svg'; +import diamond1 from '@/assets/icons/rank/diamond_1.svg'; +import infinity5 from '@/assets/icons/rank/infinity_5.svg'; +import infinity4 from '@/assets/icons/rank/infinity_4.svg'; +import infinity3 from '@/assets/icons/rank/infinity_3.svg'; +import infinity2 from '@/assets/icons/rank/infinity_2.svg'; +import infinity1 from '@/assets/icons/rank/infinity_1.svg'; + +export function getImageSrcFromRank(rank: Rank): string { + switch (rank) { + case 'BRONZE_5': + return bronze5; + case 'BRONZE_4': + return bronze4; + case 'BRONZE_3': + return bronze3; + case 'BRONZE_2': + return bronze2; + case 'BRONZE_1': + return bronze1; + case 'SILVER_5': + return silver5; + case 'SILVER_4': + return silver4; + case 'SILVER_3': + return silver3; + case 'SILVER_2': + return silver2; + case 'SILVER_1': + return silver1; + case 'GOLD_5': + return gold5; + case 'GOLD_4': + return gold4; + case 'GOLD_3': + return gold3; + case 'GOLD_2': + return gold2; + case 'GOLD_1': + return gold1; + case 'PLATINUM_5': + return platinum5; + case 'PLATINUM_4': + return platinum4; + case 'PLATINUM_3': + return platinum3; + case 'PLATINUM_2': + return platinum2; + case 'PLATINUM_1': + return platinum1; + case 'DIAMOND_5': + return diamond5; + case 'DIAMOND_4': + return diamond4; + case 'DIAMOND_3': + return diamond3; + case 'DIAMOND_2': + return diamond2; + case 'DIAMOND_1': + return diamond1; + case 'INFINITY_5': + return infinity5; + case 'INFINITY_4': + return infinity4; + case 'INFINITY_3': + return infinity3; + case 'INFINITY_2': + return infinity2; + case 'INFINITY_1': + return infinity1; + default: + throw new Error('wrong rank type'); + } +} diff --git a/src/types/memo.ts b/src/types/memo.ts index 365f3d55..b7ee604c 100644 --- a/src/types/memo.ts +++ b/src/types/memo.ts @@ -1,3 +1,5 @@ +import { Rank } from './rank'; + export type Memo = { memoId: number; memoTitle: string; @@ -17,6 +19,7 @@ export type Memo = { isMine: boolean; seriesId: number; isCreated: boolean; + authorRank: Rank; }; export type PostMemoData = { diff --git a/src/types/rank.ts b/src/types/rank.ts new file mode 100644 index 00000000..d062cdfa --- /dev/null +++ b/src/types/rank.ts @@ -0,0 +1,31 @@ +export type Rank = + | 'BRONZE_5' + | 'BRONZE_4' + | 'BRONZE_3' + | 'BRONZE_2' + | 'BRONZE_1' + | 'SILVER_5' + | 'SILVER_4' + | 'SILVER_3' + | 'SILVER_2' + | 'SILVER_1' + | 'GOLD_5' + | 'GOLD_4' + | 'GOLD_3' + | 'GOLD_2' + | 'GOLD_1' + | 'PLATINUM_5' + | 'PLATINUM_4' + | 'PLATINUM_3' + | 'PLATINUM_2' + | 'PLATINUM_1' + | 'DIAMOND_5' + | 'DIAMOND_4' + | 'DIAMOND_3' + | 'DIAMOND_2' + | 'DIAMOND_1' + | 'INFINITY_5' + | 'INFINITY_4' + | 'INFINITY_3' + | 'INFINITY_2' + | 'INFINITY_1';