mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-18 22:39:44 +00:00
move edit link back into navbar
This commit is contained in:
@@ -17,7 +17,6 @@ const Navbar = ({ children, brew, editor, title = '', props }) => {
|
|||||||
const mod = isMac ? '⌘' : 'Ctrl';
|
const mod = isMac ? '⌘' : 'Ctrl';
|
||||||
const isBrew = !!brew && brew.shareId;
|
const isBrew = !!brew && brew.shareId;
|
||||||
const account = global.account;
|
const account = global.account;
|
||||||
console.log(editor);
|
|
||||||
|
|
||||||
const slots = React.Children.toArray(children).reduce((acc, child) => {
|
const slots = React.Children.toArray(children).reduce((acc, child) => {
|
||||||
if (React.isValidElement(child)) {
|
if (React.isValidElement(child)) {
|
||||||
@@ -51,7 +50,16 @@ const Navbar = ({ children, brew, editor, title = '', props }) => {
|
|||||||
</Nav.item>
|
</Nav.item>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const renderEditLink = () => {
|
||||||
|
const editLink = brew?.googleId && !brew?.stubbed ? brew?.googleId + brew?.editId : brew?.editId;
|
||||||
|
return (
|
||||||
|
<Nav.item href={`/edit/${editLink}`} disabled={!brew?.editId}>
|
||||||
|
edit this brew
|
||||||
|
</Nav.item>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const renderFile = () => {
|
const renderFile = () => {
|
||||||
return (
|
return (
|
||||||
<Dropdown groupName={'File'} customTrigger={<>File</>} icon={null} key={'file'}>
|
<Dropdown groupName={'File'} customTrigger={<>File</>} icon={null} key={'file'}>
|
||||||
@@ -63,7 +71,6 @@ const Navbar = ({ children, brew, editor, title = '', props }) => {
|
|||||||
<PrintNavitem disabled={!isBrew} />
|
<PrintNavitem disabled={!isBrew} />
|
||||||
{renderDownloadLink()}
|
{renderDownloadLink()}
|
||||||
</div>
|
</div>
|
||||||
<ShareNavitem brew={brew} disabled={!isBrew} currentPage={'' /*how the hell do i get it here?*/} />
|
|
||||||
<div className='nav-section'>
|
<div className='nav-section'>
|
||||||
<Nav.item className='beta' disabled={!isBrew}>
|
<Nav.item className='beta' disabled={!isBrew}>
|
||||||
Delete File
|
Delete File
|
||||||
@@ -79,28 +86,28 @@ const Navbar = ({ children, brew, editor, title = '', props }) => {
|
|||||||
</Dropdown>
|
</Dropdown>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderEdit = () => {
|
const renderEdit = () => {
|
||||||
return (
|
return (
|
||||||
<Dropdown groupName={'Edit'} customTrigger={<>Edit</>} icon={null} key={'edit'}>
|
<Dropdown groupName={'Edit'} customTrigger={<>Edit</>} icon={null} key={'edit'}>
|
||||||
<div className='nav-section'>
|
<div className='nav-section'>
|
||||||
{slots.edit?.props.children}
|
<Nav.item onClick={() => editor?.undo()} kbd={mod + ' + z'} disabled={!isBrew}>
|
||||||
<Nav.item onClick={()=>editor?.undo()} kbd={mod + ' + z'} disabled={!isBrew}>
|
|
||||||
Undo
|
Undo
|
||||||
</Nav.item>
|
</Nav.item>
|
||||||
<Nav.item onClick={()=>editor?.redo()} kbd={mod + ' + Shift + z'} disabled={!isBrew}>
|
<Nav.item onClick={() => editor?.redo()} kbd={mod + ' + Shift + z'} disabled={!isBrew}>
|
||||||
Redo
|
Redo
|
||||||
</Nav.item>
|
</Nav.item>
|
||||||
<Nav.item onClick={()=>editor?.find()} kbd={mod + ' + f'} disabled={!isBrew}>
|
<Nav.item onClick={() => editor?.find()} kbd={mod + ' + f'} disabled={!isBrew}>
|
||||||
Find / Replace
|
Find / Replace
|
||||||
</Nav.item>
|
</Nav.item>
|
||||||
<Nav.item onClick={()=>editor?.foldCode()} disabled={!isBrew}>
|
<Nav.item onClick={() => editor?.foldCode()} disabled={!isBrew}>
|
||||||
Fold all lines
|
Fold all lines
|
||||||
</Nav.item>
|
</Nav.item>
|
||||||
<Nav.item onClick={()=>editor?.unfoldCode()} disabled={!isBrew}>
|
<Nav.item onClick={() => editor?.unfoldCode()} disabled={!isBrew}>
|
||||||
Unfold all lines
|
Unfold all lines
|
||||||
</Nav.item>
|
</Nav.item>
|
||||||
</div>
|
</div>
|
||||||
|
{slots.edit?.props.children}
|
||||||
{/*
|
{/*
|
||||||
<div className="nav-section">
|
<div className="nav-section">
|
||||||
<Nav.item onClick={()=>editor?.cut()} kbd={mod + ' + x'} disabled={!isBrew}>
|
<Nav.item onClick={()=>editor?.cut()} kbd={mod + ' + x'} disabled={!isBrew}>
|
||||||
@@ -113,7 +120,7 @@ const Navbar = ({ children, brew, editor, title = '', props }) => {
|
|||||||
paste
|
paste
|
||||||
</Nav.item>
|
</Nav.item>
|
||||||
</div>
|
</div>
|
||||||
*/}
|
*/}
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -121,6 +128,8 @@ const Navbar = ({ children, brew, editor, title = '', props }) => {
|
|||||||
const renderGo = () => {
|
const renderGo = () => {
|
||||||
return (
|
return (
|
||||||
<Dropdown groupName={'Go'} customTrigger={<>Go</>} icon={null} key={'go'}>
|
<Dropdown groupName={'Go'} customTrigger={<>Go</>} icon={null} key={'go'}>
|
||||||
|
{renderEditLink()}
|
||||||
|
<ShareNavitem brew={brew} disabled={!isBrew} currentPage={'' /*how the hell do i get it here?*/} />
|
||||||
<div className='nav-section'>
|
<div className='nav-section'>
|
||||||
<Nav.item className='patreon' newTab={true} href='https://www.patreon.com/NaturalCrit' color='green' icon='fas fa-heart'>
|
<Nav.item className='patreon' newTab={true} href='https://www.patreon.com/NaturalCrit' color='green' icon='fas fa-heart'>
|
||||||
Patreon
|
Patreon
|
||||||
|
|||||||
@@ -3,21 +3,6 @@
|
|||||||
@navbarHeight: 28px;
|
@navbarHeight: 28px;
|
||||||
@viewerToolsHeight: 32px;
|
@viewerToolsHeight: 32px;
|
||||||
|
|
||||||
@keyframes pinkColoring {
|
|
||||||
0% {
|
|
||||||
color: pink;
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
color: pink;
|
|
||||||
}
|
|
||||||
75% {
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
color: pink;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes glideDropDown {
|
@keyframes glideDropDown {
|
||||||
0% {
|
0% {
|
||||||
background-color: #333333;
|
background-color: #333333;
|
||||||
@@ -195,7 +180,7 @@
|
|||||||
.homebrew nav {
|
.homebrew nav {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
background: #333;
|
background: #333;
|
||||||
min-height: 29px;
|
height: @navbarHeight;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-family:
|
font-family:
|
||||||
Alata,
|
Alata,
|
||||||
|
|||||||
@@ -64,25 +64,11 @@ const SharePage = (props)=>{
|
|||||||
document.removeEventListener('keydown', handleControlKeys);
|
document.removeEventListener('keydown', handleControlKeys);
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const renderEditLink = () => {
|
|
||||||
if (!currentBrew.editId) return null;
|
|
||||||
|
|
||||||
const editLink = currentBrew.googleId && !currentBrew.stubbed ? currentBrew.googleId + currentBrew.editId : currentBrew.editId;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Navbar.File>
|
|
||||||
<Nav.item color='orange' icon='fas fa-pencil-alt' href={`/edit/${editLink}`}>
|
|
||||||
edit
|
|
||||||
</Nav.item>
|
|
||||||
</Navbar.File>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='sharePage sitePage'>
|
<div className='sharePage sitePage'>
|
||||||
<Meta name='robots' content='noindex, nofollow' />
|
<Meta name='robots' content='noindex, nofollow' />
|
||||||
<Navbar>{renderEditLink()}</Navbar>
|
<Navbar brew={currentBrew} />
|
||||||
<div className='content'>
|
<div className='content'>
|
||||||
<BrewRenderer
|
<BrewRenderer
|
||||||
text={currentBrew.text}
|
text={currentBrew.text}
|
||||||
|
|||||||
Reference in New Issue
Block a user