mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-03-24 04:18:10 +00:00
trying to get this to work
This commit is contained in:
@@ -11,8 +11,7 @@ import ToolBar from './toolBar/toolBar.jsx';
|
||||
//TODO: move to the brew renderer
|
||||
import RenderWarnings from '../../components/renderWarnings/renderWarnings.jsx';
|
||||
import NotificationPopup from './notificationPopup/notificationPopup.jsx';
|
||||
import frameComp from 'react-frame-component';
|
||||
const Frame = frameComp.default;
|
||||
import Frame from 'react-frame-component';
|
||||
import dedent from 'dedent';
|
||||
import { printCurrentBrew } from '../../../shared/helpers.js';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'core-js/es/string/to-well-formed.js'; // Polyfill for older browsers
|
||||
import './homebrew.less';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { BrowserRouter as Router, Routes, Route, useParams, useSearchParams } from 'react-router-dom';
|
||||
import { BrowserRouter as Router, Routes, Route, useParams, useSearchParams } from 'react-router';
|
||||
|
||||
import { updateLocalStorage } from './utils/updateLocalStorage/updateLocalStorageKeys.js';
|
||||
|
||||
@@ -21,31 +21,27 @@ const WithRoute = ({ el: Element, ...rest })=>{
|
||||
return <Element {...rest} {...params} query={queryParams} />;
|
||||
};
|
||||
|
||||
const Homebrew = ()=>{
|
||||
const Homebrew = (props)=>{
|
||||
// SPA defaults / client-side state
|
||||
const [account, setAccount] = useState(null);
|
||||
const [version] = useState('0.0.0');
|
||||
const [config, setConfig] = useState({});
|
||||
const [brew, setBrew] = useState({
|
||||
title : '',
|
||||
text : '',
|
||||
shareId : null,
|
||||
editId : null,
|
||||
createdAt : null,
|
||||
updatedAt : null,
|
||||
lang : ''
|
||||
});
|
||||
const [userThemes, setUserThemes] = useState([]);
|
||||
const [brews, setBrews] = useState([]);
|
||||
const {
|
||||
url = '',
|
||||
version = '0.0.0',
|
||||
account = null,
|
||||
config,
|
||||
brew = {
|
||||
title : '',
|
||||
text : '',
|
||||
shareId : null,
|
||||
editId : null,
|
||||
createdAt : null,
|
||||
updatedAt : null,
|
||||
lang : ''
|
||||
},
|
||||
userThemes,
|
||||
brews
|
||||
} = props;
|
||||
|
||||
// Maybe should fetch the data here?
|
||||
//probably should fetch the object later
|
||||
// useEffect(() => { fetch('/api/...').then(res => res.json()).then(setBrew) }, []);
|
||||
|
||||
// Set globals if needed (legacy)
|
||||
global.account = account;
|
||||
global.version = version;
|
||||
global.config = config;
|
||||
console.log('props: ', props);
|
||||
|
||||
const backgroundObject = ()=>{
|
||||
if(config?.deployment || (config?.local && config?.development)) {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { BrowserRouter } from "react-router-dom";
|
||||
import App from "./App";
|
||||
import Homebrew from "./homebrew.jsx";
|
||||
|
||||
createRoot(document.getElementById("reactRoot")).render(
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>
|
||||
);
|
||||
const props = window.__INITIAL_PROPS__ || {};
|
||||
console.log('props: ', window.__INITIAL_PROPS__);
|
||||
|
||||
createRoot(document.getElementById("reactRoot")).render(<Homebrew {...props} />);
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, height=device-height, interactive-widget=resizes-visual"
|
||||
/>
|
||||
|
||||
<link
|
||||
href="//fonts.googleapis.com/css?family=Open+Sans:400,300,600,700"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
|
||||
<link rel="icon" href="/assets/favicon.ico" type="image/x-icon" />
|
||||
|
||||
<!-- Optional: static OG defaults -->
|
||||
<meta name="twitter:card" content="summary" />
|
||||
<title>The Homebrewery - NaturalCrit</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main id="reactRoot"></main>
|
||||
|
||||
<script type="module" src="/src/homebrewMain.jsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user