This repository has been archived by the owner on May 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathreputation.html
237 lines (219 loc) · 7.9 KB
/
reputation.html
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<!--
@license
Copyright (c) 2018 Swarm City
This code may only be used under the license found at https://github.com/swarmcity/license
-->
<link rel="import" href="../../bower_components/polymer/polymer-element.html">
<link rel="import" href="../../bower_components/iron-media-query/iron-media-query.html">
<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../../bower_components/app-route/app-location.html">
<link rel="import" href="../../bower_components/app-localize-behavior/app-localize-behavior.html">
<link rel="import" href="../../bower_components/iron-image/iron-image.html">
<link rel="import" href="../redux-state.html">
<!--
Displays and shared styles only
-->
<link rel="import" href="../shared-styles.html">
<link rel="import" href="../displays/display-user-reputation.html">
<dom-module id="page-user-reputation">
<template>
<!--
Page specific styles, if the style is used on more than one page, moveit to shared styles.
-->
<style include="shared-styles">
.container {
height: 100%;
width: 100vw;
max-width: 100%;
min-height: 100vh;
background-image: var(--sc-bg);
display: block;
}
.container .closebox {
width: 100%;
@apply --layout-horizontal;
@apply --layout-end-justified;
box-sizing: border-box;
padding: 0;
position: fixed;
}
.container[wide-layout] .closebox {
@apply --layout-horizontal;
@apply --layout-end-justified;
@apply --layout-start;
box-sizing: border-box;
padding: 0px;
max-width: 100%;
background-color:red;
}
.close {
@apply --xmark-grey3-small;
cursor: pointer;
@apply --close;
}
.container .userbox {
width: 100%;
box-sizing: border-box;
padding: 80px 0px 20px 0px;
@apply --layout-vertical;
@apply --layout-center-center;
}
.container[wide-layout] .userbox {
padding: 80px 10vw 20px 10vw;
@apply --layout-horizontal;
@apply --layout-center;
@apply --layout-start-justified;
}
.container .avatar {
margin-top: 25px;
width: 80px;
height: 80px;
min-width: 80px;
min-height: 80px;
cursor: pointer;
border-radius: 50%;
background-size: 40px;
}
.container[wide-layout] .avatar {
margin-top: 0px;
}
.container .userinfo {
@apply --layout-vertical;
@apply --layout-start;
@apply --layout-center-center;
margin-left: 0px;
}
.container[wide-layout] .userinfo {
@apply --layout-vertical;
@apply --layout-start;
@apply --layout-center-justified;
margin-left: 30px;
}
.container .username {
@apply --body-bold;
margin-top: 15px;
color: var(--sc-grey4);
}
.container[wide-layout] .username {
@apply --main-title4;
margin-top: 0px;
color: var(--sc-grey4);
}
.container .linkbox {
margin-top: 10px;
text-align: center;
}
.container[wide-layout] .linkbox {
margin-top: 0px;
text-align: left;
}
.link {
@apply --small-bold;
border-bottom: 2px dotted var(--sc-blue);
color: var(--sc-blue);
cursor: pointer;
}
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (min--moz-device-pixel-ratio: 1.5),
only screen and (min-resolution: 240dpi) {
.close {
@apply --retina;
}
}
</style>
<app-location route="{{route}}"></app-location>
<iron-media-query query="(min-width: 600px)" query-matches="{{wide}}"></iron-media-query>
<div id="container" class="container" wide-layout$="{{wide}}">
<div class="closebox">
<div class="close" on-tap="_close"></div>
</div>
<div class="userbox">
<iron-image class="avatar" sizing="cover" preload src="https://scapiweb3-c.swarm.city/img/[[avatarHash]]" placeholder="../images/defaultavatar.png">
</iron-image>
<div class="userinfo">
<div class="username">{{username}}</div>
<div class="linkbox">
<span class="link"on-tap="_toEtherscan">show on etherscan</span>
</div>
</div>
</div>
<display-user-reputation user-address="{{userAddress}}"></display-user-reputation>
</div>
</template>
<script>
class MyUserReputation extends new ReduxMixin(Polymer.mixinBehaviors([
Polymer.AppLocalizeBehavior,
],
Polymer.Element
)) {
static get is() {
return 'page-user-reputation';
}
static get properties() {
return {
/**
* The current user selected language
* @type {Object}
*/
language: {
type: String,
statePath: 'language',
},
/**
* The avatarHash of the user we look up
* @type {String}
*/
avatarHash: {
type: String,
},
/**
* The username of the user we look up
* @type {String}
*/
username: {
type: String,
},
/**
* Route is the current URL
* @type {Object}
*/
route: {
type: Object,
observer: '_routeChanged',
},
/**
* The address of the user we look up
* @type {String}
*/
userAddress: {
type: String,
},
};
}
/**
* takes the user to originating page
*/
_close() {
window.history.back();
}
/**
* set the values from the route on route change
*/
_routeChanged() {
if (
this.route.path.split('/')[1] == 'user-reputation') {
this.userAddress = this.route.path.split('/')[2];
this.avatarHash = this.route.path.split('/')[3];
this.username = this.route.path.split('/')[4];
}
}
/**
* takes the user to the selected user balance on etherscan
*/
_toEtherscan() {
window.open(`https://kovan.etherscan.io/address/${this.userAddress}`, '_blank');
}
}
window.customElements.define(MyUserReputation.is, MyUserReputation);
</script>
</dom-module>