fix: Fix panorama + route scale data

This commit is contained in:
2025-07-26 11:48:41 +03:00
parent 89d7fc2748
commit 470a58a3fa
7 changed files with 43 additions and 20 deletions

View File

@ -1,7 +1,7 @@
export const UP_SCALE = 30000; export const UP_SCALE = 10000;
export const PATH_WIDTH = 15; export const PATH_WIDTH = 5;
export const STATION_RADIUS = 20; export const STATION_RADIUS = 8;
export const STATION_OUTLINE_WIDTH = 10; export const STATION_OUTLINE_WIDTH = 4;
export const SIGHT_SIZE = 40; export const SIGHT_SIZE = 40;
export const SCALE_FACTOR = 50; export const SCALE_FACTOR = 50;

View File

@ -57,8 +57,8 @@ export function Widgets() {
mb: 1, mb: 1,
}} }}
> >
<Box sx={{ display: "flex", alignItems: "center", gap: 0.5 }}> <Box sx={{ display: "flex", gap: 0.5 }}>
<Landmark size={16} /> <Landmark size={16} className="shrink-0" />
<Typography <Typography
variant="subtitle2" variant="subtitle2"
sx={{ color: "#fff", fontWeight: "bold" }} sx={{ color: "#fff", fontWeight: "bold" }}

View File

@ -165,6 +165,7 @@ export const RouteMap = observer(() => {
return ( return (
<div style={{ width: "100%", height: "100%" }} ref={parentRef}> <div style={{ width: "100%", height: "100%" }} ref={parentRef}>
<LanguageSwitcher />
<Application resizeTo={parentRef} background="#fff"> <Application resizeTo={parentRef} background="#fff">
<InfiniteCanvas> <InfiniteCanvas>
<TravelPath points={points} /> <TravelPath points={points} />

View File

@ -117,12 +117,15 @@ export const SnapshotListPage = observer(() => {
<SnapshotRestore <SnapshotRestore
open={isRestoreModalOpen} open={isRestoreModalOpen}
loading={isLoading}
onDelete={async () => { onDelete={async () => {
setIsLoading(true);
if (rowId) { if (rowId) {
await restoreSnapshot(rowId); await restoreSnapshot(rowId);
} }
setIsRestoreModalOpen(false); setIsRestoreModalOpen(false);
setRowId(null); setRowId(null);
setIsLoading(false);
}} }}
onCancel={() => { onCancel={() => {
setIsRestoreModalOpen(false); setIsRestoreModalOpen(false);

View File

@ -109,6 +109,7 @@ export const MediaArea = observer(
media_type: m.media_type, media_type: m.media_type,
filename: m.filename, filename: m.filename,
}} }}
height="40px"
/> />
<button <button
className="absolute top-2 right-2" className="absolute top-2 right-2"

View File

@ -12,11 +12,15 @@ export interface MediaData {
export function MediaViewer({ export function MediaViewer({
media, media,
className, className,
height,
width,
fullWidth, fullWidth,
fullHeight, fullHeight,
}: Readonly<{ }: Readonly<{
media?: MediaData; media?: MediaData;
className?: string; className?: string;
height?: string;
width?: string;
fullWidth?: boolean; fullWidth?: boolean;
fullHeight?: boolean; fullHeight?: boolean;
}>) { }>) {
@ -42,8 +46,8 @@ export function MediaViewer({
}/download?token=${token}`} }/download?token=${token}`}
alt={media?.filename} alt={media?.filename}
style={{ style={{
height: fullHeight ? "100%" : "auto", height: fullHeight ? "100%" : height ? height : "auto",
width: fullWidth ? "100%" : "auto", width: fullWidth ? "100%" : width ? width : "auto",
...(media?.filename?.toLowerCase().endsWith(".webp") && { ...(media?.filename?.toLowerCase().endsWith(".webp") && {
maxWidth: "300px", maxWidth: "300px",
maxHeight: "300px", maxHeight: "300px",
@ -59,8 +63,8 @@ export function MediaViewer({
media?.id media?.id
}/download?token=${token}`} }/download?token=${token}`}
style={{ style={{
width: "100%", width: width ? width : "100%",
height: "100%", height: height ? height : "100%",
objectFit: "cover", objectFit: "cover",
borderRadius: 8, borderRadius: 8,
}} }}
@ -76,8 +80,8 @@ export function MediaViewer({
}/download?token=${token}`} }/download?token=${token}`}
alt={media?.filename} alt={media?.filename}
style={{ style={{
height: fullHeight ? "100%" : "auto", height: fullHeight ? "100%" : height ? height : "auto",
width: fullWidth ? "100%" : "auto", width: fullWidth ? "100%" : width ? width : "auto",
}} }}
/> />
)} )}
@ -98,8 +102,8 @@ export function MediaViewer({
src={`${import.meta.env.VITE_KRBL_MEDIA}${ src={`${import.meta.env.VITE_KRBL_MEDIA}${
media?.id media?.id
}/download?token=${token}`} }/download?token=${token}`}
width={"100%"} width={width ? width : "500px"}
height={"100%"} height={height ? height : "300px"}
/> />
)} )}
@ -108,8 +112,8 @@ export function MediaViewer({
fileUrl={`${import.meta.env.VITE_KRBL_MEDIA}${ fileUrl={`${import.meta.env.VITE_KRBL_MEDIA}${
media?.id media?.id
}/download?token=${token}`} }/download?token=${token}`}
height="500px" height={height ? height : "500px"}
width="500px" width={width ? width : "500px"}
/> />
)} )}
</Box> </Box>

View File

@ -1,13 +1,15 @@
import { Button } from "@mui/material"; import { Button, CircularProgress } from "@mui/material";
export const SnapshotRestore = ({ export const SnapshotRestore = ({
onDelete, onDelete,
onCancel, onCancel,
open, open,
loading = false,
}: { }: {
onDelete: () => void; onDelete: () => void;
onCancel: () => void; onCancel: () => void;
open: boolean; open: boolean;
loading?: boolean;
}) => { }) => {
return ( return (
<div <div
@ -23,10 +25,22 @@ export const SnapshotRestore = ({
Это действие нельзя будет отменить. Это действие нельзя будет отменить.
</p> </p>
<div className="flex gap-4 justify-center"> <div className="flex gap-4 justify-center">
<Button variant="contained" color="primary" onClick={onDelete}> <Button
Да variant="contained"
color="primary"
onClick={onDelete}
disabled={loading}
startIcon={
loading ? (
<CircularProgress size={16} color="inherit" />
) : undefined
}
>
{loading ? "Восстановление..." : "Да"}
</Button>
<Button onClick={onCancel} disabled={loading}>
Нет
</Button> </Button>
<Button onClick={onCancel}>Нет</Button>
</div> </div>
</div> </div>
</div> </div>