logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

chat_panel.vue (2952B)


  1. <template>
  2. <div
  3. v-if="!collapsed || !floating"
  4. class="chat-panel"
  5. >
  6. <div class="panel panel-default">
  7. <div
  8. class="panel-heading timeline-heading"
  9. :class="{ 'chat-heading': floating }"
  10. @click.stop.prevent="togglePanel"
  11. >
  12. <div class="title">
  13. {{ $t('shoutbox.title') }}
  14. <FAIcon
  15. v-if="floating"
  16. icon="times"
  17. class="close-icon"
  18. />
  19. </div>
  20. </div>
  21. <div class="chat-window">
  22. <div
  23. v-for="message in messages"
  24. :key="message.id"
  25. class="chat-message"
  26. >
  27. <span class="chat-avatar">
  28. <img :src="message.author.avatar">
  29. </span>
  30. <div class="chat-content">
  31. <router-link
  32. class="chat-name"
  33. :to="userProfileLink(message.author)"
  34. >
  35. {{ message.author.username }}
  36. </router-link>
  37. <br>
  38. <span class="chat-text">
  39. {{ message.text }}
  40. </span>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="chat-input">
  45. <textarea
  46. v-model="currentMessage"
  47. class="chat-input-textarea"
  48. rows="1"
  49. @keyup.enter="submit(currentMessage)"
  50. />
  51. </div>
  52. </div>
  53. </div>
  54. <div
  55. v-else
  56. class="chat-panel"
  57. >
  58. <div class="panel panel-default">
  59. <div
  60. class="panel-heading stub timeline-heading chat-heading"
  61. @click.stop.prevent="togglePanel"
  62. >
  63. <div class="title">
  64. <FAIcon
  65. class="icon"
  66. icon="bullhorn"
  67. />
  68. {{ $t('shoutbox.title') }}
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </template>
  74. <script src="./chat_panel.js"></script>
  75. <style lang="scss">
  76. @import '../../_variables.scss';
  77. .floating-chat {
  78. position: fixed;
  79. right: 0px;
  80. bottom: 0px;
  81. z-index: 1000;
  82. max-width: 25em;
  83. }
  84. .chat-panel {
  85. .chat-heading {
  86. cursor: pointer;
  87. .icon {
  88. color: $fallback--text;
  89. color: var(--text, $fallback--text);
  90. margin-right: 0.5em;
  91. }
  92. .title {
  93. display: flex;
  94. justify-content: space-between;
  95. align-items: center;
  96. }
  97. }
  98. .chat-window {
  99. overflow-y: auto;
  100. overflow-x: hidden;
  101. max-height: 20em;
  102. }
  103. .chat-window-container {
  104. height: 100%;
  105. }
  106. .chat-message {
  107. display: flex;
  108. padding: 0.2em 0.5em
  109. }
  110. .chat-avatar {
  111. img {
  112. height: 24px;
  113. width: 24px;
  114. border-radius: $fallback--avatarRadius;
  115. border-radius: var(--avatarRadius, $fallback--avatarRadius);
  116. margin-right: 0.5em;
  117. margin-top: 0.25em;
  118. }
  119. }
  120. .chat-input {
  121. display: flex;
  122. textarea {
  123. flex: 1;
  124. margin: 0.6em;
  125. min-height: 3.5em;
  126. resize: none;
  127. }
  128. }
  129. .chat-panel {
  130. .title {
  131. display: flex;
  132. justify-content: space-between;
  133. }
  134. }
  135. }
  136. </style>