buddy-finder.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. .explanation {
  30. @apply(--paper-font-headline);
  31. color: #4285f4;
  32. text-align: center;
  33. cursor: default;
  34. }
  35. .short {
  36. font-size: 14px;
  37. line-height: 20px;
  38. color: #727272;
  39. }
  40. .short a {
  41. color: #4285f4;
  42. text-decoration: none;
  43. }
  44. .explanation:hover a {
  45. transform: scale(1.1);
  46. }
  47. @media all and (max-width: 600px) {
  48. .explanation {
  49. width: 340px;
  50. }
  51. }
  52. @media all and (max-height: 440px) {
  53. .buddies {
  54. padding-top: 48px;
  55. @apply(--layout-self-start);
  56. }
  57. }
  58. .explanation2 {
  59. display: none;
  60. }
  61. @media all and (min-height: 640px) {
  62. .explanation2 {
  63. display: block;
  64. position: absolute;
  65. top: 128px;
  66. width: 296px;
  67. margin-left: -148px;
  68. left: 50%;
  69. @apply(--paper-font-title);
  70. color: #7baaf7;
  71. text-align: center;
  72. }
  73. }
  74. </style>
  75. <div class="explanation2" hidden$="{{!buddies.0}}">
  76. Tap to send File.<br>Long Press to send Text.
  77. </div>
  78. <div class="buddies">
  79. <template is="dom-repeat" items="{{buddies}}">
  80. <buddy-avatar on-file-selected="_fileSelected" only$="{{!buddies.1}}" contact="{{item}}"></buddy-avatar>
  81. </template>
  82. </div>
  83. <div hidden$="{{buddies.0}}" class="explanation">
  84. Open Snapdrop on other devices to send files.
  85. <div class="short">
  86. Short link: <a href="http://yg.gl" target="_blank">yg.gl</a>
  87. </div>
  88. </div>
  89. <personal-avatar class="me"></personal-avatar>
  90. </template>
  91. <script>
  92. 'use strict';
  93. Polymer({
  94. is: 'buddy-finder',
  95. properties: {
  96. buddies: {
  97. type: Array,
  98. notify: true
  99. },
  100. me: {
  101. type: String,
  102. },
  103. },
  104. _fileSelected: function(e) {
  105. var peerId = e.model.item.peerId;
  106. var file = e.detail;
  107. app.conn.sendFile(peerId, file);
  108. }
  109. });
  110. </script>
  111. </dom-module>