PairDrop/app/elements/buddy-finder/buddy-finder.html

101 lines
2.8 KiB
HTML
Raw Normal View History

<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
<link rel="import" href="../../bower_components/paper-styles/paper-styles.html">
2015-12-19 01:18:02 +01:00
<link rel="import" href="../file-sharing/file-input.html">
2015-12-30 23:59:11 +01:00
<link rel="import" href="buddy-avatar.html">
<link rel="import" href="personal-avatar.html">
2015-12-18 17:43:46 +01:00
<dom-module id="buddy-finder">
<template>
<style>
:host {
background-color: transparent;
2015-12-18 17:43:46 +01:00
@apply(--layout-fit);
2015-12-19 01:18:02 +01:00
@apply(--layout-horizontal);
2015-12-18 17:43:46 +01:00
@apply(--layout-center-center);
2015-12-19 01:18:02 +01:00
overflow: hidden;
position: relative;
height: 100%;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
margin: 0;
2015-12-30 22:07:18 +01:00
--paper-tooltip: {
font-size: 14px;
background-color: #4285f4;
}
2015-12-18 17:43:46 +01:00
}
.buddies {
z-index: 1;
2015-12-19 01:18:02 +01:00
@apply(--layout-horizontal);
@apply(--layout-center-center);
@apply(--layout-wrap);
2015-12-18 17:43:46 +01:00
}
.buddy {
cursor: pointer;
}
.me {
2015-12-18 17:43:46 +01:00
position: absolute;
bottom: 24px;
2015-12-18 17:43:46 +01:00
left: 50%;
margin-left: -180px;
2015-12-18 17:43:46 +01:00
}
.explanation {
@apply(--paper-font-headline);
2015-12-30 22:07:18 +01:00
color: #4285f4;
text-align: center;
2015-12-18 17:43:46 +01:00
}
.short {
@apply(--paper-font-body1);
color: #333;
}
[only] {
@apply(--layout-fit);
@apply(--layout-horizontal);
@apply(--layout-center-center);
2015-12-30 18:38:25 +01:00
cursor: pointer;
}
2015-12-18 17:43:46 +01:00
</style>
<div class="buddies">
<template is="dom-repeat" items="{{buddies}}">
<file-input on-file-selected="_fileSelected" only$="{{!buddies.1}}">
2015-12-30 23:59:11 +01:00
<buddy-avatar contact="{{item}}" class="buddy"></buddy-avatar>
2015-12-19 01:18:02 +01:00
</file-input>
2015-12-18 17:43:46 +01:00
</template>
</div>
2015-12-26 13:33:16 +01:00
<div hidden$="{{buddies.0}}" class="explanation">
2015-12-30 22:07:18 +01:00
Open Snapdrop on other devices
<br> to send files.
2015-12-30 22:07:18 +01:00
<paper-tooltip offset="14">
short url: dropc.at
</paper-tooltip>
</div>
<personal-avatar class="me"></personal-avatar>
2015-12-18 17:43:46 +01:00
</template>
<script>
'use strict';
Polymer({
is: 'buddy-finder',
properties: {
buddies: {
type: Array,
2015-12-26 13:33:16 +01:00
notify: true
},
2015-12-18 17:43:46 +01:00
me: {
type: String,
2015-12-26 13:33:16 +01:00
},
2015-12-19 01:18:02 +01:00
},
_fileSelected: function(e) {
2015-12-19 01:18:02 +01:00
var peerId = e.model.item.peerId;
var file = e.detail;
app.p2p.sendFile(peerId, file);
2015-12-18 17:43:46 +01:00
}
});
</script>
</dom-module>