diff --git a/src/lib/components/admin/ProjectForm.svelte b/src/lib/components/admin/ProjectForm.svelte index 34309a8..bb000dc 100644 --- a/src/lib/components/admin/ProjectForm.svelte +++ b/src/lib/components/admin/ProjectForm.svelte @@ -236,6 +236,7 @@ show: formData.status !== 'password-protected' } ]} + viewUrl={project?.slug ? `/work/${project.slug}` : undefined} /> {/if} @@ -314,6 +315,7 @@ width: 250px; display: flex; justify-content: flex-end; + gap: $unit-2x; } } @@ -336,6 +338,7 @@ } } + .admin-container { width: 100%; margin: 0 auto; diff --git a/src/lib/components/admin/StatusDropdown.svelte b/src/lib/components/admin/StatusDropdown.svelte index 1c12b2e..366a09d 100644 --- a/src/lib/components/admin/StatusDropdown.svelte +++ b/src/lib/components/admin/StatusDropdown.svelte @@ -17,6 +17,7 @@ status: string show?: boolean }> + viewUrl?: string } let { @@ -25,7 +26,8 @@ disabled = false, isLoading = false, primaryAction, - dropdownActions = [] + dropdownActions = [], + viewUrl }: Props = $props() let isDropdownOpen = $state(false) @@ -62,6 +64,9 @@ const availableActions = $derived( dropdownActions.filter((action) => action.show !== false && action.status !== currentStatus) ) + + const showViewInDropdown = $derived(viewUrl && currentStatus === 'published') + const hasDropdownContent = $derived(availableActions.length > 0 || showViewInDropdown)
@@ -74,7 +79,7 @@ {isLoading ? `${primaryAction.label.replace(/e$/, 'ing')}...` : primaryAction.label} - {#if availableActions.length > 0} + {#if hasDropdownContent}
{/if} @@ -768,22 +769,6 @@ } } - .btn { - padding: $unit-2x $unit-3x; - border: none; - border-radius: 50px; - font-size: 0.925rem; - cursor: pointer; - transition: all 0.2s ease; - display: flex; - align-items: center; - gap: $unit; - - &:disabled { - opacity: 0.6; - cursor: not-allowed; - } - } .loading-container { display: flex; diff --git a/src/routes/admin/posts/[id]/edit/+page.svelte b/src/routes/admin/posts/[id]/edit/+page.svelte index d359bd6..3ea564f 100644 --- a/src/routes/admin/posts/[id]/edit/+page.svelte +++ b/src/routes/admin/posts/[id]/edit/+page.svelte @@ -366,6 +366,7 @@ ? { label: 'Save', status: 'published' } : { label: 'Publish', status: 'published' }} dropdownActions={[{ label: 'Save as Draft', status: 'draft', show: status !== 'draft' }]} + viewUrl={slug ? `/universe/${slug}` : undefined} /> {/if} @@ -489,27 +490,6 @@ } } - .btn { - padding: $unit-2x $unit-3x; - border: none; - border-radius: 50px; - font-size: 0.925rem; - cursor: pointer; - transition: all 0.2s ease; - display: flex; - align-items: center; - gap: $unit; - - &:disabled { - opacity: 0.6; - cursor: not-allowed; - } - - &.btn-small { - padding: $unit $unit-2x; - font-size: 0.875rem; - } - } .dropdown-menu { position: absolute;