forked from open-webui/open-webui
		
	refac: styling
This commit is contained in:
		
							parent
							
								
									b35cc36e19
								
							
						
					
					
						commit
						fb516ea694
					
				
					 2 changed files with 116 additions and 84 deletions
				
			
		|  | @ -8,6 +8,8 @@ | |||
| 	import UpdatePassword from './Account/UpdatePassword.svelte'; | ||||
| 	import { getGravatarUrl } from '$lib/apis/utils'; | ||||
| 	import { copyToClipboard } from '$lib/utils'; | ||||
| 	import Plus from '$lib/components/icons/Plus.svelte'; | ||||
| 	import Tooltip from '$lib/components/common/Tooltip.svelte'; | ||||
| 
 | ||||
| 	const i18n = getContext('i18n'); | ||||
| 
 | ||||
|  | @ -199,14 +201,14 @@ | |||
| 				<div class="flex mt-2"> | ||||
| 					<div class="flex w-full"> | ||||
| 						<input | ||||
| 							class="w-full rounded-l-lg py-1.5 pl-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none" | ||||
| 							class="w-full rounded-l-lg py-1.5 pl-4 text-sm bg-white dark:text-gray-300 dark:bg-gray-800 outline-none" | ||||
| 							type={showJWTToken ? 'text' : 'password'} | ||||
| 							value={localStorage.token} | ||||
| 							disabled | ||||
| 						/> | ||||
| 
 | ||||
| 						<button | ||||
| 							class="px-2 transition rounded-r-lg dark:bg-gray-800" | ||||
| 							class="px-2 transition rounded-r-lg bg-white dark:bg-gray-800" | ||||
| 							on:click={() => { | ||||
| 								showJWTToken = !showJWTToken; | ||||
| 							}} | ||||
|  | @ -246,7 +248,7 @@ | |||
| 					</div> | ||||
| 
 | ||||
| 					<button | ||||
| 						class="ml-1.5 px-1.5 py-1 hover:bg-gray-800 transition rounded-lg" | ||||
| 						class="ml-1.5 px-1.5 py-1 dark:hover:bg-gray-800 transition rounded-lg" | ||||
| 						on:click={() => { | ||||
| 							copyToClipboard(localStorage.token); | ||||
| 							JWTTokenCopied = true; | ||||
|  | @ -296,35 +298,77 @@ | |||
| 				</div> | ||||
| 
 | ||||
| 				<div class="flex mt-2"> | ||||
| 					<div class="flex w-full"> | ||||
| 						<input | ||||
| 							class="w-full rounded-l-lg py-1.5 pl-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none" | ||||
| 							type={showAPIKey ? 'text' : 'password'} | ||||
| 							value={APIKey} | ||||
| 							disabled | ||||
| 						/> | ||||
| 					{#if APIKey} | ||||
| 						<div class="flex w-full"> | ||||
| 							<input | ||||
| 								class="w-full rounded-l-lg py-1.5 pl-4 text-sm bg-white dark:text-gray-300 dark:bg-gray-800 outline-none" | ||||
| 								type={showAPIKey ? 'text' : 'password'} | ||||
| 								value={APIKey} | ||||
| 								disabled | ||||
| 							/> | ||||
| 
 | ||||
| 							<button | ||||
| 								class="px-2 transition rounded-r-lg bg-white dark:bg-gray-800" | ||||
| 								on:click={() => { | ||||
| 									showAPIKey = !showAPIKey; | ||||
| 								}} | ||||
| 							> | ||||
| 								{#if showAPIKey} | ||||
| 									<svg | ||||
| 										xmlns="http://www.w3.org/2000/svg" | ||||
| 										viewBox="0 0 16 16" | ||||
| 										fill="currentColor" | ||||
| 										class="w-4 h-4" | ||||
| 									> | ||||
| 										<path | ||||
| 											fill-rule="evenodd" | ||||
| 											d="M3.28 2.22a.75.75 0 0 0-1.06 1.06l10.5 10.5a.75.75 0 1 0 1.06-1.06l-1.322-1.323a7.012 7.012 0 0 0 2.16-3.11.87.87 0 0 0 0-.567A7.003 7.003 0 0 0 4.82 3.76l-1.54-1.54Zm3.196 3.195 1.135 1.136A1.502 1.502 0 0 1 9.45 8.389l1.136 1.135a3 3 0 0 0-4.109-4.109Z" | ||||
| 											clip-rule="evenodd" | ||||
| 										/> | ||||
| 										<path | ||||
| 											d="m7.812 10.994 1.816 1.816A7.003 7.003 0 0 1 1.38 8.28a.87.87 0 0 1 0-.566 6.985 6.985 0 0 1 1.113-2.039l2.513 2.513a3 3 0 0 0 2.806 2.806Z" | ||||
| 										/> | ||||
| 									</svg> | ||||
| 								{:else} | ||||
| 									<svg | ||||
| 										xmlns="http://www.w3.org/2000/svg" | ||||
| 										viewBox="0 0 16 16" | ||||
| 										fill="currentColor" | ||||
| 										class="w-4 h-4" | ||||
| 									> | ||||
| 										<path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z" /> | ||||
| 										<path | ||||
| 											fill-rule="evenodd" | ||||
| 											d="M1.38 8.28a.87.87 0 0 1 0-.566 7.003 7.003 0 0 1 13.238.006.87.87 0 0 1 0 .566A7.003 7.003 0 0 1 1.379 8.28ZM11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" | ||||
| 											clip-rule="evenodd" | ||||
| 										/> | ||||
| 									</svg> | ||||
| 								{/if} | ||||
| 							</button> | ||||
| 						</div> | ||||
| 
 | ||||
| 						<button | ||||
| 							class="px-2 transition rounded-r-lg dark:bg-gray-800" | ||||
| 							class="ml-1.5 px-1.5 py-1 dark:hover:bg-gray-800 transition rounded-lg" | ||||
| 							on:click={() => { | ||||
| 								showAPIKey = !showAPIKey; | ||||
| 								copyToClipboard(APIKey); | ||||
| 								APIKeyCopied = true; | ||||
| 								setTimeout(() => { | ||||
| 									APIKeyCopied = false; | ||||
| 								}, 2000); | ||||
| 							}} | ||||
| 						> | ||||
| 							{#if showAPIKey} | ||||
| 							{#if APIKeyCopied} | ||||
| 								<svg | ||||
| 									xmlns="http://www.w3.org/2000/svg" | ||||
| 									viewBox="0 0 16 16" | ||||
| 									viewBox="0 0 20 20" | ||||
| 									fill="currentColor" | ||||
| 									class="w-4 h-4" | ||||
| 								> | ||||
| 									<path | ||||
| 										fill-rule="evenodd" | ||||
| 										d="M3.28 2.22a.75.75 0 0 0-1.06 1.06l10.5 10.5a.75.75 0 1 0 1.06-1.06l-1.322-1.323a7.012 7.012 0 0 0 2.16-3.11.87.87 0 0 0 0-.567A7.003 7.003 0 0 0 4.82 3.76l-1.54-1.54Zm3.196 3.195 1.135 1.136A1.502 1.502 0 0 1 9.45 8.389l1.136 1.135a3 3 0 0 0-4.109-4.109Z" | ||||
| 										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" | ||||
| 										clip-rule="evenodd" | ||||
| 									/> | ||||
| 									<path | ||||
| 										d="m7.812 10.994 1.816 1.816A7.003 7.003 0 0 1 1.38 8.28a.87.87 0 0 1 0-.566 6.985 6.985 0 0 1 1.113-2.039l2.513 2.513a3 3 0 0 0 2.806 2.806Z" | ||||
| 									/> | ||||
| 								</svg> | ||||
| 							{:else} | ||||
| 								<svg | ||||
|  | @ -333,82 +377,55 @@ | |||
| 									fill="currentColor" | ||||
| 									class="w-4 h-4" | ||||
| 								> | ||||
| 									<path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z" /> | ||||
| 									<path | ||||
| 										fill-rule="evenodd" | ||||
| 										d="M1.38 8.28a.87.87 0 0 1 0-.566 7.003 7.003 0 0 1 13.238.006.87.87 0 0 1 0 .566A7.003 7.003 0 0 1 1.379 8.28ZM11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" | ||||
| 										d="M11.986 3H12a2 2 0 0 1 2 2v6a2 2 0 0 1-1.5 1.937V7A2.5 2.5 0 0 0 10 4.5H4.063A2 2 0 0 1 6 3h.014A2.25 2.25 0 0 1 8.25 1h1.5a2.25 2.25 0 0 1 2.236 2ZM10.5 4v-.75a.75.75 0 0 0-.75-.75h-1.5a.75.75 0 0 0-.75.75V4h3Z" | ||||
| 										clip-rule="evenodd" | ||||
| 									/> | ||||
| 									<path | ||||
| 										fill-rule="evenodd" | ||||
| 										d="M3 6a1 1 0 0 0-1 1v7a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H3Zm1.75 2.5a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5h-3.5ZM4 11.75a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1-.75-.75Z" | ||||
| 										clip-rule="evenodd" | ||||
| 									/> | ||||
| 								</svg> | ||||
| 							{/if} | ||||
| 						</button> | ||||
| 					</div> | ||||
| 
 | ||||
| 					<button | ||||
| 						class="ml-1.5 px-1.5 py-1 hover:bg-gray-800 transition rounded-lg" | ||||
| 						on:click={() => { | ||||
| 							copyToClipboard(APIKey); | ||||
| 							APIKeyCopied = true; | ||||
| 							setTimeout(() => { | ||||
| 								APIKeyCopied = false; | ||||
| 							}, 2000); | ||||
| 						}} | ||||
| 					> | ||||
| 						{#if APIKeyCopied} | ||||
| 							<svg | ||||
| 								xmlns="http://www.w3.org/2000/svg" | ||||
| 								viewBox="0 0 20 20" | ||||
| 								fill="currentColor" | ||||
| 								class="w-4 h-4" | ||||
| 						<Tooltip content="Create new key"> | ||||
| 							<button | ||||
| 								class=" px-1.5 py-1 dark:hover:bg-gray-800transition rounded-lg" | ||||
| 								on:click={() => { | ||||
| 									createAPIKeyHandler(); | ||||
| 								}} | ||||
| 							> | ||||
| 								<path | ||||
| 									fill-rule="evenodd" | ||||
| 									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" | ||||
| 									clip-rule="evenodd" | ||||
| 								/> | ||||
| 							</svg> | ||||
| 						{:else} | ||||
| 							<svg | ||||
| 								xmlns="http://www.w3.org/2000/svg" | ||||
| 								viewBox="0 0 16 16" | ||||
| 								fill="currentColor" | ||||
| 								class="w-4 h-4" | ||||
| 							> | ||||
| 								<path | ||||
| 									fill-rule="evenodd" | ||||
| 									d="M11.986 3H12a2 2 0 0 1 2 2v6a2 2 0 0 1-1.5 1.937V7A2.5 2.5 0 0 0 10 4.5H4.063A2 2 0 0 1 6 3h.014A2.25 2.25 0 0 1 8.25 1h1.5a2.25 2.25 0 0 1 2.236 2ZM10.5 4v-.75a.75.75 0 0 0-.75-.75h-1.5a.75.75 0 0 0-.75.75V4h3Z" | ||||
| 									clip-rule="evenodd" | ||||
| 								/> | ||||
| 								<path | ||||
| 									fill-rule="evenodd" | ||||
| 									d="M3 6a1 1 0 0 0-1 1v7a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H3Zm1.75 2.5a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5h-3.5ZM4 11.75a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1-.75-.75Z" | ||||
| 									clip-rule="evenodd" | ||||
| 								/> | ||||
| 							</svg> | ||||
| 						{/if} | ||||
| 					</button> | ||||
| 
 | ||||
| 					<button | ||||
| 						class=" px-1.5 py-1 hover:bg-gray-800 transition rounded-lg" | ||||
| 						on:click={() => { | ||||
| 							createAPIKeyHandler(); | ||||
| 						}} | ||||
| 					> | ||||
| 						<svg | ||||
| 							xmlns="http://www.w3.org/2000/svg" | ||||
| 							fill="none" | ||||
| 							viewBox="0 0 24 24" | ||||
| 							stroke-width="2" | ||||
| 							stroke="currentColor" | ||||
| 							class="size-4" | ||||
| 								<svg | ||||
| 									xmlns="http://www.w3.org/2000/svg" | ||||
| 									fill="none" | ||||
| 									viewBox="0 0 24 24" | ||||
| 									stroke-width="2" | ||||
| 									stroke="currentColor" | ||||
| 									class="size-4" | ||||
| 								> | ||||
| 									<path | ||||
| 										stroke-linecap="round" | ||||
| 										stroke-linejoin="round" | ||||
| 										d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99" | ||||
| 									/> | ||||
| 								</svg> | ||||
| 							</button> | ||||
| 						</Tooltip> | ||||
| 					{:else} | ||||
| 						<button | ||||
| 							class="flex gap-1.5 items-center font-medium px-3.5 py-1.5 rounded-lg bg-gray-100/70 hover:bg-gray-100 dark:bg-gray-850 dark:hover:bg-gray-800 transition" | ||||
| 							on:click={() => { | ||||
| 								createAPIKeyHandler(); | ||||
| 							}} | ||||
| 						> | ||||
| 							<path | ||||
| 								stroke-linecap="round" | ||||
| 								stroke-linejoin="round" | ||||
| 								d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99" | ||||
| 							/> | ||||
| 						</svg> | ||||
| 					</button> | ||||
| 							<Plus strokeWidth="2" className=" size-3.5" /> | ||||
| 
 | ||||
| 							Create new secret key</button | ||||
| 						> | ||||
| 					{/if} | ||||
| 				</div> | ||||
| 			</div> | ||||
| 		</div> | ||||
|  |  | |||
							
								
								
									
										15
									
								
								src/lib/components/icons/Plus.svelte
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								src/lib/components/icons/Plus.svelte
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| <script lang="ts"> | ||||
| 	export let className = 'w-4 h-4'; | ||||
| 	export let strokeWidth = '1.5'; | ||||
| </script> | ||||
| 
 | ||||
| <svg | ||||
| 	xmlns="http://www.w3.org/2000/svg" | ||||
| 	fill="none" | ||||
| 	viewBox="0 0 24 24" | ||||
| 	stroke-width={strokeWidth} | ||||
| 	stroke="currentColor" | ||||
| 	class={className} | ||||
| > | ||||
| 	<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" /> | ||||
| </svg> | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy J. Baek
						Timothy J. Baek