Skip to content

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

chore: optimizing rendering of revisions and changing background images and thumbs

Ilian Sapundshievf022aa86b0df
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsx
index f6a6849b7..fb0d2c0a0 100644
--- a/app/components/EntryProperties.tsx
+++ b/app/components/EntryProperties.tsx
@@ -1197,7 +1197,10 @@ function EntryProperties(props: Props) {
editName === undefined &&
editDescription.current === undefined && (
<ProTooltip tooltip={i18n.t('changeThumbnail')}>
- <IconButton
+ <Button fullWidth onClick={toggleThumbFilesDialog}>
+ {i18n.t('core:change')}
+ </Button>
+ {/* <IconButton
disabled={!Pro}
color="primary"
className={classes.button}
@@ -1205,28 +1208,28 @@ function EntryProperties(props: Props) {
onClick={toggleThumbFilesDialog}
>
<EditIcon />
- </IconButton>
+ </IconButton> */}
</ProTooltip>
)}
- <ProTooltip tooltip={i18n.t('changeThumbnail')}>
- <div
- role="button"
- tabIndex={0}
- style={{
- backgroundSize: 'cover',
- backgroundRepeat: 'no-repeat',
- backgroundImage: thumbUrl.current
- ? 'url("' + thumbUrl.current + '")'
- : '',
- backgroundPosition: 'center',
- borderRadius: 8,
- minHeight: 150,
- minWidth: 150,
- marginBottom: 5
- }}
- onClick={toggleThumbFilesDialog}
- />
- </ProTooltip>
+ {/* <ProTooltip tooltip={i18n.t('changeThumbnail')}> */}
+ <div
+ role="button"
+ tabIndex={0}
+ style={{
+ backgroundSize: 'cover',
+ backgroundRepeat: 'no-repeat',
+ backgroundImage: thumbUrl.current
+ ? 'url("' + thumbUrl.current + '")'
+ : '',
+ backgroundPosition: 'center',
+ borderRadius: 8,
+ minHeight: 150,
+ minWidth: 150,
+ marginBottom: 5
+ }}
+ onClick={toggleThumbFilesDialog}
+ />
+ {/* </ProTooltip> */}
</Stack>
</InputAdornment>
)
@@ -1255,7 +1258,10 @@ function EntryProperties(props: Props) {
<ProTooltip
tooltip={i18n.t('changeBackgroundImage')}
>
- <IconButton
+ <Button fullWidth onClick={toggleBgndImgDialog}>
+ {i18n.t('core:change')}
+ </Button>
+ {/* <IconButton
disabled={!Pro}
color="primary"
className={classes.button}
@@ -1263,28 +1269,28 @@ function EntryProperties(props: Props) {
onClick={toggleBgndImgDialog}
>
<EditIcon />
- </IconButton>
+ </IconButton> */}
</ProTooltip>
)}
- <ProTooltip tooltip={i18n.t('changeBackgroundImage')}>
- <div
- role="button"
- tabIndex={0}
- style={{
- backgroundSize: 'cover',
- backgroundRepeat: 'no-repeat',
- backgroundImage: bgndUrl.current
- ? 'url("' + bgndUrl.current + '")'
- : '',
- backgroundPosition: 'center',
- borderRadius: 8,
- minHeight: 150,
- minWidth: 150,
- marginBottom: 5
- }}
- onClick={toggleBgndImgDialog}
- />
- </ProTooltip>
+ {/* <ProTooltip tooltip={i18n.t('changeBackgroundImage')}> */}
+ <div
+ role="button"
+ tabIndex={0}
+ style={{
+ backgroundSize: 'cover',
+ backgroundRepeat: 'no-repeat',
+ backgroundImage: bgndUrl.current
+ ? 'url("' + bgndUrl.current + '")'
+ : '',
+ backgroundPosition: 'center',
+ borderRadius: 8,
+ minHeight: 150,
+ minWidth: 150,
+ marginBottom: 5
+ }}
+ onClick={toggleBgndImgDialog}
+ />
+ {/* </ProTooltip> */}
</Stack>
</InputAdornment>
)
diff --git a/app/components/Revisions.tsx b/app/components/Revisions.tsx
index 019229b5f..8397d2531 100644
--- a/app/components/Revisions.tsx
+++ b/app/components/Revisions.tsx
@@ -61,10 +61,14 @@ interface Props {
theme: any;
}
+const initialRowsPerPage = 10;
+
function Revisions(props: Props) {
const [rows, setRows] = useState<Array<TS.FileSystemEntry>>();
const [page, setPage] = React.useState<number>(0);
- const [rowsPerPage, setRowsPerPage] = React.useState<number>(5);
+ const [rowsPerPage, setRowsPerPage] = React.useState<number>(
+ initialRowsPerPage
+ );
const [previewDialogEntry, setPreviewDialogEntry] = useState<
TS.FileSystemEntry
>(undefined);
@@ -133,20 +137,28 @@ function Revisions(props: Props) {
);
}
- // Avoid a layout jump when reaching the last page with empty rows.
- /*const emptyRows =
- rows && page > 0 ? Math.max(0, (1 + page) * rowsPerPage - rows.length) : 0;*/
-
return (
- <div>
- {/* <Typography
- variant="h4"
- style={{ color: theme.palette.text.primary }}
- >
- {i18n.t('core:revisions')}
- </Typography> */}
- <TableContainer component={Paper}>
- <Table sx={{ minWidth: 650 }} size="small" aria-label="revisions table">
+ <Paper
+ sx={{ width: '100%', overflow: 'hidden', height: 'calc(100% - 30px)' }}
+ >
+ {rows && rows.length > initialRowsPerPage && (
+ <TablePagination
+ rowsPerPageOptions={[10, 25]}
+ component="div"
+ count={rows.length}
+ rowsPerPage={rowsPerPage}
+ page={page}
+ onPageChange={handleChangePage}
+ onRowsPerPageChange={handleChangeRowsPerPage}
+ />
+ )}
+ <TableContainer component={Paper} sx={{ maxHeight: '100%' }}>
+ <Table
+ sx={{ width: '100%', height: '100%' }}
+ stickyHeader
+ size="small"
+ aria-label="revisions table"
+ >
<TableHead>
<TableRow>
<TableCell>{i18n.t('revisions')}</TableCell>
@@ -192,7 +204,7 @@ function Revisions(props: Props) {
aria-label="restore revision"
onClick={() =>
confirm(
- 'The content of the current file will be replaced with the chosen revision. Do you want to continue?'
+ 'The content of the current file will be replaced with the content of the selected revision. Do you want to continue?'
) && restoreRevision(row.path)
}
data-tid="restoreRevisionTID"
@@ -206,7 +218,7 @@ function Revisions(props: Props) {
aria-label="delete revision"
onClick={() =>
confirm(
- 'The current revision will be deleted. Do you want to continue?'
+ 'The selected revision will be deleted. Do you want to continue?'
) && deleteRevision(row.path)
}
data-tid="deleteRevisionTID"
@@ -218,31 +230,15 @@ function Revisions(props: Props) {
</TableCell>
</TableRow>
))}
- {/*{emptyRows > 0 && (
- <TableRow style={{ height: 53 * emptyRows }}>
- <TableCell colSpan={6} />
- </TableRow>
- )}*/}
</TableBody>
</Table>
</TableContainer>
- {rows && rowsPerPage < rows.length && (
- <TablePagination
- rowsPerPageOptions={[5, 10, 25]}
- component="div"
- count={rows.length}
- rowsPerPage={rowsPerPage}
- page={page}
- onPageChange={handleChangePage}
- onRowsPerPageChange={handleChangeRowsPerPage}
- />
- )}
<FilePreviewDialog
fsEntry={previewDialogEntry}
open={previewDialogEntry !== undefined}
onClose={() => setPreviewDialogEntry(undefined)}
/>
- </div>
+ </Paper>
);
}
diff --git a/app/locales/en/core.json b/app/locales/en/core.json
index 9cbfcab7a..8ba1129a2 100644
--- a/app/locales/en/core.json
+++ b/app/locales/en/core.json
@@ -746,5 +746,6 @@
"minutes": "minutes",
"day": "day",
"days": "days",
+ "change": "Change",
"-": "-"
}