Sidebar.svelte 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. <script lang="ts">
  2. import { toast } from 'svelte-sonner';
  3. import { goto } from '$app/navigation';
  4. import {
  5. user,
  6. chats,
  7. settings,
  8. showSettings,
  9. chatId,
  10. tags,
  11. showSidebar,
  12. mobile,
  13. showArchivedChats,
  14. pinnedChats,
  15. pageSkip,
  16. pageLimit,
  17. scrollPaginationEnabled,
  18. tagView
  19. } from '$lib/stores';
  20. import { onMount, getContext, tick } from 'svelte';
  21. const i18n = getContext('i18n');
  22. import { updateUserSettings } from '$lib/apis/users';
  23. import {
  24. deleteChatById,
  25. getChatList,
  26. getChatById,
  27. getChatListByTagName,
  28. updateChatById,
  29. getAllChatTags,
  30. archiveChatById,
  31. cloneChatById
  32. } from '$lib/apis/chats';
  33. import { WEBUI_BASE_URL } from '$lib/constants';
  34. import ArchivedChatsModal from './Sidebar/ArchivedChatsModal.svelte';
  35. import UserMenu from './Sidebar/UserMenu.svelte';
  36. import ChatItem from './Sidebar/ChatItem.svelte';
  37. import DeleteConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
  38. const BREAKPOINT = 768;
  39. let navElement;
  40. let search = '';
  41. let shiftKey = false;
  42. let selectedChatId = null;
  43. let deleteChat = null;
  44. let showDeleteConfirm = false;
  45. let showDropdown = false;
  46. let filteredChatList = [];
  47. let paginationScrollThreashold = 0.6;
  48. let nextPageLoading = false;
  49. let chatPagniationComplete = false;
  50. // number of chats per page depends on screen size.
  51. // 35px is the height of each chat item.
  52. // load 5 extra chats
  53. pageLimit.set(Math.round(window.innerHeight / 35) + 5);
  54. $: filteredChatList = $chats.filter((chat) => {
  55. if (search === '') {
  56. return true;
  57. } else {
  58. let title = chat.title.toLowerCase();
  59. const query = search.toLowerCase();
  60. let contentMatches = false;
  61. // Access the messages within chat.chat.messages
  62. if (chat.chat && chat.chat.messages && Array.isArray(chat.chat.messages)) {
  63. contentMatches = chat.chat.messages.some((message) => {
  64. // Check if message.content exists and includes the search query
  65. return message.content && message.content.toLowerCase().includes(query);
  66. });
  67. }
  68. return title.includes(query) || contentMatches;
  69. }
  70. });
  71. onMount(async () => {
  72. mobile.subscribe((e) => {
  73. if ($showSidebar && e) {
  74. showSidebar.set(false);
  75. }
  76. if (!$showSidebar && !e) {
  77. showSidebar.set(true);
  78. }
  79. });
  80. showSidebar.set(window.innerWidth > BREAKPOINT);
  81. await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
  82. await chats.set(await getChatList(localStorage.token, $pageSkip, $pageLimit));
  83. let touchstart;
  84. let touchend;
  85. function checkDirection() {
  86. const screenWidth = window.innerWidth;
  87. const swipeDistance = Math.abs(touchend.screenX - touchstart.screenX);
  88. if (touchstart.clientX < 40 && swipeDistance >= screenWidth / 8) {
  89. if (touchend.screenX < touchstart.screenX) {
  90. showSidebar.set(false);
  91. }
  92. if (touchend.screenX > touchstart.screenX) {
  93. showSidebar.set(true);
  94. }
  95. }
  96. }
  97. const onTouchStart = (e) => {
  98. touchstart = e.changedTouches[0];
  99. console.log(touchstart.clientX);
  100. };
  101. const onTouchEnd = (e) => {
  102. touchend = e.changedTouches[0];
  103. checkDirection();
  104. };
  105. const onKeyDown = (e) => {
  106. if (e.key === 'Shift') {
  107. shiftKey = true;
  108. }
  109. };
  110. const onKeyUp = (e) => {
  111. if (e.key === 'Shift') {
  112. shiftKey = false;
  113. }
  114. };
  115. const onFocus = () => {};
  116. const onBlur = () => {
  117. shiftKey = false;
  118. selectedChatId = null;
  119. };
  120. window.addEventListener('keydown', onKeyDown);
  121. window.addEventListener('keyup', onKeyUp);
  122. window.addEventListener('touchstart', onTouchStart);
  123. window.addEventListener('touchend', onTouchEnd);
  124. window.addEventListener('focus', onFocus);
  125. window.addEventListener('blur', onBlur);
  126. return () => {
  127. window.removeEventListener('keydown', onKeyDown);
  128. window.removeEventListener('keyup', onKeyUp);
  129. window.removeEventListener('touchstart', onTouchStart);
  130. window.removeEventListener('touchend', onTouchEnd);
  131. window.removeEventListener('focus', onFocus);
  132. window.removeEventListener('blur', onBlur);
  133. };
  134. });
  135. // Helper function to fetch and add chat content to each chat
  136. const enrichChatsWithContent = async (chatList) => {
  137. const enrichedChats = await Promise.all(
  138. chatList.map(async (chat) => {
  139. const chatDetails = await getChatById(localStorage.token, chat.id).catch((error) => null); // Handle error or non-existent chat gracefully
  140. if (chatDetails) {
  141. chat.chat = chatDetails.chat; // Assuming chatDetails.chat contains the chat content
  142. }
  143. return chat;
  144. })
  145. );
  146. await chats.set(enrichedChats);
  147. };
  148. const saveSettings = async (updated) => {
  149. await settings.set({ ...$settings, ...updated });
  150. await updateUserSettings(localStorage.token, { ui: $settings });
  151. location.href = '/';
  152. };
  153. const deleteChatHandler = async (id) => {
  154. const res = await deleteChatById(localStorage.token, id).catch((error) => {
  155. toast.error(error);
  156. return null;
  157. });
  158. if (res) {
  159. if ($chatId === id) {
  160. await chatId.set('');
  161. await tick();
  162. goto('/');
  163. }
  164. await chats.set(
  165. await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
  166. );
  167. await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
  168. }
  169. };
  170. </script>
  171. <ArchivedChatsModal
  172. bind:show={$showArchivedChats}
  173. on:change={async () => {
  174. await chats.set(await getChatList(localStorage.token));
  175. }}
  176. />
  177. <DeleteConfirmDialog
  178. bind:show={showDeleteConfirm}
  179. title={$i18n.t('Delete chat?')}
  180. on:confirm={() => {
  181. deleteChatHandler(deleteChat.id);
  182. }}
  183. >
  184. <div class=" text-sm text-gray-500">
  185. {$i18n.t('This will delete')} <span class=" font-semibold">{deleteChat.title}</span>.
  186. </div>
  187. </DeleteConfirmDialog>
  188. <!-- svelte-ignore a11y-no-static-element-interactions -->
  189. {#if $showSidebar}
  190. <div
  191. class=" fixed md:hidden z-40 top-0 right-0 left-0 bottom-0 bg-black/60 w-full min-h-screen h-screen flex justify-center overflow-hidden overscroll-contain"
  192. on:mousedown={() => {
  193. showSidebar.set(!$showSidebar);
  194. }}
  195. />
  196. {/if}
  197. <div
  198. bind:this={navElement}
  199. id="sidebar"
  200. class="h-screen max-h-[100dvh] min-h-screen select-none {$showSidebar
  201. ? 'md:relative w-[260px]'
  202. : '-translate-x-[260px] w-[0px]'} bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-200 text-sm transition fixed z-50 top-0 left-0 rounded-r-2xl
  203. "
  204. data-state={$showSidebar}
  205. >
  206. <div
  207. class="py-2.5 my-auto flex flex-col justify-between h-screen max-h-[100dvh] w-[260px] z-50 {$showSidebar
  208. ? ''
  209. : 'invisible'}"
  210. >
  211. <h1 class="text-red-400 text-bold text-xl">
  212. Chats loaded: {$chats.length}
  213. </h1>
  214. <h1 class="text-red-400 text-bold text-xl">
  215. Pagination Enabled: {$scrollPaginationEnabled}
  216. </h1>
  217. <h1 class="text-red-400 text-bold text-xl">
  218. Final Page Reached: {chatPagniationComplete}
  219. </h1>
  220. <div class="px-2.5 flex justify-between space-x-1 text-gray-600 dark:text-gray-400">
  221. <a
  222. id="sidebar-new-chat-button"
  223. class="flex flex-1 justify-between rounded-xl px-2 py-2 hover:bg-gray-100 dark:hover:bg-gray-900 transition"
  224. href="/"
  225. draggable="false"
  226. on:click={async () => {
  227. selectedChatId = null;
  228. await goto('/');
  229. const newChatButton = document.getElementById('new-chat-button');
  230. setTimeout(() => {
  231. newChatButton?.click();
  232. if ($mobile) {
  233. showSidebar.set(false);
  234. }
  235. }, 0);
  236. }}
  237. >
  238. <div class="self-center mx-1.5">
  239. <img
  240. crossorigin="anonymous"
  241. src="{WEBUI_BASE_URL}/static/favicon.png"
  242. class=" size-6 -translate-x-1.5 rounded-full"
  243. alt="logo"
  244. />
  245. </div>
  246. <div class=" self-center font-medium text-sm text-gray-850 dark:text-white font-primary">
  247. {$i18n.t('New Chat')}
  248. </div>
  249. <div class="self-center ml-auto">
  250. <svg
  251. xmlns="http://www.w3.org/2000/svg"
  252. viewBox="0 0 20 20"
  253. fill="currentColor"
  254. class="size-5"
  255. >
  256. <path
  257. d="M5.433 13.917l1.262-3.155A4 4 0 017.58 9.42l6.92-6.918a2.121 2.121 0 013 3l-6.92 6.918c-.383.383-.84.685-1.343.886l-3.154 1.262a.5.5 0 01-.65-.65z"
  258. />
  259. <path
  260. d="M3.5 5.75c0-.69.56-1.25 1.25-1.25H10A.75.75 0 0010 3H4.75A2.75 2.75 0 002 5.75v9.5A2.75 2.75 0 004.75 18h9.5A2.75 2.75 0 0017 15.25V10a.75.75 0 00-1.5 0v5.25c0 .69-.56 1.25-1.25 1.25h-9.5c-.69 0-1.25-.56-1.25-1.25v-9.5z"
  261. />
  262. </svg>
  263. </div>
  264. </a>
  265. <button
  266. class=" cursor-pointer px-2 py-2 flex rounded-xl hover:bg-gray-100 dark:hover:bg-gray-900 transition"
  267. on:click={() => {
  268. showSidebar.set(!$showSidebar);
  269. }}
  270. >
  271. <div class=" m-auto self-center">
  272. <svg
  273. xmlns="http://www.w3.org/2000/svg"
  274. fill="none"
  275. viewBox="0 0 24 24"
  276. stroke-width="2"
  277. stroke="currentColor"
  278. class="size-5"
  279. >
  280. <path
  281. stroke-linecap="round"
  282. stroke-linejoin="round"
  283. d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25H12"
  284. />
  285. </svg>
  286. </div>
  287. </button>
  288. </div>
  289. {#if $user?.role === 'admin'}
  290. <div class="px-2.5 flex justify-center text-gray-800 dark:text-gray-200">
  291. <a
  292. class="flex-grow flex space-x-3 rounded-xl px-2.5 py-2 hover:bg-gray-100 dark:hover:bg-gray-900 transition"
  293. href="/workspace"
  294. on:click={() => {
  295. selectedChatId = null;
  296. chatId.set('');
  297. if ($mobile) {
  298. showSidebar.set(false);
  299. }
  300. }}
  301. draggable="false"
  302. >
  303. <div class="self-center">
  304. <svg
  305. xmlns="http://www.w3.org/2000/svg"
  306. fill="none"
  307. viewBox="0 0 24 24"
  308. stroke-width="2"
  309. stroke="currentColor"
  310. class="size-[1.1rem]"
  311. >
  312. <path
  313. stroke-linecap="round"
  314. stroke-linejoin="round"
  315. d="M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 0 0 2.25-2.25V6a2.25 2.25 0 0 0-2.25-2.25H6A2.25 2.25 0 0 0 3.75 6v2.25A2.25 2.25 0 0 0 6 10.5Zm0 9.75h2.25A2.25 2.25 0 0 0 10.5 18v-2.25a2.25 2.25 0 0 0-2.25-2.25H6a2.25 2.25 0 0 0-2.25 2.25V18A2.25 2.25 0 0 0 6 20.25Zm9.75-9.75H18a2.25 2.25 0 0 0 2.25-2.25V6A2.25 2.25 0 0 0 18 3.75h-2.25A2.25 2.25 0 0 0 13.5 6v2.25a2.25 2.25 0 0 0 2.25 2.25Z"
  316. />
  317. </svg>
  318. </div>
  319. <div class="flex self-center">
  320. <div class=" self-center font-medium text-sm font-primary">{$i18n.t('Workspace')}</div>
  321. </div>
  322. </a>
  323. </div>
  324. {/if}
  325. <div class="relative flex flex-col flex-1 overflow-y-auto">
  326. {#if !($settings.saveChatHistory ?? true)}
  327. <div class="absolute z-40 w-full h-full bg-gray-50/90 dark:bg-black/90 flex justify-center">
  328. <div class=" text-left px-5 py-2">
  329. <div class=" font-medium">{$i18n.t('Chat History is off for this browser.')}</div>
  330. <div class="text-xs mt-2">
  331. {$i18n.t(
  332. "When history is turned off, new chats on this browser won't appear in your history on any of your devices."
  333. )}
  334. <span class=" font-semibold"
  335. >{$i18n.t('This setting does not sync across browsers or devices.')}</span
  336. >
  337. </div>
  338. <div class="mt-3">
  339. <button
  340. class="flex justify-center items-center space-x-1.5 px-3 py-2.5 rounded-lg text-xs bg-gray-100 hover:bg-gray-200 transition text-gray-800 font-medium w-full"
  341. type="button"
  342. on:click={() => {
  343. saveSettings({
  344. saveChatHistory: true
  345. });
  346. }}
  347. >
  348. <svg
  349. xmlns="http://www.w3.org/2000/svg"
  350. viewBox="0 0 16 16"
  351. fill="currentColor"
  352. class="w-3 h-3"
  353. >
  354. <path
  355. fill-rule="evenodd"
  356. d="M8 1a.75.75 0 0 1 .75.75v6.5a.75.75 0 0 1-1.5 0v-6.5A.75.75 0 0 1 8 1ZM4.11 3.05a.75.75 0 0 1 0 1.06 5.5 5.5 0 1 0 7.78 0 .75.75 0 0 1 1.06-1.06 7 7 0 1 1-9.9 0 .75.75 0 0 1 1.06 0Z"
  357. clip-rule="evenodd"
  358. />
  359. </svg>
  360. <div>{$i18n.t('Enable Chat History')}</div>
  361. </button>
  362. </div>
  363. </div>
  364. </div>
  365. {/if}
  366. <div class="px-2 mt-0.5 mb-2 flex justify-center space-x-2">
  367. <div class="flex w-full rounded-xl" id="chat-search">
  368. <div class="self-center pl-3 py-2 rounded-l-xl bg-transparent">
  369. <svg
  370. xmlns="http://www.w3.org/2000/svg"
  371. viewBox="0 0 20 20"
  372. fill="currentColor"
  373. class="w-4 h-4"
  374. >
  375. <path
  376. fill-rule="evenodd"
  377. d="M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z"
  378. clip-rule="evenodd"
  379. />
  380. </svg>
  381. </div>
  382. <input
  383. class="w-full rounded-r-xl py-1.5 pl-2.5 pr-4 text-sm bg-transparent dark:text-gray-300 outline-none"
  384. placeholder={$i18n.t('Search')}
  385. bind:value={search}
  386. on:focus={async () => {
  387. // loading all chats. disable pagination on scrol.
  388. scrollPaginationEnabled.set(false);
  389. // subsequent queries will calculate page size to rehydrate the ui.
  390. // since every chat is already loaded, the calculation should now load all chats.
  391. pageSkip.set(0);
  392. pageLimit.set(-1);
  393. await chats.set(await getChatList(localStorage.token)); // when searching, load all chats
  394. enrichChatsWithContent($chats);
  395. }}
  396. />
  397. </div>
  398. </div>
  399. {#if $tags.filter((t) => t.name !== 'pinned').length > 0}
  400. <div class="px-2.5 mb-2 flex gap-1 flex-wrap">
  401. <button
  402. class="px-2.5 text-xs font-medium bg-gray-50 dark:bg-gray-900 dark:hover:bg-gray-800 transition rounded-full"
  403. on:click={async () => {
  404. scrollPaginationEnabled.set(false);
  405. pageSkip.set(0);
  406. pageLimit.set(-1);
  407. await chats.set(
  408. await getChatList(localStorage.token, $pageSkip * $pageLimit, $pageLimit)
  409. );
  410. }}
  411. >
  412. {$i18n.t('all')}
  413. </button>
  414. {#each $tags.filter((t) => t.name !== 'pinned') as tag}
  415. <button
  416. class="px-2.5 text-xs font-medium bg-gray-50 dark:bg-gray-900 dark:hover:bg-gray-800 transition rounded-full"
  417. on:click={async () => {
  418. let chatIds = await getChatListByTagName(localStorage.token, tag.name);
  419. if (chatIds.length === 0) {
  420. // no chats found in the tag
  421. await tags.set(await getAllChatTags(localStorage.token));
  422. scrollPaginationEnabled.set(false);
  423. pageSkip.set(0);
  424. pageLimit.set(-1);
  425. chatIds = await getChatList(
  426. localStorage.token,
  427. $pageSkip * $pageLimit,
  428. $pageLimit
  429. );
  430. }
  431. tagView.set(true);
  432. await chats.set(chatIds);
  433. }}
  434. >
  435. {tag.name}
  436. </button>
  437. {/each}
  438. </div>
  439. {/if}
  440. {#if $pinnedChats.length > 0}
  441. <div class="pl-2 py-2 flex flex-col space-y-1">
  442. <div class="">
  443. <div class="w-full pl-2.5 text-xs text-gray-500 dark:text-gray-500 font-medium pb-1.5">
  444. {$i18n.t('Pinned')}
  445. </div>
  446. {#each $pinnedChats as chat, idx}
  447. <ChatItem
  448. {chat}
  449. {shiftKey}
  450. selected={selectedChatId === chat.id}
  451. on:select={() => {
  452. selectedChatId = chat.id;
  453. }}
  454. on:unselect={() => {
  455. selectedChatId = null;
  456. }}
  457. on:delete={(e) => {
  458. if ((e?.detail ?? '') === 'shift') {
  459. deleteChatHandler(chat.id);
  460. } else {
  461. deleteChat = chat;
  462. showDeleteConfirm = true;
  463. }
  464. }}
  465. />
  466. {/each}
  467. </div>
  468. </div>
  469. {/if}
  470. <div
  471. class="pl-2 my-2 flex-1 flex flex-col space-y-1 overflow-y-auto scrollbar-hidden"
  472. on:scroll={async (e) => {
  473. if (!$scrollPaginationEnabled) return;
  474. if ($tagView) return;
  475. if (nextPageLoading) return;
  476. if (chatPagniationComplete) return;
  477. const maxScroll = e.target.scrollHeight - e.target.clientHeight;
  478. const currentPos = e.target.scrollTop;
  479. const ratio = currentPos / maxScroll;
  480. if (ratio >= paginationScrollThreashold) {
  481. nextPageLoading = true;
  482. pageSkip.set($pageSkip + 1);
  483. // extend existing chats
  484. const nextPageChats = await getChatList(
  485. localStorage.token,
  486. $pageSkip * $pageLimit,
  487. $pageLimit
  488. );
  489. // once the bottom of the list has been reached (no results) there is no need to continue querying
  490. chatPagniationComplete = nextPageChats.length === 0;
  491. await chats.set([...$chats, ...nextPageChats]);
  492. nextPageLoading = false;
  493. }
  494. }}
  495. >
  496. {#each filteredChatList as chat, idx}
  497. {#if idx === 0 || (idx > 0 && chat.time_range !== filteredChatList[idx - 1].time_range)}
  498. <div
  499. class="w-full pl-2.5 text-xs text-gray-500 dark:text-gray-500 font-medium {idx === 0
  500. ? ''
  501. : 'pt-5'} pb-0.5"
  502. >
  503. {$i18n.t(chat.time_range)}
  504. <!-- localisation keys for time_range to be recognized from the i18next parser (so they don't get automatically removed):
  505. {$i18n.t('Today')}
  506. {$i18n.t('Yesterday')}
  507. {$i18n.t('Previous 7 days')}
  508. {$i18n.t('Previous 30 days')}
  509. {$i18n.t('January')}
  510. {$i18n.t('February')}
  511. {$i18n.t('March')}
  512. {$i18n.t('April')}
  513. {$i18n.t('May')}
  514. {$i18n.t('June')}
  515. {$i18n.t('July')}
  516. {$i18n.t('August')}
  517. {$i18n.t('September')}
  518. {$i18n.t('October')}
  519. {$i18n.t('November')}
  520. {$i18n.t('December')}
  521. -->
  522. </div>
  523. {/if}
  524. <ChatItem
  525. {chat}
  526. {shiftKey}
  527. selected={selectedChatId === chat.id}
  528. on:select={() => {
  529. selectedChatId = chat.id;
  530. }}
  531. on:unselect={() => {
  532. selectedChatId = null;
  533. }}
  534. on:delete={(e) => {
  535. if ((e?.detail ?? '') === 'shift') {
  536. deleteChatHandler(chat.id);
  537. } else {
  538. deleteChat = chat;
  539. showDeleteConfirm = true;
  540. }
  541. }}
  542. />
  543. {/each}
  544. </div>
  545. </div>
  546. <div class="px-2.5">
  547. <!-- <hr class=" border-gray-900 mb-1 w-full" /> -->
  548. <div class="flex flex-col font-primary">
  549. {#if $user !== undefined}
  550. <UserMenu
  551. role={$user.role}
  552. on:show={(e) => {
  553. if (e.detail === 'archived-chat') {
  554. showArchivedChats.set(true);
  555. }
  556. }}
  557. >
  558. <button
  559. class=" flex rounded-xl py-3 px-3.5 w-full hover:bg-gray-100 dark:hover:bg-gray-900 transition"
  560. on:click={() => {
  561. showDropdown = !showDropdown;
  562. }}
  563. >
  564. <div class=" self-center mr-3">
  565. <img
  566. src={$user.profile_image_url}
  567. class=" max-w-[30px] object-cover rounded-full"
  568. alt="User profile"
  569. />
  570. </div>
  571. <div class=" self-center font-medium">{$user.name}</div>
  572. </button>
  573. </UserMenu>
  574. {/if}
  575. </div>
  576. </div>
  577. </div>
  578. </div>
  579. <style>
  580. .scrollbar-hidden:active::-webkit-scrollbar-thumb,
  581. .scrollbar-hidden:focus::-webkit-scrollbar-thumb,
  582. .scrollbar-hidden:hover::-webkit-scrollbar-thumb {
  583. visibility: visible;
  584. }
  585. .scrollbar-hidden::-webkit-scrollbar-thumb {
  586. visibility: hidden;
  587. }
  588. </style>