Skip to content

Commit

Permalink
move edit file info button next to download and move save button up
Browse files Browse the repository at this point in the history
  • Loading branch information
sujitv19196 committed Sep 11, 2023
1 parent e3af1c6 commit 75e6743
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
13 changes: 5 additions & 8 deletions src/screens/EPub/components/EPubHeader/EPubTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@ import { CTHeading, CTFragment,useCTConfirmation } from 'layout';
import { connectWithRedux } from '../../controllers';
import EPubCopyModal from '../EPubCopyModal';
import SaveStatusLabel from './SaveStatusLabel';
import { _makeTBtn } from './ToolButton';
import { ToolButtonDivider, _makeTBtn } from './ToolButton';

function EPubTitle({ epub, dispatch }) {
const { title } = epub;
const [showCpyMdl, setShowCpyMdl] = useState(false);
const onOpenCpyMdl = () => setShowCpyMdl(true);
const onCloseCpyMdl = () => setShowCpyMdl(false);

const onOpenSettings = () => dispatch({ type: 'epub/setShowFileSettings', payload: true });

const settingsBtn = _makeTBtn(
'edit', 'Edit file', null, onOpenSettings, false, true
);
const copyBtn = _makeTBtn(
'file_copy', 'Make a copy', null, onOpenCpyMdl, false, true
);
Expand All @@ -30,17 +25,19 @@ function EPubTitle({ epub, dispatch }) {
'delete', 'Delete', null, delConfirmation.onOpen, false, true
);


const saveEPub = () => dispatch({ type: 'epub/updateEPub_Internal' })
const saveBtnEl = _makeTBtn('cloud_upload', 'Save', '⌘S', saveEPub, false, true);

return (
<CTFragment dFlex alignItCenter className="ct-epb header-title con">
<CTHeading as="h1" id="ct-epb-header-title" title={title} fadeIn={false}>
{title}
</CTHeading>
<CTFragment dFlex alignItCenter width="max-content">
{settingsBtn}
<ToolButtonDivider />
{copyBtn}
{deleteBtn}
{saveBtnEl}
<SaveStatusLabel />
</CTFragment>

Expand Down
7 changes: 6 additions & 1 deletion src/screens/EPub/components/EPubHeader/EPubToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,17 @@ function EPubToolbar({ view, dispatch, epub }) {
'help_outline', 'Show Help Guide', null, openHelpGuide, false, true
);

const onOpenSettings = () => dispatch({ type: 'epub/setShowFileSettings', payload: true });

const settingsBtn = _makeTBtn(
'edit', 'Edit I-Note Info', null, onOpenSettings, false, true
);

return (
<CTFragment id="ct-epb-header-toolbar" justConBetween>
<CTFragment alignItCenter className="ct-epb tool-btns">
{saveBtnEl}
{null && previewBtnEl} {/* The preview button causes a crash when clicked (cause unknown) */}
{settingsBtn}
<ToolButtonDivider />
<DownloadDropdown />
{!isReadOnly && <ToolButtonDivider />}
Expand Down
2 changes: 1 addition & 1 deletion src/screens/EPub/components/EPubHeader/ViewDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function ViewDropdown({ view, dispatch }) {
},
{
value: epub.const.EditINote,
text: 'Edit INote (beta)',
text: 'Edit I-Note (beta)',
icon: 'edit'
}
];
Expand Down

0 comments on commit 75e6743

Please sign in to comment.