relita

an encrypted, decentralized, peer-to-peer social network
Log | Files | Refs | README | LICENSE | git clone https://git.ne02ptzero.me/git/relita

commit f69a50656a9d8cf49fa3fc474ac197b4b7710aa5
parent d695adf4dff231705d0ee554b58e64ca394eab35
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Mon, 10 Apr 2017 13:58:19 +0200

Fix(Feed): Fix wrong tooltips, add an indicator for connection

Diffstat:
Mcss/menu.css | 33++++++++++++++++++++++++++++++++-
Mindex.html | 7+++++--
Mjs/renderer.js | 18++++++++++++++----
Mmain.js | 13++++++++++++-
4 files changed, 63 insertions(+), 8 deletions(-)

diff --git a/css/menu.css b/css/menu.css @@ -48,7 +48,7 @@ .menu ul .my_profile { position: absolute; border-bottom: 0; - bottom: 5%; + bottom: 6%; } .menu ul .my_profile:hover { @@ -67,3 +67,34 @@ margin-bottom: 15px; } +.menu .status { + border-bottom: 0; + position: absolute; + bottom: 1%; + text-align: center; + width: 100px; +} + +.menu .status:hover { + background: transparent; + cursor: pointer; +} + +.menu .status i { + font-size: 0.5em; +} + +.menu .status .pending { + color: yellow; + text-shadow: 0px 0px 5px #FFFFFF; +} + +.menu .status .failed { + color: red; + text-shadow: 0px 0px 5px #FFFFFF; +} + +.menu .status .success { + color: lime; + text-shadow: 0px 0px 5px #FFFFFF; +} diff --git a/index.html b/index.html @@ -22,6 +22,9 @@ <li class="my_profile"> <img src="https://avatars1.githubusercontent.com/u/6032832?v=3&s=460" class="round_image"/> </li> + <li class='status'> + <i class="fa fa-circle pending"></i> + </li> </ul> </div> <div class='title'> @@ -68,8 +71,8 @@ <div class='templates'> <div class='single_post'> <ul class='header'> - <li class='author' data-toggle="tooltip" data-placement="top"></li> - <li class="time" data-toggle="tooltip" data-placement="top"></li> + <li class='author'><span data-toggle="tooltip" data-placement="top"></span></li> + <li class="time"><span data-toggle="tooltip" data-placement="top"></span></li> </ul> <div class='content'></div> <ul class='bottom'> diff --git a/js/renderer.js b/js/renderer.js @@ -39,6 +39,16 @@ $(function() { add_post_to_page(arg) }) + ipcRenderer.on('connection_event', (event, arg) => { + $(".status i").removeClass("pending") + $(".status i").removeClass("failed") + $(".status i").removeClass("success") + if (arg.peer.state === 'connected') + $(".status i").addClass("success") + else + $(".status i").addClass("failed") + }) + ipcRenderer.send('connect_client', null); function get_content(id) { @@ -65,10 +75,10 @@ $(function() { post_class = 'post'; var date = new Date(arg.timestamp) $(html).find('.content').html(arg.value.content.value.text) - $(html).find('.author').html("@"+ arg.author_about.value.content.name) - $(html).find('.author').prop('title', arg.value.author) - $(html).find('.time').html(date.toDateString()) - $(html).find('.time').prop('title', arg.timestamp) + $(html).find('.author span').html("@"+ arg.author_about.value.content.name) + $(html).find('.author span').prop('title', arg.value.author) + $(html).find('.time span').html(date.toDateString()) + $(html).find('.time span').prop('title', arg.timestamp) if (arg.value.content.value.text.length > 20) post_class = 'full'; $(".posts_list .main_list").prepend("<li class='"+ post_class +"'><div class='single_post'>" + $(html).html() + "</div></li>") diff --git a/main.js b/main.js @@ -52,7 +52,8 @@ function create_window() { mainWindow = new BrowserWindow({ width: 800, height: 600, - title: default_name + title: default_name, + frame: false }) mainWindow.loadURL(url.format({ pathname: path.join(__dirname, first_connection ? 'register.html' : 'index.html'), @@ -85,6 +86,10 @@ function live_drain(msg) { } } +function live_gossip(arg) { + console.log("Test !") + console.log(arg) +} app.on('ready', create_window) app.on('window-all-closed', function () { @@ -119,6 +124,12 @@ ipcMain.on('connect_client', (event, arg) => { sbot.createLogStream({ live: true }), pull.drain(live_drain) ) + pull( + sbot_client.gossip.changes(), + pull.drain(function (ev) { + mainWindow.webContents.send('connection_event', ev) + }) + ) event.sender.send('connect_client', 'OK') }