forked from open-webui/open-webui
refac: admin panel styling
This commit is contained in:
parent
1034b45790
commit
c419949bf9
1 changed files with 77 additions and 67 deletions
|
@ -79,7 +79,7 @@
|
||||||
>
|
>
|
||||||
{#if loaded}
|
{#if loaded}
|
||||||
<div class="overflow-y-auto w-full flex justify-center">
|
<div class="overflow-y-auto w-full flex justify-center">
|
||||||
<div class="w-full max-w-3xl px-10 md:px-16 flex flex-col">
|
<div class="w-full max-w-3xl px-6 md:px-16 flex flex-col">
|
||||||
<div class="py-10 w-full">
|
<div class="py-10 w-full">
|
||||||
<div class=" flex flex-col justify-center">
|
<div class=" flex flex-col justify-center">
|
||||||
<div class=" flex justify-between items-center">
|
<div class=" flex justify-between items-center">
|
||||||
|
@ -109,45 +109,34 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class=" text-gray-500 text-xs font-medium mt-1">
|
<div class=" text-gray-500 text-xs mt-1">
|
||||||
Click on the user role cell in the table to change a user's role.
|
Click on the user role cell in the table to change a user's role.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr class=" my-3 dark:border-gray-600" />
|
<hr class=" my-3 dark:border-gray-600" />
|
||||||
|
|
||||||
<div class="scrollbar-hidden relative overflow-x-auto whitespace-nowrap">
|
<div class="scrollbar-hidden relative overflow-x-auto whitespace-nowrap">
|
||||||
<table class="w-full text-sm text-left text-gray-500 dark:text-gray-400">
|
<table class="w-full text-sm text-left text-gray-500 dark:text-gray-400 table-auto">
|
||||||
<thead
|
<thead
|
||||||
class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400"
|
class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400"
|
||||||
>
|
>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col" class="px-6 py-3"> Name </th>
|
<th scope="col" class="px-3 py-2"> Role </th>
|
||||||
<th scope="col" class="px-6 py-3"> Email </th>
|
<th scope="col" class="px-3 py-2"> Name </th>
|
||||||
<th scope="col" class="px-6 py-3"> Role </th>
|
<th scope="col" class="px-3 py-2"> Email </th>
|
||||||
<th scope="col" class="px-6 py-3"> Action </th>
|
<th scope="col" class="px-3 py-2"> Action </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each users as user}
|
{#each users as user}
|
||||||
<tr class="bg-white border-b dark:bg-gray-900 dark:border-gray-700">
|
<tr class="bg-white border-b dark:bg-gray-900 dark:border-gray-700 text-xs">
|
||||||
<th
|
<td class="px-3 py-2 min-w-[7rem] w-28">
|
||||||
scope="row"
|
|
||||||
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white w-fit"
|
|
||||||
>
|
|
||||||
<div class="flex flex-row">
|
|
||||||
<img
|
|
||||||
class=" rounded-full max-w-[30px] max-h-[30px] object-cover mr-4"
|
|
||||||
src={user.profile_image_url}
|
|
||||||
alt="user"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div class=" font-semibold self-center">{user.name}</div>
|
|
||||||
</div>
|
|
||||||
</th>
|
|
||||||
<td class="px-6 py-4"> {user.email} </td>
|
|
||||||
<td class="px-6 py-4">
|
|
||||||
<button
|
<button
|
||||||
class=" dark:text-white underline"
|
class=" flex items-center gap-2 text-xs px-3 py-0.5 rounded-lg {user.role ===
|
||||||
|
'admin' &&
|
||||||
|
'text-sky-600 dark:text-sky-300 bg-sky-200/30'} {user.role === 'user' &&
|
||||||
|
'text-green-600 dark:text-green-300 bg-green-200/30'} {user.role ===
|
||||||
|
'pending' && 'text-gray-600 dark:text-gray-300 bg-gray-200/30'}"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
if (user.role === 'user') {
|
if (user.role === 'user') {
|
||||||
updateRoleHandler(user.id, 'admin');
|
updateRoleHandler(user.id, 'admin');
|
||||||
|
@ -156,52 +145,73 @@
|
||||||
} else {
|
} else {
|
||||||
updateRoleHandler(user.id, 'pending');
|
updateRoleHandler(user.id, 'pending');
|
||||||
}
|
}
|
||||||
}}>{user.role}</button
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="w-1 h-1 rounded-full {user.role === 'admin' &&
|
||||||
|
'bg-sky-600 dark:bg-sky-300'} {user.role === 'user' &&
|
||||||
|
'bg-green-600 dark:bg-green-300'} {user.role === 'pending' &&
|
||||||
|
'bg-gray-600 dark:bg-gray-300'}"
|
||||||
|
/>
|
||||||
|
{user.role}</button
|
||||||
>
|
>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 space-x-1 text-center flex justify-center">
|
<td class="px-3 py-2 font-medium text-gray-900 dark:text-white w-max">
|
||||||
<button
|
<div class="flex flex-row w-max">
|
||||||
class="self-center w-fit text-sm p-1.5 border dark:border-gray-600 rounded-xl flex"
|
<img
|
||||||
on:click={async () => {
|
class=" rounded-full w-6 h-6 object-cover mr-2.5"
|
||||||
showEditUserModal = !showEditUserModal;
|
src={user.profile_image_url}
|
||||||
selectedUser = user;
|
alt="user"
|
||||||
}}
|
/>
|
||||||
>
|
|
||||||
<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.013 2.513a1.75 1.75 0 0 1 2.475 2.474L6.226 12.25a2.751 2.751 0 0 1-.892.596l-2.047.848a.75.75 0 0 1-.98-.98l.848-2.047a2.75 2.75 0 0 1 .596-.892l7.262-7.261Z"
|
|
||||||
clip-rule="evenodd"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button
|
<div class=" font-medium self-center">{user.name}</div>
|
||||||
class="self-center w-fit text-sm p-1.5 border dark:border-gray-600 rounded-xl flex"
|
</div>
|
||||||
on:click={async () => {
|
</td>
|
||||||
deleteUserHandler(user.id);
|
<td class=" px-3 py-2"> {user.email} </td>
|
||||||
}}
|
|
||||||
>
|
<td class="px-3 py-2">
|
||||||
<svg
|
<div class="flex justify-start w-full space-x-1">
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
<button
|
||||||
fill="none"
|
class="self-center w-fit text-sm p-1.5 border dark:border-gray-600 rounded-xl flex"
|
||||||
viewBox="0 0 24 24"
|
on:click={async () => {
|
||||||
stroke-width="1.5"
|
showEditUserModal = !showEditUserModal;
|
||||||
stroke="currentColor"
|
selectedUser = user;
|
||||||
class="w-4 h-4"
|
}}
|
||||||
>
|
>
|
||||||
<path
|
<svg
|
||||||
stroke-linecap="round"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
stroke-linejoin="round"
|
viewBox="0 0 16 16"
|
||||||
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"
|
fill="currentColor"
|
||||||
/>
|
class="w-3.5 h-3.5"
|
||||||
</svg>
|
>
|
||||||
</button>
|
<path
|
||||||
|
fill-rule="evenodd"
|
||||||
|
d="M11.013 2.513a1.75 1.75 0 0 1 2.475 2.474L6.226 12.25a2.751 2.751 0 0 1-.892.596l-2.047.848a.75.75 0 0 1-.98-.98l.848-2.047a2.75 2.75 0 0 1 .596-.892l7.262-7.261Z"
|
||||||
|
clip-rule="evenodd"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="self-center w-fit text-sm p-1.5 border dark:border-gray-600 rounded-xl flex"
|
||||||
|
on:click={async () => {
|
||||||
|
deleteUserHandler(user.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 16 16"
|
||||||
|
fill="currentColor"
|
||||||
|
class="w-3.5 h-3.5"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill-rule="evenodd"
|
||||||
|
d="M5 3.25V4H2.75a.75.75 0 0 0 0 1.5h.3l.815 8.15A1.5 1.5 0 0 0 5.357 15h5.285a1.5 1.5 0 0 0 1.493-1.35l.815-8.15h.3a.75.75 0 0 0 0-1.5H11v-.75A2.25 2.25 0 0 0 8.75 1h-1.5A2.25 2.25 0 0 0 5 3.25Zm2.25-.75a.75.75 0 0 0-.75.75V4h3v-.75a.75.75 0 0 0-.75-.75h-1.5ZM6.05 6a.75.75 0 0 1 .787.713l.275 5.5a.75.75 0 0 1-1.498.075l-.275-5.5A.75.75 0 0 1 6.05 6Zm3.9 0a.75.75 0 0 1 .712.787l-.275 5.5a.75.75 0 0 1-1.498-.075l.275-5.5a.75.75 0 0 1 .786-.711Z"
|
||||||
|
clip-rule="evenodd"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
Loading…
Reference in a new issue