feat: Add translation on 3 languages for sight page

This commit is contained in:
2025-06-01 00:34:59 +03:00
parent 0d9bbb140f
commit 87386c6a73
22 changed files with 768 additions and 732 deletions

View File

@ -3,7 +3,12 @@ import { InformationTab, RightWidgetTab } from "@widgets";
import { LeftWidgetTab } from "@widgets";
import { useEffect, useState } from "react";
import { observer } from "mobx-react-lite";
import { articlesStore, languageStore, sightsStore } from "@shared";
import {
articlesStore,
cityStore,
editSightStore,
languageStore,
} from "@shared";
import { useParams } from "react-router-dom";
function a11yProps(index: number) {
@ -15,10 +20,11 @@ function a11yProps(index: number) {
export const EditSightPage = observer(() => {
const [value, setValue] = useState(0);
const { sight, getSight } = sightsStore;
const { articles, getArticles } = articlesStore;
const { getSightInfo } = editSightStore;
const { getArticles } = articlesStore;
const { language } = languageStore;
const { id } = useParams();
const { getCities } = cityStore;
const handleChange = (_: React.SyntheticEvent, newValue: number) => {
setValue(newValue);
@ -27,55 +33,53 @@ export const EditSightPage = observer(() => {
useEffect(() => {
const fetchData = async () => {
if (id) {
await getSight(Number(id));
await getSightInfo(+id, language);
await getArticles(language);
await getCities();
}
};
fetchData();
}, [id, language]);
return (
articles &&
sight && (
<Box
sx={{
width: "100%",
display: "flex",
flexDirection: "column",
minHeight: "100vh",
}}
>
<Box
sx={{
width: "100%",
borderBottom: 1,
borderColor: "divider",
display: "flex",
flexDirection: "column",
minHeight: "100vh",
justifyContent: "center",
}}
>
<Box
<Tabs
value={value}
onChange={handleChange}
aria-label="sight tabs"
sx={{
borderBottom: 1,
borderColor: "divider",
display: "flex",
justifyContent: "center",
width: "100%",
"& .MuiTabs-flexContainer": {
justifyContent: "center",
},
}}
>
<Tabs
value={value}
onChange={handleChange}
aria-label="sight tabs"
sx={{
width: "100%",
"& .MuiTabs-flexContainer": {
justifyContent: "center",
},
}}
>
<Tab sx={{ flex: 1 }} label="Общая информация" {...a11yProps(0)} />
<Tab sx={{ flex: 1 }} label="Левый виджет" {...a11yProps(1)} />
<Tab sx={{ flex: 1 }} label="Правый виджет" {...a11yProps(2)} />
</Tabs>
</Box>
<div className="flex-1">
<InformationTab value={value} index={0} />
<LeftWidgetTab value={value} index={1} />
<RightWidgetTab value={value} index={2} />
</div>
<Tab sx={{ flex: 1 }} label="Общая информация" {...a11yProps(0)} />
<Tab sx={{ flex: 1 }} label="Левый виджет" {...a11yProps(1)} />
<Tab sx={{ flex: 1 }} label="Правый виджет" {...a11yProps(2)} />
</Tabs>
</Box>
)
<div className="flex-1">
<InformationTab value={value} index={0} />
<LeftWidgetTab value={value} index={1} />
<RightWidgetTab value={value} index={2} />
</div>
</Box>
);
});