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

chore: format

parent 54b65a89
...@@ -159,45 +159,65 @@ ...@@ -159,45 +159,65 @@
<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
{$i18n.t('Role')} scope="col"
{#if sortKey === 'role'} class="px-3 py-2 cursor-pointer select-none"
{sortOrder === 'asc' ? '▲' : '▼'} on:click={() => setSortKey('role')}
{:else} >
<span class="invisible">▲</span> {$i18n.t('Role')}
{/if} {#if sortKey === 'role'}
{sortOrder === 'asc' ? '▲' : '▼'}
{:else}
<span class="invisible">▲</span>
{/if}
</th> </th>
<th scope="col" class="px-3 py-2 cursor-pointer select-none" on:click={() => setSortKey('name')}> <th
{$i18n.t('Name')} scope="col"
{#if sortKey === 'name'} class="px-3 py-2 cursor-pointer select-none"
{sortOrder === 'asc' ? '▲' : '▼'} on:click={() => setSortKey('name')}
{:else} >
<span class="invisible">▲</span> {$i18n.t('Name')}
{/if} {#if sortKey === 'name'}
{sortOrder === 'asc' ? '▲' : '▼'}
{:else}
<span class="invisible">▲</span>
{/if}
</th> </th>
<th scope="col" class="px-3 py-2 cursor-pointer select-none" on:click={() => setSortKey('email')}> <th
{$i18n.t('Email')} scope="col"
{#if sortKey === 'email'} class="px-3 py-2 cursor-pointer select-none"
{sortOrder === 'asc' ? '▲' : '▼'} on:click={() => setSortKey('email')}
{:else} >
<span class="invisible">▲</span> {$i18n.t('Email')}
{/if} {#if sortKey === 'email'}
{sortOrder === 'asc' ? '▲' : '▼'}
{:else}
<span class="invisible">▲</span>
{/if}
</th> </th>
<th scope="col" class="px-3 py-2 cursor-pointer select-none" on:click={() => setSortKey('last_active_at')}> <th
{$i18n.t('Last Active')} scope="col"
{#if sortKey === 'last_active_at'} class="px-3 py-2 cursor-pointer select-none"
{sortOrder === 'asc' ? '▲' : '▼'} on:click={() => setSortKey('last_active_at')}
{:else} >
<span class="invisible">▲</span> {$i18n.t('Last Active')}
{/if} {#if sortKey === 'last_active_at'}
{sortOrder === 'asc' ? '▲' : '▼'}
{:else}
<span class="invisible">▲</span>
{/if}
</th> </th>
<th scope="col" class="px-3 py-2 cursor-pointer select-none" on:click={() => setSortKey('created_at')}> <th
{$i18n.t('Created at')} scope="col"
{#if sortKey === 'created_at'} class="px-3 py-2 cursor-pointer select-none"
{sortOrder === 'asc' ? '▲' : '▼'} on:click={() => setSortKey('created_at')}
{:else} >
<span class="invisible">▲</span> {$i18n.t('Created at')}
{/if} {#if sortKey === 'created_at'}
{sortOrder === 'asc' ? '▲' : '▼'}
{:else}
<span class="invisible">▲</span>
{/if}
</th> </th>
<th scope="col" class="px-3 py-2 text-right" /> <th scope="col" class="px-3 py-2 text-right" />
...@@ -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