snapdrop

A Progressive Web App for local file sharing
git clone http://git.hanabi.in/repos/snapdrop.git
Log | Files | Refs | README | LICENSE

commit 3b68a7ec6d9f236eccd868bc01659569e15529d5
parent 6a940acad2d3d8c9dc996a00c9cd500f874a4ebe
Author: Robin Linus <robin_woll@capira.de>
Date:   Wed, 30 Dec 2015 23:59:11 +0100

Rename user-avatar to buddy-avatar

Diffstat:
Aapp/elements/buddy-finder/buddy-avatar.html | 129+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mapp/elements/buddy-finder/buddy-finder.html | 4++--
Dapp/elements/buddy-finder/user-avatar.html | 129-------------------------------------------------------------------------------
3 files changed, 131 insertions(+), 131 deletions(-)

diff --git a/app/elements/buddy-finder/buddy-avatar.html b/app/elements/buddy-finder/buddy-avatar.html @@ -0,0 +1,129 @@ +<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html"> +<dom-module id="buddy-avatar"> + <template> + <style> + :host { + display: block; + @apply(--layout-vertical); + @apply(--layout-center); + width: 120px; + height: 152px; + } + + paper-icon-button { + display: inline-block; + width: 64px !important; + height: 64px !important; + border-radius: 50%; + overflow: hidden; + padding: 12px; + margin-bottom: 4px; + background-color: #4285f4; + color: white; + } + + :host:hover paper-icon-button { + transform: scale(1.05); + } + + .paper-font-subhead { + text-align: center; + } + + .paper-font-body1 { + text-align: center; + width: 100%; + font-size: 13px; + color: grey; + margin-top: 2px; + } + + :host, + .paper-font-subhead, + .paper-font-body1 { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + margin-top: 4px; + } + </style> + <paper-icon-button icon="{{_displayIcon}}"></paper-icon-button> + <div class="paper-font-subhead">{{_displayName}}</div> + <div class="paper-font-body1">{{status}}</div> + </template> + <script> + 'use strict'; + Polymer({ + is: 'buddy-avatar', + properties: { + contact: Object, + _displayName: { + computed: '_computeDisplayName(contact)' + }, + _displayIcon: { + computed: '_computeDisplayIcon(contact)' + }, + status: { + type: String, + value: '' + } + }, + _computeDisplayName: function(contact) { + contact = contact.name; + if (contact.model) { + return contact.os + ' ' + contact.model; + } + contact.os = contact.os.replace('Mac OS', 'Mac'); + return contact.os + ' ' + contact.browser; + }, + _computeDisplayIcon: function(contact) { + contact = contact.name; + if (contact.type === 'mobile') { + return 'chat:phone-iphone'; + } + if (contact.type === 'tablet') { + return 'chat:tablet-mac'; + } + return 'chat:desktop-mac'; + }, + attached: function() { + this.async(function() { + app.p2p.addEventListener('file-offered', function(e) { + if (e.detail.to === this.contact.peerId) { + this.status = 'Waiting to accept...'; + } + }.bind(this), false); + app.p2p.addEventListener('upload-started', function(e) { + if (e.detail.to === this.contact.peerId) { + this.status = 'Uploading...'; + } + }.bind(this), false); + app.p2p.addEventListener('download-started', function(e) { + if (e.detail.from === this.contact.peerId) { + this.status = 'Downloading...'; + } + }.bind(this), false); + app.p2p.addEventListener('upload-complete', function(e) { + if (e.detail.from === this.contact.peerId) { + this.status = ''; + } + }.bind(this), false); + app.p2p.addEventListener('download-complete', function(e) { + if (e.detail.from === this.contact.peerId) { + this.status = ''; + } + }.bind(this), false); + app.p2p.addEventListener('file-declined', function(e) { + if (e.detail.from === this.contact.peerId) { + this.status = ''; + } + }.bind(this), false); + app.p2p.addEventListener('upload-error', function(e) { + this.status = ''; + }.bind(this), false); + }, 200); + } + }); + </script> +</dom-module> diff --git a/app/elements/buddy-finder/buddy-finder.html b/app/elements/buddy-finder/buddy-finder.html @@ -1,7 +1,7 @@ <link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html"> <link rel="import" href="../../bower_components/paper-styles/paper-styles.html"> <link rel="import" href="../file-sharing/file-input.html"> -<link rel="import" href="user-avatar.html"> +<link rel="import" href="buddy-avatar.html"> <link rel="import" href="personal-avatar.html"> <dom-module id="buddy-finder"> <template> @@ -64,7 +64,7 @@ <div class="buddies"> <template is="dom-repeat" items="{{buddies}}"> <file-input on-file-selected="_fileSelected" only$="{{!buddies.1}}"> - <user-avatar contact="{{item}}" class="buddy"></user-avatar> + <buddy-avatar contact="{{item}}" class="buddy"></buddy-avatar> </file-input> </template> </div> diff --git a/app/elements/buddy-finder/user-avatar.html b/app/elements/buddy-finder/user-avatar.html @@ -1,129 +0,0 @@ -<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html"> -<dom-module id="user-avatar"> - <template> - <style> - :host { - display: block; - @apply(--layout-vertical); - @apply(--layout-center); - width: 120px; - height: 152px; - } - - paper-icon-button { - display: inline-block; - width: 64px !important; - height: 64px !important; - border-radius: 50%; - overflow: hidden; - padding: 12px; - margin-bottom: 4px; - background-color: #4285f4; - color: white; - } - - :host:hover paper-icon-button { - transform: scale(1.05); - } - - .paper-font-subhead { - text-align: center; - } - - .paper-font-body1 { - text-align: center; - width: 100%; - font-size: 13px; - color: grey; - margin-top: 2px; - } - - :host, - .paper-font-subhead, - .paper-font-body1 { - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - margin-top: 4px; - } - </style> - <paper-icon-button icon="{{_displayIcon}}"></paper-icon-button> - <div class="paper-font-subhead">{{_displayName}}</div> - <div class="paper-font-body1">{{status}}</div> - </template> - <script> - 'use strict'; - Polymer({ - is: 'user-avatar', - properties: { - contact: Object, - _displayName: { - computed: '_computeDisplayName(contact)' - }, - _displayIcon: { - computed: '_computeDisplayIcon(contact)' - }, - status: { - type: String, - value: '' - } - }, - _computeDisplayName: function(contact) { - contact = contact.name; - if (contact.model) { - return contact.os + ' ' + contact.model; - } - contact.os = contact.os.replace('Mac OS', 'Mac'); - return contact.os + ' ' + contact.browser; - }, - _computeDisplayIcon: function(contact) { - contact = contact.name; - if (contact.type === 'mobile') { - return 'chat:phone-iphone'; - } - if (contact.type === 'tablet') { - return 'chat:tablet-mac'; - } - return 'chat:desktop-mac'; - }, - attached: function() { - this.async(function() { - app.p2p.addEventListener('file-offered', function(e) { - if (e.detail.to === this.contact.peerId) { - this.status = 'Waiting to accept...'; - } - }.bind(this), false); - app.p2p.addEventListener('upload-started', function(e) { - if (e.detail.to === this.contact.peerId) { - this.status = 'Uploading...'; - } - }.bind(this), false); - app.p2p.addEventListener('download-started', function(e) { - if (e.detail.from === this.contact.peerId) { - this.status = 'Downloading...'; - } - }.bind(this), false); - app.p2p.addEventListener('upload-complete', function(e) { - if (e.detail.from === this.contact.peerId) { - this.status = ''; - } - }.bind(this), false); - app.p2p.addEventListener('download-complete', function(e) { - if (e.detail.from === this.contact.peerId) { - this.status = ''; - } - }.bind(this), false); - app.p2p.addEventListener('file-declined', function(e) { - if (e.detail.from === this.contact.peerId) { - this.status = ''; - } - }.bind(this), false); - app.p2p.addEventListener('upload-error', function(e) { - this.status = ''; - }.bind(this), false); - }, 200); - } - }); - </script> -</dom-module>