buddy-finder.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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: #4E4E4E;
  41. text-align: center;
  42. }
  43. .short {
  44. @apply(--paper-font-body1);
  45. color: #333;
  46. }
  47. .url {
  48. color: #4285f4;
  49. }
  50. </style>
  51. <div class="buddies">
  52. <template is="dom-repeat" items="{{buddies}}">
  53. <file-input on-file-selected="_fileSelected">
  54. <user-avatar contact="{{item}}" class="buddy"></user-avatar>
  55. </file-input>
  56. </template>
  57. </div>
  58. <div hidden$="{{buddies.0}}" class="explanation">
  59. Open <span class="url">dropc.at</span> on other devices
  60. <br> to send files.
  61. </div>
  62. <personal-avatar class="me"></personal-avatar>
  63. </template>
  64. <script>
  65. 'use strict';
  66. Polymer({
  67. is: 'buddy-finder',
  68. properties: {
  69. buddies: {
  70. type: Array,
  71. notify: true
  72. },
  73. me: {
  74. type: String,
  75. },
  76. },
  77. _fileSelected: function(e) {
  78. var peerId = e.model.item.peerId;
  79. var file = e.detail;
  80. app.p2p.sendFile(peerId, file);
  81. }
  82. });
  83. </script>
  84. </dom-module>