Skip to content

Commit 59b75b1

Browse files
fix: 26 er transaction (#1554)
* v * v * Update index.js * v * v * v * v * v * Update package.json
1 parent a6e2a05 commit 59b75b1

File tree

40 files changed

+3342
-25
lines changed

40 files changed

+3342
-25
lines changed

components/authorn/index.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
#authorn .subscribes,
136136
#authorn .subscribers,
137137
#authorn .uinfoWr,
138+
#authorn .collections,
138139
#authorn .fbuttonsrow {
139140
margin-top: 0.5em;
140141
}
@@ -169,19 +170,22 @@
169170
flex-grow: 2;
170171
}
171172
#authorn .lcolumn .subscribes,
173+
#authorn .lcolumn .collections,
172174
#authorn .lcolumn .subscribers {
173175
border-radius: 12px;
174176
background: rgba(var(--background-total-theme), 1);
175177
padding: 1em;
176178
display: none;
177179
}
178180
#authorn .lcolumn .subscribes .empty,
181+
#authorn .lcolumn .collections .empty,
179182
#authorn .lcolumn .subscribers .empty {
180183
text-align: center;
181184
color: rgb(var(--neutral-grad-3));
182185
font-size: 0.9em;
183186
}
184187
#authorn .lcolumn .subscribes.active,
188+
#authorn .lcolumn .collections.active,
185189
#authorn .lcolumn .subscribers.active {
186190
display: block;
187191
}
@@ -623,6 +627,7 @@
623627
}
624628
#authorn .acontent .lcolumn .blocking,
625629
#authorn .acontent .lcolumn .subscribers,
630+
#authorn .acontent .lcolumn .collections,
626631
#authorn .acontent .lcolumn .subscribes {
627632
display: none;
628633
}

components/authorn/index.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,6 +1544,38 @@ var authorn = (function(){
15441544
})
15451545
},
15461546

1547+
collections : function( clbk){
1548+
1549+
if (modules['collections']){
1550+
modules['collections'].destroy()
1551+
modules['collections'] = null
1552+
}
1553+
1554+
self.nav.api.load({
1555+
1556+
open : true,
1557+
id : 'collections',
1558+
el : el.collections,
1559+
animation : false,
1560+
1561+
essenseData : {
1562+
address : author.address,
1563+
preview : true,
1564+
},
1565+
1566+
clbk : function(e, p){
1567+
1568+
modules['collections'] = p
1569+
1570+
el.collections.addClass('active')
1571+
1572+
if (clbk)
1573+
clbk(e, p)
1574+
}
1575+
1576+
})
1577+
},
1578+
15471579
userslist : function(_el, addresses, empty, caption, clbk, mid, count){
15481580

15491581
if (modules['userlist' + mid]){
@@ -1754,6 +1786,7 @@ var authorn = (function(){
17541786
renders.subscribes()
17551787
renders.subscribers()
17561788
renders.blocking()
1789+
//renders.collections()
17571790
}
17581791

17591792
renders.upbutton()
@@ -1878,6 +1911,7 @@ var authorn = (function(){
18781911
el.subscribers = el.c.find('.subscribers')
18791912
el.blocking = el.c.find('.blocking')
18801913
el.upbackbutton = el.c.find('.upbackbuttonwrapper')
1914+
el.collections = el.c.find('.collections')
18811915

18821916
if(!self.app.user.isItMe(author.address))
18831917
self.sdk.activity.adduser('visited', author.address)

components/authorn/index.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@
167167
.subscribes,
168168
.subscribers,
169169
.uinfoWr,
170+
.collections,
170171
.fbuttonsrow{
171172
margin-top: @rhythm;
172173
}
@@ -221,6 +222,7 @@
221222

222223
.lcolumn{
223224
.subscribes,
225+
.collections,
224226
.subscribers{
225227
border-radius: @rad;
226228
background: rgba(var(--background-total-theme), 1);
@@ -813,6 +815,7 @@
813815

814816
.blocking,
815817
.subscribers,
818+
.collections,
816819
.subscribes{
817820
display: none;
818821
}

components/authorn/templates/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
<div class="uinfoWr">
2424
</div>
2525

26+
<!--<div class="collections">
27+
</div>-->
28+
2629
<div class="subscribes">
2730
</div>
2831

components/collections/index.css

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#collections {
2+
padding: 2.5em;
3+
background: rgb(var(--background-total-theme));
4+
}
5+
#collections.preview {
6+
padding: 0;
7+
}
8+
#collections .caption {
9+
font-weight: 100;
10+
font-size: 2em;
11+
}
12+
#collections .panel {
13+
text-align: center;
14+
}
15+
#collections .captionWrapper {
16+
display: flex;
17+
justify-content: space-between;
18+
align-items: center;
19+
}
20+
#collections .loaderWrapper {
21+
display: none;
22+
padding: 1em;
23+
text-align: center;
24+
}
25+
#collections.loading .loaderWrapper {
26+
display: block;
27+
}
28+
#collections .collectionslist .collection {
29+
padding: 0.5em 0;
30+
margin-top: 0.5em;
31+
margin-bottom: 0.5em;
32+
}
33+
#collections .collectionslist .empty {
34+
padding: 0.5em 0;
35+
margin-top: 0.5em;
36+
margin-bottom: 0.5em;
37+
}
38+
#collections .iconbutton {
39+
cursor: pointer;
40+
color: rgb(var(--color-txt-ac));
41+
padding: 0.5em;
42+
padding-right: 0;
43+
}
44+
#collections.preview {
45+
padding: 0;
46+
}
47+
#collections.preview .caption {
48+
font-weight: 700;
49+
font-size: 1em;
50+
}
51+
#collections.preview .showmoreWrapper button {
52+
width: 100%;
53+
}
54+
#collections .showmoreWrapper {
55+
display: none;
56+
}
57+
#collections.hasitems {
58+
display: block;
59+
}
60+
.wnd.userlistwindow .wndinner {
61+
max-width: 440px;
62+
max-height: 650px;
63+
}
64+
.wnd.userlistwindow #collections {
65+
padding: 0;
66+
}
67+
.wnd.userlistwindow #collections {
68+
padding: 1em;
69+
}
70+
html.mobileview .wnd #collections {
71+
padding: 1em;
72+
}

components/collections/index.js

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
var collections = (function(){
2+
3+
var self = new nModule();
4+
5+
var essenses = {};
6+
7+
var Essense = function(p){
8+
9+
var mid = p.mid
10+
11+
var primary = deep(p, 'history');
12+
13+
var el, ed, author = {};
14+
15+
var actions = {
16+
newcollection : function(){
17+
self.app.platform.sdk.collections.opennewcollectionwindow()
18+
},
19+
20+
loadcollections : function(clbk){
21+
self.app.platform.sdk.collections.load.profile(author.address, (r) => {
22+
23+
var collections = r.contents
24+
25+
if(clbk) clbk(collections)
26+
}, ed.count)
27+
}
28+
}
29+
30+
var events = {
31+
32+
}
33+
34+
var renders = {
35+
collectionsdata : function(items = [], clbk){
36+
self.shell({
37+
name : 'collectionsdata',
38+
el : el.c.find('.collectionsdata'),
39+
data : {
40+
items : items,
41+
},
42+
insertimmediately : true,
43+
}, function(p){
44+
if(items.length){
45+
el.c.addClass('.hasitems')
46+
}
47+
48+
if(clbk) clbk()
49+
})
50+
}
51+
}
52+
53+
var state = {
54+
save : function(){
55+
56+
},
57+
load : function(){
58+
59+
}
60+
}
61+
62+
var initEvents = function(){
63+
64+
el.c.find('.newcollection').on('click', function(){
65+
actions.newcollection()
66+
})
67+
68+
self.app.psdk.updatelisteners[mid] = self.app.platform.actionListeners[mid] = function({type, alias, status}){
69+
70+
if(type == 'collection'){
71+
if (author.address == alias.actor){
72+
make()
73+
}
74+
75+
}
76+
77+
}
78+
}
79+
80+
var make = function(clbk){
81+
82+
actions.loadcollections(collections => {
83+
renders.collectionsdata(collections, clbk)
84+
})
85+
86+
}
87+
88+
return {
89+
primary : primary,
90+
91+
id : mid,
92+
93+
getdata : function(clbk, p){
94+
95+
ed = p.settings.essenseData
96+
97+
if(!ed.count) ed.count = 6
98+
99+
if(ed.count > 100) ed.count = 100
100+
101+
var data = {
102+
ed
103+
};
104+
105+
author = {}
106+
107+
author.address = ed.address
108+
109+
self.sdk.users.get(author.address, function(){
110+
111+
author.data = self.psdk.userInfo.get(author.address)
112+
author.me = self.app.user.isItMe(author.address)
113+
author.reputationBlocked = self.app.platform.sdk.user.reputationBlocked(author.address)
114+
115+
data.author = author
116+
117+
clbk(data);
118+
119+
})
120+
121+
},
122+
123+
destroy : function(){
124+
ed = {}
125+
el = {};
126+
127+
delete self.app.platform.actionListeners[mid]
128+
delete self.app.psdk.updatelisteners[mid]
129+
},
130+
131+
init : function(p){
132+
133+
state.load();
134+
135+
el = {};
136+
el.c = p.el.find('#' + self.map.id);
137+
138+
initEvents();
139+
140+
make()
141+
142+
p.clbk(null, p);
143+
}
144+
}
145+
};
146+
147+
148+
149+
self.run = function(p){
150+
151+
var essense = self.addEssense(essenses, Essense, p);
152+
153+
self.init(essense, p);
154+
155+
};
156+
157+
self.stop = function(){
158+
159+
_.each(essenses, function(essense){
160+
161+
window.rifticker.add(() => {
162+
essense.destroy();
163+
})
164+
165+
})
166+
167+
}
168+
169+
return self;
170+
})();
171+
172+
173+
if(typeof module != "undefined")
174+
{
175+
module.exports = collections;
176+
}
177+
else{
178+
179+
app.modules.collections = {};
180+
app.modules.collections.module = collections;
181+
182+
}

0 commit comments

Comments
 (0)