add fields
This commit is contained in:
@@ -37,3 +37,16 @@ export async function fetchAreaName(id: string): Promise<string> {
|
|||||||
const resp = await http.get<{ id: string; name: string }>(`/areas/${id}`)
|
const resp = await http.get<{ id: string; name: string }>(`/areas/${id}`)
|
||||||
return resp.data.name
|
return resp.data.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Публичный эндпоинт (permitAll): id + parentId + name — для восстановления
|
||||||
|
* цепочки родителей при заходе по глубокой ссылке (?area=…).
|
||||||
|
*/
|
||||||
|
export async function fetchArea(
|
||||||
|
id: string,
|
||||||
|
): Promise<{ id: string; parentId: string | null; name: string }> {
|
||||||
|
const resp = await http.get<{ id: string; parentId: string | null; name: string }>(
|
||||||
|
`/areas/${id}`,
|
||||||
|
)
|
||||||
|
return resp.data
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,6 +50,32 @@ export async function uploadIcon(id: string, file: File): Promise<Attraction> {
|
|||||||
return resp.data
|
return resp.data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Медиа ачивки: kind — сегмент эндпоинта background | audio | model. */
|
||||||
|
async function uploadAchievementMedia(
|
||||||
|
id: string,
|
||||||
|
kind: 'background' | 'audio' | 'model',
|
||||||
|
file: File,
|
||||||
|
): Promise<Attraction> {
|
||||||
|
const form = new FormData()
|
||||||
|
form.append('file', file)
|
||||||
|
const resp = await http.post<Attraction>(`/admin/attractions/${id}/${kind}`, form, {
|
||||||
|
headers: { 'Content-Type': 'multipart/form-data' },
|
||||||
|
})
|
||||||
|
return resp.data
|
||||||
|
}
|
||||||
|
|
||||||
|
export function uploadBackground(id: string, file: File): Promise<Attraction> {
|
||||||
|
return uploadAchievementMedia(id, 'background', file)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function uploadAudio(id: string, file: File): Promise<Attraction> {
|
||||||
|
return uploadAchievementMedia(id, 'audio', file)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function uploadModel(id: string, file: File): Promise<Attraction> {
|
||||||
|
return uploadAchievementMedia(id, 'model', file)
|
||||||
|
}
|
||||||
|
|
||||||
/** Публичная карточка (permitAll) — источник presigned iconUrl для превью. */
|
/** Публичная карточка (permitAll) — источник presigned iconUrl для превью. */
|
||||||
export async function fetchAttractionCard(id: string): Promise<AttractionCard> {
|
export async function fetchAttractionCard(id: string): Promise<AttractionCard> {
|
||||||
const resp = await http.get<AttractionCard>(`/attractions/${id}`)
|
const resp = await http.get<AttractionCard>(`/attractions/${id}`)
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ export interface Attraction {
|
|||||||
name: string
|
name: string
|
||||||
/** Сырой ключ S3, не URL (для превью используется публичный эндпоинт). */
|
/** Сырой ключ S3, не URL (для превью используется публичный эндпоинт). */
|
||||||
iconKey: string | null
|
iconKey: string | null
|
||||||
|
/** Медиа ачивки — сырые ключи S3. */
|
||||||
|
backgroundKey: string | null
|
||||||
|
audioKey: string | null
|
||||||
|
modelKey: string | null
|
||||||
about: string | null
|
about: string | null
|
||||||
latitude: number | null
|
latitude: number | null
|
||||||
longitude: number | null
|
longitude: number | null
|
||||||
@@ -145,6 +149,10 @@ export interface AttractionCard {
|
|||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
iconUrl: string | null
|
iconUrl: string | null
|
||||||
|
/** Медиа ачивки — presigned GET URL (TTL 1 час). */
|
||||||
|
backgroundUrl: string | null
|
||||||
|
audioUrl: string | null
|
||||||
|
modelUrl: string | null
|
||||||
about: string | null
|
about: string | null
|
||||||
latitude: number | null
|
latitude: number | null
|
||||||
longitude: number | null
|
longitude: number | null
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import { useState } from 'react'
|
|||||||
import { keepPreviousData, useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
import { keepPreviousData, useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||||
import { Breadcrumb, Button, Empty, Form, Input, Modal, Space, Table, Typography } from 'antd'
|
import { Breadcrumb, Button, Empty, Form, Input, Modal, Space, Table, Typography } from 'antd'
|
||||||
import type { ColumnsType } from 'antd/es/table'
|
import type { ColumnsType } from 'antd/es/table'
|
||||||
import { createArea, fetchAreas, updateArea } from '@/api/areas'
|
import { useSearchParams } from 'react-router-dom'
|
||||||
|
import { createArea, fetchArea, fetchAreas, updateArea } from '@/api/areas'
|
||||||
import { notifyApiError, notifySuccess } from '@/api/errors'
|
import { notifyApiError, notifySuccess } from '@/api/errors'
|
||||||
import type { Area } from '@/api/types'
|
import type { Area } from '@/api/types'
|
||||||
import { AreaTreeSelect } from '@/components/AreaTreeSelect'
|
import { AreaTreeSelect } from '@/components/AreaTreeSelect'
|
||||||
@@ -28,8 +29,9 @@ const PAGE_SIZE = 20
|
|||||||
export function AreaListPage() {
|
export function AreaListPage() {
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const isMobile = useIsMobile()
|
const isMobile = useIsMobile()
|
||||||
const [parentId, setParentId] = useState<string | null>(null)
|
const [searchParams, setSearchParams] = useSearchParams()
|
||||||
const [trail, setTrail] = useState<TrailItem[]>([])
|
// Позиция синхронизирована с URL (?area=…): прямые ссылки и F5 не теряют место.
|
||||||
|
const [parentId, setParentId] = useState<string | null>(searchParams.get('area'))
|
||||||
const [page, setPage] = useState(0)
|
const [page, setPage] = useState(0)
|
||||||
|
|
||||||
const [createOpen, setCreateOpen] = useState(false)
|
const [createOpen, setCreateOpen] = useState(false)
|
||||||
@@ -44,8 +46,29 @@ export function AreaListPage() {
|
|||||||
placeholderData: keepPreviousData,
|
placeholderData: keepPreviousData,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Цепочка родителей текущей зоны — восстановление по parentId вверх до корня
|
||||||
|
// (при обычной навигации имена уже в кэше, при заходе по ссылке — доходит запросами).
|
||||||
|
const ancestryQuery = useQuery({
|
||||||
|
queryKey: ['area-ancestry', parentId],
|
||||||
|
enabled: parentId != null,
|
||||||
|
queryFn: async (): Promise<TrailItem[]> => {
|
||||||
|
const chain: TrailItem[] = []
|
||||||
|
let current: string | null = parentId
|
||||||
|
while (current != null) {
|
||||||
|
const area = await fetchArea(current)
|
||||||
|
chain.unshift({ id: area.id, name: area.name })
|
||||||
|
current = area.parentId
|
||||||
|
}
|
||||||
|
return chain
|
||||||
|
},
|
||||||
|
staleTime: 5 * 60 * 1000,
|
||||||
|
})
|
||||||
|
const trail = ancestryQuery.data ?? []
|
||||||
|
|
||||||
const invalidate = () => {
|
const invalidate = () => {
|
||||||
void queryClient.invalidateQueries({ queryKey: ['admin-areas'] })
|
void queryClient.invalidateQueries({ queryKey: ['admin-areas'] })
|
||||||
|
// после переименования цепочка крошек могла устареть
|
||||||
|
void queryClient.invalidateQueries({ queryKey: ['area-ancestry'] })
|
||||||
}
|
}
|
||||||
|
|
||||||
const createMutation = useMutation({
|
const createMutation = useMutation({
|
||||||
@@ -76,23 +99,15 @@ export function AreaListPage() {
|
|||||||
onError: (e) => notifyApiError(e, 'Не удалось обновить зону'),
|
onError: (e) => notifyApiError(e, 'Не удалось обновить зону'),
|
||||||
})
|
})
|
||||||
|
|
||||||
const openArea = (area: Area) => {
|
const setParent = (value: string | null) => {
|
||||||
setTrail((prev) => [...prev, { id: area.id, name: area.name }])
|
setParentId(value)
|
||||||
setParentId(area.id)
|
|
||||||
setPage(0)
|
setPage(0)
|
||||||
|
setSearchParams(value ? { area: value } : {}, { replace: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
const navigateTo = (index: number) => {
|
const navigateTo = (index: number) => {
|
||||||
// -1 — корень, иначе обрезаем путь до index включительно.
|
// -1 — корень, иначе обрезаем путь до index включительно.
|
||||||
if (index < 0) {
|
setParent(index < 0 ? null : trail[index].id)
|
||||||
setTrail([])
|
|
||||||
setParentId(null)
|
|
||||||
} else {
|
|
||||||
const item = trail[index]
|
|
||||||
setTrail(trail.slice(0, index + 1))
|
|
||||||
setParentId(item.id)
|
|
||||||
}
|
|
||||||
setPage(0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const columns: ColumnsType<Area> = [
|
const columns: ColumnsType<Area> = [
|
||||||
@@ -101,7 +116,7 @@ export function AreaListPage() {
|
|||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
key: 'name',
|
key: 'name',
|
||||||
render: (_, area) => (
|
render: (_, area) => (
|
||||||
<Button type="link" onClick={() => openArea(area)} style={{ padding: 0 }}>
|
<Button type="link" onClick={() => setParent(area.id)} style={{ padding: 0 }}>
|
||||||
{area.name}
|
{area.name}
|
||||||
</Button>
|
</Button>
|
||||||
),
|
),
|
||||||
@@ -112,7 +127,7 @@ export function AreaListPage() {
|
|||||||
width: 200,
|
width: 200,
|
||||||
render: (_, area) => (
|
render: (_, area) => (
|
||||||
<Space>
|
<Space>
|
||||||
<Button size="small" onClick={() => openArea(area)}>
|
<Button size="small" onClick={() => setParent(area.id)}>
|
||||||
Внутрь
|
Внутрь
|
||||||
</Button>
|
</Button>
|
||||||
<Button size="small" onClick={() => setEditing(area)}>
|
<Button size="small" onClick={() => setEditing(area)}>
|
||||||
@@ -124,6 +139,7 @@ export function AreaListPage() {
|
|||||||
]
|
]
|
||||||
|
|
||||||
const data = areasQuery.data
|
const data = areasQuery.data
|
||||||
|
const currentParentName = trail.length ? trail[trail.length - 1].name : 'корень'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -206,7 +222,7 @@ export function AreaListPage() {
|
|||||||
<Input placeholder="Например, Центральный район" maxLength={255} />
|
<Input placeholder="Например, Центральный район" maxLength={255} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="Родительская зона">
|
<Form.Item label="Родительская зона">
|
||||||
<Input disabled value={trail.length ? trail[trail.length - 1].name : '— корень —'} />
|
<Input disabled value={trail.length ? currentParentName : '— корень —'} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
@@ -234,6 +250,9 @@ export function AreaListPage() {
|
|||||||
>
|
>
|
||||||
<Input maxLength={255} />
|
<Input maxLength={255} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item label="Текущий родитель">
|
||||||
|
<Input disabled value={editing?.parentId == null ? 'корень' : currentParentName} />
|
||||||
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="newParent"
|
name="newParent"
|
||||||
label="Новая родительская зона"
|
label="Новая родительская зона"
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
|
import type { ReactNode } from 'react'
|
||||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||||
|
import type { UseMutationResult } from '@tanstack/react-query'
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -22,7 +24,15 @@ import {
|
|||||||
} from '@ant-design/icons'
|
} from '@ant-design/icons'
|
||||||
import type { UploadProps } from 'antd'
|
import type { UploadProps } from 'antd'
|
||||||
import { Link, useLocation, useParams, useSearchParams } from 'react-router-dom'
|
import { Link, useLocation, useParams, useSearchParams } from 'react-router-dom'
|
||||||
import { fetchAttractionCard, fetchAttractions, updateAttraction, uploadIcon } from '@/api/attractions'
|
import {
|
||||||
|
fetchAttractionCard,
|
||||||
|
fetchAttractions,
|
||||||
|
updateAttraction,
|
||||||
|
uploadAudio,
|
||||||
|
uploadBackground,
|
||||||
|
uploadIcon,
|
||||||
|
uploadModel,
|
||||||
|
} from '@/api/attractions'
|
||||||
import { notifyApiError, notifySuccess } from '@/api/errors'
|
import { notifyApiError, notifySuccess } from '@/api/errors'
|
||||||
import { notify } from '@/api/notify'
|
import { notify } from '@/api/notify'
|
||||||
import type { Attraction } from '@/api/types'
|
import type { Attraction } from '@/api/types'
|
||||||
@@ -37,6 +47,7 @@ import {
|
|||||||
import { PhotoGallery } from '@/pages/attractions/PhotoGallery'
|
import { PhotoGallery } from '@/pages/attractions/PhotoGallery'
|
||||||
|
|
||||||
const MAX_FILE_SIZE = 20 * 1024 * 1024
|
const MAX_FILE_SIZE = 20 * 1024 * 1024
|
||||||
|
const MAX_MEDIA_SIZE = 50 * 1024 * 1024
|
||||||
|
|
||||||
export function AttractionDetailPage() {
|
export function AttractionDetailPage() {
|
||||||
const { id } = useParams<{ id: string }>()
|
const { id } = useParams<{ id: string }>()
|
||||||
@@ -92,6 +103,36 @@ export function AttractionDetailPage() {
|
|||||||
onError: (e) => notifyApiError(e, 'Не удалось загрузить иконку'),
|
onError: (e) => notifyApiError(e, 'Не удалось загрузить иконку'),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const backgroundMutation = useMutation({
|
||||||
|
mutationFn: (file: File) => uploadBackground(id!, file),
|
||||||
|
onSuccess: (updated) => {
|
||||||
|
notifySuccess('Background обновлён')
|
||||||
|
setMutated(updated)
|
||||||
|
void queryClient.invalidateQueries({ queryKey: ['public-card', id] })
|
||||||
|
},
|
||||||
|
onError: (e) => notifyApiError(e, 'Не удалось загрузить background'),
|
||||||
|
})
|
||||||
|
|
||||||
|
const audioMutation = useMutation({
|
||||||
|
mutationFn: (file: File) => uploadAudio(id!, file),
|
||||||
|
onSuccess: (updated) => {
|
||||||
|
notifySuccess('Аудио обновлено')
|
||||||
|
setMutated(updated)
|
||||||
|
void queryClient.invalidateQueries({ queryKey: ['public-card', id] })
|
||||||
|
},
|
||||||
|
onError: (e) => notifyApiError(e, 'Не удалось загрузить аудио'),
|
||||||
|
})
|
||||||
|
|
||||||
|
const modelMutation = useMutation({
|
||||||
|
mutationFn: (file: File) => uploadModel(id!, file),
|
||||||
|
onSuccess: (updated) => {
|
||||||
|
notifySuccess('3D-модель обновлена')
|
||||||
|
setMutated(updated)
|
||||||
|
void queryClient.invalidateQueries({ queryKey: ['public-card', id] })
|
||||||
|
},
|
||||||
|
onError: (e) => notifyApiError(e, 'Не удалось загрузить 3D-модель'),
|
||||||
|
})
|
||||||
|
|
||||||
const iconUploadProps: UploadProps = {
|
const iconUploadProps: UploadProps = {
|
||||||
accept: 'image/jpeg,image/png,image/webp,image/svg+xml',
|
accept: 'image/jpeg,image/png,image/webp,image/svg+xml',
|
||||||
showUploadList: false,
|
showUploadList: false,
|
||||||
@@ -110,6 +151,27 @@ export function AttractionDetailPage() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mediaUploadProps = (
|
||||||
|
mutation: UseMutationResult<Attraction, unknown, File>,
|
||||||
|
accept: string,
|
||||||
|
): UploadProps => ({
|
||||||
|
accept,
|
||||||
|
showUploadList: false,
|
||||||
|
beforeUpload: (file) => {
|
||||||
|
if (file.size > MAX_MEDIA_SIZE) {
|
||||||
|
notify('error', 'Файл больше 50 МБ')
|
||||||
|
return Upload.LIST_IGNORE
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
customRequest: ({ file, onSuccess, onError }) => {
|
||||||
|
mutation
|
||||||
|
.mutateAsync(file as File)
|
||||||
|
.then(() => onSuccess?.(null))
|
||||||
|
.catch((e: unknown) => onError?.(e as Error))
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
if (attraction == null) {
|
if (attraction == null) {
|
||||||
if (fallbackQuery.isLoading || fallbackQuery.isFetching) {
|
if (fallbackQuery.isLoading || fallbackQuery.isFetching) {
|
||||||
return (
|
return (
|
||||||
@@ -208,20 +270,7 @@ export function AttractionDetailPage() {
|
|||||||
{iconUrl ? (
|
{iconUrl ? (
|
||||||
<Image src={iconUrl} width={96} height={96} style={{ objectFit: 'cover' }} />
|
<Image src={iconUrl} width={96} height={96} style={{ objectFit: 'cover' }} />
|
||||||
) : (
|
) : (
|
||||||
<div
|
<MediaBox>нет</MediaBox>
|
||||||
style={{
|
|
||||||
width: 96,
|
|
||||||
height: 96,
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center',
|
|
||||||
border: '1px dashed #d9d9d9',
|
|
||||||
borderRadius: 8,
|
|
||||||
color: '#999',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
нет
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
<Space direction="vertical">
|
<Space direction="vertical">
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
@@ -241,12 +290,81 @@ export function AttractionDetailPage() {
|
|||||||
<Typography.Text type="secondary">
|
<Typography.Text type="secondary">
|
||||||
JPEG / PNG / WebP / SVG, до 20 МБ. Перезаписывает текущую иконку.
|
JPEG / PNG / WebP / SVG, до 20 МБ. Перезаписывает текущую иконку.
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
<Typography.Text type="secondary">
|
<S3KeyText value={attraction.iconKey} />
|
||||||
Ключ в S3:{' '}
|
</Space>
|
||||||
<Typography.Text code copyable={{ text: attraction.iconKey ?? '' }}>
|
</Space>
|
||||||
{attraction.iconKey ?? '—'}
|
</Card>
|
||||||
|
|
||||||
|
<Card title="Медиа ачивки">
|
||||||
|
<Space direction="vertical" size="large" style={{ width: '100%' }}>
|
||||||
|
<Space size="large" align="start" wrap>
|
||||||
|
{cardQuery.data?.backgroundUrl ? (
|
||||||
|
<Image
|
||||||
|
src={cardQuery.data.backgroundUrl}
|
||||||
|
width={160}
|
||||||
|
height={96}
|
||||||
|
style={{ objectFit: 'cover', borderRadius: 8 }}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<MediaBox>нет</MediaBox>
|
||||||
|
)}
|
||||||
|
<Space direction="vertical">
|
||||||
|
<Upload
|
||||||
|
{...mediaUploadProps(
|
||||||
|
backgroundMutation,
|
||||||
|
'image/jpeg,image/png,image/webp,image/svg+xml',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<Button icon={<UploadOutlined />} loading={backgroundMutation.isPending}>
|
||||||
|
Загрузить background
|
||||||
|
</Button>
|
||||||
|
</Upload>
|
||||||
|
<Typography.Text type="secondary">
|
||||||
|
JPG / PNG / WebP / SVG, до 50 МБ. Перезаписывает текущий.
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
</Typography.Text>
|
<S3KeyText value={attraction.backgroundKey} />
|
||||||
|
</Space>
|
||||||
|
</Space>
|
||||||
|
|
||||||
|
<Space size="large" align="start" wrap>
|
||||||
|
{cardQuery.data?.audioUrl ? (
|
||||||
|
<audio controls src={cardQuery.data.audioUrl} style={{ width: 300 }} />
|
||||||
|
) : (
|
||||||
|
<MediaBox>нет</MediaBox>
|
||||||
|
)}
|
||||||
|
<Space direction="vertical">
|
||||||
|
<Upload {...mediaUploadProps(audioMutation, '.mp3,audio/mpeg')}>
|
||||||
|
<Button icon={<UploadOutlined />} loading={audioMutation.isPending}>
|
||||||
|
Загрузить аудио
|
||||||
|
</Button>
|
||||||
|
</Upload>
|
||||||
|
<Typography.Text type="secondary">
|
||||||
|
MP3, до 50 МБ. Перезаписывает текущее.
|
||||||
|
</Typography.Text>
|
||||||
|
<S3KeyText value={attraction.audioKey} />
|
||||||
|
</Space>
|
||||||
|
</Space>
|
||||||
|
|
||||||
|
<Space size="large" align="start" wrap>
|
||||||
|
{attraction.modelKey ? (
|
||||||
|
<MediaBox>
|
||||||
|
<Tag color="geekblue">{modelFormat(attraction.modelKey)}</Tag>
|
||||||
|
</MediaBox>
|
||||||
|
) : (
|
||||||
|
<MediaBox>нет</MediaBox>
|
||||||
|
)}
|
||||||
|
<Space direction="vertical">
|
||||||
|
<Upload {...mediaUploadProps(modelMutation, '.glb,.gltf,.usdz,.obj')}>
|
||||||
|
<Button icon={<UploadOutlined />} loading={modelMutation.isPending}>
|
||||||
|
Загрузить 3D-модель
|
||||||
|
</Button>
|
||||||
|
</Upload>
|
||||||
|
<Typography.Text type="secondary">
|
||||||
|
GLB / glTF / USDZ / OBJ, до 50 МБ; формат — по расширению файла. В приложении
|
||||||
|
модель отдаётся только «забравшим» ачивку.
|
||||||
|
</Typography.Text>
|
||||||
|
<S3KeyText value={attraction.modelKey} />
|
||||||
|
</Space>
|
||||||
</Space>
|
</Space>
|
||||||
</Space>
|
</Space>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -282,3 +400,38 @@ export function AttractionDetailPage() {
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function MediaBox({ children }: { children: ReactNode }) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
width: 96,
|
||||||
|
height: 96,
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
border: '1px dashed #d9d9d9',
|
||||||
|
borderRadius: 8,
|
||||||
|
color: '#999',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function S3KeyText({ value }: { value: string | null }) {
|
||||||
|
return (
|
||||||
|
<Typography.Text type="secondary">
|
||||||
|
Ключ в S3:{' '}
|
||||||
|
<Typography.Text code copyable={{ text: value ?? '' }}>
|
||||||
|
{value ?? '—'}
|
||||||
|
</Typography.Text>
|
||||||
|
</Typography.Text>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Формат 3D-модели из расширения ключа: attractions/{id}/model/{fileId}.glb -> GLB. */
|
||||||
|
function modelFormat(modelKey: string): string {
|
||||||
|
return (modelKey.split('.').pop() ?? '').toUpperCase()
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user