Enhance map functionality and API documentation

- Updated API documentation for the `rebuildZooms` endpoint to clarify its long execution time and response behavior.
- Modified MapView component to manage tile cache invalidation after rebuilding zoom levels, ensuring fresh tile display.
- Introduced a new composable for handling tile cache invalidation state after admin actions.
- Enhanced character icon creation to reflect ownership status with distinct colors.
- Improved loading state handling in various components for better user experience during data fetching.
This commit is contained in:
2026-03-01 19:09:46 +03:00
parent 8331473808
commit 225aaa36e7
16 changed files with 236 additions and 52 deletions

View File

@@ -85,7 +85,7 @@
<label class="flex cursor-pointer items-center gap-3 py-2 px-2 rounded-lg hover:bg-base-300/50 w-full min-h-0">
<icons-icon-sun v-if="!dark" class="size-4 shrink-0 opacity-80" />
<icons-icon-moon v-else class="size-4 shrink-0 opacity-80" />
<span class="flex-1 text-sm">Тёмная тема</span>
<span class="flex-1 text-sm">Dark theme</span>
<input
type="checkbox"
class="toggle toggle-sm toggle-primary shrink-0"
@@ -183,7 +183,7 @@
<label class="flex cursor-pointer items-center gap-3 py-3 px-2 rounded-lg hover:bg-base-300/50 w-full min-h-0 touch-manipulation">
<icons-icon-sun v-if="!dark" class="size-4 shrink-0 opacity-80" />
<icons-icon-moon v-else class="size-4 shrink-0 opacity-80" />
<span class="flex-1 text-sm">Тёмная тема</span>
<span class="flex-1 text-sm">Dark theme</span>
<input
type="checkbox"
class="toggle toggle-sm toggle-primary shrink-0"
@@ -244,6 +244,8 @@ const { isLoginPath } = useAppPaths()
const isLogin = computed(() => isLoginPath(route.path))
const isAdmin = computed(() => !!me.value?.auths?.includes('admin'))
let loadId = 0
async function loadMe() {
if (isLogin.value) return
try {
@@ -253,10 +255,12 @@ async function loadMe() {
}
}
async function loadConfig() {
async function loadConfig(loadToken: number) {
if (isLogin.value) return
if (loadToken !== loadId) return
try {
const config = await useMapApi().getConfig()
if (loadToken !== loadId) return
if (config?.title) title.value = config.title
} catch (_) {}
}
@@ -269,7 +273,10 @@ onMounted(() => {
watch(
() => route.path,
(path) => {
if (!isLoginPath(path)) loadMe().then(loadConfig)
if (!isLoginPath(path)) {
const currentLoadId = ++loadId
loadMe().then(() => loadConfig(currentLoadId))
}
},
{ immediate: true }
)