logo

pleroma-fe

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

side_drawer.vue (9621B)


  1. <template>
  2. <div
  3. class="side-drawer-container mobile-drawer"
  4. :class="{ 'side-drawer-container-closed': closed, 'side-drawer-container-open': !closed }"
  5. >
  6. <div
  7. class="side-drawer-darken"
  8. :class="{ 'side-drawer-darken-closed': closed}"
  9. />
  10. <div
  11. class="side-drawer"
  12. :class="{'side-drawer-closed': closed}"
  13. @touchstart="touchStart"
  14. @touchmove="touchMove"
  15. >
  16. <div
  17. class="side-drawer-heading"
  18. @click="toggleDrawer"
  19. >
  20. <UserCard
  21. v-if="currentUser"
  22. :user-id="currentUser.id"
  23. :hide-bio="true"
  24. />
  25. <div
  26. v-else
  27. class="side-drawer-logo-wrapper"
  28. >
  29. <img :src="logo">
  30. <span v-if="!hideSitename">{{ sitename }}</span>
  31. </div>
  32. </div>
  33. <ul>
  34. <li
  35. v-if="!currentUser"
  36. @click="toggleDrawer"
  37. >
  38. <router-link
  39. :to="{ name: 'login' }"
  40. class="menu-item"
  41. >
  42. <FAIcon
  43. fixed-width
  44. class="fa-scale-110 fa-old-padding"
  45. icon="sign-in-alt"
  46. /> {{ $t("login.login") }}
  47. </router-link>
  48. </li>
  49. <li
  50. v-if="currentUser || !privateMode"
  51. @click="toggleDrawer"
  52. >
  53. <router-link
  54. :to="timelinesRoute"
  55. class="menu-item"
  56. >
  57. <FAIcon
  58. fixed-width
  59. class="fa-scale-110 fa-old-padding"
  60. icon="home"
  61. /> {{ $t("nav.timelines") }}
  62. </router-link>
  63. </li>
  64. <li
  65. v-if="currentUser"
  66. @click="toggleDrawer"
  67. >
  68. <router-link
  69. :to="{ name: 'lists' }"
  70. class="menu-item"
  71. >
  72. <FAIcon
  73. fixed-width
  74. class="fa-scale-110 fa-old-padding"
  75. icon="list"
  76. /> {{ $t("nav.lists") }}
  77. </router-link>
  78. </li>
  79. <li
  80. v-if="currentUser && pleromaChatMessagesAvailable"
  81. @click="toggleDrawer"
  82. >
  83. <router-link
  84. :to="{ name: 'chats', params: { username: currentUser.screen_name } }"
  85. style="position: relative;"
  86. class="menu-item"
  87. >
  88. <FAIcon
  89. fixed-width
  90. class="fa-scale-110 fa-old-padding"
  91. icon="comments"
  92. /> {{ $t("nav.chats") }}
  93. <span
  94. v-if="unreadChatCount"
  95. class="badge -notification"
  96. >
  97. {{ unreadChatCount }}
  98. </span>
  99. </router-link>
  100. </li>
  101. </ul>
  102. <ul v-if="currentUser">
  103. <li @click="toggleDrawer">
  104. <router-link
  105. :to="{ name: 'interactions', params: { username: currentUser.screen_name } }"
  106. class="menu-item"
  107. >
  108. <FAIcon
  109. fixed-width
  110. class="fa-scale-110 fa-old-padding"
  111. icon="bell"
  112. /> {{ $t("nav.interactions") }}
  113. </router-link>
  114. </li>
  115. <li
  116. v-if="currentUser.locked"
  117. @click="toggleDrawer"
  118. >
  119. <router-link
  120. to="/friend-requests"
  121. class="menu-item"
  122. >
  123. <FAIcon
  124. fixed-width
  125. class="fa-scale-110 fa-old-padding"
  126. icon="user-plus"
  127. /> {{ $t("nav.friend_requests") }}
  128. <span
  129. v-if="followRequestCount > 0"
  130. class="badge -notification"
  131. >
  132. {{ followRequestCount }}
  133. </span>
  134. </router-link>
  135. </li>
  136. <li
  137. v-if="shout"
  138. @click="toggleDrawer"
  139. >
  140. <router-link
  141. :to="{ name: 'shout-panel' }"
  142. class="menu-item"
  143. >
  144. <FAIcon
  145. fixed-width
  146. class="fa-scale-110 fa-old-padding"
  147. icon="bullhorn"
  148. /> {{ $t("shoutbox.title") }}
  149. </router-link>
  150. </li>
  151. </ul>
  152. <ul>
  153. <li
  154. v-if="currentUser || !privateMode"
  155. @click="toggleDrawer"
  156. >
  157. <router-link
  158. :to="{ name: 'search' }"
  159. class="menu-item"
  160. >
  161. <FAIcon
  162. fixed-width
  163. class="fa-scale-110 fa-old-padding"
  164. icon="search"
  165. /> {{ $t("nav.search") }}
  166. </router-link>
  167. </li>
  168. <li
  169. v-if="currentUser && suggestionsEnabled"
  170. @click="toggleDrawer"
  171. >
  172. <router-link
  173. :to="{ name: 'who-to-follow' }"
  174. class="menu-item"
  175. >
  176. <FAIcon
  177. fixed-width
  178. class="fa-scale-110 fa-old-padding"
  179. icon="user-plus"
  180. /> {{ $t("nav.who_to_follow") }}
  181. </router-link>
  182. </li>
  183. <li @click="toggleDrawer">
  184. <button
  185. class="menu-item"
  186. @click="openSettingsModal"
  187. >
  188. <FAIcon
  189. fixed-width
  190. class="fa-scale-110 fa-old-padding"
  191. icon="cog"
  192. /> {{ $t("settings.settings") }}
  193. </button>
  194. </li>
  195. <li @click="toggleDrawer">
  196. <router-link
  197. :to="{ name: 'about'}"
  198. class="menu-item"
  199. >
  200. <FAIcon
  201. fixed-width
  202. class="fa-scale-110 fa-old-padding"
  203. icon="info-circle"
  204. /> {{ $t("nav.about") }}
  205. </router-link>
  206. </li>
  207. <li
  208. v-if="currentUser && currentUser.role === 'admin'"
  209. @click="toggleDrawer"
  210. >
  211. <button
  212. class="menu-item"
  213. @click.stop="openAdminModal"
  214. >
  215. <FAIcon
  216. fixed-width
  217. class="fa-scale-110 fa-old-padding"
  218. icon="tachometer-alt"
  219. /> {{ $t("nav.administration") }}
  220. </button>
  221. </li>
  222. <li
  223. v-if="currentUser && supportsAnnouncements"
  224. @click="toggleDrawer"
  225. >
  226. <router-link
  227. :to="{ name: 'announcements' }"
  228. class="menu-item"
  229. >
  230. <FAIcon
  231. fixed-width
  232. class="fa-scale-110 fa-old-padding"
  233. icon="bullhorn"
  234. /> {{ $t("nav.announcements") }}
  235. <span
  236. v-if="unreadAnnouncementCount"
  237. class="badge -notification"
  238. >
  239. {{ unreadAnnouncementCount }}
  240. </span>
  241. </router-link>
  242. </li>
  243. <li
  244. v-if="currentUser"
  245. @click="toggleDrawer"
  246. >
  247. <router-link
  248. :to="{ name: 'edit-navigation' }"
  249. class="menu-item"
  250. >
  251. <FAIcon
  252. fixed-width
  253. class="fa-scale-110 fa-old-padding"
  254. icon="compass"
  255. /> {{ $t("nav.edit_nav_mobile") }}
  256. </router-link>
  257. </li>
  258. <li
  259. v-if="currentUser"
  260. @click="toggleDrawer"
  261. >
  262. <button
  263. class="menu-item"
  264. @click="doLogout"
  265. >
  266. <FAIcon
  267. fixed-width
  268. class="fa-scale-110 fa-old-padding"
  269. icon="sign-out-alt"
  270. /> {{ $t("login.logout") }}
  271. </button>
  272. </li>
  273. </ul>
  274. </div>
  275. <div
  276. class="side-drawer-click-outside"
  277. :class="{'side-drawer-click-outside-closed': closed}"
  278. @click.stop.prevent="toggleDrawer"
  279. />
  280. </div>
  281. </template>
  282. <script src="./side_drawer.js"></script>
  283. <style lang="scss">
  284. .side-drawer-container {
  285. position: fixed;
  286. z-index: var(--ZI_navbar);
  287. top: 0;
  288. left: 0;
  289. width: 100%;
  290. height: 100%;
  291. display: flex;
  292. align-items: stretch;
  293. transition-duration: 0s;
  294. transition-property: transform;
  295. }
  296. .side-drawer-container-open {
  297. transform: translate(0%);
  298. }
  299. .side-drawer-container-closed {
  300. transition-delay: 0.35s;
  301. transform: translate(-100%);
  302. }
  303. .side-drawer-darken {
  304. top: 0;
  305. left: 0;
  306. width: 100vw;
  307. height: 100vh;
  308. position: fixed;
  309. z-index: -1;
  310. transition: 0.35s;
  311. transition-property: background-color;
  312. background-color: rgb(0 0 0 / 50%);
  313. }
  314. .side-drawer-darken-closed {
  315. background-color: rgb(0 0 0 / 0%);
  316. }
  317. .side-drawer-click-outside {
  318. flex: 1 1 100%;
  319. }
  320. .side-drawer {
  321. overflow-x: hidden;
  322. transition: 0.35s;
  323. transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
  324. transition-property: transform;
  325. margin: 0 0 0 -100px;
  326. padding: 0 0 1em 100px;
  327. width: 80%;
  328. max-width: 20em;
  329. flex: 0 0 80%;
  330. box-shadow: var(--shadow);
  331. background-color: var(--background);
  332. .badge {
  333. margin-left: 10px;
  334. }
  335. }
  336. .side-drawer-logo-wrapper {
  337. display: flex;
  338. align-items: center;
  339. padding: 0.85em;
  340. img {
  341. flex: none;
  342. height: 50px;
  343. margin-right: 0.85em;
  344. }
  345. span {
  346. overflow: hidden;
  347. text-overflow: ellipsis;
  348. white-space: nowrap;
  349. }
  350. }
  351. .side-drawer-click-outside-closed {
  352. flex: 0 0 0;
  353. }
  354. .side-drawer-closed {
  355. transform: translate(-100%);
  356. }
  357. .side-drawer-heading {
  358. background: transparent;
  359. flex-direction: column;
  360. align-items: stretch;
  361. display: flex;
  362. padding: 0;
  363. margin: 0;
  364. }
  365. .side-drawer ul {
  366. list-style: none;
  367. margin: 0;
  368. padding: 0;
  369. border-bottom: 1px solid;
  370. border-color: var(--border);
  371. }
  372. .side-drawer ul:last-child {
  373. border: 0;
  374. }
  375. .side-drawer li {
  376. padding: 0;
  377. a,
  378. button {
  379. box-sizing: border-box;
  380. display: block;
  381. height: 3em;
  382. line-height: 3em;
  383. padding: 0 0.7em;
  384. }
  385. }
  386. </style>