Just messing around with things. Not sure I've made anything better.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3722 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2021-12-31 00:57:57 +00:00
parent 0cab3e7ed9
commit fafc524c8c
3 changed files with 48 additions and 38 deletions

View File

@ -1 +1 @@
{"type":"tildefriends-app","files":{"app.js":"&bKoyBQBiMZinCQUoQIqGpeehKgqkANw8Ns2OYECYW30=.sha256","index.html":"&zwiRwroNQ1SnCsq97zB8dRiGwY4H+ii4ZtuKR385zdI=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&taC9THJslxAMy72UIplFjALJx1VHv2l+qfjWoRhhrS4=.sha256","tf-message.js":"&KjVh7zASx0TZtZTsS6lJ7T70K9tyXcf+ink4vK7gSWI=.sha256","tf.js":"&u6n7Eqa1ryFuL9AhlYeJ/WzXYh6zxECKVfhG8/ecRM8=.sha256","commonmark.min.js":"&5x6ek3tFrKTZX6hXNNyFsjmhvrjmWpUkwuuaiyVV1Us=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256"}} {"type":"tildefriends-app","files":{"app.js":"&bbZBdFOrGh6o0X+ypAaRhfAls89Ir/IICcUN3xlO02w=.sha256","index.html":"&zwiRwroNQ1SnCsq97zB8dRiGwY4H+ii4ZtuKR385zdI=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&KmUw2D8yehJU95RQ+8DWP69w/5wK7yWR6fUc5/LIpio=.sha256","tf-message.js":"&KjVh7zASx0TZtZTsS6lJ7T70K9tyXcf+ink4vK7gSWI=.sha256","tf.js":"&u6n7Eqa1ryFuL9AhlYeJ/WzXYh6zxECKVfhG8/ecRM8=.sha256","commonmark.min.js":"&5x6ek3tFrKTZX6hXNNyFsjmhvrjmWpUkwuuaiyVV1Us=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256"}}

View File

@ -273,33 +273,35 @@ async function refresh() {
app.postMessage({connections: await ssb.connections()}), app.postMessage({connections: await ssb.connections()}),
app.postMessage({apps: await core.apps()}), app.postMessage({apps: await core.apps()}),
followingDeep(db, [whoami], 2).then(function(f) { followingDeep(db, [whoami], 2).then(function(f) {
getRecentPostIds(db, whoami, [].concat([whoami], f), k_posts_max).then(async function(ids) { return Promise.all([
return getPosts(db, ids); getRecentPostIds(db, whoami, [].concat([whoami], f), k_posts_max).then(async function(ids) {
}).then(async function(posts) { return getPosts(db, ids);
var roots = posts.map(function(x) { }).then(async function(posts) {
try { var roots = posts.map(function(x) {
return JSON.parse(x.content).root; try {
} catch { return JSON.parse(x.content).root;
return null; } catch {
} return null;
}); }
roots = roots.filter(function(root) { });
return root && posts.every(post => post.id != root); roots = roots.filter(function(root) {
}); return root && posts.every(post => post.id != root);
return [].concat(posts, await getPosts(db, roots)); });
}).then(function(posts) { return [].concat(posts, await getPosts(db, roots));
return Promise.all(posts.map(x => app.postMessage({message: x}))); }).then(function(posts) {
}); return Promise.all(posts.map(x => app.postMessage({message: x})));
Promise.all(f.map(function(id) { }),
return Promise.all([ Promise.all(f.map(function(id) {
getVotes(db, id).then(function(votes) { return Promise.all([
return app.postMessage({votes: votes}); getVotes(db, id).then(function(votes) {
}), return app.postMessage({votes: votes});
getAbout(db, id).then(function(user) { }),
return app.postMessage({user: {user: id, about: user}}); getAbout(db, id).then(function(user) {
}), return app.postMessage({user: {user: id, about: user}});
]); }),
})); ]);
})),
]);
}), }),
sendUser(db, whoami), sendUser(db, whoami),
]); ]);

View File

@ -78,16 +78,24 @@ Vue.component('tf-user', {
<div v-if="users[id].name">{{id}}</div> <div v-if="users[id].name">{{id}}</div>
<div>{{users[id].description}}</div> <div>{{users[id].description}}</div>
<div><md-switch v-model="following">Following</md-switch></div> <div><md-switch v-model="following">Following</md-switch></div>
<md-list> <div class="md-layout">
<md-subheader>Followers</md-subheader> <div class="md-layout-item">
<md-list-item v-for="follower in Object.keys((users[id] && users[id].followers) ? users[id].followers : {})" v-bind:key="'follower-' + follower"> <md-list>
<tf-user :id="follower"></tf-user> <md-subheader>Followers</md-subheader>
</md-list-item> <md-list-item v-for="follower in Object.keys((users[id] && users[id].followers) ? users[id].followers : {})" v-bind:key="'follower-' + follower">
<md-subheader>Following</md-subheader> <tf-user :id="follower"></tf-user>
<md-list-item v-for="user in Object.keys((users[id] && users[id].following) ? users[id].following : {})" v-bind:key="'following-' + user"> </md-list-item>
<tf-user :id="user"></tf-user> </md-list>
</md-list-item> </div>
</md-list> <div class="md-layout-item">
<md-list>
<md-subheader>Following</md-subheader>
<md-list-item v-for="user in Object.keys((users[id] && users[id].following) ? users[id].following : {})" v-bind:key="'following-' + user">
<tf-user :id="user"></tf-user>
</md-list-item>
</md-list>
</div>
</div>
</template> </template>
</md-dialog-content> </md-dialog-content>
<md-dialog-actions> <md-dialog-actions>