buddy-finder.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. cursor: default;
  41. }
  42. .short {
  43. font-size: 14px;
  44. line-height: 18px;
  45. color: #505050;
  46. }
  47. .short a {
  48. color: #4285f4;
  49. text-decoration: none;
  50. }
  51. .explanation:hover a {
  52. transform: scale(1.1);
  53. }
  54. @media all and (max-width: 600px) {
  55. .explanation {
  56. width: 340px;
  57. }
  58. }
  59. [only] {
  60. @apply(--layout-fit);
  61. @apply(--layout-horizontal);
  62. @apply(--layout-center-center);
  63. cursor: pointer;
  64. }
  65. </style>
  66. <div class="buddies">
  67. <template is="dom-repeat" items="{{buddies}}">
  68. <file-input on-file-selected="_fileSelected" only$="{{!buddies.1}}">
  69. <buddy-avatar contact="{{item}}" class="buddy"></buddy-avatar>
  70. </file-input>
  71. </template>
  72. </div>
  73. <div hidden$="{{buddies.0}}" class="explanation">
  74. Open Snapdrop on other devices to send files.
  75. <div class="short">
  76. Short link: <a href="http://yg.gl" target="_blank">yg.gl</a>
  77. </div>
  78. </div>
  79. <personal-avatar class="me"></personal-avatar>
  80. </template>
  81. <script>
  82. 'use strict';
  83. Polymer({
  84. is: 'buddy-finder',
  85. properties: {
  86. buddies: {
  87. type: Array,
  88. notify: true
  89. },
  90. me: {
  91. type: String,
  92. },
  93. },
  94. _fileSelected: function(e) {
  95. var peerId = e.model.item.peerId;
  96. var file = e.detail;
  97. app.conn.sendFile(peerId, file);
  98. }
  99. });
  100. </script>
  101. </dom-module>