Skip to content

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

chore: improving qr code generation and auto-save

Ilian Sapundshiev82940aa6f2e0
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsx
index bdf6f30b9..4a55b0e8b 100644
--- a/app/components/EntryContainer.tsx
+++ b/app/components/EntryContainer.tsx
@@ -889,6 +889,28 @@ function EntryContainer(props: Props) {
openedFile.path.endsWith(ext)
);
+ const toggleAutoSave = (event: React.ChangeEvent<HTMLInputElement>) => {
+ const autoSave = event.target.checked;
+ if (Pro && Pro.MetaOperations) {
+ props
+ .switchLocationType(openedFile.locationId)
+ .then(currentLocationId => {
+ Pro.MetaOperations.saveFsEntryMeta(openedFile.path, {
+ autoSave
+ }).then(entryMeta => {
+ updateOpenedFile(openedFile.path, entryMeta).then(() => {
+ props.switchCurrentLocationType(currentLocationId);
+ });
+ });
+ });
+ } else {
+ showNotification(
+ i18n.t('core:thisFunctionalityIsAvailableInPro'),
+ NotificationTypes.default
+ );
+ }
+ };
+
const renderFileToolbar = classes => (
<div className={classes.toolbar2}>
<div className={classes.flexLeft}>
@@ -1336,34 +1358,22 @@ function EntryContainer(props: Props) {
}}
>
{isEditable && props.revisionsEnabled && (
- <Tooltip title={i18n.t('core:autosave')}>
+ <Tooltip
+ title={
+ i18n.t('core:autosave') +
+ (!Pro
+ ? ' - ' +
+ i18n.t('core:thisFunctionalityIsAvailableInPro')
+ : '')
+ }
+ >
<Switch
data-tid="autoSaveTID"
checked={
openedFile.isAutoSaveEnabled !== undefined &&
openedFile.isAutoSaveEnabled
}
- onChange={(
- event: React.ChangeEvent<HTMLInputElement>
- ) => {
- const autoSave = event.target.checked;
- props
- .switchLocationType(openedFile.locationId)
- .then(currentLocationId => {
- Pro.MetaOperations.saveFsEntryMeta(
- openedFile.path,
- { autoSave }
- ).then(entryMeta => {
- updateOpenedFile(openedFile.path, entryMeta).then(
- () => {
- props.switchCurrentLocationType(
- currentLocationId
- );
- }
- );
- });
- });
- }}
+ onChange={toggleAutoSave}
name="autoSave"
color="primary"
/>
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsx
index 0396e6edc..1470fc575 100644
--- a/app/components/EntryProperties.tsx
+++ b/app/components/EntryProperties.tsx
@@ -1117,20 +1117,26 @@ function EntryProperties(props: Props) {
InputProps={{
readOnly: true,
startAdornment: (
- <InputAdornment position="start">
- <QRCodeIcon
- style={{ color: theme.palette.text.secondary }}
- />
- </InputAdornment>
- ),
- endAdornment: (
- <InputAdornment position="start">
- <Button
- fullWidth
- onClick={() => setShowSharingLinkDialog(true)}
- >
- {i18n.t('core:generateDownloadLink')}
- </Button>
+ <InputAdornment position="start" style={{ width: '100%' }}>
+ <Tooltip title={i18n.t('core:generateDownloadLink')}>
+ <Button
+ onClick={() => setShowSharingLinkDialog(true)}
+ startIcon={
+ <QRCodeIcon
+ style={{ color: theme.palette.text.secondary }}
+ />
+ }
+ >
+ <span
+ style={{
+ overflow: 'hidden',
+ textOverflow: 'ellipsis'
+ }}
+ >
+ {i18n.t('core:generateDownloadLink')}
+ </span>
+ </Button>
+ </Tooltip>
</InputAdornment>
)
}}
diff --git a/app/components/dialogs/LinkGeneratorDialog.tsx b/app/components/dialogs/LinkGeneratorDialog.tsx
index e0bd36640..3532bffd0 100644
--- a/app/components/dialogs/LinkGeneratorDialog.tsx
+++ b/app/components/dialogs/LinkGeneratorDialog.tsx
@@ -163,12 +163,12 @@ function LinkGeneratorDialog(props: Props) {
value={' '}
InputProps={{
readOnly: true,
- endAdornment: (
- <InputAdornment position="start" style={{ paddingRight: 50 }}>
+ startAdornment: (
+ <InputAdornment position="start">
<QRCode
id="qr-code-link"
value={signedLink.current}
- size={400}
+ size={350}
enableCORS={true}
// logoWidth={64}
// logoHeight={64}
diff --git a/app/components/dialogs/MoveOrCopyFilesDialog.tsx b/app/components/dialogs/MoveOrCopyFilesDialog.tsx
index b3b41fb07..3ea93c382 100644
--- a/app/components/dialogs/MoveOrCopyFilesDialog.tsx
+++ b/app/components/dialogs/MoveOrCopyFilesDialog.tsx
@@ -34,11 +34,12 @@ import DialogContent from '@mui/material/DialogContent';
import DialogTitle from '@mui/material/DialogTitle';
import Typography from '@mui/material/Typography';
import Dialog from '@mui/material/Dialog';
+import useTheme from '@mui/styles/useTheme';
+import useMediaQuery from '@mui/material/useMediaQuery';
import DraggablePaper from '-/components/DraggablePaper';
import i18n from '-/services/i18n';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-import useTheme from '@mui/styles/useTheme';
-import useMediaQuery from '@mui/material/useMediaQuery';
+import AppConfig from '-/AppConfig';
interface Props {
open: boolean;
@@ -67,15 +68,18 @@ function MoveOrCopyFilesDialog(props: Props) {
{i18n.t('core:copyMoveEntriesTitle')}
<DialogCloseButton onClose={() => onClose()} />
</DialogTitle>
- <DialogContent>
+ <DialogContent
+ style={{
+ overflowX: 'hidden',
+ // @ts-ignore
+ overflowY: AppConfig.isFirefox ? 'auto' : 'overlay'
+ }}
+ >
<List
dense
style={{ width: 550, marginLeft: -15 }}
subheader={
- <ListSubheader
- style={{ backgroundColor: 'transparent' }}
- component="div"
- >
+ <ListSubheader component="div">
{i18n.t('selectedFiles')}
</ListSubheader>
}