diff --git a/client/admin/main.jsx b/client/admin/main.jsx
new file mode 100644
index 000000000..e69de29bb
diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx
index e27978479..86b0d57c4 100644
--- a/client/homebrew/homebrew.jsx
+++ b/client/homebrew/homebrew.jsx
@@ -1,8 +1,7 @@
-
-import 'core-js/es/string/to-well-formed.js'; //Polyfill for older browsers
+import 'core-js/es/string/to-well-formed.js'; // Polyfill for older browsers
import './homebrew.less';
-import React from 'react';
-import { StaticRouter as Router, Route, Routes, useParams, useSearchParams } from 'react-router';
+import React, { useState, useEffect } from 'react';
+import { BrowserRouter as Router, Routes, Route, useParams, useSearchParams } from 'react-router-dom';
import { updateLocalStorage } from './utils/updateLocalStorage/updateLocalStorageKeys.js';
@@ -22,42 +21,46 @@ const WithRoute = ({ el: Element, ...rest })=>{
return ;
};
-const Homebrew = (props)=>{
- const {
- url = '',
- version = '0.0.0',
- account = null,
- config,
- brew = {
- title : '',
- text : '',
- shareId : null,
- editId : null,
- createdAt : null,
- updatedAt : null,
- lang : ''
- },
- userThemes,
- brews
- } = props;
+const Homebrew = ()=>{
+ // 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([]);
- global.account = account;
- global.version = version;
- global.config = config;
+ // 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;
const backgroundObject = ()=>{
- if(global.config?.deployment || (config?.local && config?.development)){
- const bgText = global.config?.deployment || 'Local';
- return {
- backgroundImage : `url("data:image/svg+xml;utf8,")`
- };
+ if(config?.deployment || (config?.local && config?.development)) {
+ const bgText = config?.deployment || 'Local';
+ return {
+ backgroundImage : `url("data:image/svg+xml;utf8,")`
+ };
}
return null;
};
+
updateLocalStorage();
return (
-
+
} />
@@ -80,4 +83,4 @@ const Homebrew = (props)=>{
);
};
-export default Homebrew;
\ No newline at end of file
+export default Homebrew;
diff --git a/client/homebrew/main.jsx b/client/homebrew/main.jsx
new file mode 100644
index 000000000..00f68f4d6
--- /dev/null
+++ b/client/homebrew/main.jsx
@@ -0,0 +1,9 @@
+import { createRoot } from "react-dom/client";
+import { BrowserRouter } from "react-router-dom";
+import App from "./App";
+
+createRoot(document.getElementById("reactRoot")).render(
+
+
+
+);
diff --git a/client/index.html b/client/index.html
index 0a6bc03cf..dc6e934b4 100644
--- a/client/index.html
+++ b/client/index.html
@@ -24,6 +24,6 @@
-
+