From f3e098ee84b76f5b07b0766ce220e29ffb7dc0bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A2=D0=B8=D0=BC=D1=83=D1=80=20=D0=93=D0=BE=D1=80=D0=BE?= =?UTF-8?q?=D0=B4=D0=B5=D1=86=D0=BA=D0=B8=D0=B9?= Date: Fri, 23 Oct 2026 17:52:12 +0500 Subject: [PATCH] feat: add "back to objects" link on the works page The works page of an object had no way back except the sidebar. The link goes straight to the objects of the same project, so it also works when the page was opened by a direct URL. Co-Authored-By: Claude Opus 5.5 (1M context) --- .../stroyBot/pages/works/WorksPage.module.scss | 14 ++++++++++++++ src/webparts/stroyBot/pages/works/WorksPage.tsx | 4 +++- .../stroyBot/pages/works/WorksPageContent.tsx | 8 +++++++- src/webparts/stroyBot/pages/works/texts.ts | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/webparts/stroyBot/pages/works/WorksPage.module.scss b/src/webparts/stroyBot/pages/works/WorksPage.module.scss index 28ea421..9fca489 100644 --- a/src/webparts/stroyBot/pages/works/WorksPage.module.scss +++ b/src/webparts/stroyBot/pages/works/WorksPage.module.scss @@ -10,6 +10,20 @@ $toggle-size: 20px; width: 100%; } +// «← К объектам» — как «← Вернуться назад» в форме отчёта. +.backLink { + align-self: flex-start; + color: $navy-600; + font-size: $fs-sm; + font-weight: 500; + text-decoration: none; + + &:hover { + color: $navy-900; + text-decoration: underline; + } +} + .container { display: flex; flex-direction: column; diff --git a/src/webparts/stroyBot/pages/works/WorksPage.tsx b/src/webparts/stroyBot/pages/works/WorksPage.tsx index 101f4b4..cc27905 100644 --- a/src/webparts/stroyBot/pages/works/WorksPage.tsx +++ b/src/webparts/stroyBot/pages/works/WorksPage.tsx @@ -8,5 +8,7 @@ import { WorksPageContent } from './WorksPageContent'; */ export const WorksPage: React.FC = () => { const { route } = useRouter(); - return ; + return ( + + ); }; diff --git a/src/webparts/stroyBot/pages/works/WorksPageContent.tsx b/src/webparts/stroyBot/pages/works/WorksPageContent.tsx index fbd82e5..ec367f1 100644 --- a/src/webparts/stroyBot/pages/works/WorksPageContent.tsx +++ b/src/webparts/stroyBot/pages/works/WorksPageContent.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import { Alert, Button, confirmModal, Spinner } from '@tnsu/ui-kit'; import { useAppServices } from '../../app/AppServicesContext'; import { EmptyState } from '../../shared/components/EmptyState'; +import { RouteLink } from '../../app/routing/RouteLink'; import { ContextMenu, IContextMenuItem, IMenuAnchor } from '../_tree/ContextMenu'; import { TreePageHeader } from '../_tree/TreePageHeader'; import { flattenVisible, toggleId } from '../_tree/treeRules'; @@ -28,9 +29,11 @@ const MENU_OFFSET_PX = 4; interface Props { objectId: string; + /** Для ссылки «← К объектам» — объекты того же проекта. */ + projectId: string | undefined; } -export const WorksPageContent: React.FC = ({ objectId }) => { +export const WorksPageContent: React.FC = ({ objectId, projectId }) => { const services = useAppServices(); const repository = React.useMemo( () => @@ -112,6 +115,9 @@ export const WorksPageContent: React.FC = ({ objectId }) => { return (
+ + {WORKS_TEXTS.backToObjects} +
{data.canEdit &&
{addButton(WORKS_TEXTS.addWork)}
} diff --git a/src/webparts/stroyBot/pages/works/texts.ts b/src/webparts/stroyBot/pages/works/texts.ts index 8e9978f..a4737b2 100644 --- a/src/webparts/stroyBot/pages/works/texts.ts +++ b/src/webparts/stroyBot/pages/works/texts.ts @@ -2,6 +2,7 @@ export const WORKS_TEXTS = { defaultHeader: 'ОБЪЕКТЫ ПРОЕКТА', + backToObjects: '← К объектам', addWork: 'Добавить работу', addFirst: '+ Добавить работу', columns: {