fix: Fix Map
page
This commit is contained in:
@ -2,15 +2,20 @@ import { Canvas } from "@react-three/fiber";
|
||||
import { OrbitControls, Stage, useGLTF } from "@react-three/drei";
|
||||
|
||||
type ModelViewerProps = {
|
||||
width?: string;
|
||||
fileUrl: string;
|
||||
height?: string;
|
||||
};
|
||||
|
||||
export const ThreeView = ({ fileUrl, height = "100%" }: ModelViewerProps) => {
|
||||
export const ThreeView = ({
|
||||
fileUrl,
|
||||
height = "100%",
|
||||
width = "100%",
|
||||
}: ModelViewerProps) => {
|
||||
const { scene } = useGLTF(fileUrl);
|
||||
|
||||
return (
|
||||
<Canvas style={{ width: "100%", height: height }}>
|
||||
<Canvas style={{ height: height, width: width }}>
|
||||
<ambientLight />
|
||||
<directionalLight />
|
||||
<Stage environment="city" intensity={0.6}>
|
||||
|
@ -13,16 +13,30 @@ export function MediaViewer({
|
||||
media,
|
||||
className,
|
||||
fullWidth,
|
||||
}: Readonly<{ media?: MediaData; className?: string; fullWidth?: boolean }>) {
|
||||
fullHeight,
|
||||
}: Readonly<{
|
||||
media?: MediaData;
|
||||
className?: string;
|
||||
fullWidth?: boolean;
|
||||
fullHeight?: boolean;
|
||||
}>) {
|
||||
const token = localStorage.getItem("token");
|
||||
return (
|
||||
<Box className={className} width={fullWidth ? "100%" : "auto"}>
|
||||
<Box
|
||||
className={className}
|
||||
width={fullWidth ? "100%" : "auto"}
|
||||
height={fullHeight ? "100%" : "auto"}
|
||||
>
|
||||
{media?.media_type === 1 && (
|
||||
<img
|
||||
src={`${import.meta.env.VITE_KRBL_MEDIA}${
|
||||
media?.id
|
||||
}/download?token=${token}`}
|
||||
alt={media?.filename}
|
||||
style={{
|
||||
height: fullHeight ? "100%" : "auto",
|
||||
width: fullWidth ? "100%" : "auto",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@ -48,6 +62,10 @@ export function MediaViewer({
|
||||
media?.id
|
||||
}/download?token=${token}`}
|
||||
alt={media?.filename}
|
||||
style={{
|
||||
height: fullHeight ? "100%" : "auto",
|
||||
width: fullWidth ? "100%" : "auto",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{media?.media_type === 4 && (
|
||||
@ -78,6 +96,7 @@ export function MediaViewer({
|
||||
media?.id
|
||||
}/download?token=${token}`}
|
||||
height="100%"
|
||||
width="1000px"
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
|
@ -163,17 +163,22 @@ export const InformationTab = observer(
|
||||
/>
|
||||
|
||||
<Autocomplete
|
||||
options={ruCities ?? []}
|
||||
options={ruCities?.data ?? []}
|
||||
value={
|
||||
ruCities.find((city) => city.id === sight.common.city_id) ??
|
||||
null
|
||||
ruCities?.data?.find(
|
||||
(city) => city.id === sight.common.city_id
|
||||
) ?? null
|
||||
}
|
||||
getOptionLabel={(option) => option.name}
|
||||
onChange={(_, value) => {
|
||||
setCity(value?.id ?? 0);
|
||||
handleChange(language as Language, {
|
||||
city_id: value?.id ?? 0,
|
||||
});
|
||||
handleChange(
|
||||
language as Language,
|
||||
{
|
||||
city_id: value?.id ?? 0,
|
||||
},
|
||||
true
|
||||
);
|
||||
}}
|
||||
renderInput={(params) => (
|
||||
<TextField {...params} label="Город" />
|
||||
|
Reference in New Issue
Block a user