-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[No QA] Add Workspace Rooms page navigation under workspaceRoomsPage beta #90354
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
Changes from all commits
4da6579
44b4483
0e102f0
adedffc
26d93fc
acf96cb
28595b7
d9b174d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| type OpenWorkspaceRoomsPageParams = { | ||
| policyID: string; | ||
| }; | ||
|
|
||
| export default OpenWorkspaceRoomsPageParams; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import {read} from '@libs/API'; | ||
| import type {OpenWorkspaceRoomsPageParams} from '@libs/API/parameters'; | ||
| import {READ_COMMANDS} from '@libs/API/types'; | ||
| import Log from '@libs/Log'; | ||
|
|
||
| export default function openWorkspaceRoomsPage(policyID: string) { | ||
| if (!policyID) { | ||
| Log.warn('openWorkspaceRoomsPage invalid params', {policyID}); | ||
| return; | ||
| } | ||
|
|
||
| const params: OpenWorkspaceRoomsPageParams = {policyID}; | ||
|
|
||
| read(READ_COMMANDS.OPEN_WORKSPACE_ROOMS_PAGE, params); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| import {useFocusEffect} from '@react-navigation/native'; | ||
| import React from 'react'; | ||
| import Button from '@components/Button'; | ||
| import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
| import ScreenWrapper from '@components/ScreenWrapper'; | ||
| import {useMemoizedLazyExpensifyIcons, useMemoizedLazyIllustrations} from '@hooks/useLazyAsset'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import usePermissions from '@hooks/usePermissions'; | ||
| import usePolicy from '@hooks/usePolicy'; | ||
| import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import useWorkspaceDocumentTitle from '@hooks/useWorkspaceDocumentTitle'; | ||
| import openWorkspaceRoomsPage from '@libs/actions/Policy/Room'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
| import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; | ||
| import type {WorkspaceSplitNavigatorParamList} from '@navigation/types'; | ||
| import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; | ||
| import CONST from '@src/CONST'; | ||
| import type SCREENS from '@src/SCREENS'; | ||
|
|
||
| type WorkspaceRoomsPageProps = PlatformStackScreenProps<WorkspaceSplitNavigatorParamList, typeof SCREENS.WORKSPACE.ROOMS>; | ||
|
|
||
| function WorkspaceRoomsPage({route}: WorkspaceRoomsPageProps) { | ||
| const {translate} = useLocalize(); | ||
| const styles = useThemeStyles(); | ||
| const {shouldUseNarrowLayout} = useResponsiveLayout(); | ||
| const {isBetaEnabled} = usePermissions(); | ||
| const icons = useMemoizedLazyExpensifyIcons(['Plus']); | ||
| const illustrations = useMemoizedLazyIllustrations(['Hashtag']); | ||
| const policyID = route.params.policyID; | ||
| const policy = usePolicy(policyID); | ||
| useWorkspaceDocumentTitle(policy?.name, 'workspace.common.rooms'); | ||
|
|
||
| useFocusEffect(() => { | ||
| openWorkspaceRoomsPage(policyID); | ||
| }); | ||
|
Comment on lines
+34
to
+36
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.
Useful? React with 👍 / 👎. |
||
|
|
||
| return ( | ||
| <AccessOrNotFoundWrapper | ||
| policyID={policyID} | ||
| shouldBeBlocked={!isBetaEnabled(CONST.BETAS.WORKSPACE_ROOMS_PAGE)} | ||
| > | ||
| <ScreenWrapper | ||
| testID={WorkspaceRoomsPage.displayName} | ||
| style={[styles.defaultModalContainer]} | ||
| shouldEnableMaxHeight | ||
| shouldShowOfflineIndicatorInWideScreen | ||
| enableEdgeToEdgeBottomSafeAreaPadding | ||
| > | ||
|
Comment on lines
+43
to
+49
Contributor
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. i think we should add |
||
| <HeaderWithBackButton | ||
| title={translate('workspace.common.rooms')} | ||
| icon={illustrations.Hashtag} | ||
| shouldUseHeadlineHeader | ||
| shouldShowBackButton={shouldUseNarrowLayout} | ||
| onBackButtonPress={Navigation.goBack} | ||
| shouldDisplayHelpButton | ||
| > | ||
| <Button | ||
| success | ||
| onPress={() => {}} | ||
| icon={icons.Plus} | ||
| text={translate('common.create')} | ||
| /> | ||
|
Comment on lines
+58
to
+63
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.
When beta users open the new Rooms page, the visible Create button is wired to an empty handler, so pressing it appears broken and gives no navigation or feedback. Either connect this to the existing create-room flow described for the page or hide/disable the button until that flow exists. Useful? React with 👍 / 👎. |
||
| </HeaderWithBackButton> | ||
| </ScreenWrapper> | ||
| </AccessOrNotFoundWrapper> | ||
| ); | ||
| } | ||
|
|
||
| WorkspaceRoomsPage.displayName = 'WorkspaceRoomsPage'; | ||
|
|
||
| export default WorkspaceRoomsPage; | ||
Uh oh!
There was an error while loading. Please reload this page.