-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Handle navigation for Tasks Page #17322
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
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
9d2a5e4
Add new Task Beta
thienlnam 78c2316
Update CONST.js
thienlnam f1f5ae3
handle all the new page linking
thienlnam 0298aef
show in FAB
thienlnam 8fa6b58
add new page for creating tasks
thienlnam 933411c
update copy
thienlnam b62bbe2
allow task to be created from within DM
thienlnam 0d5efaa
update methods to be called menuItemOptions
thienlnam 399da8a
update tests to include tasks
thienlnam 9af275a
Merge branch 'main' into jack-createTask
thienlnam 8f59e8f
fix icons
thienlnam 0060b84
add translations
thienlnam 0e0cf20
copy / fix bug
thienlnam 957016c
revert changes to money request options
thienlnam 1906acc
more reverts
thienlnam 5d1ef62
test reverts / update translations
thienlnam a842d2b
clean up logic for determining if we should show task
thienlnam 6646909
add new icon, update translations
thienlnam d3b2914
remove unused reports
thienlnam 8663c78
Merge branch 'main' into jack-createTask
thienlnam 0223811
add permission
thienlnam 31e980c
Add note
thienlnam 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,96 @@ | ||
| import React from 'react'; | ||
| import {View} from 'react-native'; | ||
| import {withOnyx} from 'react-native-onyx'; | ||
| import PropTypes from 'prop-types'; | ||
| import withLocalize, {withLocalizePropTypes} from '../components/withLocalize'; | ||
| import compose from '../libs/compose'; | ||
| import HeaderWithCloseButton from '../components/HeaderWithCloseButton'; | ||
| import Navigation from '../libs/Navigation/Navigation'; | ||
| import ScreenWrapper from '../components/ScreenWrapper'; | ||
| import styles from '../styles/styles'; | ||
| import ONYXKEYS from '../ONYXKEYS'; | ||
| import * as ErrorUtils from '../libs/ErrorUtils'; | ||
| import Form from '../components/Form'; | ||
| import TextInput from '../components/TextInput'; | ||
| import Permissions from '../libs/Permissions'; | ||
|
|
||
| const propTypes = { | ||
| /** List of betas available to current user */ | ||
| betas: PropTypes.arrayOf(PropTypes.string), | ||
|
|
||
| ...withLocalizePropTypes, | ||
| }; | ||
| const defaultProps = { | ||
| betas: [], | ||
| }; | ||
|
|
||
| // NOTE: This page is going to be updated in https://github.com/Expensify/App/issues/16855, this is just a placeholder for now | ||
| const NewTaskPage = (props) => { | ||
| /** | ||
| * @param {Object} values - form input values passed by the Form component | ||
| * @returns {Boolean} | ||
| */ | ||
| function validate(values) { | ||
|
thienlnam marked this conversation as resolved.
|
||
| const errors = {}; | ||
|
|
||
| if (!values.taskTitle) { | ||
| // We error if the user doesn't enter a room name | ||
| ErrorUtils.addErrorMessage(errors, 'taskTitle', props.translate('newTaskPage.pleaseEnterTaskName')); | ||
| } | ||
|
|
||
| return errors; | ||
| } | ||
|
|
||
| function onSubmit() { | ||
|
thienlnam marked this conversation as resolved.
|
||
|
|
||
| } | ||
|
|
||
| if (!Permissions.canUseTasks(props.betas)) { | ||
| Navigation.dismissModal(); | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <ScreenWrapper includeSafeAreaPaddingBottom={false}> | ||
| <HeaderWithCloseButton | ||
| title={props.translate('newTaskPage.assignTask')} | ||
| onCloseButtonPress={() => Navigation.dismissModal()} | ||
| /> | ||
| <Form | ||
| formID={ONYXKEYS.FORMS.NEW_TASK_FORM} | ||
| submitButtonText={props.translate('newTaskPage.assignTask')} | ||
| style={[styles.mh5, styles.mt5, styles.flexGrow1]} | ||
| validate={values => validate(values)} | ||
| onSubmit={() => onSubmit()} | ||
| enabledWhenOffline | ||
| > | ||
| <View style={styles.mb5}> | ||
| <TextInput | ||
| autoFocus | ||
| inputID="taskTitle" | ||
| label={props.translate('newTaskPage.title')} | ||
| /> | ||
| </View> | ||
| <View style={styles.mb5}> | ||
| <TextInput | ||
| inputID="taskDescription" | ||
| label={props.translate('newTaskPage.description')} | ||
| /> | ||
| </View> | ||
| </Form> | ||
| </ScreenWrapper> | ||
| ); | ||
| }; | ||
|
|
||
| NewTaskPage.displayName = 'NewTaskPage'; | ||
| NewTaskPage.propTypes = propTypes; | ||
| NewTaskPage.defaultProps = defaultProps; | ||
|
|
||
| export default compose( | ||
| withOnyx({ | ||
| betas: { | ||
| key: ONYXKEYS.BETAS, | ||
| }, | ||
| }), | ||
| withLocalize, | ||
| )(NewTaskPage); | ||
This file contains hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.