UI - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: выравнивание home-шапки и системных уведомлений
This commit is contained in:
@@ -34,9 +34,7 @@ class WorkspaceHomePreferenceViewSet(BaseAPIView):
|
||||
if key not in ["quick_tutorial", "new_at_plane"]
|
||||
]
|
||||
|
||||
sort_order_counter = 1
|
||||
|
||||
for preference in keys:
|
||||
for sort_order_counter, preference in enumerate(keys, start=1):
|
||||
if preference not in get_preference.values_list("key", flat=True):
|
||||
create_preference_keys.append(preference)
|
||||
|
||||
@@ -55,7 +53,6 @@ class WorkspaceHomePreferenceViewSet(BaseAPIView):
|
||||
batch_size=10,
|
||||
ignore_conflicts=True,
|
||||
)
|
||||
sort_order_counter += 1
|
||||
|
||||
preference = WorkspaceHomePreference.objects.filter(user=request.user, workspace_id=workspace.id)
|
||||
|
||||
|
||||
@@ -380,6 +380,7 @@ class WorkspaceHomePreference(BaseModel):
|
||||
QUICK_LINKS = "quick_links", "Quick Links"
|
||||
RECENTS = "recents", "Recents"
|
||||
MY_STICKIES = "my_stickies", "My Stickies"
|
||||
PROJECT_LATEST_ISSUES = "project_latest_issues", "Project Latest Issues"
|
||||
NEW_AT_PLANE = "new_at_plane", "New at Plane"
|
||||
QUICK_TUTORIAL = "quick_tutorial", "Quick Tutorial"
|
||||
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -1792,32 +1792,17 @@
|
||||
|
||||
.nodedc-home-route-surface {
|
||||
min-height: 100vh;
|
||||
background: #333333 !important;
|
||||
background: var(--background-color-surface-1) !important;
|
||||
}
|
||||
|
||||
main:has(.nodedc-home-route-surface) {
|
||||
background: #333333 !important;
|
||||
background: var(--background-color-surface-1) !important;
|
||||
}
|
||||
|
||||
.nodedc-home-page-shell {
|
||||
max-width: min(1840px, calc(100vw - 5rem));
|
||||
}
|
||||
|
||||
.nodedc-home-top-toolbar > .nodedc-glass-modal {
|
||||
max-width: min(1840px, calc(100vw - 5rem));
|
||||
margin-inline: auto;
|
||||
border: 0 !important;
|
||||
background: transparent !important;
|
||||
padding-inline: 0 !important;
|
||||
box-shadow: none !important;
|
||||
-webkit-backdrop-filter: none !important;
|
||||
backdrop-filter: none !important;
|
||||
}
|
||||
|
||||
.nodedc-home-top-toolbar {
|
||||
padding-inline: 0 !important;
|
||||
}
|
||||
|
||||
.nodedc-home-dashboard-shell {
|
||||
gap: 0.75rem;
|
||||
}
|
||||
@@ -1833,8 +1818,8 @@
|
||||
}
|
||||
|
||||
.nodedc-home-project-panel {
|
||||
margin-top: 1.75rem;
|
||||
height: calc(100% - 1.75rem) !important;
|
||||
margin-top: 0;
|
||||
height: 100% !important;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
@@ -1879,7 +1864,7 @@
|
||||
display: grid;
|
||||
min-width: 0;
|
||||
position: relative;
|
||||
min-height: 8.55rem;
|
||||
min-height: 11.1rem;
|
||||
}
|
||||
|
||||
@media (min-width: 1280px) {
|
||||
@@ -1894,13 +1879,13 @@
|
||||
inset: 0;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
min-height: 8.55rem;
|
||||
min-height: 11.1rem;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
border-radius: 1.7rem;
|
||||
background: #474747 !important;
|
||||
padding: 1.25rem;
|
||||
padding-right: max(1.25rem, calc(100% - var(--nodedc-home-title-width)));
|
||||
padding: 1.6rem 1.35rem;
|
||||
padding-right: max(1.35rem, calc(100% - var(--nodedc-home-title-width)));
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035) !important;
|
||||
}
|
||||
|
||||
@@ -1963,12 +1948,12 @@
|
||||
display: flex;
|
||||
width: auto;
|
||||
min-width: 0;
|
||||
min-height: 8.55rem;
|
||||
min-height: 11.1rem;
|
||||
align-items: flex-end;
|
||||
gap: 1rem;
|
||||
border-radius: 1.7rem !important;
|
||||
background: rgb(var(--nodedc-card-active-rgb)) !important;
|
||||
padding: 1rem;
|
||||
padding: 1.35rem 1.15rem;
|
||||
color: rgb(var(--nodedc-on-card-active-rgb));
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.42),
|
||||
|
||||
Reference in New Issue
Block a user