buddy-finder.html 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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="../contact-item/contact-item.html">
  4. <link rel="import" href="../file-sharing/share-area.html">
  5. <link rel="import" href="user-avatar.html">
  6. <dom-module id="buddy-finder">
  7. <template>
  8. <style>
  9. :host {
  10. display: block;
  11. background-color: white;
  12. @apply(--layout-fit);
  13. @apply(--layout-vertical);
  14. @apply(--layout-center-center);
  15. border-left: 1px solid #ccc;
  16. }
  17. .paper-font-display1 {
  18. color: black;
  19. text-align: center;
  20. margin-bottom: 16px;
  21. display: none;
  22. }
  23. .buddies {
  24. z-index: 1;
  25. }
  26. .buddy {
  27. cursor: pointer;
  28. }
  29. .circles {
  30. position: absolute;
  31. bottom: -50px;
  32. left: 50%;
  33. width: 1140px;
  34. margin-left: -570px;
  35. height: 700px;
  36. transform-origin: 570px 570px;
  37. animation: grow 1.5s ease-out;
  38. fill: transparent;
  39. }
  40. .me {
  41. position: absolute;
  42. bottom: 30px;
  43. left: 50%;
  44. margin-left: -60px;
  45. }
  46. </style>
  47. <div class="paper-font-display1">People near by</div>
  48. <div class="buddies">
  49. <template is="dom-repeat" items="{{buddies}}">
  50. <share-area>
  51. <user-avatar on-tap="_connect" contact="{{item.peerId}}" class="buddy"></user-avatar>
  52. </share-area>
  53. </template>
  54. </div>
  55. <user-avatar contact="{{me}}" class="me"></user-avatar>
  56. <iron-ajax auto url="https://yawim.com/findbuddies/{{me}}" handle-as="json" last-response="{{buddies}}"></iron-ajax>
  57. <svg class="circles" viewBox="-0.5 -0.5 1140 700">
  58. <circle class="circle" cx="570" cy="570" r="120" stroke="rgba(160,160,160,.4)"></circle>
  59. <circle class="circle" cx="570" cy="570" r="210" stroke="rgba(160,160,160,.35)"></circle>
  60. <circle class="circle" cx="570" cy="570" r="300" stroke="rgba(160,160,160,.3)"></circle>
  61. <circle class="circle" cx="570" cy="570" r="390" stroke="rgba(160,160,160,.2)"></circle>
  62. <circle class="circle" cx="570" cy="570" r="480" stroke="rgba(160,160,160,.15)"></circle>
  63. </svg>
  64. </template>
  65. <script>
  66. 'use strict';
  67. Polymer({
  68. is: 'buddy-finder',
  69. properties: {
  70. buddies: Array,
  71. me: {
  72. type: String,
  73. }
  74. },
  75. _connect: function(e) {
  76. Polymer.dom(document).querySelector('x-app').p2p.connectToPeer(e.model.item.peerId);
  77. }
  78. });
  79. </script>
  80. </dom-module>