From d425435c290a7e63c4e30a469da51f43be4db5cc Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Tue, 15 Mar 2022 00:15:31 +0100 Subject: feat: Open in external browser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kristóf Marussy --- .../src/components/locationBar/ExtraButtons.tsx | 52 ++++++++++++++++++++++ .../src/components/locationBar/LocationBar.tsx | 2 + .../components/locationBar/NavigationButtons.tsx | 2 +- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 packages/renderer/src/components/locationBar/ExtraButtons.tsx (limited to 'packages/renderer/src/components/locationBar') diff --git a/packages/renderer/src/components/locationBar/ExtraButtons.tsx b/packages/renderer/src/components/locationBar/ExtraButtons.tsx new file mode 100644 index 0000000..4eaee29 --- /dev/null +++ b/packages/renderer/src/components/locationBar/ExtraButtons.tsx @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2022 Kristóf Marussy + * + * This file is part of Sophie. + * + * Sophie is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import IconOpenInBrowser from '@mui/icons-material/OpenInBrowser'; +import Box from '@mui/material/Box'; +import IconButton from '@mui/material/IconButton'; +import { observer } from 'mobx-react-lite'; +import React from 'react'; + +import type Service from '../../stores/Service'; + +function ExtraButtons({ + service, +}: { + service: Service | undefined; +}): JSX.Element { + return ( + + service?.openCurrentURLInExternalBrowser()} + > + + + + ); +} + +export default observer(ExtraButtons); diff --git a/packages/renderer/src/components/locationBar/LocationBar.tsx b/packages/renderer/src/components/locationBar/LocationBar.tsx index 0debaab..fc9c147 100644 --- a/packages/renderer/src/components/locationBar/LocationBar.tsx +++ b/packages/renderer/src/components/locationBar/LocationBar.tsx @@ -24,6 +24,7 @@ import React from 'react'; import { useStore } from '../StoreProvider'; +import ExtraButtons from './ExtraButtons'; import LocationTextField from './LocationTextField'; import NavigationButtons from './NavigationButtons'; @@ -49,6 +50,7 @@ function LocationBar(): JSX.Element { ); } diff --git a/packages/renderer/src/components/locationBar/NavigationButtons.tsx b/packages/renderer/src/components/locationBar/NavigationButtons.tsx index 5c5c959..9995a21 100644 --- a/packages/renderer/src/components/locationBar/NavigationButtons.tsx +++ b/packages/renderer/src/components/locationBar/NavigationButtons.tsx @@ -29,7 +29,7 @@ import IconButton from '@mui/material/IconButton'; import { observer } from 'mobx-react-lite'; import React from 'react'; -import Service from '../../stores/Service'; +import type Service from '../../stores/Service'; function NavigationButtons({ service, -- cgit v1.2.3-54-g00ecf