-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLevel2.jsx
More file actions
68 lines (64 loc) · 1.67 KB
/
Level2.jsx
File metadata and controls
68 lines (64 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { LevelCard } from "../LevelCard/LevelCard";
import { getLevelsStatuses } from "../../utils";
export const Level2 = (props) => {
const {
selectedLevel,
currentLevel,
onSetLevel,
onTradeClick,
nftCount,
burnStatus,
ended,
} = props;
const level2Count = nftCount["2"] || 0;
const status = getLevelsStatuses(currentLevel || 1)[2];
let instructions = "";
let tradeActionText = "";
let actionDisabled = false;
let actionLocked = false;
let noActions = false;
actionDisabled = false;
instructions = `You have ${level2Count === -1 ? 0 : level2Count} cards.`;
if (level2Count === 0) {
instructions = "Trade 2 cards from the previous level.";
noActions = true;
} else if (level2Count === 1) {
instructions = `You have ${
level2Count === -1 ? 0 : level2Count
} cards. Get 1 more from the previous level.`;
tradeActionText = "Start Trading";
actionDisabled = true;
actionLocked = true;
}
if (level2Count >= 2 && burnStatus) {
tradeActionText = "Trade More";
} else {
tradeActionText = "Trade Now";
}
const actions = noActions
? []
: [
{
onActionClick: (level) => onTradeClick(level),
label: tradeActionText,
mode: actionLocked ? "pinkStroke" : "default",
disabled: ended ? ended : actionDisabled,
useIcon: actionDisabled,
},
];
return (
<LevelCard
status={status}
current={selectedLevel}
setLevel={onSetLevel}
actions={actions}
level={{
id: 2,
title: "1 rare live song",
edition: "",
instructions,
useEmtpyActionsStyle: true,
}}
/>
);
};