Skip to content

Commit 92fe786

Browse files
committed
Menu changes
1 parent d20b0d2 commit 92fe786

File tree

9 files changed

+68
-15
lines changed

9 files changed

+68
-15
lines changed

apps/webapp/src/Components/CreateTodoModal/TaskEditor/styled.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ModalSection } from '../../../Style/Refactor'
77
export const TaskEditorWrapper = styled.section<{ withMaxHeight?: boolean }>`
88
padding: ${({ theme }) => theme.spacing.medium};
99
border-radius: ${({ theme }) => theme.borderRadius.small};
10-
background: ${({ theme }) => theme.tokens.surfaces.app};
10+
background-color: ${({ theme }) => theme.tokens.surfaces.s[0]};
1111
margin: ${({ theme }) => theme.spacing.large} 0;
1212
${({ withMaxHeight }) => withMaxHeight && `height: 22vh;`}
1313
max-height: 24vh;

apps/webapp/src/Components/Modals/CreateTodoModal.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Button, DisplayShortcut, LoadingButton } from '@workduck-io/mex-compone
1010
import { tinykeys } from '@workduck-io/tinykeys'
1111

1212
import { getDefaultContent, ModalsType, mog, useModalStore } from '@mexit/core'
13-
import { DefaultMIcons, IconDisplay, InsertMenu, PrimaryText } from '@mexit/shared'
13+
import { DefaultMIcons, IconDisplay, InsertMenu, MexIcon, PrimaryText } from '@mexit/shared'
1414

1515
import useUpdateBlock from '../../Editor/Hooks/useUpdateBlock'
1616
import { useApi } from '../../Hooks/API/useNodeAPI'
@@ -157,6 +157,14 @@ const CreateTodoModal = ({ children }) => {
157157
?
158158
</Title>
159159
</Group>
160+
<MexIcon
161+
color={theme.tokens.text.fade}
162+
$cursor
163+
height={24}
164+
width={24}
165+
icon={DefaultMIcons.CLEAR.value}
166+
onClick={onRequestClose}
167+
/>
160168
</Header>
161169
<DeletionWarning>
162170
<Group>

apps/webapp/src/Components/Modals/DeleteSpaceModal/index.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ import { tinykeys } from '@workduck-io/tinykeys'
99

1010
import {
1111
API,
12-
DefaultMIcons,
1312
ModalsType,
1413
useDataStore,
1514
useLayoutStore,
1615
useModalStore,
1716
userPreferenceStore as useUserPreferenceStore
1817
} from '@mexit/core'
19-
import { Group, IconDisplay, PrimaryText } from '@mexit/shared'
18+
import { DefaultMIcons, Group, IconDisplay, MexIcon, PrimaryText } from '@mexit/shared'
2019

2120
import { useNamespaceApi } from '../../../Hooks/API/useNamespaceAPI'
2221
import { useNamespaces } from '../../../Hooks/useNamespaces'
@@ -116,6 +115,14 @@ const DeleteSpaceModal = () => {
116115
?
117116
</Title>
118117
</Group>
118+
<MexIcon
119+
color={theme.tokens.text.fade}
120+
$cursor
121+
height={24}
122+
width={24}
123+
icon={DefaultMIcons.CLEAR.value}
124+
onClick={onRequestClose}
125+
/>
119126
</Header>
120127
<DeletionWarning>
121128
All (<PrimaryText>{notesSize}</PrimaryText>) Note(s) created within this Space will be permanently deleted.{' '}

apps/webapp/src/Components/Refactor/DeleteModal.tsx

+17-4
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@ import { useLocation } from 'react-router-dom'
44

55
import archiveLine from '@iconify/icons-ri/archive-line'
66
import { Icon } from '@iconify/react'
7+
import { useTheme } from 'styled-components'
78
import create from 'zustand'
89

910
import { Button, DisplayShortcut, PrimaryButton } from '@workduck-io/mex-components'
1011
import { tinykeys } from '@workduck-io/tinykeys'
1112

1213
import { isReserved, RefactorPath, useEditorStore, useHelpStore } from '@mexit/core'
13-
import { isOnEditableElement } from '@mexit/shared'
14+
import { DefaultMIcons, isOnEditableElement, MexIcon } from '@mexit/shared'
1415

1516
import { useKeyListener } from '../../Hooks/useChangeShortcutListener'
1617
import { useDelete } from '../../Hooks/useDelete'
1718
import { useEditorBuffer } from '../../Hooks/useEditorBuffer'
1819
import { NavigationType, ROUTE_PATHS, useRouting } from '../../Hooks/useRouting'
19-
import { DeleteIcon, MockRefactorMap, ModalControls, ModalHeader, MRMHead, MRMRow } from '../../Style/Refactor'
20+
import { DeleteIcon, MockRefactorMap, ModalControls, MRMHead, MRMRow } from '../../Style/Refactor'
21+
import { Header, Title } from '../Modals/DeleteSpaceModal/styled'
2022
import { QuickLink, WrappedNodeSelect } from '../NodeSelect/NodeSelect'
2123

2224
interface DeleteStoreState {
@@ -63,8 +65,9 @@ const Delete = () => {
6365
const { getMockArchive, execArchive } = useDelete()
6466
const shortcuts = useHelpStore((store) => store.shortcuts)
6567

66-
const location = useLocation()
68+
const theme = useTheme()
6769
const { goTo } = useRouting()
70+
const location = useLocation()
6871

6972
const openModal = useDeleteStore((store) => store.openModal)
7073
const closeModal = useDeleteStore((store) => store.closeModal)
@@ -141,7 +144,17 @@ const Delete = () => {
141144

142145
return (
143146
<Modal className="ModalContent" overlayClassName="ModalOverlay" onRequestClose={closeModal} isOpen={open}>
144-
<ModalHeader>Archive</ModalHeader>
147+
<Header>
148+
<Title>Archive</Title>
149+
<MexIcon
150+
color={theme.tokens.text.fade}
151+
$cursor
152+
height={24}
153+
width={24}
154+
icon={DefaultMIcons.CLEAR.value}
155+
onClick={closeModal}
156+
/>
157+
</Header>
145158
<WrappedNodeSelect
146159
autoFocusSelectAll
147160
autoFocus

apps/webapp/src/Components/Template/TemplateModal.tsx

+20-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import { useForm } from 'react-hook-form'
33
import toast from 'react-hot-toast'
44
import Modal from 'react-modal'
55

6+
import { useTheme } from 'styled-components'
7+
68
import { LoadingButton, Title } from '@workduck-io/mex-components'
79

810
import { API, ModalsType, mog, Snippet, useMetadataStore, useModalStore, useSnippetStore } from '@mexit/core'
9-
import { ButtonFields, TemplateContainer } from '@mexit/shared'
11+
import { ButtonFields, DefaultMIcons, FlexBetween, MexIcon, TemplateContainer } from '@mexit/shared'
1012

1113
import { defaultContent } from '../../Data/baseData'
1214
import EditorPreviewRenderer from '../../Editor/EditorPreviewRenderer'
@@ -18,6 +20,7 @@ import SidebarList from '../Sidebar/SidebarList'
1820
import { RemovalButton } from './TemplateModal.styles'
1921

2022
const TemplateModal = () => {
23+
const theme = useTheme()
2124
const { getILinkFromNodeid } = useLinks()
2225
const { toggleOpen, open, data } = useModalStore()
2326

@@ -93,18 +96,32 @@ const TemplateModal = () => {
9396
toggleOpen(ModalsType.template)
9497
}
9598

99+
const onRequestClose = () => {
100+
toggleOpen(ModalsType.template)
101+
}
102+
96103
return (
97104
<Modal
98105
className="ModalContent"
99106
overlayClassName="ModalOverlay"
100-
onRequestClose={() => toggleOpen(ModalsType.template)}
107+
onRequestClose={onRequestClose}
101108
isOpen={open === ModalsType.template}
102109
>
103110
<InviteWrapper>
104111
{templates.length !== 0 ? (
105112
!currentTemplate ? (
106113
<>
107-
<Title>Set Template for {getTitleFromPath(node?.path)}</Title>
114+
<FlexBetween>
115+
<Title>Set Template for {getTitleFromPath(node?.path)}</Title>
116+
<MexIcon
117+
color={theme.tokens.text.fade}
118+
$cursor
119+
height={24}
120+
width={24}
121+
icon={DefaultMIcons.CLEAR.value}
122+
onClick={onRequestClose}
123+
/>
124+
</FlexBetween>
108125
<p>Auto fill new notes using template</p>
109126
</>
110127
) : (

apps/webapp/src/Components/Todo/Todo.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const TodoBase = ({
9696
return (
9797
<TodoContainer
9898
key={`BasicTodo_${todo.nodeid}_${todo.id}_${oid}`}
99-
id={`BasicTodo_${todo.nodeid}_${todo.id}_${oid}`}
99+
id="mexit-todo-container"
100100
checked={todo?.metadata.status === TodoStatus.completed}
101101
>
102102
<CheckBoxWrapper id={`TodoStatusFor_${todo.id}_${oid}`} contentEditable={false}>

libs/shared/src/Components/AIPreview/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const AIPreviewContainer: React.FC<AIPreviewProps> = (props) => {
133133
Replace
134134
</StyledButton>
135135
)}
136-
<InsertMenu root={props.root} isMenu={props.insertInNote} onClick={handleOnInsert} />
136+
<InsertMenu type="modal" root={props.root} isMenu={props.insertInNote} onClick={handleOnInsert} />
137137
</Group>
138138
</AIContainerFooter>
139139
</StyledAIContainer>

libs/shared/src/Components/FloatingElements/Autocomplete.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ export const AutoComplete: React.FC<AutoCompleteProps> = (props) => {
169169
{open && items.length > 0 && !disableMenu && (
170170
<FloatingFocusManager context={context} initialFocus={-1} visuallyHiddenDismiss>
171171
<AutoCompleteSuggestions
172+
type="modal"
172173
{...getFloatingProps({
173174
className: MenuClassName,
174175
ref: refs.setFloating,

libs/shared/src/Components/FloatingElements/Dropdown.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,13 @@ export const MenuComponent = forwardRef<any, Props & React.HTMLProps<HTMLButtonE
192192
const { x, y, reference, floating, strategy, refs, context } = useFloating<HTMLButtonElement>({
193193
open,
194194
onOpenChange: setOpen,
195-
middleware: [offset({ mainAxis: 4, alignmentAxis: nested ? -5 : 0 }), flip(), shift()],
195+
middleware: [
196+
offset({ mainAxis: 4, alignmentAxis: nested ? -5 : 0 }),
197+
flip(),
198+
shift({
199+
padding: 25
200+
})
201+
],
196202
placement: nested ? 'right-start' : 'bottom-start',
197203
nodeId
198204
// whileElementsMounted: autoUpdate
@@ -216,7 +222,8 @@ export const MenuComponent = forwardRef<any, Props & React.HTMLProps<HTMLButtonE
216222
ignoreMouse: nested
217223
}),
218224
useDismiss(context, {
219-
escapeKey: true
225+
escapeKey: true,
226+
bubbles: false
220227
}),
221228
useListNavigation(context, {
222229
listRef: listItemsRef,

0 commit comments

Comments
 (0)