Maps Manager
Manage your stored map data files.
import { Head, router } from '@inertiajs/react'
import StyledTable from '~/components/StyledTable'
import SettingsLayout from '~/layouts/SettingsLayout'
import StyledButton from '~/components/StyledButton'
import { useModals } from '~/context/ModalContext'
import StyledModal from '~/components/StyledModal'
import { FileEntry } from '../../../types/files'
import MissingBaseAssetsAlert from '~/components/layout/MissingBaseAssetsAlert'
import { useNotifications } from '~/context/NotificationContext'
import { useState } from 'react'
import api from '~/lib/api'
export default function MapsManager(props: {
maps: { baseAssetsExist: boolean; regionFiles: FileEntry[] }
}) {
const { openModal, closeAllModals } = useModals()
const { addNotification } = useNotifications()
const [downloading, setDownloading] = useState(false)
async function downloadBaseAssets() {
try {
setDownloading(true)
const res = await api.downloadBaseMapAssets()
if (res.success) {
addNotification({
type: 'success',
message: 'Base map assets downloaded successfully.',
})
router.reload()
}
} catch (error) {
console.error('Error downloading base assets:', error)
addNotification({
type: 'error',
message: 'An error occurred while downloading the base map assets. Please try again.',
})
} finally {
setDownloading(false)
}
}
async function confirmDeleteFile(file: FileEntry) {
openModal(
Are you sure you want to delete {file.name}? This action cannot be undone.
Manage your stored map data files.