buddy-finder.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. [only] {
  51. @apply(--layout-fit);
  52. @apply(--layout-horizontal);
  53. @apply(--layout-center-center);
  54. }
  55. </style>
  56. <div class="buddies">
  57. <template is="dom-repeat" items="{{buddies}}">
  58. <file-input on-file-selected="_fileSelected" only$="{{!buddies.1}}">
  59. <user-avatar contact="{{item}}" class="buddy"></user-avatar>
  60. </file-input>
  61. </template>
  62. </div>
  63. <div hidden$="{{buddies.0}}" class="explanation">
  64. Open <span class="url">dropc.at</span> on other devices
  65. <br> to send files.
  66. </div>
  67. <personal-avatar class="me"></personal-avatar>
  68. </template>
  69. <script>
  70. 'use strict';
  71. Polymer({
  72. is: 'buddy-finder',
  73. properties: {
  74. buddies: {
  75. type: Array,
  76. notify: true
  77. },
  78. me: {
  79. type: String,
  80. },
  81. },
  82. _fileSelected: function(e) {
  83. var peerId = e.model.item.peerId;
  84. var file = e.detail;
  85. app.p2p.sendFile(peerId, file);
  86. }
  87. });
  88. </script>
  89. </dom-module>