lint: remove more unused imports and variables (6 fixes)

Co-Authored-By: Justin Edmund <justin@jedmund.com>
This commit is contained in:
Devin AI 2025-11-23 14:29:05 +00:00
parent 3f5969a08c
commit 3e2336bc5c
5 changed files with 0 additions and 102 deletions

View file

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import { getContext } from 'svelte'
import PhotosIcon from '$icons/photos.svg?component' import PhotosIcon from '$icons/photos.svg?component'
import ViewSingleIcon from '$icons/view-single.svg?component' import ViewSingleIcon from '$icons/view-single.svg?component'
import ViewTwoColumnIcon from '$icons/view-two-column.svg?component' import ViewTwoColumnIcon from '$icons/view-two-column.svg?component'

View file

@ -4,7 +4,6 @@
import AdminPage from './AdminPage.svelte' import AdminPage from './AdminPage.svelte'
import AdminSegmentedControl from './AdminSegmentedControl.svelte' import AdminSegmentedControl from './AdminSegmentedControl.svelte'
import Input from './Input.svelte' import Input from './Input.svelte'
import Button from './Button.svelte'
import DropdownSelectField from './DropdownSelectField.svelte' import DropdownSelectField from './DropdownSelectField.svelte'
import AutoSaveStatus from './AutoSaveStatus.svelte' import AutoSaveStatus from './AutoSaveStatus.svelte'
import UnifiedMediaModal from './UnifiedMediaModal.svelte' import UnifiedMediaModal from './UnifiedMediaModal.svelte'
@ -148,103 +147,6 @@
} }
} }
async function handleSave() {
if (!validateForm()) {
toast.error('Please fix the validation errors')
return
}
const loadingToastId = toast.loading(`${mode === 'edit' ? 'Saving' : 'Creating'} album...`)
try {
isSaving = true
const payload = {
title: formData.title,
slug: formData.slug,
description: null,
date: formData.year || null,
location: formData.location || null,
showInUniverse: formData.showInUniverse,
status: formData.status,
content: formData.content
}
const url = mode === 'edit' ? `/api/albums/${album?.id}` : '/api/albums'
const method = mode === 'edit' ? 'PUT' : 'POST'
const response = await fetch(url, {
method,
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(payload),
credentials: 'same-origin'
})
if (!response.ok) {
const errorData = await response.json()
throw new Error(
errorData.message || `Failed to ${mode === 'edit' ? 'save' : 'create'} album`
)
}
const savedAlbum = await response.json()
toast.dismiss(loadingToastId)
// Add pending photos to newly created album
if (mode === 'create' && pendingMediaIds.length > 0) {
const photoToastId = toast.loading('Adding selected photos to album...')
try {
const photoResponse = await fetch(`/api/albums/${savedAlbum.id}/media`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ mediaIds: pendingMediaIds }),
credentials: 'same-origin'
})
if (!photoResponse.ok) {
throw new Error('Failed to add photos to album')
}
toast.dismiss(photoToastId)
toast.success(
`Album created with ${pendingMediaIds.length} photo${pendingMediaIds.length !== 1 ? 's' : ''}!`
)
} catch (err) {
toast.dismiss(photoToastId)
toast.error(
'Album created but failed to add photos. You can add them by editing the album.'
)
console.error('Failed to add photos:', err)
}
} else {
toast.success(`Album ${mode === 'edit' ? 'saved' : 'created'} successfully!`)
}
if (mode === 'create') {
goto(`/admin/albums/${savedAlbum.id}/edit`)
} else if (mode === 'edit' && album) {
// Update the album object to reflect saved changes
album = savedAlbum
populateFormData(savedAlbum)
}
} catch (err) {
toast.dismiss(loadingToastId)
toast.error(
err instanceof Error
? err.message
: `Failed to ${mode === 'edit' ? 'save' : 'create'} album`
)
console.error(err)
} finally {
isSaving = false
}
}
async function handleBulkAlbumSave() { async function handleBulkAlbumSave() {
// Reload album to get updated photo count // Reload album to get updated photo count
if (album && mode === 'edit') { if (album && mode === 'edit') {

View file

@ -4,7 +4,6 @@
import Button from './Button.svelte' import Button from './Button.svelte'
import CloseButton from '../icons/CloseButton.svelte' import CloseButton from '../icons/CloseButton.svelte'
import LoadingSpinner from './LoadingSpinner.svelte' import LoadingSpinner from './LoadingSpinner.svelte'
import type { Album } from '@prisma/client'
interface Props { interface Props {
isOpen: boolean isOpen: boolean

View file

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import { onMount } from 'svelte'
import { browser } from '$app/environment' import { browser } from '$app/environment'
import { computePosition, flip, shift, offset, autoUpdate } from '@floating-ui/dom' import { computePosition, flip, shift, offset, autoUpdate } from '@floating-ui/dom'
import ChevronRight from '$icons/chevron-right.svg?component' import ChevronRight from '$icons/chevron-right.svg?component'

View file

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import Button from './Button.svelte'
import { validateFileType } from '$lib/utils/mediaHelpers' import { validateFileType } from '$lib/utils/mediaHelpers'
interface Props { interface Props {