diff --git a/.env b/.env
index 2f7a4b8..d0bbd46 100644
--- a/.env
+++ b/.env
@@ -1,3 +1,4 @@
-VITE_API_URL='https://wn.krbl.ru'
-VITE_REACT_APP ='https://wn.krbl.ru'
-VITE_KRBL_MEDIA='https://wn.krbl.ru/media/'
\ No newline at end of file
+VITE_API_URL='https://content.wn.polygon.unprism.ru'
+VITE_REACT_APP ='https://content.wn.polygon.unprism.ru'
+VITE_KRBL_MEDIA='https://content.wn.polygon.unprism.ru//media/'
+VITE_NEED_AUTH='false'
\ No newline at end of file
diff --git a/src/app/router/index.tsx b/src/app/router/index.tsx
index e82522d..2b35dea 100644
--- a/src/app/router/index.tsx
+++ b/src/app/router/index.tsx
@@ -51,7 +51,9 @@ import {
const PublicRoute = ({ children }: { children: React.ReactNode }) => {
const { isAuthenticated } = authStore;
- if (isAuthenticated) {
+ const need_auth = import.meta.env.VITE_NEED_AUTH == "true";
+
+ if (isAuthenticated || !need_auth) {
return ;
}
return <>{children}>;
@@ -59,13 +61,18 @@ const PublicRoute = ({ children }: { children: React.ReactNode }) => {
const ProtectedRoute = ({ children }: { children: React.ReactNode }) => {
const { isAuthenticated } = authStore;
+ const need_auth = import.meta.env.VITE_NEED_AUTH == "true";
+
const location = useLocation();
- if (!isAuthenticated) {
+
+ if (!isAuthenticated && need_auth) {
return ;
}
+
if (location.pathname === "/") {
return ;
}
+
return <>{children}>;
};
diff --git a/src/entities/navigation/ui/index.tsx b/src/entities/navigation/ui/index.tsx
index fb9b91f..3b67622 100644
--- a/src/entities/navigation/ui/index.tsx
+++ b/src/entities/navigation/ui/index.tsx
@@ -33,8 +33,10 @@ export const NavigationItemComponent: React.FC = ({
const [isExpanded, setIsExpanded] = React.useState(false);
const { payload } = authStore;
+ const need_auth = import.meta.env.VITE_NEED_AUTH == "true";
+
// @ts-ignore
- const isAdmin = payload?.is_admin || false;
+ const isAdmin = payload?.is_admin || false || !need_auth;
const isActive = item.path ? location.pathname.startsWith(item.path) : false;
diff --git a/src/pages/Route/LinekedStations.tsx b/src/pages/Route/LinekedStations.tsx
index 01dc597..ebf3491 100644
--- a/src/pages/Route/LinekedStations.tsx
+++ b/src/pages/Route/LinekedStations.tsx
@@ -39,6 +39,7 @@ import {
languageStore,
routeStore,
selectedCityStore,
+ stationsStore,
} from "@shared";
import { EditStationModal } from "../../widgets/modals/EditStationModal";
@@ -185,6 +186,19 @@ const LinkedItemsContentsInner = <
setPosition(linkedItems.length + 1);
}, [linkedItems.length]);
+ const getStationTransfers = (stationId: number, fallbackTransfers?: any) => {
+ const { stationLists } = stationsStore;
+ for (const lang of ["ru", "en", "zh"] as const) {
+ const station = stationLists[lang].data.find(
+ (s: any) => s.id === stationId
+ );
+ if (station?.transfers) {
+ return station.transfers;
+ }
+ }
+ return fallbackTransfers;
+ };
+
const onDragEnd = (result: DropResult) => {
if (!result.destination) return;
@@ -198,7 +212,14 @@ const LinkedItemsContentsInner = <
authInstance
.post(`/${parentResource}/${parentId}/${childResource}`, {
- stations: reorderedItems.map((item) => ({ id: item.id })),
+ stations: reorderedItems.map((item) => {
+ const stationData: any = { id: item.id };
+ const transfers = getStationTransfers(item.id, item.transfers);
+ if (transfers) {
+ stationData.transfers = transfers;
+ }
+ return stationData;
+ }),
})
.catch((error) => {
console.error("Error updating station order:", error);
@@ -245,11 +266,29 @@ const LinkedItemsContentsInner = <
const linkItem = () => {
if (selectedItemId !== null) {
setError(null);
+ const selectedItem = allItems.find((item) => item.id === selectedItemId);
const requestData = {
stations: insertAtPosition(
- linkedItems.map((item) => ({ id: item.id })),
+ linkedItems.map((item) => {
+ const stationData: any = { id: item.id };
+ const transfers = getStationTransfers(item.id, item.transfers);
+ if (transfers) {
+ stationData.transfers = transfers;
+ }
+ return stationData;
+ }),
position,
- { id: selectedItemId }
+ (() => {
+ const newStationData: any = { id: selectedItemId };
+ const transfers = getStationTransfers(
+ selectedItemId,
+ selectedItem?.transfers
+ );
+ if (transfers) {
+ newStationData.transfers = transfers;
+ }
+ return newStationData;
+ })()
),
};
@@ -331,10 +370,25 @@ const LinkedItemsContentsInner = <
setError(null);
setIsLinkingBulk(true);
- const selectedStations = Array.from(selectedItems).map((id) => ({ id }));
+ const selectedStations = Array.from(selectedItems).map((id) => {
+ const item = allItems.find((item) => item.id === id);
+ const stationData: any = { id };
+ const transfers = getStationTransfers(id, item?.transfers);
+ if (transfers) {
+ stationData.transfers = transfers;
+ }
+ return stationData;
+ });
const requestData = {
stations: [
- ...linkedItems.map((item) => ({ id: item.id })),
+ ...linkedItems.map((item) => {
+ const stationData: any = { id: item.id };
+ const transfers = getStationTransfers(item.id, item.transfers);
+ if (transfers) {
+ stationData.transfers = transfers;
+ }
+ return stationData;
+ }),
...selectedStations,
],
};
diff --git a/src/pages/Station/StationListPage/index.tsx b/src/pages/Station/StationListPage/index.tsx
index 1e71e59..4a8d681 100644
--- a/src/pages/Station/StationListPage/index.tsx
+++ b/src/pages/Station/StationListPage/index.tsx
@@ -8,9 +8,14 @@ import {
} from "@shared";
import { useEffect, useState } from "react";
import { observer } from "mobx-react-lite";
-import { Eye, Pencil, Trash2, Minus } from "lucide-react";
+import { Eye, Pencil, Trash2, Minus, Route } from "lucide-react";
import { useNavigate } from "react-router-dom";
-import { CreateButton, DeleteModal, LanguageSwitcher } from "@widgets";
+import {
+ CreateButton,
+ DeleteModal,
+ LanguageSwitcher,
+ EditStationTransfersModal,
+} from "@widgets";
import { Box, CircularProgress } from "@mui/material";
export const StationListPage = observer(() => {
@@ -18,7 +23,11 @@ export const StationListPage = observer(() => {
const navigate = useNavigate();
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
const [isBulkDeleteModalOpen, setIsBulkDeleteModalOpen] = useState(false);
+ const [isTransfersModalOpen, setIsTransfersModalOpen] = useState(false);
const [rowId, setRowId] = useState(null);
+ const [selectedStationId, setSelectedStationId] = useState(
+ null
+ );
const [ids, setIds] = useState([]);
const [isLoading, setIsLoading] = useState(false);
const { language } = languageStore;
@@ -88,7 +97,7 @@ export const StationListPage = observer(() => {
{
field: "actions",
headerName: "Действия",
- width: 140,
+ width: 200,
align: "center",
headerAlign: "center",
sortable: false,
@@ -102,6 +111,15 @@ export const StationListPage = observer(() => {
+