Skip to content

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

Entry details refactoring (#1980)

Stanimir198a926c1252
diff --git a/app/components/EditDescription.tsx b/app/components/EditDescription.tsx
index 157dbf5eb..ec838e671 100644
--- a/app/components/EditDescription.tsx
+++ b/app/components/EditDescription.tsx
@@ -24,7 +24,7 @@ const classes = {
};
const Root = styled('div')(({ theme }) => ({
- height: 250,
+ height: '90%',
[`& .${classes.button}`]: {
position: 'relative',
padding: '8px 12px 6px 8px',
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsx
index baaf04a7d..bb1db3bad 100644
--- a/app/components/EntryContainer.tsx
+++ b/app/components/EntryContainer.tsx
@@ -24,37 +24,18 @@ import React, {
useRef,
useState
} from 'react';
-import { connect } from 'react-redux';
+import { connect, useSelector } from 'react-redux';
import { bindActionCreators } from 'redux';
import { GlobalHotKeys } from 'react-hotkeys';
import fscreen from 'fscreen';
import Button from '@mui/material/Button';
import LoadingButton from '@mui/lab/LoadingButton';
import Tooltip from '-/components/Tooltip';
-import MoreVertIcon from '@mui/icons-material/MoreVert';
-import IconButton from '@mui/material/IconButton';
-import BookmarkIcon from '@mui/icons-material/BookmarkTwoTone';
-import BookmarkAddIcon from '@mui/icons-material/BookmarkAddTwoTone';
import EditIcon from '@mui/icons-material/Edit';
import SaveIcon from '@mui/icons-material/Save';
-import CloseIcon from '@mui/icons-material/Close';
-import FullScreenIcon from '@mui/icons-material/ZoomOutMap';
-import FileDownloadIcon from '@mui/icons-material/AssignmentReturned';
-import DetailsIcon from '@mui/icons-material/Info';
-import ExpandIcon from '@mui/icons-material/SettingsEthernet';
import Box from '@mui/material/Box';
import ButtonGroup from '@mui/material/ButtonGroup';
-import {
- ParentFolderIcon,
- NavigateToFolderIcon,
- OpenNewWindowIcon,
- CancelIcon,
- ReloadIcon,
- DeleteIcon,
- LinkIcon
-} from '-/components/CommonIcons';
-import HistoryIcon from '@mui/icons-material/History';
-import { Split } from 'ts-react-splitter';
+import { CancelIcon } from '-/components/CommonIcons';
import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
import { buffer } from '@tagspaces/tagspaces-common/misc';
import AppConfig from '-/AppConfig';
@@ -62,14 +43,8 @@ import {
getMetaFileLocationForDir,
getMetaFileLocationForFile,
extractContainingDirectoryPath,
- extractTitle,
- extractFileExtension,
- extractFileName,
- extractDirectoryName,
getBackupFileLocation
} from '@tagspaces/tagspaces-common/paths';
-import { ProTooltip } from '-/components/HelperComponents';
-import TagsPreview from '-/components/TagsPreview';
import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
import PlatformIO from '-/services/platform-facade';
import AddRemoveTagsDialog from '-/components/dialogs/AddRemoveTagsDialog';
@@ -79,7 +54,8 @@ import {
isDesktopMode,
getKeyBindingObject,
getCurrentLanguage,
- isRevisionsEnabled
+ isRevisionsEnabled,
+ getEntryContainerTab
} from '-/reducers/settings';
import {
OpenedEntry,
@@ -91,23 +67,18 @@ import useEventListener from '-/utils/useEventListener';
import { TS } from '-/tagspaces.namespace';
import FileView from '-/components/FileView';
import { Pro } from '-/pro';
-import { actions as LocationActions, getLocations } from '-/reducers/locations';
-import Revisions from '-/components/Revisions';
-import { Grid, Switch } from '@mui/material';
+import { actions as LocationActions } from '-/reducers/locations';
+import { Switch } from '@mui/material';
import useFirstRender from '-/utils/useFirstRender';
import ResolveConflictDialog from '-/components/dialogs/ResolveConflictDialog';
-import { dataTidFormat } from '-/services/test';
-import { getSharingLink, loadJSONFile } from '-/services/utils-io';
+import { loadJSONFile } from '-/services/utils-io';
import { styled, useTheme } from '@mui/material/styles';
import EntryContainerTabs from '-/components/EntryContainerTabs';
import EntryContainerNav from '-/components/EntryContainerNav';
-import EntryContainerMenu from '-/components/EntryContainerMenu';
+import EntryContainerTitle from '-/components/EntryContainerTitle';
+
+//const defaultSplitSize = '7.86%'; // '7.2%'; // 103;
-const defaultSplitSize = '7.86%'; // '7.2%'; // 103;
-// const openedSplitSize = AppConfig.isElectron ? 560 : 360;
-/* const fullSplitSize = 750;
-// const maxCharactersTitleLength = 50;
-*/
const bufferedSplitResize = buffer({
timeout: 300,
id: 'buffered-split-resize'
@@ -116,8 +87,7 @@ const bufferedSplitResize = buffer({
const PREFIX = 'EntryContainer';
const classes = {
toolbar2: `${PREFIX}-toolbar2`,
- flexLeft: `${PREFIX}-flexLeft`,
- fileBadge: `${PREFIX}-fileBadge`
+ flexLeft: `${PREFIX}-flexLeft`
};
const Root = styled(Box)(({ theme }) => ({
@@ -126,6 +96,7 @@ const Root = styled(Box)(({ theme }) => ({
flex: '1 1 100%',
display: 'flex',
backgroundColor: theme.palette.background.default,
+ overflow: 'hidden',
// height: '100%', // filePropsHeight ||
[`& .${classes.toolbar2}`]: {
width: '100%',
@@ -146,15 +117,6 @@ const Root = styled(Box)(({ theme }) => ({
overflowX: 'auto',
overflowY: 'hidden',
paddingRight: 100
- },
- [`& .${classes.fileBadge}`]: {
- color: 'white',
- backgroundColor: AppConfig.defaultFileColor,
- padding: 3,
- textShadow: '1px 1px #8f8f8f',
- fontSize: 13,
- marginLeft: 3,
- borderRadius: 3
}
}));
@@ -165,16 +127,16 @@ interface Props {
closeAllFiles: () => void;
openPrevFile: (path: string) => void;
openNextFile: (path: string) => void;
- openFileNatively: (path: string) => void;
- openLink: (url: string, options?: any) => void;
- openDirectory: (path: string) => void;
+ //openFileNatively: (path: string) => void;
+ //openLink: (url: string, options?: any) => void;
+ //openDirectory: (path: string) => void;
showNotification: (
text: string,
notificationType?: string, // NotificationTypes
autohide?: boolean
) => void;
- deleteFile: (path: string, uuid: string) => void;
- toggleEntryFullWidth: () => void;
+ //deleteFile: (path: string, uuid: string) => void;
+ //toggleEntryFullWidth: () => void;
isReadOnlyMode: boolean;
setEntryPropertiesSplitSize: (size: string) => void;
updateOpenedFile: (
@@ -193,7 +155,6 @@ interface Props {
switchLocationType: (locationId: string) => Promise<string | null>;
switchCurrentLocationType: (currentLocationId) => Promise<boolean>;
revisionsEnabled: boolean;
- locations: Array<TS.Location>;
}
const historyKeys = Pro && Pro.history ? Pro.history.historyKeys : {};
@@ -205,30 +166,20 @@ function EntryContainer(props: Props) {
openedFiles,
currentDirectoryPath,
desktopMode,
- toggleEntryFullWidth,
isReadOnlyMode,
updateOpenedFile,
- deleteFile,
- openLink,
closeAllFiles,
- openFileNatively,
- openDirectory,
setEntryPropertiesSplitSize,
showNotification
} = props;
- const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
+ const tabIndex = useSelector(getEntryContainerTab);
const theme = useTheme();
// const [percent, setPercent] = React.useState<number | undefined>(undefined);
const percent = useRef<number | undefined>(undefined);
const timer = useRef(null);
const openedFile = openedFiles[0];
const openedFilePath = useRef(openedFile.path);
- // const [currentEntry, setCurrentEntry] = useState<OpenedEntry>(openedFile);
-
- const [isPropertiesPanelVisible, setPropertiesPanelVisible] = useState<
- boolean
- >(false);
const [propertiesStyles, setPropertiesStyles] = useState<React.CSSProperties>(
{ display: 'flex', flexDirection: 'column' }
@@ -405,23 +356,15 @@ function EntryContainer(props: Props) {
}, [openedFilePath.current, isReadOnlyMode]); // , settings]);
// always open for dirs
- const isPropPanelVisible = openedFile.isFile
+ /*const isPropPanelVisible = openedFile.isFile
? isPropertiesPanelVisible
- : true;
+ : true;*/
const editingSupported: boolean =
!isReadOnlyMode &&
openedFile.editingExtensionId !== undefined &&
openedFile.editingExtensionId.length > 3;
- const haveBookmark =
- Pro && Pro.bookmarks && Pro.bookmarks.haveBookmark(openedFile.path);
-
- const { sharingLink, sharingParentFolderLink } = getSharingLink(
- openedFile,
- props.locations
- );
-
const handleMessage = (data: any) => {
let message;
let textFilePath;
@@ -828,24 +771,6 @@ function EntryContainer(props: Props) {
props.openPrevFile(openedFile.path);
};
- const bookmarkClick = () => {
- if (Pro) {
- if (haveBookmark) {
- Pro.bookmarks.delBookmark(openedFile.path);
- } else {
- Pro.bookmarks.setBookmark(openedFile.path, sharingLink);
- }
- forceUpdate();
- } else {
- showNotification(
- i18n.t('core:toggleBookmark') +
- ' - ' +
- i18n.t('thisFunctionalityIsAvailableInPro'),
- NotificationTypes.default
- );
- }
- };
-
const isEditable = AppConfig.editableFiles.some(ext =>
openedFile.path.endsWith(ext)
);
@@ -872,34 +797,6 @@ function EntryContainer(props: Props) {
}
};
- let fileTitle: string = openedFile.path
- ? extractTitle(
- openedFile.path,
- !openedFile.isFile,
- PlatformIO.getDirSeparator()
- )
- : '';
-
- let fileName: string;
- if (openedFile.path) {
- if (openedFile.isFile) {
- fileName = extractFileName(openedFile.path, PlatformIO.getDirSeparator());
- } else {
- fileName = extractDirectoryName(
- openedFile.path,
- PlatformIO.getDirSeparator()
- );
- }
- }
- if (!fileName) {
- const currentLocation = props.locations.find(
- location => location.uuid === openedFile.locationId
- );
- if (currentLocation) {
- fileName = currentLocation.name;
- }
- }
-
const renderPanels = () => {
const toolbarButtons = () => {
return (
@@ -923,118 +820,12 @@ function EntryContainer(props: Props) {
paddingRight: editingSupported ? 85 : 5
}}
>
- {openedFile.isFile ? (
- <>
- {fileChanged.current ? (
- <Tooltip title={i18n.t('core:fileChanged')}>
- <span
- style={{
- color: theme.palette.text.primary,
- margin: 3
- }}
- >
- {String.fromCharCode(0x25cf)}
- </span>
- </Tooltip>
- ) : (
- ''
- )}
- <span
- className={classes.fileBadge}
- title={i18n.t('core:toggleEntryProperties')}
- data-tid="propsActionsMenuTID"
- aria-controls={Boolean(anchorEl) ? 'basic-menu' : undefined}
- aria-haspopup="true"
- aria-expanded={Boolean(anchorEl) ? 'true' : undefined}
- // endIcon={<MoreVertIcon sx={{ fontSize: 20 }} />}
- onClick={(event: React.MouseEvent<HTMLElement>) => {
- setAnchorEl(event.currentTarget);
- }}
- style={{
- backgroundColor: openedFile.color,
- display: 'flex',
- alignItems: 'center',
- textTransform: 'uppercase',
- paddingLeft: 10
- }}
- >
- {//'.' +
- extractFileExtension(
- openedFile.path,
- PlatformIO.getDirSeparator()
- )}
- <MoreVertIcon style={{ fontSize: 20 }} />
- </span>
- </>
- ) : (
- <span
- className={classes.fileBadge}
- title={i18n.t('core:toggleEntryProperties')}
- data-tid="propsActionsMenuTID"
- aria-controls={Boolean(anchorEl) ? 'basic-menu' : undefined}
- aria-haspopup="true"
- aria-expanded={Boolean(anchorEl) ? 'true' : undefined}
- // endIcon={<MoreVertIcon sx={{ fontSize: 20 }} />}
- onClick={(event: React.MouseEvent<HTMLElement>) => {
- setAnchorEl(event.currentTarget);
- }}
- style={{
- backgroundColor: AppConfig.defaultFolderColor,
- display: 'flex',
- alignItems: 'center'
- }}
- >
- {i18n.t('core:folder')}
- <MoreVertIcon style={{ fontSize: 20 }} />
- </span>
- )}
- <EntryContainerMenu
- anchorEl={anchorEl}
- handleClose={() => setAnchorEl(null)}
- openedEntry={openedFile}
+ <EntryContainerTitle
+ isFileChanged={fileChanged.current}
+ openedFile={openedFile}
reloadDocument={reloadDocument}
- sharingLink={sharingLink}
- sharingParentFolderLink={sharingParentFolderLink}
toggleFullScreen={toggleFullScreen}
/>
- <Tooltip title={openedFile.isFile && fileName}>
- <Box
- data-tid={'OpenedTID' + dataTidFormat(fileName)}
- style={{
- color: theme.palette.text.primary,
- display: 'inline',
- fontSize: 17,
- marginLeft: 5,
- maxHeight: 40,
- overflowY: 'auto'
- }}
- >
- {fileTitle}
- </Box>
- </Tooltip>
- <ProTooltip tooltip={i18n.t('core:toggleBookmark')}>
- <IconButton
- data-tid="toggleBookmarkTID"
- aria-label="bookmark"
- size="small"
- onClick={bookmarkClick}
- >
- {haveBookmark ? (
- <BookmarkIcon
- style={{
- color: theme.palette.primary.main
- }}
- />
- ) : (
- <BookmarkAddIcon
- style={{
- color: theme.palette.text.secondary
- }}
- />
- )}
- </IconButton>
- </ProTooltip>
- <TagsPreview tags={openedFile.tags} />
</Box>
<EntryContainerNav
isFile={openedFile.isFile}
@@ -1145,7 +936,8 @@ function EntryContainer(props: Props) {
return (
<div
style={{
- position: 'relative'
+ position: 'relative',
+ overflow: 'hidden'
}}
>
{tabsComponent('160px')}
@@ -1176,10 +968,10 @@ function EntryContainer(props: Props) {
return (
<div
style={{
- height: 'calc(100% - 47px)',
- //height: '100%',
+ // height: 'calc(100% - 47px)',
+ height: '100%',
//minHeight: '100%',
- ...propertiesStyles
+ ...(tabIndex !== undefined && propertiesStyles)
}}
>
<Root>
@@ -1304,8 +1096,7 @@ function mapStateToProps(state) {
keyBindings: getKeyBindingObject(state),
desktopMode: isDesktopMode(state),
revisionsEnabled: isRevisionsEnabled(state),
- language: getCurrentLanguage(state),
- locations: getLocations(state)
+ language: getCurrentLanguage(state)
};
}
@@ -1314,14 +1105,9 @@ function mapActionCreatorsToProps(dispatch) {
{
setEntryPropertiesSplitSize: SettingsActions.setEntryPropertiesSplitSize,
closeAllFiles: AppActions.closeAllFiles,
- openFileNatively: AppActions.openFileNatively,
- openDirectory: AppActions.openDirectory,
- openLink: AppActions.openLink,
showNotification: AppActions.showNotification,
openNextFile: AppActions.openNextFile,
openPrevFile: AppActions.openPrevFile,
- deleteFile: AppActions.deleteFile,
- toggleEntryFullWidth: AppActions.toggleEntryFullWidth,
updateOpenedFile: AppActions.updateOpenedFile,
switchLocationType: LocationActions.switchLocationType,
switchCurrentLocationType: AppActions.switchCurrentLocationType
diff --git a/app/components/EntryContainerTabs.tsx b/app/components/EntryContainerTabs.tsx
index e5621f116..ff95aadc6 100644
--- a/app/components/EntryContainerTabs.tsx
+++ b/app/components/EntryContainerTabs.tsx
@@ -21,7 +21,6 @@ import { styled, useTheme } from '@mui/material/styles';
import { useSelector, useDispatch } from 'react-redux';
import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab';
-import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';
import {
actions as AppActions,
@@ -36,7 +35,11 @@ import Revisions from '-/components/Revisions';
import EntryProperties from '-/components/EntryProperties';
import TaggingActions from '-/reducers/tagging-actions';
import { TS } from '-/tagspaces.namespace';
-import { getMapTileServer } from '-/reducers/settings';
+import {
+ actions as SettingsActions,
+ getEntryContainerTab,
+ getMapTileServer
+} from '-/reducers/settings';
import EditDescription from '-/components/EditDescription';
interface StyledTabsProps {
@@ -107,7 +110,8 @@ interface TabPanelProps {
}
function EntryContainerTabs(props: Props) {
- const [value, setValue] = React.useState(0);
+ const tabIndex = useSelector(getEntryContainerTab);
+ // const [value, setValue] = React.useState(0);
const { openedFile, openPanel, toggleProperties, marginRight } = props;
const editDescription = useRef<string>(undefined);
//const theme = useTheme();
@@ -129,8 +133,8 @@ function EntryContainerTabs(props: Props) {
style={{
height: '100%',
overflowY: 'auto',
- padding: 10,
- ...(openedFile.isFile && { maxHeight: 400 })
+ padding: 10
+ // ...(openedFile.isFile && { maxHeight: 400 })
}}
>
{value === index && children}
@@ -154,16 +158,16 @@ function EntryContainerTabs(props: Props) {
) => dispatch(TaggingActions.addTags(paths, tags, updateIndex));
const handleChange = (event: React.SyntheticEvent, newValue: number) => {
- setValue(newValue);
+ dispatch(SettingsActions.setEntryContainerTab(newValue));
openPanel();
};
const handleTabClick = (event: React.SyntheticEvent) => {
if (
openedFile.isFile &&
- value === parseInt(event.currentTarget.id.split('-')[1], 10)
+ tabIndex === parseInt(event.currentTarget.id.split('-')[1], 10)
) {
// when selected tab is clicked...
- setValue(undefined);
+ dispatch(SettingsActions.setEntryContainerTab(undefined));
toggleProperties();
}
};
@@ -217,10 +221,18 @@ function EntryContainerTabs(props: Props) {
};
return (
- <Box sx={{ width: '100%', height: '100%' }}>
+ <div
+ style={{
+ width: '100%',
+ height: '100%',
+ display: 'flex',
+ flexDirection: 'column',
+ overflow: 'hidden'
+ }}
+ >
<Box sx={{ ...(marginRight && { marginRight }) }}>
<StyledTabs
- value={value}
+ value={tabIndex}
onChange={handleChange}
aria-label="basic tabs example"
>
@@ -246,7 +258,7 @@ function EntryContainerTabs(props: Props) {
)}
</StyledTabs>
</Box>
- <TsTabPanel value={value} index={0}>
+ <TsTabPanel value={tabIndex} index={0}>
<EntryProperties
key={openedFile.path}
openedEntry={openedFile}
@@ -258,7 +270,7 @@ function EntryContainerTabs(props: Props) {
tileServer={tileServer}
/>
</TsTabPanel>
- <TsTabPanel value={value} index={1}>
+ <TsTabPanel value={tabIndex} index={1}>
<EditDescription
toggleEditDescriptionField={
!readOnlyMode && !openedFile.editMode && toggleEditDescriptionField
@@ -269,11 +281,11 @@ function EntryContainerTabs(props: Props) {
/>
</TsTabPanel>
{openedFile.isFile && (
- <TsTabPanel value={value} index={2}>
+ <TsTabPanel value={tabIndex} index={2}>
<Revisions />
</TsTabPanel>
)}
- </Box>
+ </div>
);
}
diff --git a/app/components/EntryContainerTitle.tsx b/app/components/EntryContainerTitle.tsx
new file mode 100644
index 000000000..b013ebb50
--- /dev/null
+++ b/app/components/EntryContainerTitle.tsx
@@ -0,0 +1,244 @@
+/**
+ * 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, { useReducer, useRef } from 'react';
+import { styled, useTheme } from '@mui/material/styles';
+import {
+ extractTitle,
+ extractFileExtension,
+ extractFileName,
+ extractDirectoryName
+} from '@tagspaces/tagspaces-common/paths';
+import {
+ actions as AppActions,
+ AppDispatch,
+ NotificationTypes,
+ OpenedEntry
+} from '-/reducers/app';
+import i18n from '-/services/i18n';
+import Tooltip from '-/components/Tooltip';
+import PlatformIO from '-/services/platform-facade';
+import MoreVertIcon from '@mui/icons-material/MoreVert';
+import AppConfig from '-/AppConfig';
+import EntryContainerMenu from '-/components/EntryContainerMenu';
+import { getSharingLink, loadJSONFile } from '-/services/utils-io';
+import { useDispatch, useSelector } from 'react-redux';
+import { getLocations } from '-/reducers/locations';
+import Box from '@mui/material/Box';
+import { dataTidFormat } from '-/services/test';
+import { ProTooltip } from '-/components/HelperComponents';
+import IconButton from '@mui/material/IconButton';
+import BookmarkIcon from '@mui/icons-material/BookmarkTwoTone';
+import BookmarkAddIcon from '@mui/icons-material/BookmarkAddTwoTone';
+import TagsPreview from '-/components/TagsPreview';
+import { Pro } from '-/pro';
+
+const FileBadge = styled('span')(({ theme }) => ({
+ color: 'white',
+ backgroundColor: AppConfig.defaultFileColor,
+ padding: 3,
+ textShadow: '1px 1px #8f8f8f',
+ fontSize: 13,
+ marginLeft: 3,
+ borderRadius: 3
+}));
+
+interface Props {
+ openedFile: OpenedEntry;
+ isFileChanged: boolean;
+ toggleFullScreen: () => void;
+ reloadDocument: () => void;
+}
+
+function EntryContainerTitle(props: Props) {
+ const { openedFile, isFileChanged, reloadDocument, toggleFullScreen } = props;
+ const theme = useTheme();
+ const dispatch: AppDispatch = useDispatch();
+ const locations = useSelector(getLocations);
+ const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
+ const { sharingLink, sharingParentFolderLink } = getSharingLink(
+ openedFile,
+ locations
+ );
+ const [ignored, forceUpdate] = useReducer(x => x + 1, 0);
+
+ const haveBookmark =
+ Pro && Pro.bookmarks && Pro.bookmarks.haveBookmark(openedFile.path);
+
+ const bookmarkClick = () => {
+ if (Pro) {
+ if (haveBookmark) {
+ Pro.bookmarks.delBookmark(openedFile.path);
+ } else {
+ Pro.bookmarks.setBookmark(openedFile.path, sharingLink);
+ }
+ forceUpdate();
+ } else {
+ dispatch(
+ AppActions.showNotification(
+ i18n.t('core:toggleBookmark') +
+ ' - ' +
+ i18n.t('thisFunctionalityIsAvailableInPro'),
+ NotificationTypes.default
+ )
+ );
+ }
+ };
+
+ let fileTitle: string = openedFile.path
+ ? extractTitle(
+ openedFile.path,
+ !openedFile.isFile,
+ PlatformIO.getDirSeparator()
+ )
+ : '';
+
+ let fileName: string;
+ if (openedFile.path) {
+ if (openedFile.isFile) {
+ fileName = extractFileName(openedFile.path, PlatformIO.getDirSeparator());
+ } else {
+ fileName = extractDirectoryName(
+ openedFile.path,
+ PlatformIO.getDirSeparator()
+ );
+ }
+ }
+ if (!fileName) {
+ const currentLocation = locations.find(
+ location => location.uuid === openedFile.locationId
+ );
+ if (currentLocation) {
+ fileName = currentLocation.name;
+ }
+ }
+
+ return (
+ <>
+ {openedFile.isFile ? (
+ <>
+ {isFileChanged ? (
+ <Tooltip title={i18n.t('core:fileChanged')}>
+ <span
+ style={{
+ color: theme.palette.text.primary,
+ margin: 3
+ }}
+ >
+ {String.fromCharCode(0x25cf)}
+ </span>
+ </Tooltip>
+ ) : (
+ ''
+ )}
+ <FileBadge
+ title={i18n.t('core:toggleEntryProperties')}
+ data-tid="propsActionsMenuTID"
+ aria-controls={Boolean(anchorEl) ? 'basic-menu' : undefined}
+ aria-haspopup="true"
+ aria-expanded={Boolean(anchorEl) ? 'true' : undefined}
+ // endIcon={<MoreVertIcon sx={{ fontSize: 20 }} />}
+ onClick={(event: React.MouseEvent<HTMLElement>) => {
+ setAnchorEl(event.currentTarget);
+ }}
+ style={{
+ backgroundColor: openedFile.color,
+ display: 'flex',
+ alignItems: 'center',
+ textTransform: 'uppercase',
+ paddingLeft: 10
+ }}
+ >
+ {//'.' +
+ extractFileExtension(openedFile.path, PlatformIO.getDirSeparator())}
+ <MoreVertIcon style={{ fontSize: 20 }} />
+ </FileBadge>
+ </>
+ ) : (
+ <FileBadge
+ title={i18n.t('core:toggleEntryProperties')}
+ data-tid="propsActionsMenuTID"
+ aria-controls={Boolean(anchorEl) ? 'basic-menu' : undefined}
+ aria-haspopup="true"
+ aria-expanded={Boolean(anchorEl) ? 'true' : undefined}
+ // endIcon={<MoreVertIcon sx={{ fontSize: 20 }} />}
+ onClick={(event: React.MouseEvent<HTMLElement>) => {
+ setAnchorEl(event.currentTarget);
+ }}
+ style={{
+ backgroundColor: AppConfig.defaultFolderColor,
+ display: 'flex',
+ alignItems: 'center'
+ }}
+ >
+ {i18n.t('core:folder')}
+ <MoreVertIcon style={{ fontSize: 20 }} />
+ </FileBadge>
+ )}
+ <Tooltip title={openedFile.isFile && fileName}>
+ <Box
+ data-tid={'OpenedTID' + dataTidFormat(fileName)}
+ style={{
+ color: theme.palette.text.primary,
+ display: 'inline',
+ fontSize: 17,
+ marginLeft: 5,
+ maxHeight: 40,
+ overflowY: 'auto'
+ }}
+ >
+ {fileTitle}
+ </Box>
+ </Tooltip>
+ <ProTooltip tooltip={i18n.t('core:toggleBookmark')}>
+ <IconButton
+ data-tid="toggleBookmarkTID"
+ aria-label="bookmark"
+ size="small"
+ onClick={bookmarkClick}
+ >
+ {haveBookmark ? (
+ <BookmarkIcon
+ style={{
+ color: theme.palette.primary.main
+ }}
+ />
+ ) : (
+ <BookmarkAddIcon
+ style={{
+ color: theme.palette.text.secondary
+ }}
+ />
+ )}
+ </IconButton>
+ </ProTooltip>
+ <TagsPreview tags={openedFile.tags} />
+ <EntryContainerMenu
+ anchorEl={anchorEl}
+ handleClose={() => setAnchorEl(null)}
+ openedEntry={openedFile}
+ reloadDocument={reloadDocument}
+ sharingLink={sharingLink}
+ sharingParentFolderLink={sharingParentFolderLink}
+ toggleFullScreen={toggleFullScreen}
+ />
+ </>
+ );
+}
+
+export default EntryContainerTitle;
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsx
index 25fdaef7e..33d8c4565 100644
--- a/app/components/EntryProperties.tsx
+++ b/app/components/EntryProperties.tsx
@@ -119,10 +119,10 @@ const classes = {
};
const Root = styled('div')(({ theme }) => ({
- overflowY: 'auto',
+ /*overflowY: 'auto',
overflowX: 'hidden',
flexGrow: 1,
- height: '100%',
+ height: '100%',*/
[`& .${classes.tags}`]: {
padding: '5px 5px 2px 2px',
diff --git a/app/components/FileView.tsx b/app/components/FileView.tsx
index c932f6565..ea0c1944a 100644
--- a/app/components/FileView.tsx
+++ b/app/components/FileView.tsx
@@ -138,8 +138,8 @@ function FileView(props: Props) {
style={{
width: '100%',
height: height || '100%',
- //flex: '1 1 100%',
- //display: 'flex',
+ display: 'flex',
+ flex: '1 1 100%',
backgroundColor: theme.palette.background.default,
borderTop: 'outset'
}}
diff --git a/app/components/Revisions.tsx b/app/components/Revisions.tsx
index 72d550143..7a5737f47 100644
--- a/app/components/Revisions.tsx
+++ b/app/components/Revisions.tsx
@@ -166,7 +166,7 @@ function Revisions() {
return (
<Paper
- sx={{ width: '100%', overflow: 'hidden', height: 'calc(100% - 30px)' }}
+ sx={{ width: '100%', overflow: 'hidden', height: '100%' }} //'calc(100% - 30px)' }}
>
{rows.length > initialRowsPerPage && (
<TablePagination
diff --git a/app/components/menus/DirectoryMenu.tsx b/app/components/menus/DirectoryMenu.tsx
index 1df51dd5a..3f2361aec 100644
--- a/app/components/menus/DirectoryMenu.tsx
+++ b/app/components/menus/DirectoryMenu.tsx
@@ -108,7 +108,7 @@ function DirectoryMenu(props: Props) {
dispatch(AppActions.toggleCreateDirectoryDialog());
};
- const openEntry = path => dispatch(AppActions.openEntry(path));
+ const openEntry = path => dispatch(AppActions.openEntry(path, true));
const reflectCreateEntry = (path, isFile) => {
dispatch(AppActions.reflectCreateEntry(path, isFile));
diff --git a/app/components/menus/FileMenu.tsx b/app/components/menus/FileMenu.tsx
index a7b12bc83..5603c5704 100644
--- a/app/components/menus/FileMenu.tsx
+++ b/app/components/menus/FileMenu.tsx
@@ -67,6 +67,7 @@ import {
LinkIcon
} from '-/components/CommonIcons';
import { getLocations } from '-/reducers/locations';
+import PropertiesIcon from '@mui/icons-material/Info';
interface Props {
anchorEl: Element;
@@ -132,6 +133,13 @@ function FileMenu(props: Props) {
return generateSharingLink(locationID, relativePath);
}
+ function showProperties() {
+ onClose();
+ if (selectedEntries && selectedEntries.length === 1) {
+ dispatch(AppActions.openEntry(selectedEntries[0].path, true));
+ }
+ }
+
function copySharingLink() {
onClose();
if (selectedEntries && selectedEntries.length === 1) {
@@ -442,7 +450,7 @@ function FileMenu(props: Props) {
</MenuItem>
);
}
- menuItems.push(<Divider key="fmDivider3" />);
+ menuItems.push(<Divider key="fmDivider1" />);
menuItems.push(
<MenuItem
key="fileMenuRenameFile"
@@ -554,6 +562,22 @@ function FileMenu(props: Props) {
);
}
+ if (selectedEntries.length < 2) {
+ menuItems.push(<Divider key="fmDivider3" />);
+ menuItems.push(
+ <MenuItem
+ key="showProperties"
+ data-tid="showPropertiesTID"
+ onClick={showProperties}
+ >
+ <ListItemIcon>
+ <PropertiesIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:filePropertiesTitle')} />
+ </MenuItem>
+ );
+ }
+
return (
<div style={{ overflowY: 'hidden' }}>
<Menu
diff --git a/app/containers/MainPage.tsx b/app/containers/MainPage.tsx
index 81377bde1..6e244b0d9 100644
--- a/app/containers/MainPage.tsx
+++ b/app/containers/MainPage.tsx
@@ -684,7 +684,11 @@ function MainPage(props: Props) {
return (
<Root>
- <HotKeys handlers={keyBindingHandlers} keyMap={keyMap}>
+ <HotKeys
+ handlers={keyBindingHandlers}
+ keyMap={keyMap}
+ style={{ height: '100%' }}
+ >
<MoveOrCopyFilesDialog
open={moveCopyDialogOpened !== undefined}
onClose={() => {
@@ -877,6 +881,10 @@ function MainPage(props: Props) {
: '3px'
} !important;
}
+ .react-split .secondary .full-content {
+ display: flex;
+ flex-direction: column;
+ }
`}
</style>
{props.isDesktopMode || (AppConfig.isAmplify && !props.user) ? (
diff --git a/app/locales/en/core.json b/app/locales/en/core.json
index 85ca801cb..0816839ee 100644
--- a/app/locales/en/core.json
+++ b/app/locales/en/core.json
@@ -41,7 +41,8 @@
"errorDeletingDirectoryAlert": "Deleting '{{dirPath}}' failed. Folder probably not empty.",
"deletingDirectorySuccessfull": "Folder '{{dirPath}}' successfully deleted.",
"filePropertiesDescription": "Description",
- "directoryPropertiesTitle": "Folder Properties",
+ "directoryPropertiesTitle": "Folder Details",
+ "filePropertiesTitle": "File Details",
"createLocationTitle": "Connect a Location",
"createLocation": "New location",
"exportLocationTitle": "Export Location Configuration",
diff --git a/app/reducers/app.ts b/app/reducers/app.ts
index ed0940baa..95b247918 100644
--- a/app/reducers/app.ts
+++ b/app/reducers/app.ts
@@ -2309,13 +2309,15 @@ export const actions = {
}
return Promise.resolve(false);
},
- openEntry: (path?: string) => (dispatch: (action) => void) => {
+ openEntry: (path?: string, showDetails = false) => (
+ dispatch: (action) => void
+ ) => {
if (path === undefined) {
- return dispatch(actions.openFsEntry());
+ return dispatch(actions.openFsEntry(undefined, showDetails));
}
return getAllPropertiesPromise(path)
.then((fsEntry: TS.FileSystemEntry) =>
- dispatch(actions.openFsEntry(fsEntry))
+ dispatch(actions.openFsEntry(fsEntry, showDetails))
)
.catch(error =>
console.warn(
@@ -2323,10 +2325,11 @@ export const actions = {
)
);
},
- openFsEntry: (fsEntry?: TS.FileSystemEntry) => (
+ openFsEntry: (fsEntry?: TS.FileSystemEntry, showDetails = false) => (
dispatch: (action) => void,
getState: () => any
) => {
+ dispatch(SettingsActions.setShowDetails(showDetails));
if (fsEntry === undefined) {
// eslint-disable-next-line no-param-reassign
fsEntry = getLastSelectedEntry(getState());
diff --git a/app/reducers/settings-default.ts b/app/reducers/settings-default.ts
index e3a35711e..f02fe636e 100644
--- a/app/reducers/settings-default.ts
+++ b/app/reducers/settings-default.ts
@@ -53,6 +53,7 @@ export default {
newHTMLFileContent:
'<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body></body></html>',
showUnixHiddenEntries: false,
+ entryContainerTab: 0,
checkForUpdates,
reorderTags: false,
coloredFileExtension: false,
diff --git a/app/reducers/settings.ts b/app/reducers/settings.ts
index 41964ffa7..827e2ef4d 100644
--- a/app/reducers/settings.ts
+++ b/app/reducers/settings.ts
@@ -38,6 +38,8 @@ export const types = {
UPGRADE_SETTINGS: 'SETTINGS/UPGRADE_SETTINGS',
SET_LANGUAGE: 'SETTINGS/SET_LANGUAGE',
TOGGLE_SHOWUNIXHIDDENENTRIES: 'SETTINGS/TOGGLE_SHOWUNIXHIDDENENTRIES',
+ SET_ENTRY_CONTAINER_TAB: 'SETTINGS/SET_ENTRY_CONTAINER_TAB',
+ SET_SHOW_DETAILS: 'SETTINGS/SET_SHOW_DETAILS',
SET_DESKTOPMODE: 'SETTINGS/SET_DESKTOPMODE',
SET_DEVMODE: 'SETTINGS/SET_DEVMODE',
SET_ENABLE_WS: 'SETTINGS/SET_ENABLE_WS',
@@ -138,6 +140,21 @@ export default (state: any = defaultSettings, action: any) => {
case types.TOGGLE_SHOWUNIXHIDDENENTRIES: {
return { ...state, showUnixHiddenEntries: !state.showUnixHiddenEntries };
}
+ case types.SET_ENTRY_CONTAINER_TAB: {
+ return { ...state, entryContainerTab: action.entryContainerTab };
+ }
+ case types.SET_SHOW_DETAILS: {
+ if (action.showDetails) {
+ if (state.entryContainerTab !== 0) {
+ return { ...state, entryContainerTab: 0 };
+ }
+ } /*else {
+ if (state.entryContainerTab !== undefined) {
+ return { ...state, entryContainerTab: undefined };
+ }
+ }*/
+ return state;
+ }
case types.SET_TAG_DELIMITER: {
return { ...state, tagDelimiter: action.delimiter };
}
@@ -561,6 +578,14 @@ export const actions = {
toggleShowUnixHiddenEntries: () => ({
type: types.TOGGLE_SHOWUNIXHIDDENENTRIES
}),
+ setEntryContainerTab: (tabIndex: number) => ({
+ type: types.SET_ENTRY_CONTAINER_TAB,
+ entryContainerTab: tabIndex
+ }),
+ setShowDetails: (showDetails: boolean) => ({
+ type: types.SET_SHOW_DETAILS,
+ showDetails: showDetails
+ }),
setCheckForUpdates: (checkForUpdates: boolean) => ({
type: types.SET_CHECKFORUPDATES,
checkForUpdates
@@ -849,6 +874,8 @@ export const getLastPublishedVersion = (state: any) =>
state.settings.lastPublishedVersion;
export const getShowUnixHiddenEntries = (state: any) =>
state.settings.showUnixHiddenEntries;
+export const getEntryContainerTab = (state: any) =>
+ state.settings.entryContainerTab;
export const getUseDefaultLocation = (state: any) =>
state.settings.useDefaultLocation;
export const getDefaultPerspective = (state: any) =>