-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Workspace Menu #5921
Merged
chiragsalian
merged 33 commits into
Expensify:main
from
mananjadhav:fix/workspace-popup-menu
Nov 30, 2021
Merged
Added Workspace Menu #5921
Changes from 27 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
4d20e55
fix(workspace-popup-menu): Added more options and hide close button b…
mananjadhav 21e630e
Merge branch 'main' of https://github.com/mananjadhav/App into fix/wo…
mananjadhav 713e7a0
fix(wkspace-popup-menu): Added icons and triggers
mananjadhav a39816d
feat(wkspace-popup-menu): Basic version of the popup menu added
mananjadhav 82ea2ca
feat(wkspace-popup-menu): Moved with menu structure and items
mananjadhav e95d231
feat(wkspace-popup-menu): Fixed menu items from header
mananjadhav 19ad6d0
fix(workspace-popup-menu): Added create call
mananjadhav f4dc5c3
fix(wkspace-popup-menu): Changed function call
mananjadhav 409fc3d
feat(wkspace-popup-menu): Made offset to props
mananjadhav 67812fa
Merge branch 'main' of https://github.com/mananjadhav/App into fix/wo…
mananjadhav 06a39c9
fix(wkspace-popup-menu): Discarded extra Header component
mananjadhav ffa5b9c
fix(wkspace-popup-menu): Removed hook and replaced with getPathFromState
mananjadhav 90d0453
fix(wkspace-popup-menu): Changed function component to class component
mananjadhav 0fb02ff
fix(wkspace-popup-menu): Added Confirm delete handling
mananjadhav 6f36f93
fix(wkspace-popup-menu): Fixed keys for Delete modal
mananjadhav 03c0676
fix(wkspace-popup-menu): Added delete policy API
mananjadhav 4b88a10
fix(wkspace-popup-menu): Added comments to the policy
mananjadhav ddced90
Merge branch 'main' of https://github.com/mananjadhav/App into fix/wo…
mananjadhav 6a3b23d
fix(wkspace-popup-menu): Converted from function to class component
mananjadhav 9dbfbf1
fix(wkspace-popup-menu): Fixed create and delete functions
mananjadhav c38131f
fix(wkspace-popup-menu): Added growl on delete success
mananjadhav ea91fbb
fix(wkspace-popup-menu): Changed PopoverMenu component
mananjadhav 9492c40
fix(wkspace-popup-menu): Code cleanup
mananjadhav c62b284
fix(wkspace-popup-menu): code cleanup
mananjadhav 4057e10
fix(wkspace-popup-menu): code cleanup
mananjadhav 27891cf
Merge branch 'fix/workspace-popup-menu' of https://github.com/mananja…
mananjadhav 4eadb71
fix(wkspace-popup-menu): Fixed Item onSelected
mananjadhav 20ea9d2
Merge branch 'main' of https://github.com/mananjadhav/App into fix/wo…
mananjadhav d50cdd9
fix(wkspace-popup-menu): Fixed lint issues and typos
mananjadhav 89d35b5
fix(wkspace-popup-menu): Removed extra params from deletePolicy
mananjadhav f9a0bcc
Merge branch 'main' of https://github.com/mananjadhav/App into fix/wo…
mananjadhav 5d37753
fix(wkspace-popup-menu): Lint fixes
mananjadhav 39d8a14
fix(wkspace-popup-menu): Removed Navigation.dismissModal
mananjadhav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
11 changes: 11 additions & 0 deletions
11
src/components/ThreeDotsMenu/ThreeDotsMenuItemPropTypes.js
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,11 @@ | ||
import PropTypes from 'prop-types'; | ||
|
||
|
||
const menuItemProps = PropTypes.arrayOf(PropTypes.shape({ | ||
icon: PropTypes.oneOfType([PropTypes.elementType, PropTypes.string]), | ||
text: PropTypes.string, | ||
onPress: PropTypes.func, | ||
})); | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. delete extra line break |
||
export default menuItemProps; |
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,112 @@ | ||
import React, {Component} from 'react'; | ||
import { | ||
View, Pressable, | ||
} from 'react-native'; | ||
import PropTypes from 'prop-types'; | ||
import Icon from '../Icon'; | ||
import PopoverMenu from '../PopoverMenu'; | ||
import styles from '../../styles/styles'; | ||
import withLocalize, {withLocalizePropTypes} from '../withLocalize'; | ||
import Tooltip from '../Tooltip'; | ||
import {ThreeDots} from '../Icon/Expensicons'; | ||
import ThreeDotsMenuItemPropTypes from './ThreeDotsMenuItemPropTypes'; | ||
|
||
const propTypes = { | ||
...withLocalizePropTypes, | ||
|
||
/** Tooltip for the popup icon */ | ||
iconTooltip: PropTypes.string, | ||
|
||
/** icon for the popup trigger */ | ||
icon: PropTypes.oneOfType([PropTypes.elementType, PropTypes.string]), | ||
|
||
/** Any additional styles to pass to the icon container. */ | ||
iconStyles: PropTypes.arrayOf(PropTypes.object), | ||
|
||
/** The fill color to pass into the icon. */ | ||
iconFill: PropTypes.string, | ||
|
||
/** Function to call on icon press */ | ||
onIconPress: PropTypes.func, | ||
|
||
/** menuItems that'll show up on toggle of the popup menu */ | ||
menuItems: ThreeDotsMenuItemPropTypes.isRequired, | ||
|
||
/** The anchor position of the menu */ | ||
anchorPosition: PropTypes.shape({ | ||
top: PropTypes.number, | ||
right: PropTypes.number, | ||
bottom: PropTypes.number, | ||
left: PropTypes.number, | ||
}).isRequired, | ||
}; | ||
|
||
const defaultProps = { | ||
iconTooltip: 'common.more', | ||
iconFill: undefined, | ||
iconStyles: [], | ||
icon: ThreeDots, | ||
onIconPress: () => {}, | ||
}; | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a line break should just be 1 line break and not 2. Remove the extra line break. |
||
class ThreeDotsMenu extends Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.togglePopupMenu = this.togglePopupMenu.bind(this); | ||
this.state = { | ||
isPopupMenuVisible: false, | ||
}; | ||
} | ||
|
||
/** | ||
* Toggles the popup menu visibility | ||
*/ | ||
togglePopupMenu() { | ||
this.setState(prevState => ({ | ||
isPopupMenuVisible: !prevState.isPopupMenuVisible, | ||
})); | ||
} | ||
|
||
render() { | ||
return ( | ||
<> | ||
<View> | ||
<Tooltip text={this.props.translate(this.props.iconTooltip)}> | ||
<Pressable | ||
onPress={() => { | ||
this.togglePopupMenu(); | ||
if (this.props.onIconPress) { | ||
this.props.onIconPress(); | ||
} | ||
}} | ||
style={[styles.touchableButtonImage, ...this.props.iconStyles]} | ||
> | ||
<Icon | ||
src={this.props.icon} | ||
fill={this.props.iconFill} | ||
/> | ||
</Pressable> | ||
</Tooltip> | ||
</View> | ||
<PopoverMenu | ||
onClose={this.togglePopupMenu} | ||
isVisible={this.state.isPopupMenuVisible} | ||
anchorPosition={this.props.anchorPosition} | ||
onItemSelected={() => this.togglePopupMenu()} | ||
animationIn="fadeInDown" | ||
animationOut="fadeOutUp" | ||
menuItems={this.props.menuItems} | ||
/> | ||
</> | ||
); | ||
} | ||
} | ||
|
||
ThreeDotsMenu.propTypes = propTypes; | ||
ThreeDotsMenu.defaultProps = defaultProps; | ||
ThreeDotsMenu.displayName = 'ThreeDotsMenu'; | ||
export default withLocalize(ThreeDotsMenu); | ||
|
||
export {ThreeDotsMenuItemPropTypes}; |
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete extra line break