buddy-finder.html 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
  2. <link rel="import" href="../../bower_components/paper-styles/paper-styles.html">
  3. <link rel="import" href="../file-sharing/file-input.html">
  4. <link rel="import" href="user-avatar.html">
  5. <link rel="import" href="personal-avatar.html">
  6. <dom-module id="buddy-finder">
  7. <template>
  8. <style>
  9. :host {
  10. background-color: transparent;
  11. @apply(--layout-fit);
  12. @apply(--layout-horizontal);
  13. @apply(--layout-center-center);
  14. overflow: hidden;
  15. position: relative;
  16. height: 100%;
  17. -webkit-user-select: none;
  18. -moz-user-select: none;
  19. -ms-user-select: none;
  20. user-select: none;
  21. margin: 0;
  22. }
  23. .buddies {
  24. z-index: 1;
  25. @apply(--layout-horizontal);
  26. @apply(--layout-center-center);
  27. @apply(--layout-wrap);
  28. }
  29. .buddy {
  30. cursor: pointer;
  31. }
  32. .me {
  33. position: absolute;
  34. bottom: 24px;
  35. left: 50%;
  36. margin-left: -180px;
  37. }
  38. .explanation {
  39. @apply(--paper-font-headline);
  40. color: #4285f4;
  41. text-align: center;
  42. }
  43. </style>
  44. <div class="buddies">
  45. <template is="dom-repeat" items="{{buddies}}">
  46. <file-input on-file-selected="_fileSelected">
  47. <user-avatar contact="{{item}}" class="buddy"></user-avatar>
  48. </file-input>
  49. </template>
  50. </div>
  51. <div hidden$="{{buddies.0}}" class="explanation">
  52. Open this page on other devices<br> to send files.
  53. </div>
  54. <personal-avatar class="me"></personal-avatar>
  55. </template>
  56. <script>
  57. 'use strict';
  58. Polymer({
  59. is: 'buddy-finder',
  60. properties: {
  61. buddies: {
  62. type: Array,
  63. notify: true
  64. },
  65. me: {
  66. type: String,
  67. },
  68. },
  69. _fileSelected: function(e) {
  70. var peerId = e.model.item.peerId;
  71. var file = e.detail;
  72. app.p2p.sendFile(peerId, file);
  73. }
  74. });
  75. </script>
  76. </dom-module>