UI - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: выравнивание home-шапки и системных уведомлений

This commit is contained in:
DCCONSTRUCTIONS
2026-04-26 11:52:29 +03:00
parent ba996998e8
commit 8b5f15333a
9 changed files with 109 additions and 110 deletions
@@ -57,6 +57,11 @@ export const HOME_WIDGETS_LIST: {
fullWidth: false,
title: "stickies.title",
},
project_latest_issues: {
component: null,
fullWidth: true,
title: "Последние задачи проекта",
},
new_at_plane: {
component: null,
fullWidth: false,
@@ -164,6 +169,7 @@ export const DashboardWidgets = observer(function DashboardWidgets(props: Dashbo
const isRecentsEnabled = !!widgetsMap.recents?.is_enabled;
const isQuickLinksEnabled = !!widgetsMap.quick_links?.is_enabled;
const isStickiesEnabled = !!widgetsMap.my_stickies?.is_enabled;
const isProjectLatestIssuesEnabled = widgetsMap.project_latest_issues?.is_enabled ?? true;
const hasSecondaryWidgets = isQuickLinksEnabled || isStickiesEnabled;
if (!workspaceSlugValue) return null;
@@ -199,6 +205,14 @@ export const DashboardWidgets = observer(function DashboardWidgets(props: Dashbo
handleOnClose={() => toggleWidgetSettings(false)}
/>
<HomePageHeader
currentUser={currentUser}
selectedProject={selectedProject}
selectedProjectAnalytics={selectedProjectAnalytics}
recents={workspaceRecents}
workspaceName={currentWorkspace?.name}
/>
<div className="nodedc-home-dashboard-grid grid xl:grid-cols-[minmax(320px,360px)_minmax(0,1fr)] xl:items-stretch">
<div className="flex min-w-0">
<HomeProjectStack
@@ -212,13 +226,6 @@ export const DashboardWidgets = observer(function DashboardWidgets(props: Dashbo
/>
</div>
<div className="nodedc-home-main-column min-w-0">
<HomePageHeader
currentUser={currentUser}
selectedProject={selectedProject}
selectedProjectAnalytics={selectedProjectAnalytics}
recents={workspaceRecents}
workspaceName={currentWorkspace?.name}
/>
<HomeGanttPreview
project={selectedProject}
analytics={selectedProjectAnalytics}
@@ -252,7 +259,9 @@ export const DashboardWidgets = observer(function DashboardWidgets(props: Dashbo
/>
</div>
<HomeRecentIssueDecks project={selectedProject} workspaceSlug={workspaceSlugValue} />
{isProjectLatestIssuesEnabled && (
<HomeRecentIssueDecks project={selectedProject} workspaceSlug={workspaceSlugValue} />
)}
<div className="space-y-5">
{!isWikiApp && <NoProjectsEmptyState />}
@@ -31,6 +31,16 @@ import { HOME_WIDGETS_LIST } from "../../home-dashboard-widgets";
import { WidgetItemDragHandle } from "./widget-item-drag-handle";
import { getCanDrop, getInstructionFromPayload } from "./widget.helpers";
const WIDGET_TITLE_FALLBACKS: Record<string, string> = {
"home.project_latest_issues.title": "Последние задачи проекта",
my_stickies: "Ваши стикеры",
new_at_plane: "Новое в NODE.DC",
project_latest_issues: "Последние задачи проекта",
quick_links: "Быстрые ссылки",
quick_tutorial: "Быстрое обучение",
recents: "Недавние",
};
type Props = {
widgetId: string;
isLastChild: boolean;
@@ -53,6 +63,11 @@ export const WidgetItem = observer(function WidgetItem(props: Props) {
// derived values
const widget = widgetsMap[widgetId];
const widgetTitle = HOME_WIDGETS_LIST[widget.key]?.title;
const translatedWidgetTitle = widgetTitle ? t(widgetTitle, { count: 1 }) : undefined;
const widgetLabel =
!translatedWidgetTitle || translatedWidgetTitle === widgetTitle
? (WIDGET_TITLE_FALLBACKS[widgetTitle ?? ""] ?? WIDGET_TITLE_FALLBACKS[widget.key] ?? widget.key)
: translatedWidgetTitle;
// drag and drop
useEffect(() => {
@@ -76,7 +91,7 @@ export const WidgetItem = observer(function WidgetItem(props: Props) {
getOffset: pointerOutsideOfPreview({ x: "0px", y: "0px" }),
render: ({ container }) => {
const root = createRoot(container);
root.render(<div className="rounded-sm bg-surface-1 p-1 pr-2 text-13">{widget.key}</div>);
root.render(<div className="rounded-sm bg-surface-1 p-1 pr-2 text-13">{widgetLabel}</div>);
return () => root.unmount();
},
nativeSetDragImage,
@@ -118,7 +133,7 @@ export const WidgetItem = observer(function WidgetItem(props: Props) {
})
);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [elementRef?.current, isDragging, isLastChild, widget.key]);
}, [elementRef?.current, isDragging, isLastChild, widget.key, widgetLabel]);
return (
<div className="">
@@ -134,7 +149,7 @@ export const WidgetItem = observer(function WidgetItem(props: Props) {
>
<div className="flex items-center">
<WidgetItemDragHandle sort_order={widget.sort_order} isDragging={isDragging} />
<div>{t(widgetTitle, { count: 1 })}</div>
<div>{widgetLabel}</div>
</div>
<ToggleSwitch
value={widget.is_enabled}