mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-04 22:38:43 +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 SplitPane from '@components/splitPane/splitPane.jsx';
|
||||
import Editor from '../editor/editor.jsx';
|
||||
import BrewRenderer from '../brewRenderer/brewRenderer.jsx';
|
||||
import LockNotification from '../pages/editPage/lockNotification/lockNotification.jsx';
|
||||
import Editor from '../../../editor/editor.jsx';
|
||||
import BrewRenderer from '../../../brewRenderer/brewRenderer.jsx';
|
||||
import LockNotification from '../../editPage/lockNotification/lockNotification.jsx';
|
||||
const Meta = Headtags.Meta;
|
||||
|
||||
//===---- Navbar
|
||||
@@ -24,7 +24,7 @@ import PrintNavItem from '@navbar/print.navitem.jsx';
|
||||
import ShareNavItem from '@navbar/share.navitem.jsx';
|
||||
import RecentNavItems from '@navbar/recent.navitem.jsx';
|
||||
const { both: RecentNavItem } = RecentNavItems;
|
||||
import googleDriveIcon from '../googleDrive.svg';
|
||||
import googleDriveIcon from '../../../googleDrive.svg';
|
||||
|
||||
const AUTOSAVE_KEY = 'HB_editor_autoSaveOn';
|
||||
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_POPUP_TIMEOUT = 4000; //Show the warning for 4 seconds
|
||||
|
||||
export default function useCommonEditPageFunctions(dependencies) {
|
||||
const EditorPage = (props)=>{
|
||||
const {
|
||||
brew,
|
||||
useLocalStorage,
|
||||
@@ -48,7 +48,7 @@ export default function useCommonEditPageFunctions(dependencies) {
|
||||
pageName,
|
||||
showEditorButtons,
|
||||
userThemes = {}
|
||||
} = dependencies;
|
||||
} = props;
|
||||
|
||||
const [currentBrew, setCurrentBrew] = useState(brew);
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
@@ -399,7 +399,7 @@ export default function useCommonEditPageFunctions(dependencies) {
|
||||
</>
|
||||
);
|
||||
|
||||
const renderPanels = ()=>(
|
||||
return (
|
||||
<div className= {`${pageName} sitePage`}>
|
||||
<Meta name='google-site-verification' content='NwnAQSSJZzAT7N-p5MY6ydQ7Njm67dtbu73ZSyE5Fy4' />
|
||||
{(pageName == 'editPage') && <Meta name='robots' content='noindex, nofollow' />}
|
||||
@@ -439,9 +439,6 @@ export default function useCommonEditPageFunctions(dependencies) {
|
||||
{showFloatingButtons && renderFloatingSaveButtons()}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
return {
|
||||
trySave,
|
||||
renderPanels
|
||||
};
|
||||
}
|
||||
export default EditorPage;
|
||||
@@ -1,11 +1,10 @@
|
||||
import './editPage.less';
|
||||
|
||||
// Common imports
|
||||
import React from 'react';
|
||||
import request from '../../utils/request-middleware.js';
|
||||
import _ from 'lodash';
|
||||
import useCommonEditPageFunctions from '../../utils/commonEditPageFunctions.jsx';
|
||||
import { DEFAULT_BREW_LOAD } from '../../../../server/brewDefaults.js';
|
||||
import React from 'react';
|
||||
import request from '../../utils/request-middleware.js';
|
||||
import _ from 'lodash';
|
||||
import EditorPage from '../basePages/editPage/editorPage.jsx';
|
||||
import { DEFAULT_BREW_LOAD } from '../../../../server/brewDefaults.js';
|
||||
|
||||
// Page specific imports
|
||||
import { gzipSync, strToU8 } from 'fflate';
|
||||
@@ -45,21 +44,18 @@ const EditPage = (props)=>{
|
||||
history.replaceState(null, null, `/edit/${savedBrew.editId}`);;
|
||||
};
|
||||
|
||||
const {
|
||||
renderPanels,
|
||||
} = useCommonEditPageFunctions({
|
||||
useLocalStorage : false,
|
||||
sandbox : false,
|
||||
showFloatingButtons : false,
|
||||
showEditorButtons : true,
|
||||
pageName : 'newPage',
|
||||
brew : props.brew,
|
||||
userThemes : props.userThemes,
|
||||
save,
|
||||
onSaveSuccess,
|
||||
});
|
||||
|
||||
return renderPanels();
|
||||
return (
|
||||
<EditorPage
|
||||
useLocalStorage = {false}
|
||||
sandbox = {false}
|
||||
showFloatingButtons = {false}
|
||||
showEditorButtons = {true}
|
||||
pageName = {'editPage'}
|
||||
brew = {props.brew}
|
||||
userThemes = {props.userThemes}
|
||||
save = {save}
|
||||
onSaveSuccess = {onSaveSuccess}
|
||||
></EditorPage>);
|
||||
};
|
||||
|
||||
export default EditPage;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import './homePage.less';
|
||||
|
||||
// Common imports
|
||||
import React from 'react';
|
||||
import request from '../../utils/request-middleware.js';
|
||||
import _ from 'lodash';
|
||||
import useCommonEditPageFunctions from '../../utils/commonEditPageFunctions.jsx';
|
||||
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
||||
import React from 'react';
|
||||
import request from '../../utils/request-middleware.js';
|
||||
import _ from 'lodash';
|
||||
import EditorPage from '../basePages/editPage/editorPage.jsx';
|
||||
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
||||
|
||||
const HomePage =(props)=>{
|
||||
props = {
|
||||
@@ -26,21 +25,18 @@ const HomePage =(props)=>{
|
||||
window.location = `/edit/${savedBrew.editId}`;
|
||||
};
|
||||
|
||||
const {
|
||||
renderPanels
|
||||
} = useCommonEditPageFunctions({
|
||||
useLocalStorage : false,
|
||||
sandbox : true,
|
||||
showFloatingButtons : true,
|
||||
showEditorButtons : false,
|
||||
pageName : 'homePage',
|
||||
brew : props.brew,
|
||||
userThemes : {},
|
||||
save,
|
||||
onSaveSuccess,
|
||||
});
|
||||
|
||||
return renderPanels();
|
||||
return (
|
||||
<EditorPage
|
||||
useLocalStorage = {false}
|
||||
sandbox = {true}
|
||||
showFloatingButtons = {true}
|
||||
showEditorButtons = {false}
|
||||
pageName = {'homePage'}
|
||||
brew = {props.brew}
|
||||
userThemes = {{}}
|
||||
save = {save}
|
||||
onSaveSuccess = {onSaveSuccess}
|
||||
></EditorPage>);
|
||||
};
|
||||
|
||||
export default HomePage;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import './newPage.less';
|
||||
|
||||
// Common imports
|
||||
import React from 'react';
|
||||
import request from '../../utils/request-middleware.js';
|
||||
import _ from 'lodash';
|
||||
import useCommonEditPageFunctions from '../../utils/commonEditPageFunctions.jsx';
|
||||
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
||||
import React from 'react';
|
||||
import request from '../../utils/request-middleware.js';
|
||||
import _ from 'lodash';
|
||||
import EditorPage from '../basePages/editPage/editorPage.jsx';
|
||||
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
||||
|
||||
const NewPage = (props)=>{
|
||||
props = {
|
||||
@@ -26,21 +25,18 @@ const NewPage = (props)=>{
|
||||
window.location = `/edit/${savedBrew.editId}`;
|
||||
};
|
||||
|
||||
const {
|
||||
renderPanels
|
||||
} = useCommonEditPageFunctions({
|
||||
useLocalStorage : true,
|
||||
sandbox : true,
|
||||
showFloatingButtons : false,
|
||||
showEditorButtons : true,
|
||||
pageName : 'newPage',
|
||||
brew : props.brew,
|
||||
userThemes : props.userThemes,
|
||||
save,
|
||||
onSaveSuccess,
|
||||
});
|
||||
|
||||
return renderPanels();
|
||||
return (
|
||||
<EditorPage
|
||||
useLocalStorage = {true}
|
||||
sandbox = {true}
|
||||
showFloatingButtons = {false}
|
||||
showEditorButtons = {true}
|
||||
pageName = {'newPage'}
|
||||
brew = {props.brew}
|
||||
userThemes = {props.userThemes}
|
||||
save = {save}
|
||||
onSaveSuccess = {onSaveSuccess}
|
||||
></EditorPage>);
|
||||
};
|
||||
|
||||
export default NewPage;
|
||||
|
||||
Reference in New Issue
Block a user