forked from drinky78/sortello
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStyleguideApp.jsx
More file actions
130 lines (118 loc) · 3.98 KB
/
StyleguideApp.jsx
File metadata and controls
130 lines (118 loc) · 3.98 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import React from "react"
import PrioritizationEnd from "./components/PrioritizationEnd.jsx"
import ChoicesView from "./components/view/ChoicesView.jsx"
import ChoicesVoter from "./components/ChoicesVoter.jsx"
import loremIpsum from 'lorem-ipsum'
import RoomLink from './components/RoomLink.jsx'
const randomColor = () => {
return ['red', 'green', 'blue', 'yellow'][randInt(0, 3)]
}
const randInt = (min, max) => {
return (Math.floor(Math.random() * ((max + 1) - min)) + min)
}
const createCardData = () => {
return {
value: {
id: randInt(0, 1000),
shortUrl: "#",
name: loremIpsum({count: 1, units: 'sentences'}),
labels: [
{
color: randomColor(),
name: loremIpsum({count: 1, units: 'words'}),
id: randInt(0, 1000)
},
{
color: randomColor(),
name: loremIpsum({count: 1, units: 'words'}),
id: randInt(0, 1000)
}
]
}
}
}
const voters = {
left:
[
{trelloAvatar: '//www.gravatar.com/avatar/94d093eda664addd6e450d7ew881bcad?s=32&d=identicon&r=PG'},
{trelloAvatar: '//www.gravatar.com/avatar/94d093eda664addd6e450d7ew831bcad?s=32&d=identicon&r=PG'}
],
right:
[
{trelloAvatar: '//www.gravatar.com/avatar/94d093eda664addd6e450d7ew831bcad?s=32&d=identicon&r=PG'}
]
}
const roomVoters = [
{trelloAvatar: '//www.gravatar.com/avatar/94d093eda664addd6e450d7ew881bcad?s=32&d=identicon&r=PG'},
{trelloAvatar: '//www.gravatar.com/avatar/94d093eda664addd6e450d7ew831bcad?s=32&d=identicon&r=PG'},
{trelloAvatar: '//www.gravatar.com/avatar/94d093eda664addd6e450d7ew831bcad?s=32&d=identicon&r=PG'},
{trelloAvatar: '//www.gravatar.com/avatar/94d093eda664addd6e450d7ew831bcad?s=32&d=identicon&r=PG', isAdmin:true}
]
class StyleguideApp extends React.Component {
constructor (props) {
super(props)
}
renderRoomLink () {
return (<RoomLink roomId={"9812u9812uej1298e2j88ewu8ewfu89"}/>)
}
renderChoicesViewForVoter () {
return (
<ChoicesView
roomVoters={roomVoters}
leftCard={createCardData()}
rightCard={createCardData()}
everybodyVoted={true}
voters={voters}
handleAddToBlacklist={null}
handleCardClicked={() => {
}}
handleGoToNextVoting={() => {
}}
progress={75}
selectedSide={'compareNode'}
role="voter"
/>
)
}
renderChoicesViewForMaster () {
return (
<ChoicesView
newRoomButton={""}
roomLink={this.renderRoomLink()}
roomVoters={roomVoters}
leftCard={createCardData()}
rightCard={createCardData()}
everybodyVoted={true}
voters={voters}
handleAddToBlacklist={this.handleAddToBlacklist}
handleCardClicked={() => {
}}
handleUndoClicked={() => {
}}
handleGoToNextVoting={() => {
}}
progress={60}
selectedSide={null}
role="admin"
/>
)
}
render () {
return (
<div id="container_div">
<h2>Choices view for master</h2>
{this.renderChoicesViewForMaster()}
<hr/>
<h2>Choices view for voter</h2>
{this.renderChoicesViewForVoter()}
<hr/>
<h2>Voters view, prioritization end</h2>
<PrioritizationEnd/>
<hr/>
<h2>No board permissions message</h2>
<ChoicesVoter/>
</div>
)
}
}
export default StyleguideApp