2024-11-13 04:33:22 +00:00
|
|
|
<script>
|
2024-11-13 05:51:42 +00:00
|
|
|
import { getContext, tick, onMount } from 'svelte';
|
2024-11-13 04:33:22 +00:00
|
|
|
import { toast } from 'svelte-sonner';
|
2024-11-13 05:51:42 +00:00
|
|
|
import UserList from './Users/UserList.svelte';
|
|
|
|
|
import Groups from './Users/Groups.svelte';
|
2024-11-13 04:33:22 +00:00
|
|
|
|
|
|
|
|
const i18n = getContext('i18n');
|
|
|
|
|
|
2024-11-13 05:51:42 +00:00
|
|
|
let selectedTab = 'overview';
|
2024-11-13 04:33:22 +00:00
|
|
|
|
2024-11-13 05:51:42 +00:00
|
|
|
onMount(() => {
|
|
|
|
|
const containerElement = document.getElementById('users-tabs-container');
|
2024-11-13 04:33:22 +00:00
|
|
|
|
2024-11-13 05:51:42 +00:00
|
|
|
if (containerElement) {
|
|
|
|
|
containerElement.addEventListener('wheel', function (event) {
|
|
|
|
|
if (event.deltaY !== 0) {
|
|
|
|
|
// Adjust horizontal scroll position based on vertical scroll
|
|
|
|
|
containerElement.scrollLeft += event.deltaY;
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-11-13 04:33:22 +00:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
2024-11-13 05:51:42 +00:00
|
|
|
<div class="flex flex-col w-full h-full">
|
2024-11-13 04:33:22 +00:00
|
|
|
<div
|
2024-11-13 05:51:42 +00:00
|
|
|
id="users-tabs-container"
|
|
|
|
|
class="tabs flex mb-2 gap-3 flex-row overflow-x-auto max-w-full dark:text-white text-sm font-medium text-left scrollbar-none border-b dark:border-gray-800"
|
2024-11-13 04:33:22 +00:00
|
|
|
>
|
2024-11-13 05:51:42 +00:00
|
|
|
<button
|
|
|
|
|
class="pb-1.5 min-w-fit flex text-right transition border-b-2 {selectedTab === 'overview'
|
|
|
|
|
? ' dark:border-white'
|
|
|
|
|
: ' border-transparent text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white'}"
|
|
|
|
|
on:click={() => {
|
|
|
|
|
selectedTab = 'overview';
|
|
|
|
|
}}
|
2024-11-13 04:33:22 +00:00
|
|
|
>
|
2024-11-13 05:51:42 +00:00
|
|
|
<div class=" self-center">{$i18n.t('Overview')}</div>
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
class=" pb-1.5 min-w-fit flex text-right transition border-b-2 {selectedTab === 'groups'
|
|
|
|
|
? ' dark:border-white'
|
|
|
|
|
: ' border-transparent text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white'}"
|
|
|
|
|
on:click={() => {
|
|
|
|
|
selectedTab = 'groups';
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<div class=" self-center">{$i18n.t('Groups')}</div>
|
|
|
|
|
</button>
|
2024-11-13 04:33:22 +00:00
|
|
|
</div>
|
|
|
|
|
|
2024-11-13 05:51:42 +00:00
|
|
|
<div class="flex-1 overflow-y-scroll">
|
|
|
|
|
{#if selectedTab === 'overview'}
|
|
|
|
|
<UserList />
|
|
|
|
|
{:else if selectedTab === 'groups'}
|
|
|
|
|
<Groups />
|
|
|
|
|
{/if}
|
2024-11-13 04:33:22 +00:00
|
|
|
</div>
|
2024-11-13 05:51:42 +00:00
|
|
|
</div>
|