diff options
Diffstat (limited to 'gui/src/renderer/components')
| -rw-r--r-- | gui/src/renderer/components/ErrorView.tsx | 29 | ||||
| -rw-r--r-- | gui/src/renderer/components/Launch.tsx | 64 |
2 files changed, 87 insertions, 6 deletions
diff --git a/gui/src/renderer/components/ErrorView.tsx b/gui/src/renderer/components/ErrorView.tsx index 12ca510396..fead788c24 100644 --- a/gui/src/renderer/components/ErrorView.tsx +++ b/gui/src/renderer/components/ErrorView.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import styled from 'styled-components'; import { colors } from '../../config.json'; @@ -10,8 +11,15 @@ const StyledContainer = styled(Container)({ flex: 1, flexDirection: 'column', alignItems: 'center', - justifyContent: 'center', - marginTop: '-150px', + justifyContent: 'end', +}); + +const StyledContent = styled.div({ + display: 'flex', + flex: 1, + flexDirection: 'column', + alignItems: 'center', + justifyContent: 'end', }); const Logo = styled(ImageView)({ @@ -32,8 +40,16 @@ const Subtitle = styled.span({ textAlign: 'center', }); +const StyledFooterContainer = styled.div({ + display: 'flex', + flexDirection: 'column', + justifyContent: 'end', + minHeight: '241px', +}); + interface ErrorViewProps { settingsUnavailable?: boolean; + footer?: React.ReactNode | React.ReactNode[]; children: React.ReactNode | React.ReactNode[]; } @@ -42,9 +58,12 @@ export default function ErrorView(props: ErrorViewProps) { <Layout> <Header>{!props.settingsUnavailable && <HeaderBarSettingsButton />}</Header> <StyledContainer> - <Logo height={106} width={106} source="logo-icon" /> - <Title height={18} source="logo-text" /> - <Subtitle role="alert">{props.children}</Subtitle> + <StyledContent> + <Logo height={106} width={106} source="logo-icon" /> + <Title height={18} source="logo-text" /> + <Subtitle role="alert">{props.children}</Subtitle> + </StyledContent> + <StyledFooterContainer>{props.footer}</StyledFooterContainer> </StyledContainer> </Layout> ); diff --git a/gui/src/renderer/components/Launch.tsx b/gui/src/renderer/components/Launch.tsx index a3145b8e16..5f12fcce8f 100644 --- a/gui/src/renderer/components/Launch.tsx +++ b/gui/src/renderer/components/Launch.tsx @@ -1,10 +1,72 @@ +import { useCallback } from 'react'; +import styled from 'styled-components'; + +import { colors } from '../../config.json'; import { messages } from '../../shared/gettext'; +import { useAppContext } from '../context'; +import { useSelector } from '../redux/store'; +import * as AppButton from './AppButton'; +import { measurements, tinyText } from './common-styles'; import ErrorView from './ErrorView'; +import { Footer } from './Layout'; export default function Launch() { + const daemonAllowed = useSelector((state) => state.userInterface.daemonAllowed); + const footer = <SettingsFooter show={daemonAllowed === false} />; + return ( - <ErrorView> + <ErrorView footer={footer}> {messages.pgettext('launch-view', 'Connecting to Mullvad system service...')} </ErrorView> ); } + +const StyledFooter = styled(Footer)({}, (props: { show: boolean }) => ({ + backgroundColor: colors.blue, + padding: `0 14px ${measurements.viewMargin}`, + opacity: props.show ? 1 : 0, + transition: 'opacity 250ms ease-in-out', +})); + +const StyledSystemSettingsContainer = styled.div({ + display: 'flex', + flexDirection: 'column', + flex: 1, + backgroundColor: colors.darkBlue, + borderRadius: '8px', + margin: 0, + padding: '16px', +}); + +const StyledLaunchFooterPrompt = styled.span(tinyText, { + color: colors.white, + margin: `8px 0 ${measurements.buttonVerticalMargin} 0`, +}); + +interface ISettingsFooterProps { + show: boolean; +} + +function SettingsFooter(props: ISettingsFooterProps) { + const { showLaunchDaemonSettings } = useAppContext(); + + const openSettings = useCallback(async () => { + await showLaunchDaemonSettings(); + }, []); + + return ( + <StyledFooter show={props.show}> + <StyledSystemSettingsContainer> + <StyledLaunchFooterPrompt> + {messages.pgettext( + 'launch-view', + 'Permission for the Mullvad VPN service has been revoked. Please go to System Settings and allow Mullvad VPN under the “Allow in the Background” setting.', + )} + </StyledLaunchFooterPrompt> + <AppButton.BlueButton onClick={openSettings}> + {messages.gettext('Go to System Settings')} + </AppButton.BlueButton> + </StyledSystemSettingsContainer> + </StyledFooter> + ); +} |
