mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-05 00:48:44 +00:00
Merge branch 'master' into fit-listpage-into-vault
This commit is contained in:
+9
-12
@@ -7,9 +7,9 @@ import { makePatches, stringifyPatches } from '@sanity/diff-match-patch';
|
|||||||
|
|
||||||
import Headtags from '@vitreum/headtags.js';
|
import Headtags from '@vitreum/headtags.js';
|
||||||
import SplitPane from '@components/splitPane/splitPane.jsx';
|
import SplitPane from '@components/splitPane/splitPane.jsx';
|
||||||
import Editor from '../editor/editor.jsx';
|
import Editor from '../../../editor/editor.jsx';
|
||||||
import BrewRenderer from '../brewRenderer/brewRenderer.jsx';
|
import BrewRenderer from '../../../brewRenderer/brewRenderer.jsx';
|
||||||
import LockNotification from '../pages/editPage/lockNotification/lockNotification.jsx';
|
import LockNotification from '../../editPage/lockNotification/lockNotification.jsx';
|
||||||
const Meta = Headtags.Meta;
|
const Meta = Headtags.Meta;
|
||||||
|
|
||||||
//===---- Navbar
|
//===---- Navbar
|
||||||
@@ -24,7 +24,7 @@ import PrintNavItem from '@navbar/print.navitem.jsx';
|
|||||||
import ShareNavItem from '@navbar/share.navitem.jsx';
|
import ShareNavItem from '@navbar/share.navitem.jsx';
|
||||||
import RecentNavItems from '@navbar/recent.navitem.jsx';
|
import RecentNavItems from '@navbar/recent.navitem.jsx';
|
||||||
const { both: RecentNavItem } = RecentNavItems;
|
const { both: RecentNavItem } = RecentNavItems;
|
||||||
import googleDriveIcon from '../googleDrive.svg';
|
import googleDriveIcon from '../../../googleDrive.svg';
|
||||||
|
|
||||||
const AUTOSAVE_KEY = 'HB_editor_autoSaveOn';
|
const AUTOSAVE_KEY = 'HB_editor_autoSaveOn';
|
||||||
const BREWKEY = 'HB_newPage_content';
|
const BREWKEY = 'HB_newPage_content';
|
||||||
@@ -37,7 +37,7 @@ const SAVE_TIMEOUT = 10000; //Autosave 10 seconds after last c
|
|||||||
const UNSAVED_WARNING_TIMEOUT = 900000; //Warn user afer 15 minutes of unsaved changes
|
const UNSAVED_WARNING_TIMEOUT = 900000; //Warn user afer 15 minutes of unsaved changes
|
||||||
const UNSAVED_WARNING_POPUP_TIMEOUT = 4000; //Show the warning for 4 seconds
|
const UNSAVED_WARNING_POPUP_TIMEOUT = 4000; //Show the warning for 4 seconds
|
||||||
|
|
||||||
export default function useCommonEditPageFunctions(dependencies) {
|
const EditorPage = (props)=>{
|
||||||
const {
|
const {
|
||||||
brew,
|
brew,
|
||||||
useLocalStorage,
|
useLocalStorage,
|
||||||
@@ -48,7 +48,7 @@ export default function useCommonEditPageFunctions(dependencies) {
|
|||||||
pageName,
|
pageName,
|
||||||
showEditorButtons,
|
showEditorButtons,
|
||||||
userThemes = {}
|
userThemes = {}
|
||||||
} = dependencies;
|
} = props;
|
||||||
|
|
||||||
const [currentBrew, setCurrentBrew] = useState(brew);
|
const [currentBrew, setCurrentBrew] = useState(brew);
|
||||||
const [isSaving, setIsSaving] = useState(false);
|
const [isSaving, setIsSaving] = useState(false);
|
||||||
@@ -399,7 +399,7 @@ export default function useCommonEditPageFunctions(dependencies) {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderPanels = ()=>(
|
return (
|
||||||
<div className= {`${pageName} sitePage`}>
|
<div className= {`${pageName} sitePage`}>
|
||||||
<Meta name='google-site-verification' content='NwnAQSSJZzAT7N-p5MY6ydQ7Njm67dtbu73ZSyE5Fy4' />
|
<Meta name='google-site-verification' content='NwnAQSSJZzAT7N-p5MY6ydQ7Njm67dtbu73ZSyE5Fy4' />
|
||||||
{(pageName == 'editPage') && <Meta name='robots' content='noindex, nofollow' />}
|
{(pageName == 'editPage') && <Meta name='robots' content='noindex, nofollow' />}
|
||||||
@@ -439,9 +439,6 @@ export default function useCommonEditPageFunctions(dependencies) {
|
|||||||
{showFloatingButtons && renderFloatingSaveButtons()}
|
{showFloatingButtons && renderFloatingSaveButtons()}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
export default EditorPage;
|
||||||
trySave,
|
|
||||||
renderPanels
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
import './editPage.less';
|
import './editPage.less';
|
||||||
|
|
||||||
// Common imports
|
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';
|
import EditorPage from '../basePages/editPage/editorPage.jsx';
|
||||||
import useCommonEditPageFunctions from '../../utils/commonEditPageFunctions.jsx';
|
import { DEFAULT_BREW_LOAD } from '../../../../server/brewDefaults.js';
|
||||||
import { DEFAULT_BREW_LOAD } from '../../../../server/brewDefaults.js';
|
|
||||||
|
|
||||||
// Page specific imports
|
// Page specific imports
|
||||||
import { gzipSync, strToU8 } from 'fflate';
|
import { gzipSync, strToU8 } from 'fflate';
|
||||||
@@ -45,21 +44,18 @@ const EditPage = (props)=>{
|
|||||||
history.replaceState(null, null, `/edit/${savedBrew.editId}`);;
|
history.replaceState(null, null, `/edit/${savedBrew.editId}`);;
|
||||||
};
|
};
|
||||||
|
|
||||||
const {
|
return (
|
||||||
renderPanels,
|
<EditorPage
|
||||||
} = useCommonEditPageFunctions({
|
useLocalStorage = {false}
|
||||||
useLocalStorage : false,
|
sandbox = {false}
|
||||||
sandbox : false,
|
showFloatingButtons = {false}
|
||||||
showFloatingButtons : false,
|
showEditorButtons = {true}
|
||||||
showEditorButtons : true,
|
pageName = {'editPage'}
|
||||||
pageName : 'newPage',
|
brew = {props.brew}
|
||||||
brew : props.brew,
|
userThemes = {props.userThemes}
|
||||||
userThemes : props.userThemes,
|
save = {save}
|
||||||
save,
|
onSaveSuccess = {onSaveSuccess}
|
||||||
onSaveSuccess,
|
></EditorPage>);
|
||||||
});
|
|
||||||
|
|
||||||
return renderPanels();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default EditPage;
|
export default EditPage;
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import './homePage.less';
|
import './homePage.less';
|
||||||
|
|
||||||
// Common imports
|
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';
|
import EditorPage from '../basePages/editPage/editorPage.jsx';
|
||||||
import useCommonEditPageFunctions from '../../utils/commonEditPageFunctions.jsx';
|
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
||||||
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
|
||||||
|
|
||||||
const HomePage =(props)=>{
|
const HomePage =(props)=>{
|
||||||
props = {
|
props = {
|
||||||
@@ -26,21 +25,18 @@ const HomePage =(props)=>{
|
|||||||
window.location = `/edit/${savedBrew.editId}`;
|
window.location = `/edit/${savedBrew.editId}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const {
|
return (
|
||||||
renderPanels
|
<EditorPage
|
||||||
} = useCommonEditPageFunctions({
|
useLocalStorage = {false}
|
||||||
useLocalStorage : false,
|
sandbox = {true}
|
||||||
sandbox : true,
|
showFloatingButtons = {true}
|
||||||
showFloatingButtons : true,
|
showEditorButtons = {false}
|
||||||
showEditorButtons : false,
|
pageName = {'homePage'}
|
||||||
pageName : 'homePage',
|
brew = {props.brew}
|
||||||
brew : props.brew,
|
userThemes = {{}}
|
||||||
userThemes : {},
|
save = {save}
|
||||||
save,
|
onSaveSuccess = {onSaveSuccess}
|
||||||
onSaveSuccess,
|
></EditorPage>);
|
||||||
});
|
|
||||||
|
|
||||||
return renderPanels();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default HomePage;
|
export default HomePage;
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import './newPage.less';
|
import './newPage.less';
|
||||||
|
|
||||||
// Common imports
|
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';
|
import EditorPage from '../basePages/editPage/editorPage.jsx';
|
||||||
import useCommonEditPageFunctions from '../../utils/commonEditPageFunctions.jsx';
|
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
||||||
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
|
||||||
|
|
||||||
const NewPage = (props)=>{
|
const NewPage = (props)=>{
|
||||||
props = {
|
props = {
|
||||||
@@ -26,21 +25,18 @@ const NewPage = (props)=>{
|
|||||||
window.location = `/edit/${savedBrew.editId}`;
|
window.location = `/edit/${savedBrew.editId}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const {
|
return (
|
||||||
renderPanels
|
<EditorPage
|
||||||
} = useCommonEditPageFunctions({
|
useLocalStorage = {true}
|
||||||
useLocalStorage : true,
|
sandbox = {true}
|
||||||
sandbox : true,
|
showFloatingButtons = {false}
|
||||||
showFloatingButtons : false,
|
showEditorButtons = {true}
|
||||||
showEditorButtons : true,
|
pageName = {'newPage'}
|
||||||
pageName : 'newPage',
|
brew = {props.brew}
|
||||||
brew : props.brew,
|
userThemes = {props.userThemes}
|
||||||
userThemes : props.userThemes,
|
save = {save}
|
||||||
save,
|
onSaveSuccess = {onSaveSuccess}
|
||||||
onSaveSuccess,
|
></EditorPage>);
|
||||||
});
|
|
||||||
|
|
||||||
return renderPanels();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default NewPage;
|
export default NewPage;
|
||||||
|
|||||||
Reference in New Issue
Block a user