Commit 1efa25ee authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

chore: format

parent 54b65a89
...@@ -159,7 +159,11 @@ ...@@ -159,7 +159,11 @@
<table class="w-full text-sm text-left text-gray-500 dark:text-gray-400 table-auto max-w-full"> <table class="w-full text-sm text-left text-gray-500 dark:text-gray-400 table-auto max-w-full">
<thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-850 dark:text-gray-400"> <thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-850 dark:text-gray-400">
<tr> <tr>
<th scope="col" class="px-3 py-2 cursor-pointer select-none" on:click={() => setSortKey('role')}> <th
scope="col"
class="px-3 py-2 cursor-pointer select-none"
on:click={() => setSortKey('role')}
>
{$i18n.t('Role')} {$i18n.t('Role')}
{#if sortKey === 'role'} {#if sortKey === 'role'}
{sortOrder === 'asc' ? '▲' : '▼'} {sortOrder === 'asc' ? '▲' : '▼'}
...@@ -167,7 +171,11 @@ ...@@ -167,7 +171,11 @@
<span class="invisible">▲</span> <span class="invisible">▲</span>
{/if} {/if}
</th> </th>
<th scope="col" class="px-3 py-2 cursor-pointer select-none" on:click={() => setSortKey('name')}> <th
scope="col"
class="px-3 py-2 cursor-pointer select-none"
on:click={() => setSortKey('name')}
>
{$i18n.t('Name')} {$i18n.t('Name')}
{#if sortKey === 'name'} {#if sortKey === 'name'}
{sortOrder === 'asc' ? '▲' : '▼'} {sortOrder === 'asc' ? '▲' : '▼'}
...@@ -175,7 +183,11 @@ ...@@ -175,7 +183,11 @@
<span class="invisible">▲</span> <span class="invisible">▲</span>
{/if} {/if}
</th> </th>
<th scope="col" class="px-3 py-2 cursor-pointer select-none" on:click={() => setSortKey('email')}> <th
scope="col"
class="px-3 py-2 cursor-pointer select-none"
on:click={() => setSortKey('email')}
>
{$i18n.t('Email')} {$i18n.t('Email')}
{#if sortKey === 'email'} {#if sortKey === 'email'}
{sortOrder === 'asc' ? '▲' : '▼'} {sortOrder === 'asc' ? '▲' : '▼'}
...@@ -183,7 +195,11 @@ ...@@ -183,7 +195,11 @@
<span class="invisible">▲</span> <span class="invisible">▲</span>
{/if} {/if}
</th> </th>
<th scope="col" class="px-3 py-2 cursor-pointer select-none" on:click={() => setSortKey('last_active_at')}> <th
scope="col"
class="px-3 py-2 cursor-pointer select-none"
on:click={() => setSortKey('last_active_at')}
>
{$i18n.t('Last Active')} {$i18n.t('Last Active')}
{#if sortKey === 'last_active_at'} {#if sortKey === 'last_active_at'}
{sortOrder === 'asc' ? '▲' : '▼'} {sortOrder === 'asc' ? '▲' : '▼'}
...@@ -191,7 +207,11 @@ ...@@ -191,7 +207,11 @@
<span class="invisible">▲</span> <span class="invisible">▲</span>
{/if} {/if}
</th> </th>
<th scope="col" class="px-3 py-2 cursor-pointer select-none" on:click={() => setSortKey('created_at')}> <th
scope="col"
class="px-3 py-2 cursor-pointer select-none"
on:click={() => setSortKey('created_at')}
>
{$i18n.t('Created at')} {$i18n.t('Created at')}
{#if sortKey === 'created_at'} {#if sortKey === 'created_at'}
{sortOrder === 'asc' ? '▲' : '▼'} {sortOrder === 'asc' ? '▲' : '▼'}
...@@ -213,7 +233,8 @@ ...@@ -213,7 +233,8 @@
const query = search.toLowerCase(); const query = search.toLowerCase();
return name.includes(query); return name.includes(query);
} }
}).sort((a, b) => { })
.sort((a, b) => {
if (a[sortKey] < b[sortKey]) return sortOrder === 'asc' ? -1 : 1; if (a[sortKey] < b[sortKey]) return sortOrder === 'asc' ? -1 : 1;
if (a[sortKey] > b[sortKey]) return sortOrder === 'asc' ? 1 : -1; if (a[sortKey] > b[sortKey]) return sortOrder === 'asc' ? 1 : -1;
return 0; return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment