Skip to content

Commit

Permalink
Add logout button to bail
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-glazier committed May 20, 2024
1 parent a5cc162 commit 7176827
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/components/ActivityIndicatorView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,22 @@ import { Text } from 'react-native-paper';
interface Props {
message?: string;
timeOutMilliseconds?: number;
secondaryTimeOutMilliseconds?: number;
style?: ActivityIndicatorViewStyles;
}

export function ActivityIndicatorView({
message: messageText,
timeOutMilliseconds,
secondaryTimeOutMilliseconds,
style: instanceStyles,
children,
...props
}: Props & Omit<ActivityIndicator['props'], 'style'>) {
const { styles } = useStyles(defaultStyles, instanceStyles);
const { colors } = useTheme();
const [showMessage] = useTimeout(timeOutMilliseconds || 5000);
const [showChildren] = useTimeout(secondaryTimeOutMilliseconds || 30000);
const { CustomActivityIndicatorView } = useDeveloperConfig();

const timeOutMessage =
Expand All @@ -32,6 +36,9 @@ export function ActivityIndicatorView({
</Text>
) : null;

const secondTimeoutComponents =
!!children && !!showChildren() ? children : null;

return CustomActivityIndicatorView ? (
<CustomActivityIndicatorView timeoutMessage={timeOutMessage} />
) : (
Expand All @@ -45,6 +52,7 @@ export function ActivityIndicatorView({
{...props}
/>
{timeOutMessage}
{secondTimeoutComponents}
</View>
);
}
Expand Down
10 changes: 7 additions & 3 deletions src/hooks/useActiveProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useRestQuery } from './rest-api';
import { useActiveAccount } from './useActiveAccount';
import { useDeveloperConfig } from './useDeveloperConfig';
import { tID } from '../common/testID';
import { OAuthLogoutButton } from '../components/OAuthLogoutButton';

const selectedProjectIdKey = 'selectedProjectIdKey';

Expand Down Expand Up @@ -188,14 +189,17 @@ export const ActiveProjectContextProvider: React.FC<ActiveProjectContextProvider
testID={tID('waiting-for-patient-loader')}
style={{
text: {
alignSelf: 'center',
textAlign: 'center',
},
}}
message={t(
'expected-waiting-for-account-and-project',
'Please wait while we complete the initial setup for your first login.',
'Please wait while we complete the initial setup for your first login. This may take a couple minutes.',
)}
/>
secondaryTimeOutMilliseconds={60000}
>
<OAuthLogoutButton label="Logout" />
</ActivityIndicatorView>
);
}

Expand Down

0 comments on commit 7176827

Please sign in to comment.