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