remove redundant edit description button and edit party modal
This commit is contained in:
parent
aeea96cb8f
commit
b66405ca73
3 changed files with 5 additions and 128 deletions
|
|
@ -122,8 +122,6 @@
|
|||
let loading = $state(false)
|
||||
let error = $state<string | null>(null)
|
||||
let selectedSlot = $state<number>(0)
|
||||
let editDialogOpen = $state(false)
|
||||
let editingTitle = $state('')
|
||||
let conflictDialogOpen = $state(false)
|
||||
let conflictData = $state<ConflictData | null>(null)
|
||||
|
||||
|
|
@ -327,30 +325,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Edit dialog functions
|
||||
function openEditDialog() {
|
||||
if (!canEdit()) return
|
||||
editingTitle = party.name || ''
|
||||
editDialogOpen = true
|
||||
}
|
||||
|
||||
async function savePartyTitle() {
|
||||
if (!canEdit()) return
|
||||
|
||||
try {
|
||||
loading = true
|
||||
error = null
|
||||
|
||||
// Update party title via API
|
||||
await updatePartyDetails({ name: editingTitle })
|
||||
editDialogOpen = false
|
||||
} catch (err: any) {
|
||||
error = err.message || 'Failed to update party title'
|
||||
} finally {
|
||||
loading = false
|
||||
}
|
||||
}
|
||||
|
||||
// Party operations
|
||||
async function updatePartyDetails(updates: Omit<UpdatePartyParams, 'id' | 'shortcode'>) {
|
||||
if (!canEdit()) return
|
||||
|
|
@ -431,9 +405,7 @@
|
|||
function openDescriptionPanel() {
|
||||
openDescriptionSidebar({
|
||||
title: party.name || '(untitled party)',
|
||||
description: party.description,
|
||||
canEdit: canEdit(),
|
||||
onEdit: openEditDialog
|
||||
description: party.description
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -1046,34 +1018,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Edit Dialog -->
|
||||
<Dialog bind:open={editDialogOpen}>
|
||||
{#snippet children()}
|
||||
<ModalHeader title="Edit Party Details" />
|
||||
<ModalBody>
|
||||
<div class="edit-form">
|
||||
<label for="party-title">Party Title</label>
|
||||
<input
|
||||
id="party-title"
|
||||
type="text"
|
||||
bind:value={editingTitle}
|
||||
placeholder="Enter party title..."
|
||||
disabled={loading}
|
||||
/>
|
||||
</div>
|
||||
</ModalBody>
|
||||
<ModalFooter
|
||||
onCancel={() => (editDialogOpen = false)}
|
||||
cancelDisabled={loading}
|
||||
primaryAction={{
|
||||
label: loading ? 'Saving...' : 'Save',
|
||||
onclick: savePartyTitle,
|
||||
disabled: loading || !editingTitle.trim()
|
||||
}}
|
||||
/>
|
||||
{/snippet}
|
||||
</Dialog>
|
||||
|
||||
<!-- Delete Confirmation Dialog -->
|
||||
<DeleteTeamDialog
|
||||
bind:open={deleteDialogOpen}
|
||||
|
|
@ -1281,44 +1225,6 @@
|
|||
gap: $unit-2x;
|
||||
}
|
||||
|
||||
// Edit form styles
|
||||
.edit-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: $unit-half;
|
||||
|
||||
label {
|
||||
font-weight: $medium;
|
||||
font-size: $font-small;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
input {
|
||||
padding: $unit-three-quarter;
|
||||
border: 1px solid var(--button-bg);
|
||||
border-radius: $unit-three-quarter;
|
||||
font-size: $font-regular;
|
||||
background: var(--input-bg);
|
||||
@include smooth-transition($duration-quick, border-color, background);
|
||||
|
||||
&:hover {
|
||||
background: var(--input-bg-hover);
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent-blue);
|
||||
box-shadow: 0 0 0 2px rgba(39, 93, 197, 0.1); // Using raw value since CSS variables don't work in rgba()
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
background: var(--button-bg);
|
||||
opacity: 0.7;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dialog buttons (shared styles)
|
||||
.btn-primary,
|
||||
.btn-secondary,
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
<script lang="ts">
|
||||
import DescriptionRenderer from '$lib/components/DescriptionRenderer.svelte'
|
||||
import Button from '$lib/components/ui/Button.svelte'
|
||||
|
||||
interface Props {
|
||||
title?: string
|
||||
description?: string
|
||||
canEdit?: boolean
|
||||
onEdit?: () => void
|
||||
}
|
||||
|
||||
let { title, description, canEdit = false, onEdit }: Props = $props()
|
||||
let { description }: Props = $props()
|
||||
</script>
|
||||
|
||||
<div class="description-sidebar">
|
||||
|
|
@ -22,19 +18,10 @@
|
|||
{:else}
|
||||
<div class="empty-state">
|
||||
<p>No description available for this party.</p>
|
||||
{#if canEdit}
|
||||
<Button variant="primary" onclick={onEdit}>Add Description</Button>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if canEdit && description}
|
||||
<div class="actions-section">
|
||||
<Button variant="secondary" onclick={onEdit} class="edit-button">Edit Description</Button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
@ -88,19 +75,9 @@
|
|||
min-height: 200px;
|
||||
|
||||
p {
|
||||
margin: 0 0 $unit-2x 0;
|
||||
margin: 0;
|
||||
color: var(--text-secondary);
|
||||
font-size: $font-regular;
|
||||
}
|
||||
}
|
||||
|
||||
.actions-section {
|
||||
padding: $unit-2x;
|
||||
padding-bottom: $unit-2x;
|
||||
border-top: 1px solid var(--button-bg);
|
||||
|
||||
:global(.edit-button) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -4,19 +4,13 @@ import DescriptionSidebar from '$lib/components/sidebar/DescriptionSidebar.svelt
|
|||
interface DescriptionSidebarOptions {
|
||||
title?: string | undefined
|
||||
description?: string | undefined
|
||||
canEdit?: boolean | undefined
|
||||
onEdit?: (() => void) | undefined
|
||||
}
|
||||
|
||||
export function openDescriptionSidebar(options: DescriptionSidebarOptions) {
|
||||
const { title, description, canEdit = false, onEdit } = options
|
||||
const { title, description } = options
|
||||
|
||||
// Open the sidebar with the party title as the header
|
||||
sidebar.openWithComponent(title ?? '', DescriptionSidebar, {
|
||||
title,
|
||||
description,
|
||||
canEdit,
|
||||
onEdit
|
||||
description
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue