mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-19 22:28:10 +00:00
bunch of things that should have been commits
This commit is contained in:
@@ -1,69 +1,30 @@
|
|||||||
@import '@sharedStyles/core.less';
|
@import '@sharedStyles/core.less';
|
||||||
|
|
||||||
@keyframes glideDown {
|
|
||||||
0% {
|
|
||||||
opacity : 0;transform : translate(-50% + 3px, 0px);}
|
|
||||||
100% {
|
|
||||||
opacity : 1;transform : translate(-50% + 3px, 10px);}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.navItem.error {
|
.navItem.error {
|
||||||
position : relative;
|
position : relative;
|
||||||
background-color : @red;
|
background-color : @red;
|
||||||
}
|
}
|
||||||
|
|
||||||
.errorContainer {
|
.errorContainer {
|
||||||
position : absolute;
|
|
||||||
top : 100%;
|
|
||||||
left : 50%;
|
|
||||||
z-index : 1000;
|
|
||||||
width : 140px;
|
width : 140px;
|
||||||
padding : 3px;
|
padding : 5px !important;
|
||||||
font-size : 10px;
|
font-size : 10px;
|
||||||
font-weight : 800;
|
line-height: 1.5em;
|
||||||
color : white;
|
color : white;
|
||||||
text-align : center;
|
|
||||||
text-transform : uppercase;
|
text-transform : uppercase;
|
||||||
background-color : #333333;
|
flex-direction: column;
|
||||||
border : 3px solid #444444;
|
outline:1px solid red;
|
||||||
border-radius : 5px;
|
border:1px solid red;
|
||||||
transform : translate(-50% + 3px, 10px);
|
border-width: 1px 3px;
|
||||||
animation-name : glideDown;
|
border-radius:5px;
|
||||||
animation-duration : 0.4s;
|
|
||||||
.lowercase { text-transform : none; }
|
.lowercase { text-transform : none; }
|
||||||
a { color : @teal; }
|
a { color : @teal; }
|
||||||
&::before {
|
|
||||||
position : absolute;
|
|
||||||
top : -23px;
|
|
||||||
left : 53px;
|
|
||||||
width : 0px;
|
|
||||||
height : 0px;
|
|
||||||
content : '';
|
|
||||||
border-top : 10px solid transparent;
|
|
||||||
border-right : 10px solid transparent;
|
|
||||||
border-bottom : 10px solid #444444;
|
|
||||||
border-left : 10px solid transparent;
|
|
||||||
}
|
|
||||||
&::after {
|
|
||||||
position : absolute;
|
|
||||||
top : -19px;
|
|
||||||
left : 53px;
|
|
||||||
width : 0px;
|
|
||||||
height : 0px;
|
|
||||||
content : '';
|
|
||||||
border-top : 10px solid transparent;
|
|
||||||
border-right : 10px solid transparent;
|
|
||||||
border-bottom : 10px solid #333333;
|
|
||||||
border-left : 10px solid transparent;
|
|
||||||
}
|
|
||||||
.deny {
|
.deny {
|
||||||
display : inline-block;
|
display : inline-block;
|
||||||
width : 48%;
|
width : 48%;
|
||||||
padding : 5px;
|
padding : 5px;
|
||||||
margin : 1px;
|
margin : 1px;
|
||||||
background-color : #333333;
|
background:@orange;
|
||||||
border-left : 1px solid #666666;
|
|
||||||
.animate(background-color);
|
.animate(background-color);
|
||||||
&:hover { background-color : red; }
|
&:hover { background-color : red; }
|
||||||
}
|
}
|
||||||
@@ -73,7 +34,7 @@
|
|||||||
padding : 5px;
|
padding : 5px;
|
||||||
margin : 1px;
|
margin : 1px;
|
||||||
color : white;
|
color : white;
|
||||||
background-color : #333333;
|
background:@orange;
|
||||||
.animate(background-color);
|
.animate(background-color);
|
||||||
&:hover { background-color : teal; }
|
&:hover { background-color : teal; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const Nav = {
|
|||||||
</div>;
|
</div>;
|
||||||
},
|
},
|
||||||
|
|
||||||
item : ({ icon, kbd,href, newTab, onClick, color, children, className, disabled, ...props })=>{
|
item : ({ icon, kbd,href, newTab, onClick, color, children, className, disabled, noDismiss, ...props })=>{
|
||||||
const classes = cx('navItem', color, className);
|
const classes = cx('navItem', color, className);
|
||||||
if(disabled) {
|
if(disabled) {
|
||||||
return <button className={classes} disabled>{children}{icon && <i className={icon}></i>}</button>
|
return <button className={classes} disabled>{children}{icon && <i className={icon}></i>}</button>
|
||||||
@@ -36,57 +36,18 @@ const Nav = {
|
|||||||
{icon && <i className={icon}></i>}
|
{icon && <i className={icon}></i>}
|
||||||
</a>;
|
</a>;
|
||||||
} else {
|
} else {
|
||||||
return <button {...props} className={classes} onClick={onClick} >
|
return <button {...props} no-dismiss={noDismiss ? 'true' : 'false'} className={classes} onClick={onClick} >
|
||||||
{children}
|
{children}
|
||||||
{icon && <i className={icon}></i>}
|
{icon && <i className={icon}></i>}
|
||||||
{kbd && <kbd>{kbd}</kbd>}
|
{kbd && <kbd>{kbd}</kbd>}
|
||||||
</button>;
|
</button>;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
header: ({span, className, children, ...props})=>{
|
||||||
dropdown : function dropdown(props) {
|
return <li className={cx([`navItem header`, className])} no-dismiss='true'>
|
||||||
props = Object.assign({}, props, {
|
{children}
|
||||||
trigger : 'hover click'
|
</li>;
|
||||||
});
|
},
|
||||||
|
|
||||||
const myRef = useRef(null);
|
|
||||||
const [showDropdown, setShowDropdown] = useState(false);
|
|
||||||
|
|
||||||
useEffect(()=>{
|
|
||||||
document.addEventListener('click', handleClickOutside);
|
|
||||||
return ()=>{
|
|
||||||
document.removeEventListener('click', handleClickOutside);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
function handleClickOutside(e) {
|
|
||||||
// Close dropdown when clicked outside
|
|
||||||
if(!myRef.current?.contains(e.target)) {
|
|
||||||
handleDropdown(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleDropdown(show) {
|
|
||||||
setShowDropdown(show ?? !showDropdown);
|
|
||||||
}
|
|
||||||
|
|
||||||
const dropdownChildren = React.Children.map(props.children, (child, i)=>{
|
|
||||||
if(i < 1) return;
|
|
||||||
return child;
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={`navDropdownContainer ${props.className ?? ''}`}
|
|
||||||
ref={myRef}
|
|
||||||
onMouseEnter = { props.trigger.includes('hover') ? ()=>handleDropdown(true) : undefined }
|
|
||||||
onMouseLeave = { props.trigger.includes('hover') ? ()=>handleDropdown(false) : undefined }
|
|
||||||
onClick = { props.trigger.includes('click') ? ()=>handleDropdown(true) : undefined }
|
|
||||||
>
|
|
||||||
{props.children[0] || props.children /*children is not an array when only one child*/}
|
|
||||||
{showDropdown && <div className='navDropdown'>{dropdownChildren}</div>}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ const Navbar = ({ children, brew, pageName, editor, title, currentPage, props })
|
|||||||
</Dropdown>
|
</Dropdown>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
console.log(navSlots);
|
||||||
return (
|
return (
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
@@ -3,19 +3,6 @@
|
|||||||
@navbarHeight: 29px;
|
@navbarHeight: 29px;
|
||||||
@viewerToolsHeight: 32px;
|
@viewerToolsHeight: 32px;
|
||||||
|
|
||||||
@keyframes glideDropDown {
|
|
||||||
0% {
|
|
||||||
background-color: #333333;
|
|
||||||
opacity: 0;
|
|
||||||
transform: translate(0px, -100%);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
background-color: #333333;
|
|
||||||
opacity: 1;
|
|
||||||
transform: translate(0px, 0px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.homebrew nav {
|
.homebrew nav {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
@@ -25,6 +12,7 @@
|
|||||||
color: #ccc;
|
color: #ccc;
|
||||||
height: @navbarHeight;
|
height: @navbarHeight;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
||||||
font-family:
|
font-family:
|
||||||
Alata,
|
Alata,
|
||||||
open sans;
|
open sans;
|
||||||
@@ -36,11 +24,12 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
max-width:140px;
|
||||||
|
text-wrap:wrap;
|
||||||
|
|
||||||
&:has(> button, > a) {
|
&:has(> button, > a) {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.brewTitle {
|
&.brewTitle {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -54,7 +43,6 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.metadata {
|
&.metadata {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -165,27 +153,9 @@
|
|||||||
text-transform: none;
|
text-transform: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
button,
|
|
||||||
a {
|
|
||||||
&:disabled {
|
|
||||||
color: #777;
|
|
||||||
}
|
|
||||||
display: grid;
|
|
||||||
place-items: center;
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
padding: 5px 10px;
|
|
||||||
}
|
|
||||||
a {
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.header {
|
&.header {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.save {
|
&.save {
|
||||||
width: 90px;
|
width: 90px;
|
||||||
|
|
||||||
@@ -204,17 +174,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.googleDriveStorage {
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
img {
|
button,
|
||||||
height: 18px;
|
a {
|
||||||
padding: 0px;
|
&:disabled {
|
||||||
margin: -5px;
|
color: #777;
|
||||||
&.inactive {
|
|
||||||
filter: grayscale(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
padding: 5px 10px;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
i.fa-power-off {
|
i.fa-power-off {
|
||||||
@@ -235,7 +209,7 @@
|
|||||||
&:hover {
|
&:hover {
|
||||||
background: #484848;
|
background: #484848;
|
||||||
}
|
}
|
||||||
&:has(> i, > kbd) {
|
&:has(> i, > kbd, >img) {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -298,6 +272,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.googleDriveStorage {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
img {
|
||||||
|
height: 18px;
|
||||||
|
padding: 0px;
|
||||||
|
margin: -5px;
|
||||||
|
translate:-5px;
|
||||||
|
&.inactive {
|
||||||
|
filter: grayscale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
> ul {
|
> ul {
|
||||||
|
|||||||
@@ -156,11 +156,11 @@ const RecentItems = createReactClass({
|
|||||||
|
|
||||||
return <>
|
return <>
|
||||||
{(this.props.showEdit && this.props.showView) ?
|
{(this.props.showEdit && this.props.showView) ?
|
||||||
<Nav.item className='header'>edited</Nav.item> : null }
|
<Nav.header>edited</Nav.header> : null }
|
||||||
{this.props.showEdit ?
|
{this.props.showEdit ?
|
||||||
makeItems(this.state.edit) : null }
|
makeItems(this.state.edit) : null }
|
||||||
{(this.props.showEdit && this.props.showView) ?
|
{(this.props.showEdit && this.props.showView) ?
|
||||||
<Nav.item className='header'>viewed</Nav.item> : null }
|
<Nav.header>viewed</Nav.header> : null }
|
||||||
{this.props.showView ?
|
{this.props.showView ?
|
||||||
makeItems(this.state.view) : null }
|
makeItems(this.state.view) : null }
|
||||||
</>;
|
</>;
|
||||||
|
|||||||
@@ -306,49 +306,55 @@ const EditorPage = (props)=>{
|
|||||||
trySave(true, true, newSaveGoogle);
|
trySave(true, true, newSaveGoogle);
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderGoogleDriveIcon = ()=>(
|
const renderGoogleDriveIcon = ()=>{
|
||||||
<Nav.item className='googleDriveStorage' onClick={handleGoogleClick}>
|
const errorExists = alertNoGoogleToTransfer || alertOwnershipToTransfer || alertTrashedGoogleBrew || confirmGoogleTransfer;
|
||||||
<img src={googleDriveIcon} className={saveGoogle ? '' : 'inactive'} alt='Google Drive icon' />
|
return (<>
|
||||||
|
<Nav.header>This brew is in {saveGoogle ? 'Google Drive' : 'The Homebrewery'}</Nav.header>
|
||||||
|
<Nav.item className='googleDriveStorage' noDismiss={errorExists} onClick={handleGoogleClick}>
|
||||||
|
{saveGoogle ? 'Transfer to Homebrewery' : 'Transfer to Drive'}
|
||||||
|
{saveGoogle? '' : <img src={googleDriveIcon} className={saveGoogle ? '' : 'inactive'} alt='Google Drive icon' /> }
|
||||||
|
</Nav.item>
|
||||||
|
{errorExists && <Nav.item className='errorContainer' >
|
||||||
{alertOwnershipToTransfer && (
|
{alertOwnershipToTransfer && (
|
||||||
<div className='errorContainer'>
|
<>
|
||||||
You must be the Owner to transfer between the Homebrewery and Google Drive!
|
You must be the Owner to transfer between the Homebrewery and Google Drive!
|
||||||
The owner of this file is {currentBrew.authors[0]}.
|
The owner of this file is {currentBrew.authors[0]}.
|
||||||
<br></br>
|
<br></br>
|
||||||
<div className='confirm' onClick={closeAlerts}> Okay </div>
|
<div className='confirm' onClick={closeAlerts}> Okay </div>
|
||||||
</div>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{alertNoGoogleToTransfer && (
|
{alertNoGoogleToTransfer && (
|
||||||
<div className='errorContainer'>
|
<>
|
||||||
You must be signed in to a Google account to transfer between the Homebrewery and Google Drive!
|
You must be signed in to a Google account to transfer between the Homebrewery and Google Drive!
|
||||||
<a target='_blank' rel='noopener noreferrer' href={`https://www.naturalcrit.com/login?redirect=${window.location.href}`}>
|
<a target='_blank' rel='noopener noreferrer' href={`https://www.naturalcrit.com/login?redirect=${window.location.href}`}>
|
||||||
<div className='confirm' onClick={closeAlerts}> Sign In </div>
|
<div className='confirm' onClick={closeAlerts}> Sign In </div>
|
||||||
</a>
|
</a>
|
||||||
<div className='deny' onClick={closeAlerts}> Not Now </div>
|
<div className='deny' onClick={closeAlerts}> Not Now </div>
|
||||||
</div>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{alertTrashedGoogleBrew && (
|
{alertTrashedGoogleBrew && (
|
||||||
<div className='errorContainer'>
|
<>
|
||||||
This brew is currently in your Trash folder on Google Drive!<br />
|
This brew is currently in your Trash folder on Google Drive!<br />
|
||||||
If you want to keep it, make sure to move it before it is deleted permanently!<br />
|
If you want to keep it, make sure to move it before it is deleted permanently!<br />
|
||||||
<div className='confirm' onClick={toggleGoogleStorage}> Save my brew </div>
|
<div className='confirm' onClick={toggleGoogleStorage}> Save my brew </div>
|
||||||
</div>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{confirmGoogleTransfer && (
|
{confirmGoogleTransfer && (
|
||||||
<div className='errorContainer'>
|
<>
|
||||||
{saveGoogle
|
{saveGoogle
|
||||||
? 'Would you like to transfer this brew from your Google Drive storage back to the Homebrewery?'
|
? 'Would you like to transfer this brew from your Google Drive storage back to the Homebrewery?'
|
||||||
: 'Would you like to transfer this brew from the Homebrewery to your personal Google Drive storage?'}
|
: 'Would you like to transfer this brew from the Homebrewery to your personal Google Drive storage?'}
|
||||||
<br />
|
<br />
|
||||||
<div className='confirm' onClick={toggleGoogleStorage}> Yes </div>
|
<div className='confirm' onClick={toggleGoogleStorage}> Yes </div>
|
||||||
<div className='deny' onClick={closeAlerts}> No </div>
|
<div className='deny' onClick={closeAlerts}> No </div>
|
||||||
</div>
|
</>
|
||||||
)}
|
)}
|
||||||
</Nav.item>
|
</Nav.item>}
|
||||||
);
|
</>
|
||||||
|
)};
|
||||||
|
|
||||||
|
|
||||||
const renderAutoSaveButton = ()=>(
|
const renderAutoSaveButton = ()=>(
|
||||||
@@ -381,6 +387,9 @@ const EditorPage = (props)=>{
|
|||||||
save now
|
save now
|
||||||
</Nav.item>
|
</Nav.item>
|
||||||
{(pageName == 'editPage') && renderAutoSaveButton()}
|
{(pageName == 'editPage') && renderAutoSaveButton()}
|
||||||
|
{pageName === 'editPage' && <div className="nav-section">
|
||||||
|
{renderGoogleDriveIcon()}
|
||||||
|
</div>}
|
||||||
</Navbar.File>
|
</Navbar.File>
|
||||||
<Navbar.Menu>
|
<Navbar.Menu>
|
||||||
{error? <ErrorNavItem error={error} clearError={clearError} /> : renderSaveButton()}
|
{error? <ErrorNavItem error={error} clearError={clearError} /> : renderSaveButton()}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import './editPage.less';
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import request from '../../utils/request-middleware.js';
|
import request from '../../utils/request-middleware.js';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
|
|
||||||
.editPage {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
import './newPage.less';
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import request from '../../utils/request-middleware.js';
|
import request from '../../utils/request-middleware.js';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
@import '@sharedStyles/colors.less';
|
|
||||||
|
|
||||||
.newPage {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user