buddy-finder.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. -webkit-user-select: none;
  15. -moz-user-select: none;
  16. -ms-user-select: none;
  17. user-select: none;
  18. margin: 0;
  19. --paper-tooltip: {
  20. font-size: 14px;
  21. background-color: #4285f4;
  22. }
  23. }
  24. .buddies {
  25. z-index: 1;
  26. @apply(--layout-horizontal);
  27. @apply(--layout-center-center);
  28. @apply(--layout-wrap);
  29. }
  30. .buddy {
  31. cursor: pointer;
  32. }
  33. .explanation {
  34. @apply(--paper-font-headline);
  35. color: #4285f4;
  36. text-align: center;
  37. cursor: default;
  38. }
  39. .short {
  40. font-size: 14px;
  41. line-height: 20px;
  42. color: #727272;
  43. }
  44. .short a {
  45. color: #4285f4;
  46. text-decoration: none;
  47. }
  48. .explanation:hover a {
  49. transform: scale(1.1);
  50. }
  51. @media all and (max-width: 600px) {
  52. .explanation {
  53. width: 340px;
  54. }
  55. }
  56. [only] {
  57. @apply(--layout-fit);
  58. @apply(--layout-horizontal);
  59. @apply(--layout-center-center);
  60. cursor: pointer;
  61. }
  62. </style>
  63. <div class="buddies">
  64. <template is="dom-repeat" items="{{buddies}}">
  65. <file-input on-file-selected="_fileSelected" only$="{{!buddies.1}}">
  66. <buddy-avatar contact="{{item}}" class="buddy"></buddy-avatar>
  67. </file-input>
  68. </template>
  69. </div>
  70. <div hidden$="{{buddies.0}}" class="explanation">
  71. Open Snapdrop on other devices to send files.
  72. <div class="short">
  73. Short link: <a href="http://yg.gl" target="_blank">yg.gl</a>
  74. </div>
  75. </div>
  76. <personal-avatar class="me"></personal-avatar>
  77. </template>
  78. <script>
  79. 'use strict';
  80. Polymer({
  81. is: 'buddy-finder',
  82. properties: {
  83. buddies: {
  84. type: Array,
  85. notify: true
  86. },
  87. me: {
  88. type: String,
  89. },
  90. },
  91. _fileSelected: function(e) {
  92. var peerId = e.model.item.peerId;
  93. var file = e.detail;
  94. app.conn.sendFile(peerId, file);
  95. }
  96. });
  97. </script>
  98. </dom-module>