add visibility dropdown and share with crew switch to party edit
This commit is contained in:
parent
7ede296826
commit
e263c426b6
1 changed files with 44 additions and 1 deletions
|
|
@ -14,16 +14,22 @@
|
||||||
import MetricField from '$lib/components/party/edit/MetricField.svelte'
|
import MetricField from '$lib/components/party/edit/MetricField.svelte'
|
||||||
import EditRaidPane from '$lib/components/sidebar/EditRaidPane.svelte'
|
import EditRaidPane from '$lib/components/sidebar/EditRaidPane.svelte'
|
||||||
import EditDescriptionPane from '$lib/components/sidebar/EditDescriptionPane.svelte'
|
import EditDescriptionPane from '$lib/components/sidebar/EditDescriptionPane.svelte'
|
||||||
|
import Select from '$lib/components/ui/Select.svelte'
|
||||||
|
import Switch from '$lib/components/ui/switch/Switch.svelte'
|
||||||
import { sidebar } from '$lib/stores/sidebar.svelte'
|
import { sidebar } from '$lib/stores/sidebar.svelte'
|
||||||
import { usePaneStack } from '$lib/stores/paneStack.svelte'
|
import { usePaneStack } from '$lib/stores/paneStack.svelte'
|
||||||
import { untrack } from 'svelte'
|
import { crewStore } from '$lib/stores/crew.store.svelte'
|
||||||
|
import { untrack } from 'svelte'
|
||||||
import type { Raid } from '$lib/types/api/entities'
|
import type { Raid } from '$lib/types/api/entities'
|
||||||
import type { RaidFull } from '$lib/types/api/raid'
|
import type { RaidFull } from '$lib/types/api/raid'
|
||||||
|
import type { PartyVisibility } from '$lib/types/visibility'
|
||||||
import Icon from '$lib/components/Icon.svelte'
|
import Icon from '$lib/components/Icon.svelte'
|
||||||
|
|
||||||
export interface PartyEditValues {
|
export interface PartyEditValues {
|
||||||
name: string
|
name: string
|
||||||
description: string | null
|
description: string | null
|
||||||
|
visibility: PartyVisibility
|
||||||
|
sharedWithCrew: boolean
|
||||||
fullAuto: boolean
|
fullAuto: boolean
|
||||||
autoGuard: boolean
|
autoGuard: boolean
|
||||||
autoSummon: boolean
|
autoSummon: boolean
|
||||||
|
|
@ -55,6 +61,8 @@
|
||||||
|
|
||||||
// Local state - initialized from initialValues
|
// Local state - initialized from initialValues
|
||||||
let name = $state(initialValues.name)
|
let name = $state(initialValues.name)
|
||||||
|
let visibility = $state<PartyVisibility>(initialValues.visibility)
|
||||||
|
let sharedWithCrew = $state(initialValues.sharedWithCrew)
|
||||||
let fullAuto = $state(initialValues.fullAuto)
|
let fullAuto = $state(initialValues.fullAuto)
|
||||||
let autoGuard = $state(initialValues.autoGuard)
|
let autoGuard = $state(initialValues.autoGuard)
|
||||||
let autoSummon = $state(initialValues.autoSummon)
|
let autoSummon = $state(initialValues.autoSummon)
|
||||||
|
|
@ -68,9 +76,18 @@
|
||||||
let raidId = $state<string | null>(initialValues.raidId)
|
let raidId = $state<string | null>(initialValues.raidId)
|
||||||
let description = $state(initialValues.description)
|
let description = $state(initialValues.description)
|
||||||
|
|
||||||
|
// Visibility options for select
|
||||||
|
const visibilityOptions: Array<{ value: PartyVisibility; label: string }> = [
|
||||||
|
{ value: 'public', label: 'Public' },
|
||||||
|
{ value: 'private', label: 'Private' },
|
||||||
|
{ value: 'unlisted', label: 'Unlisted' }
|
||||||
|
]
|
||||||
|
|
||||||
// Check if any values have changed
|
// Check if any values have changed
|
||||||
const hasChanges = $derived(
|
const hasChanges = $derived(
|
||||||
name !== initialValues.name ||
|
name !== initialValues.name ||
|
||||||
|
visibility !== initialValues.visibility ||
|
||||||
|
sharedWithCrew !== initialValues.sharedWithCrew ||
|
||||||
fullAuto !== initialValues.fullAuto ||
|
fullAuto !== initialValues.fullAuto ||
|
||||||
autoGuard !== initialValues.autoGuard ||
|
autoGuard !== initialValues.autoGuard ||
|
||||||
autoSummon !== initialValues.autoSummon ||
|
autoSummon !== initialValues.autoSummon ||
|
||||||
|
|
@ -89,6 +106,8 @@
|
||||||
const values: PartyEditValues = {
|
const values: PartyEditValues = {
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
|
visibility,
|
||||||
|
sharedWithCrew,
|
||||||
fullAuto,
|
fullAuto,
|
||||||
autoGuard,
|
autoGuard,
|
||||||
autoSummon,
|
autoSummon,
|
||||||
|
|
@ -264,6 +283,30 @@
|
||||||
<YouTubeUrlInput label="Video" bind:value={videoUrl} contained />
|
<YouTubeUrlInput label="Video" bind:value={videoUrl} contained />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<DetailsSection title="Sharing">
|
||||||
|
<DetailRow label="Visibility" noHover compact>
|
||||||
|
{#snippet children()}
|
||||||
|
<Select
|
||||||
|
options={visibilityOptions}
|
||||||
|
bind:value={visibility}
|
||||||
|
size="small"
|
||||||
|
contained
|
||||||
|
/>
|
||||||
|
{/snippet}
|
||||||
|
</DetailRow>
|
||||||
|
{#if crewStore.isInCrew}
|
||||||
|
<DetailRow label="Share with Crew" noHover compact>
|
||||||
|
{#snippet children()}
|
||||||
|
<Switch
|
||||||
|
bind:checked={sharedWithCrew}
|
||||||
|
size="small"
|
||||||
|
{element}
|
||||||
|
/>
|
||||||
|
{/snippet}
|
||||||
|
</DetailRow>
|
||||||
|
{/if}
|
||||||
|
</DetailsSection>
|
||||||
|
|
||||||
<button type="button" class="description-button" onclick={openDescriptionPane}>
|
<button type="button" class="description-button" onclick={openDescriptionPane}>
|
||||||
<div class="description-header">
|
<div class="description-header">
|
||||||
<span class="description-label">Description</span>
|
<span class="description-label">Description</span>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue