buddy-finder.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. --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. .me {
  37. position: absolute;
  38. bottom: 24px;
  39. left: 50%;
  40. margin-left: -180px;
  41. }
  42. .explanation {
  43. @apply(--paper-font-headline);
  44. color: #4285f4;
  45. text-align: center;
  46. }
  47. .short {
  48. @apply(--paper-font-body1);
  49. color: #333;
  50. }
  51. [only] {
  52. @apply(--layout-fit);
  53. @apply(--layout-horizontal);
  54. @apply(--layout-center-center);
  55. cursor: pointer;
  56. }
  57. </style>
  58. <div class="buddies">
  59. <template is="dom-repeat" items="{{buddies}}">
  60. <file-input on-file-selected="_fileSelected" only$="{{!buddies.1}}">
  61. <user-avatar contact="{{item}}" class="buddy"></user-avatar>
  62. </file-input>
  63. </template>
  64. </div>
  65. <div hidden$="{{buddies.0}}" class="explanation">
  66. Open Snapdrop on other devices
  67. <br> to send files.
  68. <paper-tooltip offset="14">
  69. short url: dropc.at
  70. </paper-tooltip>
  71. </div>
  72. <personal-avatar class="me"></personal-avatar>
  73. </template>
  74. <script>
  75. 'use strict';
  76. Polymer({
  77. is: 'buddy-finder',
  78. properties: {
  79. buddies: {
  80. type: Array,
  81. notify: true
  82. },
  83. me: {
  84. type: String,
  85. },
  86. },
  87. _fileSelected: function(e) {
  88. var peerId = e.model.item.peerId;
  89. var file = e.detail;
  90. app.p2p.sendFile(peerId, file);
  91. }
  92. });
  93. </script>
  94. </dom-module>