-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mobile): explorer create/rename operation
- Loading branch information
Showing
34 changed files
with
877 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,4 @@ export { | |
}; | ||
|
||
export { Menu, MenuItem, MenuSeparator, MenuSub, MenuTrigger }; | ||
export * from './mobile/hook'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useCallback, useContext } from 'react'; | ||
|
||
import { MobileMenuContext } from './context'; | ||
|
||
export const useMobileMenuController = () => { | ||
const context = useContext(MobileMenuContext); | ||
|
||
/** | ||
* **A workaround to close mobile menu manually** | ||
* By default, it will close automatically when `MenuItem` clicked. | ||
* For custom menu content, you can use this method to close the menu. | ||
*/ | ||
const close = useCallback(() => { | ||
context.setOpen?.(false); | ||
}, [context]); | ||
|
||
return { close }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
packages/frontend/core/src/mobile/components/explorer/nodes/collection/dialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { useI18n } from '@affine/i18n'; | ||
|
||
import { | ||
RenameDialog, | ||
type RenameDialogProps, | ||
RenameSubMenu, | ||
type RenameSubMenuProps, | ||
} from '../../../rename'; | ||
|
||
export const CollectionRenameSubMenu = ({ | ||
title, | ||
text, | ||
...props | ||
}: RenameSubMenuProps) => { | ||
const t = useI18n(); | ||
return ( | ||
<RenameSubMenu | ||
title={title || t['com.affine.m.explorer.collection.rename-menu-title']()} | ||
text={text || t['com.affine.m.explorer.collection.rename']()} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
|
||
const CollectionDesc = () => { | ||
const t = useI18n(); | ||
return t['com.affine.collection.emptyCollectionDescription'](); | ||
}; | ||
|
||
export const CollectionRenameDialog = ({ | ||
title, | ||
confirmText, | ||
...props | ||
}: RenameDialogProps) => { | ||
return ( | ||
<RenameDialog | ||
title={title} | ||
confirmText={confirmText} | ||
{...props} | ||
descRenderer={CollectionDesc} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/frontend/core/src/mobile/components/explorer/nodes/doc/dialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { useI18n } from '@affine/i18n'; | ||
|
||
import { RenameSubMenu, type RenameSubMenuProps } from '../../../rename'; | ||
|
||
export const DocRenameSubMenu = ({ title, text }: RenameSubMenuProps) => { | ||
const t = useI18n(); | ||
return ( | ||
<RenameSubMenu | ||
title={title || t['com.affine.m.explorer.doc.rename']()} | ||
text={text || t['com.affine.m.explorer.doc.rename']()} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.