Skip to content

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

chore: improvements for the revisions

Ilian Sapundshiev17fa840dd6e5
diff --git a/app/components/FileView.tsx b/app/components/FileView.tsx
index e703e7ea4..a9b345e30 100644
--- a/app/components/FileView.tsx
+++ b/app/components/FileView.tsx
@@ -35,6 +35,7 @@ interface Props {
fileViewerContainer: MutableRefObject<HTMLDivElement>;
searchQuery: TS.SearchQuery;
toggleFullScreen?: () => void;
+ height?: string;
theme: any;
currentTheme: string;
}
@@ -48,6 +49,7 @@ function FileView(props: Props) {
fileViewerContainer,
toggleFullScreen,
searchQuery,
+ height,
currentTheme
} = props; // .openedFiles[0];
@@ -128,7 +130,7 @@ function FileView(props: Props) {
ref={fileViewerContainer}
style={{
width: '100%',
- height: '100%',
+ height: height || '100%',
flex: '1 1 100%',
display: 'flex',
backgroundColor: theme.palette.background.default
diff --git a/app/components/Revisions.tsx b/app/components/Revisions.tsx
index 36497bef5..107f5d8da 100644
--- a/app/components/Revisions.tsx
+++ b/app/components/Revisions.tsx
@@ -21,6 +21,8 @@ import {
getBackupFileLocation,
extractContainingDirectoryPath
} from '@tagspaces/tagspaces-common/paths';
+import Typography from '@mui/material/Typography';
+import Tooltip from '-/components/Tooltip';
import withStyles from '@mui/styles/withStyles';
import {
actions as AppActions,
@@ -131,14 +133,16 @@ function Revisions(props: Props) {
return (
<div>
- <h2>{i18n.t('revisions')}</h2>
+ <Typography variant="h4" style={{ color: theme.palette.text.primary }}>
+ {i18n.t('core:revisions')}
+ </Typography>
<TableContainer component={Paper}>
- <Table sx={{ minWidth: 650 }} aria-label="revisions table">
+ <Table sx={{ minWidth: 650 }} size="small" aria-label="revisions table">
<TableHead>
<TableRow>
- <TableCell>File</TableCell>
- <TableCell align="right">Revision Date</TableCell>
- <TableCell align="right">Review/Delete</TableCell>
+ <TableCell>{i18n.t('file')}</TableCell>
+ <TableCell align="right">{i18n.t('createdOn')}</TableCell>
+ <TableCell align="right">{i18n.t('revisions')}</TableCell>
</TableRow>
</TableHead>
<TableBody>
@@ -164,35 +168,41 @@ function Revisions(props: Props) {
})}
</TableCell>
<TableCell align="right">
- <IconButton
- aria-label={i18n.t('core:view')}
- onClick={() => setPreviewDialogEntry(row)}
- data-tid="viewRevisionTID"
- size="large"
- >
- <PreviewIcon color="primary" />
- </IconButton>
- <IconButton
- aria-label={i18n.t('core:restore')}
- onClick={() => restoreRevision(row.path)}
- data-tid="restoreRevisionTID"
- size="large"
- >
- <RestoreIcon color="primary" />
- </IconButton>
- <IconButton
- aria-label={i18n.t('core:delete')}
- onClick={() => {
- PlatformIO.deleteFilePromise(
- row.path,
- true
- ).then(() => loadHistoryItems(openedFiles[0]));
- }}
- data-tid="deleteRevisionTID"
- size="large"
- >
- <DeleteIcon color="primary" />
- </IconButton>
+ <Tooltip title="core:view">
+ <IconButton
+ aria-label={i18n.t('core:view')}
+ onClick={() => setPreviewDialogEntry(row)}
+ data-tid="viewRevisionTID"
+ size="large"
+ >
+ <PreviewIcon color="primary" />
+ </IconButton>
+ </Tooltip>
+ <Tooltip title="core:restore">
+ <IconButton
+ aria-label={i18n.t('core:restore')}
+ onClick={() => restoreRevision(row.path)}
+ data-tid="restoreRevisionTID"
+ size="large"
+ >
+ <RestoreIcon color="primary" />
+ </IconButton>
+ </Tooltip>
+ <Tooltip title="core:delete">
+ <IconButton
+ aria-label={i18n.t('core:delete')}
+ onClick={() => {
+ PlatformIO.deleteFilePromise(
+ row.path,
+ true
+ ).then(() => loadHistoryItems(openedFiles[0]));
+ }}
+ data-tid="deleteRevisionTID"
+ size="large"
+ >
+ <DeleteIcon color="primary" />
+ </IconButton>
+ </Tooltip>
</TableCell>
</TableRow>
))}
diff --git a/app/components/dialogs/FilePreviewDialog.tsx b/app/components/dialogs/FilePreviewDialog.tsx
index 22cfeac72..f8e093fcd 100644
--- a/app/components/dialogs/FilePreviewDialog.tsx
+++ b/app/components/dialogs/FilePreviewDialog.tsx
@@ -176,8 +176,8 @@ function FilePreviewDialog(props: Props) {
onClose={onClose}
keepMounted
scroll="paper"
- /*fullWidth={true}
- maxWidth="md"*/
+ fullWidth
+ maxWidth="md"
PaperProps={{ sx: { width: '100%', height: '100%' } }}
BackdropProps={{ style: { backgroundColor: 'transparent' } }}
>
@@ -189,6 +189,7 @@ function FilePreviewDialog(props: Props) {
style={{
marginLeft: 'auto',
marginRight: 'auto',
+ overflowY: 'hidden',
width: '90%',
flexGrow: 1
}}
@@ -199,6 +200,7 @@ function FilePreviewDialog(props: Props) {
openedFile={openedFile}
fileViewer={fileViewer}
fileViewerContainer={fileViewerContainer}
+ height={'90%'}
currentTheme={props.currentTheme}
/>
</DialogContent>
diff --git a/app/locales/en/core.json b/app/locales/en/core.json
index 779ce0755..d013428c5 100644
--- a/app/locales/en/core.json
+++ b/app/locales/en/core.json
@@ -730,7 +730,9 @@
"linkValidityTooltip": "Time for which the link is valid",
"revisions": "Revisions",
"setRevisionsEnabled": "Enable Revisions",
- "setRevisionsEnabledHelp": "Save file edit change history",
+ "setRevisionsEnabledHelp": "Create a file revision, every time a text document is saved",
"autosave": "Auto save",
+ "restore": "Restore",
+ "createdOn": "Created on",
"-": "-"
}