feat(ui): add situational tips system (#6648)
This commit is contained in:
1 parent
3c2f95d529
commit
f0f9539466
20 files changed
+694
-493
No files matched your search
@@ -18,10 +18,11 @@ export interface CreateItemInput {
|
||||
integrationIds?: string[];
|
||||
targetSectionId?: string;
|
||||
advancedOptions?: BoardItemAdvancedOptions;
|
||||
size?: { width: number; height: number };
|
||||
}
|
||||
|
||||
export const createItemCallback =
|
||||
({ id, kind, options = {}, integrationIds = [], targetSectionId, advancedOptions }: CreateItemInput) =>
|
||||
({ id, kind, options = {}, integrationIds = [], targetSectionId, advancedOptions, size }: CreateItemInput) =>
|
||||
(previous: Board): Board => {
|
||||
const firstCanvasSection = previous.sections
|
||||
.filter(
|
||||
@@ -40,10 +41,10 @@ export const createItemCallback =
|
||||
|
||||
if (!targetSection) return previous;
|
||||
|
||||
let itemLayouts = createItemLayouts(previous, targetSection, kind);
|
||||
let itemLayouts = createItemLayouts(previous, targetSection, kind, size);
|
||||
if (itemLayouts.length === 0 && firstCanvasSection && targetSection.id !== firstCanvasSection.id) {
|
||||
targetSection = firstCanvasSection;
|
||||
itemLayouts = createItemLayouts(previous, targetSection, kind);
|
||||
itemLayouts = createItemLayouts(previous, targetSection, kind, size);
|
||||
}
|
||||
if (itemLayouts.length === 0) return previous;
|
||||
const widget = {
|
||||
@@ -74,9 +75,10 @@ const createItemLayouts = (
|
||||
board: Board,
|
||||
currentSection: EmptySection | ContainerSection,
|
||||
kind: WidgetKind,
|
||||
requestedSize?: { width: number; height: number },
|
||||
): ItemLayout[] => {
|
||||
const layouts = getBoardLayouts(board);
|
||||
const itemSize = getWidgetItemSize(kind);
|
||||
const itemSize = requestedSize ?? getWidgetItemSize(kind);
|
||||
|
||||
return layouts.flatMap((layoutId) => {
|
||||
const boardLayout = board.layouts.find((layout) => layout.id === layoutId);
|
||||
|
||||
@@ -382,7 +382,7 @@ const LoadedBoardItemContent = ({
|
||||
className={itemContentClasses.advancedFocusTrigger}
|
||||
aria-expanded={isAdvanced}
|
||||
aria-controls={isAdvanced ? advancedViewId : undefined}
|
||||
aria-keyshortcuts="Shift+Enter"
|
||||
aria-keyshortcuts="Shift+Control Shift+Meta"
|
||||
data-advanced-focus-trigger
|
||||
onClick={openAdvancedView}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user