feat: refine mobile dashboard experience
This commit is contained in:
1 parent
9f0969ec22
commit
315520beca
116 files changed
+2499
-586
No files matched your search
@@ -25,6 +25,7 @@ interface BoardItemContentProps {
|
||||
item: SectionItem;
|
||||
displayMode?: WidgetDisplayMode;
|
||||
disableContextMenu?: boolean;
|
||||
isReadOnly?: boolean;
|
||||
widgetStateRef?: MutableRefObject<Record<string, unknown> | null>;
|
||||
}
|
||||
|
||||
@@ -38,6 +39,7 @@ export const BoardItemContent = ({
|
||||
item,
|
||||
displayMode = "default",
|
||||
disableContextMenu = false,
|
||||
isReadOnly = false,
|
||||
widgetStateRef: externalWidgetStateRef,
|
||||
}: BoardItemContentProps) => {
|
||||
const { ref, width, height } = useElementSize<HTMLDivElement>();
|
||||
@@ -69,6 +71,7 @@ export const BoardItemContent = ({
|
||||
width={width}
|
||||
height={height}
|
||||
displayMode={displayMode}
|
||||
isReadOnly={isReadOnly}
|
||||
widgetStateRef={widgetStateRef}
|
||||
/>
|
||||
</Card>
|
||||
@@ -87,9 +90,8 @@ export const BoardItemContent = ({
|
||||
<Badge
|
||||
pos="absolute"
|
||||
// It's 4 because of the mantine-react-table that has z-index 3
|
||||
style={{ zIndex: 4 }}
|
||||
style={{ zIndex: 4, insetInlineStart: 16 }}
|
||||
top={2}
|
||||
left={16}
|
||||
size="xs"
|
||||
radius={board.itemRadius}
|
||||
styles={{
|
||||
@@ -113,10 +115,11 @@ interface InnerContentProps {
|
||||
width: number;
|
||||
height: number;
|
||||
displayMode: WidgetDisplayMode;
|
||||
isReadOnly: boolean;
|
||||
widgetStateRef: MutableRefObject<Record<string, unknown> | null>;
|
||||
}
|
||||
|
||||
const InnerContent = ({ item, displayMode, ...dimensions }: InnerContentProps) => {
|
||||
const InnerContent = ({ item, displayMode, isReadOnly, ...dimensions }: InnerContentProps) => {
|
||||
const settings = useSettings();
|
||||
const board = useRequiredBoard();
|
||||
const [isEditMode] = useEditMode();
|
||||
@@ -141,7 +144,7 @@ const InnerContent = ({ item, displayMode, ...dimensions }: InnerContentProps) =
|
||||
}}
|
||||
fallbackRender={({ resetErrorBoundary, error }) => (
|
||||
<>
|
||||
<BoardItemMenu offset={4} item={newItem} resetErrorBoundary={resetErrorBoundary} />
|
||||
{!isReadOnly && <BoardItemMenu offset={4} item={newItem} resetErrorBoundary={resetErrorBoundary} />}
|
||||
<WidgetError kind={item.kind} error={error} resetErrorBoundary={resetErrorBoundary} />
|
||||
</>
|
||||
)}
|
||||
@@ -154,21 +157,23 @@ const InnerContent = ({ item, displayMode, ...dimensions }: InnerContentProps) =
|
||||
(!("integrationsRequired" in definition) || definition.integrationsRequired !== false)
|
||||
}
|
||||
/>
|
||||
<BoardItemMenu offset={4} item={newItem} />
|
||||
{!isReadOnly && <BoardItemMenu offset={4} item={newItem} />}
|
||||
<Comp
|
||||
options={options as never}
|
||||
integrationIds={item.integrationIds}
|
||||
isEditMode={isEditMode}
|
||||
boardId={board.id}
|
||||
itemId={item.id}
|
||||
setOptions={(partialNewOptions) =>
|
||||
isReadOnly={isReadOnly}
|
||||
setOptions={(partialNewOptions) => {
|
||||
if (isReadOnly) return;
|
||||
updateOptions({
|
||||
newOptions: {
|
||||
...options,
|
||||
...partialNewOptions.newOptions,
|
||||
},
|
||||
})
|
||||
}
|
||||
});
|
||||
}}
|
||||
displayMode={displayMode}
|
||||
{...dimensions}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user