Sidebar.svelte 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. <script lang="ts">
  2. import { v4 as uuidv4 } from 'uuid';
  3. import fileSaver from 'file-saver';
  4. const { saveAs } = fileSaver;
  5. import { goto, invalidateAll } from '$app/navigation';
  6. import { page } from '$app/stores';
  7. import { user, chats, showSettings, chatId } from '$lib/stores';
  8. import { onMount } from 'svelte';
  9. import { deleteChatById, getChatList, updateChatById } from '$lib/apis/chats';
  10. let show = false;
  11. let navElement;
  12. let title: string = 'Ollama Web UI';
  13. let search = '';
  14. let chatDeleteId = null;
  15. let chatTitleEditId = null;
  16. let chatTitle = '';
  17. let showDropdown = false;
  18. onMount(async () => {
  19. if (window.innerWidth > 1280) {
  20. show = true;
  21. }
  22. await chats.set(await getChatList(localStorage.token));
  23. });
  24. const loadChat = async (id) => {
  25. goto(`/c/${id}`);
  26. };
  27. const editChatTitle = async (id, _title) => {
  28. title = _title;
  29. await updateChatById(localStorage.token, id, {
  30. title: _title
  31. });
  32. await chats.set(await getChatList(localStorage.token));
  33. };
  34. const deleteChat = async (id) => {
  35. goto('/');
  36. await deleteChatById(localStorage.token, id);
  37. await chats.set(await getChatList(localStorage.token));
  38. };
  39. </script>
  40. <div
  41. bind:this={navElement}
  42. class="h-screen {show
  43. ? ''
  44. : '-translate-x-[260px]'} w-[260px] fixed top-0 left-0 z-40 transition bg-black text-gray-200 shadow-2xl text-sm
  45. "
  46. >
  47. <div class="py-2.5 my-auto flex flex-col justify-between h-screen">
  48. <div class="px-2.5 flex justify-center space-x-2">
  49. <button
  50. class="flex-grow flex justify-between rounded-md px-3 py-1.5 mt-2 hover:bg-gray-900 transition"
  51. on:click={async () => {
  52. goto('/');
  53. const newChatButton = document.getElementById('new-chat-button');
  54. if (newChatButton) {
  55. newChatButton.click();
  56. }
  57. }}
  58. >
  59. <div class="flex self-center">
  60. <div class="self-center mr-3.5">
  61. <img src="/ollama.png" class=" w-5 invert-[100%] rounded-full" />
  62. </div>
  63. <div class=" self-center font-medium text-sm">New Chat</div>
  64. </div>
  65. <div class="self-center">
  66. <svg
  67. xmlns="http://www.w3.org/2000/svg"
  68. viewBox="0 0 20 20"
  69. fill="currentColor"
  70. class="w-4 h-4"
  71. >
  72. <path
  73. 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"
  74. />
  75. <path
  76. 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"
  77. />
  78. </svg>
  79. </div>
  80. </button>
  81. </div>
  82. <div class="px-2.5 flex justify-center my-1">
  83. <button
  84. class="flex-grow flex space-x-3 rounded-md px-3 py-2 hover:bg-gray-900 transition"
  85. on:click={async () => {
  86. goto('/modelfiles');
  87. }}
  88. >
  89. <div class="self-center">
  90. <svg
  91. xmlns="http://www.w3.org/2000/svg"
  92. fill="none"
  93. viewBox="0 0 24 24"
  94. stroke-width="1.5"
  95. stroke="currentColor"
  96. class="w-4 h-4"
  97. >
  98. <path
  99. stroke-linecap="round"
  100. stroke-linejoin="round"
  101. d="M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 002.25-2.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v2.25A2.25 2.25 0 006 10.5zm0 9.75h2.25A2.25 2.25 0 0010.5 18v-2.25a2.25 2.25 0 00-2.25-2.25H6a2.25 2.25 0 00-2.25 2.25V18A2.25 2.25 0 006 20.25zm9.75-9.75H18a2.25 2.25 0 002.25-2.25V6A2.25 2.25 0 0018 3.75h-2.25A2.25 2.25 0 0013.5 6v2.25a2.25 2.25 0 002.25 2.25z"
  102. />
  103. </svg>
  104. </div>
  105. <div class="flex self-center">
  106. <div class=" self-center font-medium text-sm">Modelfiles</div>
  107. </div>
  108. </button>
  109. </div>
  110. <div class="px-2.5 mt-1 mb-2 flex justify-center space-x-2">
  111. <div class="flex w-full">
  112. <div class="self-center pl-3 py-2 rounded-l bg-gray-950">
  113. <svg
  114. xmlns="http://www.w3.org/2000/svg"
  115. viewBox="0 0 20 20"
  116. fill="currentColor"
  117. class="w-4 h-4"
  118. >
  119. <path
  120. fill-rule="evenodd"
  121. 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"
  122. clip-rule="evenodd"
  123. />
  124. </svg>
  125. </div>
  126. <input
  127. class="w-full rounded-r py-1.5 pl-2.5 pr-4 text-sm text-gray-300 bg-gray-950 outline-none"
  128. placeholder="Search"
  129. bind:value={search}
  130. />
  131. <!-- <div class="self-center pr-3 py-2 bg-gray-900">
  132. <svg
  133. xmlns="http://www.w3.org/2000/svg"
  134. fill="none"
  135. viewBox="0 0 24 24"
  136. stroke-width="1.5"
  137. stroke="currentColor"
  138. class="w-4 h-4"
  139. >
  140. <path
  141. stroke-linecap="round"
  142. stroke-linejoin="round"
  143. d="M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z"
  144. />
  145. </svg>
  146. </div> -->
  147. </div>
  148. </div>
  149. <div class="pl-2.5 my-2 flex-1 flex flex-col space-y-1 overflow-y-auto">
  150. {#each $chats.filter((chat) => {
  151. if (search === '') {
  152. return true;
  153. } else {
  154. let title = chat.title.toLowerCase();
  155. if (title.includes(search)) {
  156. return true;
  157. } else {
  158. return false;
  159. }
  160. }
  161. }) as chat, i}
  162. <div class=" w-full pr-2 relative">
  163. <button
  164. class=" w-full flex justify-between rounded-md px-3 py-2 hover:bg-gray-900 {chat.id ===
  165. $chatId
  166. ? 'bg-gray-900'
  167. : ''} transition whitespace-nowrap text-ellipsis"
  168. on:click={() => {
  169. // goto(`/c/${chat.id}`);
  170. if (chat.id !== chatTitleEditId) {
  171. chatTitleEditId = null;
  172. chatTitle = '';
  173. }
  174. if (chat.id !== $chatId) {
  175. loadChat(chat.id);
  176. }
  177. }}
  178. >
  179. <div class=" flex self-center flex-1">
  180. <div class=" self-center mr-3">
  181. <svg
  182. xmlns="http://www.w3.org/2000/svg"
  183. fill="none"
  184. viewBox="0 0 24 24"
  185. stroke-width="1.5"
  186. stroke="currentColor"
  187. class="w-4 h-4"
  188. >
  189. <path
  190. stroke-linecap="round"
  191. stroke-linejoin="round"
  192. d="M2.25 12.76c0 1.6 1.123 2.994 2.707 3.227 1.087.16 2.185.283 3.293.369V21l4.076-4.076a1.526 1.526 0 011.037-.443 48.282 48.282 0 005.68-.494c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0012 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018z"
  193. />
  194. </svg>
  195. </div>
  196. <div
  197. class=" text-left self-center overflow-hidden {chat.id === $chatId
  198. ? 'w-[120px]'
  199. : 'w-[180px]'} "
  200. >
  201. {#if chatTitleEditId === chat.id}
  202. <input bind:value={chatTitle} class=" bg-transparent w-full" />
  203. {:else}
  204. {chat.title}
  205. {/if}
  206. </div>
  207. </div>
  208. </button>
  209. {#if chat.id === $chatId}
  210. <div class=" absolute right-[22px] top-[10px]">
  211. {#if chatTitleEditId === chat.id}
  212. <div class="flex self-center space-x-1.5">
  213. <button
  214. class=" self-center hover:text-white transition"
  215. on:click={() => {
  216. editChatTitle(chat.id, chatTitle);
  217. chatTitleEditId = null;
  218. chatTitle = '';
  219. }}
  220. >
  221. <svg
  222. xmlns="http://www.w3.org/2000/svg"
  223. viewBox="0 0 20 20"
  224. fill="currentColor"
  225. class="w-4 h-4"
  226. >
  227. <path
  228. fill-rule="evenodd"
  229. d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z"
  230. clip-rule="evenodd"
  231. />
  232. </svg>
  233. </button>
  234. <button
  235. class=" self-center hover:text-white transition"
  236. on:click={() => {
  237. chatTitleEditId = null;
  238. chatTitle = '';
  239. }}
  240. >
  241. <svg
  242. xmlns="http://www.w3.org/2000/svg"
  243. viewBox="0 0 20 20"
  244. fill="currentColor"
  245. class="w-4 h-4"
  246. >
  247. <path
  248. d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"
  249. />
  250. </svg>
  251. </button>
  252. </div>
  253. {:else if chatDeleteId === chat.id}
  254. <div class="flex self-center space-x-1.5">
  255. <button
  256. class=" self-center hover:text-white transition"
  257. on:click={() => {
  258. deleteChat(chat.id);
  259. }}
  260. >
  261. <svg
  262. xmlns="http://www.w3.org/2000/svg"
  263. viewBox="0 0 20 20"
  264. fill="currentColor"
  265. class="w-4 h-4"
  266. >
  267. <path
  268. fill-rule="evenodd"
  269. d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z"
  270. clip-rule="evenodd"
  271. />
  272. </svg>
  273. </button>
  274. <button
  275. class=" self-center hover:text-white transition"
  276. on:click={() => {
  277. chatDeleteId = null;
  278. }}
  279. >
  280. <svg
  281. xmlns="http://www.w3.org/2000/svg"
  282. viewBox="0 0 20 20"
  283. fill="currentColor"
  284. class="w-4 h-4"
  285. >
  286. <path
  287. d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"
  288. />
  289. </svg>
  290. </button>
  291. </div>
  292. {:else}
  293. <div class="flex self-center space-x-1.5">
  294. <button
  295. class=" self-center hover:text-white transition"
  296. on:click={() => {
  297. chatTitle = chat.title;
  298. chatTitleEditId = chat.id;
  299. // editChatTitle(chat.id, 'a');
  300. }}
  301. >
  302. <svg
  303. xmlns="http://www.w3.org/2000/svg"
  304. fill="none"
  305. viewBox="0 0 24 24"
  306. stroke-width="1.5"
  307. stroke="currentColor"
  308. class="w-4 h-4"
  309. >
  310. <path
  311. stroke-linecap="round"
  312. stroke-linejoin="round"
  313. d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487zm0 0L19.5 7.125"
  314. />
  315. </svg>
  316. </button>
  317. <button
  318. class=" self-center hover:text-white transition"
  319. on:click={() => {
  320. chatDeleteId = chat.id;
  321. }}
  322. >
  323. <svg
  324. xmlns="http://www.w3.org/2000/svg"
  325. fill="none"
  326. viewBox="0 0 24 24"
  327. stroke-width="1.5"
  328. stroke="currentColor"
  329. class="w-4 h-4"
  330. >
  331. <path
  332. stroke-linecap="round"
  333. stroke-linejoin="round"
  334. d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"
  335. />
  336. </svg>
  337. </button>
  338. </div>
  339. {/if}
  340. </div>
  341. {/if}
  342. </div>
  343. {/each}
  344. </div>
  345. <div class="px-2.5">
  346. <hr class=" border-gray-900 mb-1 w-full" />
  347. <div class="flex flex-col">
  348. {#if $user !== undefined}
  349. <button
  350. class=" flex rounded-md py-3 px-3.5 w-full hover:bg-gray-900 transition"
  351. on:click={() => {
  352. showDropdown = !showDropdown;
  353. }}
  354. on:focusout={() => {
  355. setTimeout(() => {
  356. showDropdown = false;
  357. }, 150);
  358. }}
  359. >
  360. <div class=" self-center mr-3">
  361. <img
  362. src={$user.profile_image_url}
  363. class=" max-w-[30px] object-cover rounded-full"
  364. alt="User profile"
  365. />
  366. </div>
  367. <div class=" self-center font-semibold">{$user.name}</div>
  368. </button>
  369. {#if showDropdown}
  370. <div
  371. id="dropdownDots"
  372. class="absolute z-10 bottom-[70px] 4.5rem rounded-lg shadow w-[240px] bg-gray-900"
  373. >
  374. <div class="py-2 w-full">
  375. {#if $user.role === 'admin'}
  376. <button
  377. class="flex py-2.5 px-3.5 w-full hover:bg-gray-800 transition"
  378. on:click={() => {
  379. goto('/admin');
  380. }}
  381. >
  382. <div class=" self-center mr-3">
  383. <svg
  384. xmlns="http://www.w3.org/2000/svg"
  385. fill="none"
  386. viewBox="0 0 24 24"
  387. stroke-width="1.5"
  388. stroke="currentColor"
  389. class="w-5 h-5"
  390. >
  391. <path
  392. stroke-linecap="round"
  393. stroke-linejoin="round"
  394. d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z"
  395. />
  396. </svg>
  397. </div>
  398. <div class=" self-center font-medium">Admin Panel</div>
  399. </button>
  400. {/if}
  401. <button
  402. class="flex py-2.5 px-3.5 w-full hover:bg-gray-800 transition"
  403. on:click={async () => {
  404. await showSettings.set(true);
  405. }}
  406. >
  407. <div class=" self-center mr-3">
  408. <svg
  409. xmlns="http://www.w3.org/2000/svg"
  410. fill="none"
  411. viewBox="0 0 24 24"
  412. stroke-width="1.5"
  413. stroke="currentColor"
  414. class="w-5 h-5"
  415. >
  416. <path
  417. stroke-linecap="round"
  418. stroke-linejoin="round"
  419. d="M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"
  420. />
  421. <path
  422. stroke-linecap="round"
  423. stroke-linejoin="round"
  424. d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
  425. />
  426. </svg>
  427. </div>
  428. <div class=" self-center font-medium">Settings</div>
  429. </button>
  430. </div>
  431. <hr class=" border-gray-700 m-0 p-0" />
  432. <div class="py-2 w-full">
  433. <button
  434. class="flex py-2.5 px-3.5 w-full hover:bg-gray-800 transition"
  435. on:click={() => {
  436. localStorage.removeItem('token');
  437. location.href = '/auth';
  438. }}
  439. >
  440. <div class=" self-center mr-3">
  441. <svg
  442. xmlns="http://www.w3.org/2000/svg"
  443. viewBox="0 0 20 20"
  444. fill="currentColor"
  445. class="w-5 h-5"
  446. >
  447. <path
  448. fill-rule="evenodd"
  449. d="M3 4.25A2.25 2.25 0 015.25 2h5.5A2.25 2.25 0 0113 4.25v2a.75.75 0 01-1.5 0v-2a.75.75 0 00-.75-.75h-5.5a.75.75 0 00-.75.75v11.5c0 .414.336.75.75.75h5.5a.75.75 0 00.75-.75v-2a.75.75 0 011.5 0v2A2.25 2.25 0 0110.75 18h-5.5A2.25 2.25 0 013 15.75V4.25z"
  450. clip-rule="evenodd"
  451. />
  452. <path
  453. fill-rule="evenodd"
  454. d="M6 10a.75.75 0 01.75-.75h9.546l-1.048-.943a.75.75 0 111.004-1.114l2.5 2.25a.75.75 0 010 1.114l-2.5 2.25a.75.75 0 11-1.004-1.114l1.048-.943H6.75A.75.75 0 016 10z"
  455. clip-rule="evenodd"
  456. />
  457. </svg>
  458. </div>
  459. <div class=" self-center font-medium">Sign Out</div>
  460. </button>
  461. </div>
  462. </div>
  463. {/if}
  464. {:else}
  465. <button
  466. class=" flex rounded-md py-3 px-3.5 w-full hover:bg-gray-900 transition"
  467. on:click={async () => {
  468. await showSettings.set(true);
  469. }}
  470. >
  471. <div class=" self-center mr-3">
  472. <svg
  473. xmlns="http://www.w3.org/2000/svg"
  474. fill="none"
  475. viewBox="0 0 24 24"
  476. stroke-width="1.5"
  477. stroke="currentColor"
  478. class="w-5 h-5"
  479. >
  480. <path
  481. stroke-linecap="round"
  482. stroke-linejoin="round"
  483. d="M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"
  484. />
  485. <path
  486. stroke-linecap="round"
  487. stroke-linejoin="round"
  488. d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
  489. />
  490. </svg>
  491. </div>
  492. <div class=" self-center font-medium">Settings</div>
  493. </button>
  494. {/if}
  495. </div>
  496. </div>
  497. </div>
  498. <div
  499. class="fixed left-0 top-[50dvh] z-40 -translate-y-1/2 transition-transform translate-x-[255px] md:translate-x-[260px] rotate-0"
  500. >
  501. <button
  502. class=" group"
  503. on:click={() => {
  504. show = !show;
  505. }}
  506. ><span class="" data-state="closed"
  507. ><div
  508. class="flex h-[72px] w-8 items-center justify-center opacity-20 group-hover:opacity-100 transition"
  509. >
  510. <div class="flex h-6 w-6 flex-col items-center">
  511. <div
  512. class="h-3 w-1 rounded-full bg-[#0f0f0f] dark:bg-white rotate-0 translate-y-[0.15rem] {show
  513. ? 'group-hover:rotate-[15deg]'
  514. : 'group-hover:rotate-[-15deg]'}"
  515. />
  516. <div
  517. class="h-3 w-1 rounded-full bg-[#0f0f0f] dark:bg-white rotate-0 translate-y-[-0.15rem] {show
  518. ? 'group-hover:rotate-[-15deg]'
  519. : 'group-hover:rotate-[15deg]'}"
  520. />
  521. </div>
  522. </div>
  523. </span>
  524. </button>
  525. </div>
  526. </div>