buddy-finder.html 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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="buddy-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. --paper-tooltip: {
  23. font-size: 14px;
  24. background-color: #4285f4;
  25. }
  26. }
  27. .buddies {
  28. z-index: 1;
  29. @apply(--layout-horizontal);
  30. @apply(--layout-center-center);
  31. @apply(--layout-wrap);
  32. }
  33. .buddy {
  34. cursor: pointer;
  35. }
  36. .explanation {
  37. @apply(--paper-font-headline);
  38. color: #4285f4;
  39. text-align: center;
  40. }
  41. .short {
  42. @apply(--paper-font-body1);
  43. color: #333;
  44. }
  45. [only] {
  46. @apply(--layout-fit);
  47. @apply(--layout-horizontal);
  48. @apply(--layout-center-center);
  49. cursor: pointer;
  50. }
  51. </style>
  52. <div class="buddies">
  53. <template is="dom-repeat" items="{{buddies}}">
  54. <file-input on-file-selected="_fileSelected" only$="{{!buddies.1}}">
  55. <buddy-avatar contact="{{item}}" class="buddy"></buddy-avatar>
  56. </file-input>
  57. </template>
  58. </div>
  59. <div hidden$="{{buddies.0}}" class="explanation">
  60. Open Snapdrop on other devices
  61. <br> to send files.
  62. <paper-tooltip offset="14">
  63. short url: yg.gl
  64. </paper-tooltip>
  65. </div>
  66. <personal-avatar class="me"></personal-avatar>
  67. </template>
  68. <script>
  69. 'use strict';
  70. Polymer({
  71. is: 'buddy-finder',
  72. properties: {
  73. buddies: {
  74. type: Array,
  75. notify: true
  76. },
  77. me: {
  78. type: String,
  79. },
  80. },
  81. _fileSelected: function(e) {
  82. var peerId = e.model.item.peerId;
  83. var file = e.detail;
  84. app.conn.sendFile(peerId, file);
  85. }
  86. });
  87. </script>
  88. </dom-module>