Skip to content

Commit

Permalink
Merge pull request #414 from decert-me/chore-rate
Browse files Browse the repository at this point in the history
feat: rating-modal add params
  • Loading branch information
0xdwong authored May 13, 2024
2 parents 9cde536 + 40e8af9 commit 310b191
Show file tree
Hide file tree
Showing 14 changed files with 126 additions and 35 deletions.
4 changes: 3 additions & 1 deletion src/assets/locales/en-US/claim.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"bindAc": "Bind your social account",
"score": {
"now": "Score",
"passScore": "Reach {{score}} to pass the challenge."
"passScore": "Reach {{score}} to pass the challenge.",
"pass": "Pass",
"unpass": "Not Pass"
},
"step": {
"title": "Claim SBT badge",
Expand Down
6 changes: 6 additions & 0 deletions src/assets/locales/en-US/explore.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
"go-to": "Head to",
"suport": "Support",
"size": "Size",

"annotation": "Annotations",
"view-annotation": "View Annotations",
"last-answer": "Previous Answer",
"view-last-answer": "View Previous Answer",
"last-score": "Previous Score",

"notice": "Please complete all challenge first.",
"comming": "Please stay tuned.",
Expand Down
1 change: 1 addition & 0 deletions src/assets/locales/en-US/public.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"btn-add-answer": "Add option",
"btn-sumbit-confirm": "Confirm and submit",
"btn-go-challenge": "View challenge details",
"btn-go-rechallenge": "Rechallenge",
"btn-edit-profile": "Edit Profile",
"btn-cancel": "Cancel",
"btn-save": "Save",
Expand Down
4 changes: 3 additions & 1 deletion src/assets/locales/en-US/rate.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
"h1": "Grading List",
"quest": "Quiz",
"tips": "批注",
"tips": "Annotations",
"challenger": "Challenger",
"ans": "Answer",
"status": "Status",
"annex": "Attach files",
"score": "Score",
"c-num": "Challenge Number",
"c-addr": "Challenger Address",
"c-total": "Challenge total score",
"c-pass": "Passing score",
"all": "All",
"rated": "Processed",
"rate": "Pending",
Expand Down
4 changes: 3 additions & 1 deletion src/assets/locales/zh-CN/claim.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"bindAc": "绑定你的社交账号",
"score": {
"now": "得分",
"passScore": "达到 {{score}} 即可挑战通关"
"passScore": "达到 {{score}} 即可挑战通关",
"pass": "通过",
"unpass": "未通过"
},
"step": {
"title": "领取 SBT 徽章",
Expand Down
6 changes: 6 additions & 0 deletions src/assets/locales/zh-CN/explore.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
"go-to": "前往",
"suport": "支持",
"size": "大小",

"annotation": "批注",
"view-annotation": "查看批注",
"last-answer": "上次答案",
"view-last-answer": "查看上次答案",
"last-score": "上次得分",

"notice": "请先完成全部挑战",
"comming": "敬请期待...",
Expand Down
1 change: 1 addition & 0 deletions src/assets/locales/zh-CN/public.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"btn-add-answer": "添加选项",
"btn-sumbit-confirm": "确认并提交",
"btn-go-challenge": "查看挑战详情",
"btn-go-rechallenge": "重新挑战",
"btn-edit-profile": "编辑资料",
"btn-cancel": "取消",
"btn-save": "保存",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/locales/zh-CN/rate.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"score": "评分",
"c-num": "挑战编号",
"c-addr": "挑战者地址",
"c-total": "挑战总得分",
"c-pass": "挑战及格分",
"all": "全部",
"rated": "已评分",
"rate": "待评分",
Expand Down
38 changes: 30 additions & 8 deletions src/assets/styles/component-style/claim.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@
margin-right: 3px;
}
}
.box-center{
margin-top: 150px;
display: flex;
align-items: center;
justify-content: center;
gap: 40px;
#hover-btn-full{
border: none;
}
button{
min-width: 160px;
height: 38px;
}
}
p{
width: 450px;
font-size: 26px;
Expand All @@ -45,15 +59,9 @@
color: #999999;
font-size: 14px;
}
button{
margin: 0 auto;
display: block;
}
#hover-btn-line{
margin-top: 150px;
}
.btn-link{
margin-top: 200px;
margin: 200px auto 0;
display: block;
font-size: 16px;
color: #000000;
span{
Expand Down Expand Up @@ -171,6 +179,10 @@
position: absolute;
bottom: -25px;
}
.text-unpass{
font-size: 40px;
font-weight: 500;
}
}
.info{
margin-left: 145px;
Expand All @@ -188,6 +200,16 @@
line-height: 26px;
font-weight: 500;
}
.btns-flex{
display: flex;
gap: 40px;
#hover-btn-full{
border: none;
}
button{
min-width: 160px;
}
}
}

}
Expand Down
10 changes: 8 additions & 2 deletions src/assets/styles/mobile/view-style/claim.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ $container-width: 21.875rem;
line-height: 1.0625rem;
bottom: -1rem;
}
.text-unpass{
font-size: 1.5625rem;
font-weight: 500;
}
}
.info{
margin-left: 2.625rem;
Expand All @@ -52,11 +56,13 @@ $container-width: 21.875rem;
width: 100%;
margin: 2.75rem auto 0;
display: flex;
justify-content: center;
justify-content: space-between;
.btn{
width: 48.5%;
height: 1.9375rem;
margin: 0;
padding: 0 2.625rem;
// padding: 0 2.625rem;
padding: 0;
border-radius: .3125rem;
font-size: .75rem;
font-weight: 400;
Expand Down
17 changes: 8 additions & 9 deletions src/components/CustomChallenge/CustomOpen.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function CustomOpen(props) {

const { label, value, defaultValue, defaultFileList, question, detail } = props;
const { connectWallet } = useContext(MyContext);
const { t } = useTranslation(["explore"]);
const { t } = useTranslation(["explore", "translation"]);
const { isConnected } = useAddress();
const [annotationModal, setAnnottaionModal] = useState(false);
const [answerModal, setAnswerModal] = useState(false);
Expand Down Expand Up @@ -132,7 +132,7 @@ export default function CustomOpen(props) {
footer={<></>}
className="annotationModal"
>
<p className="title">批注</p>
<p className="title">{t("annotation")}</p>
<TextArea
className="box"
readOnly
Expand All @@ -142,7 +142,7 @@ export default function CustomOpen(props) {
autoSize={{ minRows: 7 }}
/>
<div className="btns">
<Button id="hover-btn-full" onClick={() => setAnnottaionModal(false)}>我知道了</Button>
<Button id="hover-btn-full" onClick={() => setAnnottaionModal(false)}>{t("translation:btn-ok")}</Button>
</div>
</Modal>
<Modal
Expand All @@ -152,10 +152,10 @@ export default function CustomOpen(props) {
className="answerModal"
width={1560}
>
<p className="title text-center">上次答案</p>
<p className="title text-center">{t("last-answer")}</p>
<div className="box mh480">
<div className="last-rate">
<p>上次得分</p>
<p>{t("last-score")}</p>
<Rate
allowHalf
disabled
Expand All @@ -180,7 +180,7 @@ export default function CustomOpen(props) {
/>
</div>
<div className="btns">
<Button id="hover-btn-full" onClick={() => setAnswerModal(false)}>我知道了</Button>
<Button id="hover-btn-full" onClick={() => setAnswerModal(false)}>{t("translation:btn-ok")}</Button>
</div>
</Modal>
<div className="inner-title">
Expand All @@ -189,8 +189,8 @@ export default function CustomOpen(props) {
<div className="CustomInput-content">

<div className="check-item">
<div onClick={() => openAnnotation()}><img src={require("@/assets/images/icon/icon-annotation.png")} />查看批注</div>
<div onClick={() => openAnswer()}><img src={require("@/assets/images/icon/icon-answer.png")} />查看上次答案</div>
<div onClick={() => openAnnotation()}><img src={require("@/assets/images/icon/icon-annotation.png")} />{t("view-annotation")}</div>
<div onClick={() => openAnswer()}><img src={require("@/assets/images/icon/icon-answer.png")} />{t("view-last-answer")}</div>
</div>
<TextArea
className={`custom-input bd mh`}
Expand All @@ -201,7 +201,6 @@ export default function CustomOpen(props) {
autoSize={{
minRows: 7,
}}
placeholder={t("inner.text")}
/>
<Upload
{...upload}
Expand Down
11 changes: 8 additions & 3 deletions src/views/Claim/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,14 @@ export default function Claim(params) {
<img className="icon-info" src={require("@/assets/images/icon/icon-info.png")} alt="" />
<p className="tip">{t("message.success.submit.score")}</p>
</div> */}
<Button className="btn" id="hover-btn-line" onClick={() => navigateTo(`/quests/${questId}`)}>
{t("btn-go-challenge")}
</Button>
<div className="box-center">
<Button className="btn" id="hover-btn-line" onClick={() => navigateTo(`/quests/${questId}`)}>
{t("btn-go-challenge")}
</Button>
<Button className="btn" id="hover-btn-full" onClick={() => navigateTo(`/challenge/${questId}`)}>
{t("btn-go-rechallenge")}
</Button>
</div>
<Button className="btn-link" type="link" onClick={() => navigateTo("/challenges")}>{t("btn-another")}</Button>
</div>
:
Expand Down
37 changes: 29 additions & 8 deletions src/views/Claim/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,40 @@ export default function ClaimInfo({answerInfo, detail}) {
{ '0%': '#F46565', '100%': '#B64444'}
}
format={(percent) => (
<>
{percent}
<p className="text">{t("score.now")}</p>
</>
detail.open_quest_review_status === 0 ?
(
<>
{percent}
<p className="text">{t("score.now")}</p>
</>
)
:
(
isPass ?
<p className="text-unpass">{t("score.pass")}</p>
:
<p className="text-unpass">{t("score.unpass")}</p>
)
)}
strokeWidth={10}
/>
</div>
<div className="info">
<p className="network newline-omitted">{detail.title}</p>
<p className="pass">{t("score.passScore",{score: passingPercent})}</p>
{
detail.open_quest_review_status === 0 &&
<p className="pass">{t("score.passScore",{score: passingPercent})}</p>
}
{
!isMobile &&
<Button className="btn" id="hover-btn-line" onClick={() => navigateTo(`/quests/${detail.tokenId}`)}>
{t("translation:btn-go-challenge")}
</Button>
<div className="btns-flex">
<Button className="btn" id="hover-btn-line" onClick={() => navigateTo(`/quests/${detail.tokenId}`)}>
{t("translation:btn-go-challenge")}
</Button>
<Button className="btn" id="hover-btn-full" onClick={() => navigateTo(`/challenge/${detail.tokenId}`)}>
{t("translation:btn-go-rechallenge")}
</Button>
</div>
}
</div>
</div>
Expand All @@ -169,6 +187,9 @@ export default function ClaimInfo({answerInfo, detail}) {
<Button className="btn" id="hover-btn-line" onClick={() => navigateTo(`/quests/${detail.tokenId}`)}>
{t("translation:btn-go-challenge")}
</Button>
<Button className="btn" id="hover-btn-full" onClick={() => navigateTo(`/challenge/${questId}`)}>
{t("translation:btn-go-rechallenge")}
</Button>
</div>
}
{
Expand Down
20 changes: 18 additions & 2 deletions src/views/Rating/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,25 @@ function RatingModal({ data, isMobile, onFinish }, ref) {
</div>
</div>

<div className="item item-flex">
<p className="item-title">{t("c-total")}:</p>
<div className="item-content">
<p>{(list[page]?.answer?.score ? list[page]?.user_score : rateCache?.score ? list[page]?.user_score + rateCache.score : "")}</p>
</div>
</div>

<div className="item item-flex">
<p className="item-title">{t("c-pass")}:</p>
<div className="item-content">
<p>{list[page]?.pass_score}</p>
</div>
</div>

<div className="item mb40">
<div className="item-title flex">
{t("score")}:
<div className="item-title">
<div>
{t("score")}: {(list[page]?.answer?.score ? list[page].answer?.score : rateCache?.score ? rateCache.score : "")}
</div>
<div ref={star}>
<Rate
allowHalf
Expand Down

0 comments on commit 310b191

Please sign in to comment.