feat: use new select menu for modlog
This commit is contained in:
1 parent
5ed5395712
commit
9fac9ec1fd
1 file changed
+62
-58
@@ -8,8 +8,18 @@
|
|||||||
import { userSettings } from '$lib/settings.js'
|
import { userSettings } from '$lib/settings.js'
|
||||||
import ModlogItemCard from './item/ModlogItemCard.svelte'
|
import ModlogItemCard from './item/ModlogItemCard.svelte'
|
||||||
import ModlogItemTable from './item/ModlogItemTable.svelte'
|
import ModlogItemTable from './item/ModlogItemTable.svelte'
|
||||||
|
import { Select } from 'mono-svelte'
|
||||||
|
import { Bars3BottomRight, Icon, ViewColumns } from 'svelte-hero-icons'
|
||||||
|
|
||||||
export let data
|
export let data
|
||||||
|
|
||||||
|
let view = `${
|
||||||
|
$userSettings.modlogCardView ??
|
||||||
|
!window.matchMedia('(min-width: 1600px)').matches
|
||||||
|
}`
|
||||||
|
|
||||||
|
$: $userSettings.modlogCardView =
|
||||||
|
view == 'true' ? true : view == 'false' ? false : undefined
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
@@ -18,64 +28,58 @@
|
|||||||
|
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<h1 class="font-bold text-2xl">Modlog</h1>
|
<h1 class="font-bold text-2xl">Modlog</h1>
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-row flex-wrap gap-2">
|
||||||
<MultiSelect
|
<Select
|
||||||
options={[
|
bind:value={data.type}
|
||||||
'All',
|
on:change={(e) => searchParam($page.url, 'type', data.type, 'page')}
|
||||||
'ModRemovePost',
|
class="w-48"
|
||||||
'ModLockPost',
|
>
|
||||||
'ModFeaturePost',
|
<span slot="label" class="flex gap-1 items-center">
|
||||||
'ModRemoveComment',
|
<Icon src={Bars3BottomRight} size="15" mini />
|
||||||
'ModRemoveCommunity',
|
Type
|
||||||
'ModBanFromCommunity',
|
</span>
|
||||||
'ModAddCommunity',
|
<option value="All">All</option>
|
||||||
'ModTransferCommunity',
|
<option value="ModRemovePost">Remove Post</option>
|
||||||
'ModAdd',
|
<option value="ModLockPost">Lock Post</option>
|
||||||
'ModBan',
|
<option value="ModFeaturePost">Feature Post</option>
|
||||||
'ModHideCommunity',
|
<option value="ModRemoveComment">Remove Comment</option>
|
||||||
'AdminPurgePerson',
|
<option value="ModRemoveCommunity">Remove Community</option>
|
||||||
'AdminPurgeCommunity',
|
<option value="ModBanFromCommunity">Ban From Community</option>
|
||||||
'AdminPurgePost',
|
<option value="ModAddCommunity">Add Moderator</option>
|
||||||
'AdminPurgeComment',
|
<option value="ModTransferCommunity">Transfer Community</option>
|
||||||
]}
|
<option value="ModAdd">Add Admin</option>
|
||||||
optionNames={[
|
<option value="ModBan">Ban Admin</option>
|
||||||
'All',
|
<option value="ModHideCommunity">Hide Community</option>
|
||||||
'Remove Post',
|
<option value="AdminPurgePerson">Purge User</option>
|
||||||
'Lock Post',
|
<option value="AdminPurgeCommunity">Purge Community</option>
|
||||||
'Feature Post',
|
<option value="AdminPurgePost">Purge Post</option>
|
||||||
'Remove Comment',
|
<option value="AdminPurgeComment">Purge Comment</option>
|
||||||
'Remove Community',
|
</Select>
|
||||||
'Ban From Community',
|
|
||||||
'Add Community',
|
<Select bind:value={view} class="w-36">
|
||||||
'Transfer Community',
|
<span slot="label" class="flex gap-1 items-center">
|
||||||
'Add',
|
<Icon src={ViewColumns} size="15" mini />
|
||||||
'Ban',
|
View
|
||||||
'Hide Community',
|
</span>
|
||||||
'Purge Person',
|
<option value="false">Table</option>
|
||||||
'Purge Community',
|
<option value="true">Cards</option>
|
||||||
'Purge Post',
|
<option value="undefined">Default</option>
|
||||||
'Purge Comment',
|
</Select>
|
||||||
]}
|
</div>
|
||||||
selected={data.type}
|
<div class="max-w-sm">
|
||||||
on:select={(e) => searchParam($page.url, 'type', e.detail, 'page')}
|
<div class="block my-1 font-bold text-sm">Community</div>
|
||||||
/>
|
<ObjectAutocomplete
|
||||||
<div class="max-w-sm">
|
placeholder="Filter by community"
|
||||||
<div class="block my-1 font-bold text-sm">Community</div>
|
jwt={$profile?.jwt}
|
||||||
<ObjectAutocomplete
|
listing_type="All"
|
||||||
placeholder="Filter by community"
|
showWhenEmpty={true}
|
||||||
jwt={$profile?.jwt}
|
on:select={(e) =>
|
||||||
listing_type="All"
|
searchParam(
|
||||||
showWhenEmpty={true}
|
$page.url,
|
||||||
on:select={(e) =>
|
'community',
|
||||||
searchParam($page.url, 'community', e.detail?.id.toString(), 'page')}
|
e.detail?.id.toString() ?? '',
|
||||||
/>
|
'page'
|
||||||
</div>
|
)}
|
||||||
<MultiSelect
|
|
||||||
options={[false, true, undefined]}
|
|
||||||
optionNames={['Table', 'Cards', 'Default']}
|
|
||||||
selected={$userSettings.modlogCardView ??
|
|
||||||
!window.matchMedia('(min-width: 1600px)').matches}
|
|
||||||
on:select={(e) => ($userSettings.modlogCardView = e.detail)}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{#if data.modlog}
|
{#if data.modlog}
|
||||||
|
|||||||
Reference in new issue
Block a user