summaryrefslogtreecommitdiffhomepage
path: root/gui/src/renderer/components
diff options
context:
space:
mode:
Diffstat (limited to 'gui/src/renderer/components')
-rw-r--r--gui/src/renderer/components/ErrorView.tsx83
-rw-r--r--gui/src/renderer/components/Launch.tsx4
2 files changed, 75 insertions, 12 deletions
diff --git a/gui/src/renderer/components/ErrorView.tsx b/gui/src/renderer/components/ErrorView.tsx
index 12ca510396..04fbbee9f9 100644
--- a/gui/src/renderer/components/ErrorView.tsx
+++ b/gui/src/renderer/components/ErrorView.tsx
@@ -1,10 +1,14 @@
+import React, { useCallback } from 'react';
import styled from 'styled-components';
import { colors } from '../../config.json';
-import { measurements } from './common-styles';
+import { messages } from '../../shared/gettext';
+import { useAppContext } from '../context';
+import * as AppButton from './AppButton';
+import { measurements, tinyText } from './common-styles';
import { HeaderBarSettingsButton } from './HeaderBar';
import ImageView from './ImageView';
-import { Container, Header, Layout } from './Layout';
+import { Container, Footer, Header, Layout } from './Layout';
const StyledContainer = styled(Container)({
flex: 1,
@@ -14,6 +18,31 @@ const StyledContainer = styled(Container)({
marginTop: '-150px',
});
+const StyledFooter = styled(Footer)({}, (props: { show: boolean }) => ({
+ backgroundColor: colors.blue,
+ padding: '12px',
+ position: 'absolute',
+ bottom: 0,
+ transform: `translateY(${props.show ? 0 : 100}%)`,
+ transition: 'transform 250ms ease-in-out',
+}));
+
+const StyledSystemSettingsContainer = styled.div({
+ display: 'flex',
+ flexDirection: 'column',
+ flex: 1,
+ alignSelf: 'start',
+ backgroundColor: colors.darkBlue,
+ borderRadius: '8px',
+ margin: 0,
+ padding: '16px',
+});
+
+const StyledLaunchFooterPrompt = styled.span(tinyText, {
+ color: colors.white,
+ margin: '9px 0 20px 0',
+});
+
const Logo = styled(ImageView)({
marginBottom: '12px',
});
@@ -34,18 +63,50 @@ const Subtitle = styled.span({
interface ErrorViewProps {
settingsUnavailable?: boolean;
+ showSettingsFooter?: boolean;
children: React.ReactNode | React.ReactNode[];
}
-export default function ErrorView(props: ErrorViewProps) {
+export default class ErrorView extends React.Component<ErrorViewProps> {
+ public render() {
+ return (
+ <Layout>
+ <Header>{!this.props.settingsUnavailable && <HeaderBarSettingsButton />}</Header>
+ <StyledContainer>
+ <Logo height={106} width={106} source="logo-icon" />
+ <Title height={18} source="logo-text" />
+ <Subtitle role="alert">{this.props.children}</Subtitle>
+ </StyledContainer>
+ <SettingsFooter show={this.props.showSettingsFooter} />
+ </Layout>
+ );
+ }
+}
+
+interface ISettingsFooterProps {
+ show?: boolean;
+}
+
+function SettingsFooter(props: ISettingsFooterProps) {
+ const { showLaunchDaemonSettings } = useAppContext();
+
+ const openSettings = useCallback(async () => {
+ await showLaunchDaemonSettings();
+ }, []);
+
return (
- <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>
- </StyledContainer>
- </Layout>
+ <StyledFooter show={props.show ? props.show : false}>
+ <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>
);
}
diff --git a/gui/src/renderer/components/Launch.tsx b/gui/src/renderer/components/Launch.tsx
index a3145b8e16..c5406e1578 100644
--- a/gui/src/renderer/components/Launch.tsx
+++ b/gui/src/renderer/components/Launch.tsx
@@ -1,9 +1,11 @@
import { messages } from '../../shared/gettext';
+import { useSelector } from '../redux/store';
import ErrorView from './ErrorView';
export default function Launch() {
+ const daemonAllowed = useSelector((state) => state.userInterface.daemonAllowed);
return (
- <ErrorView>
+ <ErrorView showSettingsFooter={daemonAllowed === false}>
{messages.pgettext('launch-view', 'Connecting to Mullvad system service...')}
</ErrorView>
);