buddy-finder.html 2.7 KB

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