Skip to content

TagSpaces is an offline, open source, document manager with tagging support

chore: refactoring ProTeaser out of Navigation component

Ilian Sapundshiev0c6de1ca9775
diff --git a/app/components/MobileNavigation.tsx b/app/components/MobileNavigation.tsx
index 45461356c..3709370a0 100644
--- a/app/components/MobileNavigation.tsx
+++ b/app/components/MobileNavigation.tsx
@@ -28,7 +28,6 @@ import Button from '@mui/material/Button';
import ButtonGroup from '@mui/material/ButtonGroup';
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
import IconButton from '@mui/material/IconButton';
-import Typography from '@mui/material/Typography';
import ThemingIcon from '@mui/icons-material/InvertColors';
import LocationsIcon from '@mui/icons-material/WorkOutline';
import CreateIcon from '@mui/icons-material/Add';
@@ -38,15 +37,11 @@ import HelpIcon from '@mui/icons-material/HelpOutline';
import AccountCircleIcon from '@mui/icons-material/AccountCircle';
import SettingsIcon from '@mui/icons-material/Settings';
import withStyles from '@mui/styles/withStyles';
-import CardActions from '@mui/material/CardActions';
-import CardContent from '@mui/material/CardContent';
import { CognitoUserInterface } from '@aws-amplify/ui-components';
-import CloseIcon from '@mui/icons-material/Close';
import Popover from '@mui/material/Popover';
-import ProTeaserImage from '-/assets/images/pro-teaser.svg';
-import ProTextLogo from '-/assets/images/text-logo-pro.svg';
import { Pro } from '-/pro';
import CustomLogo from '-/components/CustomLogo';
+import ProTeaser from '-/components/ProTeaser';
import TagLibrary from '-/components/TagLibrary';
import LocationManager from '-/components/LocationManager';
import HelpFeedbackPanel from '-/components/HelpFeedbackPanel';
@@ -241,64 +236,11 @@ function MobileNavigation(props: Props) {
}}
>
{showProTeaser && (
- <>
- <CardContent
- onClick={toggleProTeaser}
- style={{
- padding: 5,
- paddingBottom: 0,
- textAlign: 'center'
- }}
- >
- <Typography color="textSecondary" variant="caption">
- achieve more with
- <IconButton
- style={{ right: 5, marginTop: -10, position: 'absolute' }}
- size="small"
- aria-label="close"
- onClick={event => {
- event.preventDefault();
- event.stopPropagation();
- setShowTeaserBanner(false);
- }}
- >
- <CloseIcon fontSize="small" />
- </IconButton>
- </Typography>
- <br />
- <img style={{ height: 35 }} src={ProTextLogo} alt="" />
- <br />
- <img style={{ maxHeight: 60 }} src={ProTeaserImage} alt="" />
- </CardContent>
- <CardActions
- style={{
- flexDirection: 'row',
- justifyContent: 'center',
- marginTop: -10
- }}
- >
- <Button
- size="small"
- onClick={(event: any) => {
- event.preventDefault();
- event.stopPropagation();
- toggleProTeaser();
- }}
- >
- {i18n.t('showMeMore')}
- </Button>
- <Button
- size="small"
- onClick={(event: any) => {
- event.preventDefault();
- event.stopPropagation();
- openURLExternally(Links.links.productsOverview, true);
- }}
- >
- {i18n.t('getItNow')}
- </Button>
- </CardActions>
- </>
+ <ProTeaser
+ toggleProTeaser={toggleProTeaser}
+ setShowTeaserBanner={setShowTeaserBanner}
+ openURLExternally={openURLExternally}
+ />
)}
<Tooltip title={i18n.t('core:settings')}>
<IconButton
diff --git a/app/components/ProTeaser.tsx b/app/components/ProTeaser.tsx
new file mode 100644
index 000000000..0988f3031
--- /dev/null
+++ b/app/components/ProTeaser.tsx
@@ -0,0 +1,102 @@
+/**
+ * TagSpaces - universal file and folder organizer
+ * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License (version 3) as
+ * published by the Free Software Foundation.
+ *
+ * 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 <https://www.gnu.org/licenses/>.
+ *
+ */
+
+import React from 'react';
+
+import IconButton from '@mui/material/IconButton';
+import Button from '@mui/material/Button';
+import CardActions from '@mui/material/CardActions';
+import CardContent from '@mui/material/CardContent';
+import Typography from '@mui/material/Typography';
+import CloseIcon from '@mui/icons-material/Close';
+import ProTeaserImage from '-/assets/images/pro-teaser.svg';
+import ProTextLogo from '-/assets/images/text-logo-pro.svg';
+import i18n from '../services/i18n';
+import Links from '-/links';
+
+interface Props {
+ toggleProTeaser: () => void;
+ setShowTeaserBanner: (teaserVisibility: boolean) => void;
+ openURLExternally: (url: string, skipConfirmation?: boolean) => void;
+}
+
+function ProTeaser(props: Props) {
+ const { toggleProTeaser, setShowTeaserBanner, openURLExternally } = props;
+ return (
+ <>
+ <CardContent
+ onClick={toggleProTeaser}
+ style={{
+ padding: 5,
+ paddingBottom: 0,
+ textAlign: 'center'
+ }}
+ >
+ <Typography color="textSecondary" variant="caption">
+ achieve more with
+ <IconButton
+ style={{ right: 5, marginTop: -10, position: 'absolute' }}
+ size="small"
+ aria-label="close"
+ onClick={event => {
+ event.preventDefault();
+ event.stopPropagation();
+ setShowTeaserBanner(false);
+ }}
+ >
+ <CloseIcon fontSize="small" />
+ </IconButton>
+ </Typography>
+ <br />
+ <img style={{ height: 35 }} src={ProTextLogo} alt="" />
+ <br />
+ <img style={{ maxHeight: 60 }} src={ProTeaserImage} alt="" />
+ </CardContent>
+ <CardActions
+ style={{
+ flexDirection: 'row',
+ justifyContent: 'center',
+ marginTop: -10
+ }}
+ >
+ <Button
+ size="small"
+ onClick={(event: any) => {
+ event.preventDefault();
+ event.stopPropagation();
+ toggleProTeaser();
+ }}
+ >
+ {i18n.t('showMeMore')}
+ </Button>
+ <Button
+ size="small"
+ onClick={(event: any) => {
+ event.preventDefault();
+ event.stopPropagation();
+ openURLExternally(Links.links.productsOverview, true);
+ }}
+ >
+ {i18n.t('getItNow')}
+ </Button>
+ </CardActions>
+ </>
+ );
+}
+
+export default ProTeaser;
diff --git a/app/locales/en/core.json b/app/locales/en/core.json
index 2f95161a8..b671c7684 100644
--- a/app/locales/en/core.json
+++ b/app/locales/en/core.json
@@ -246,7 +246,7 @@
"searchSubFolder": "Search in subfolders",
"file": "File",
"newFileNote": "New File / Note",
- "createNewContent": "Create or add new files",
+ "createNewContent": "Add or create new files",
"createFileTitle": "Create File / Note",
"createNote": "Create Note",
"createNoteTitle": "Use to create a document with rich text formatting.",