Skip to content

Commit 3e27671

Browse files
authored
Merge pull request #331 from topcoder-platform/feat/GAME-124
Feat/game 124
2 parents a19e9bd + e4c7732 commit 3e27671

File tree

10 files changed

+537
-23
lines changed

10 files changed

+537
-23
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"highlight.js": "^11.6.0",
3535
"html2canvas": "^1.4.1",
3636
"lodash": "^4.17.21",
37+
"markdown-it": "^13.0.1",
3738
"marked": "4.0.3",
3839
"moment": "^2.29.3",
3940
"moment-timezone": "^0.5.34",
@@ -42,6 +43,7 @@
4243
"react": "^17.0.2",
4344
"react-apexcharts": "^1.4.0",
4445
"react-app-rewired": "^2.2.1",
46+
"react-contenteditable": "^3.3.6",
4547
"react-dom": "^17.0.2",
4648
"react-elastic-carousel": "^0.11.5",
4749
"react-gtm-module": "^2.0.11",
@@ -85,6 +87,7 @@
8587
"@types/highlightjs": "^9.12.2",
8688
"@types/jest": "^27.0.1",
8789
"@types/lodash": "^4.14.182",
90+
"@types/markdown-it": "^12.2.3",
8891
"@types/marked": "4.0.3",
8992
"@types/node": "^18.7.13",
9093
"@types/reach__router": "^1.3.10",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from './game-badge.model'
22
export * from './use-get-game-badges-page.hook'
33
export * from './use-gamification-breadcrumb.hook'
4+
export * from './use-get-game-badge-details.hook'
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import useSWR, { KeyedMutator, SWRResponse } from 'swr'
2+
3+
import { EnvironmentConfig } from '../../../config'
4+
5+
import { GameBadge } from './game-badge.model'
6+
7+
export interface BadgeDetailPageHandler<T> {
8+
data?: Readonly<T>
9+
error?: Readonly<any>
10+
mutate: KeyedMutator<any>
11+
}
12+
13+
export function useGetGameBadgeDetails(badgeID: string): BadgeDetailPageHandler<GameBadge> {
14+
15+
const badgeEndpointUrl: URL = new URL(`${EnvironmentConfig.API.V5}/gamification/badges/${badgeID}`)
16+
17+
const { data, error, mutate }: SWRResponse = useSWR(badgeEndpointUrl.toString())
18+
19+
return {
20+
data,
21+
error,
22+
mutate,
23+
}
24+
}
Lines changed: 130 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,134 @@
1-
.contentLayout {
2-
width: 100%;
3-
padding-bottom: 0;
1+
@import "../../../../lib/styles/variables";
2+
@import "../../../../lib/styles/includes";
43

5-
.contentLayout-outer {
6-
width: 100%;
4+
$badgePreview: 130px;
5+
$badgePreviewImage: 72px;
76

8-
.contentLayout-inner {
9-
width: 100%;
10-
overflow: visible;
7+
.container {
8+
display: flex;
9+
flex-direction: column;
10+
11+
.error {
12+
background-color: $black-5;
13+
color: red;
14+
padding: $space-sm;
1115
}
12-
}
13-
}
1416

15-
.container {
16-
display: flex;
17-
}
17+
.badge {
18+
display: flex;
19+
margin-top: $space-xxxxl;
20+
21+
@include ltemd {
22+
flex-direction: column;
23+
}
24+
25+
.badgeImage {
26+
position: relative;
27+
border-radius: $space-sm;
28+
background-color: $black-5;
29+
margin-right: $space-xxxxl;
30+
display: flex;
31+
align-items: center;
32+
justify-content: center;
33+
width: $badgePreview;
34+
height: $badgePreview;
35+
min-width: $badgePreview;
36+
min-height: $badgePreview;
37+
38+
@include ltemd {
39+
margin-right: 0;
40+
margin-bottom: $space-xxl;
41+
width: 100%;
42+
}
43+
44+
img {
45+
width: $badgePreviewImage;
46+
height: $badgePreviewImage;
47+
}
48+
49+
.filePickerPencil {
50+
position: absolute;
51+
top: 0;
52+
right: 0;
53+
color: $turq-160;
54+
}
55+
56+
.filePickerInput {
57+
display: none;
58+
}
59+
}
60+
61+
.badgeDetails {
62+
display: flex;
63+
flex-direction: column;
64+
flex: 1;
65+
66+
.badgeName {
67+
font-family: $font-roboto;
68+
font-weight: $font-weight-bold;
69+
padding: $space-sm;
70+
font-size: 24px;
71+
line-height: 32px;
72+
73+
@include ltemd {
74+
font-size: 20px;
75+
line-height: 28px;
76+
}
77+
78+
&:hover {
79+
background-color: $black-5;
80+
cursor: text;
81+
}
82+
83+
&:focus {
84+
background-color: $tc-white;
85+
outline-color: $turq-160;
86+
}
87+
}
88+
89+
.badgeDesc {
90+
margin-top: $space-sm;
91+
92+
.badgeEditWrap {
93+
display: flex;
94+
flex-direction: column;
95+
96+
.badgeEditable,
97+
.badgeEditableMode {
98+
padding: $space-sm;
99+
border-radius: 3px;
100+
border: 2px solid $tc-white;
101+
102+
&:hover {
103+
background-color: $black-5;
104+
cursor: text;
105+
}
106+
107+
&:focus {
108+
background-color: $tc-white;
109+
outline: none;
110+
}
111+
112+
a {
113+
color: $link-blue-dark;
114+
}
115+
}
116+
117+
.badgeEditableMode {
118+
border: 2px solid $turq-160;
119+
}
120+
121+
.badgeEditActions {
122+
display: flex;
123+
justify-content: flex-end;
124+
margin-top: $space-sm;
125+
126+
button:first-child {
127+
margin-right: $space-sm;
128+
}
129+
}
130+
}
131+
}
132+
}
133+
}
134+
}

0 commit comments

Comments
 (0)