Skip to content

Commit

Permalink
made some changes to fix setup bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfang97 committed Nov 13, 2024
1 parent d13ffd4 commit 279acf9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
24 changes: 10 additions & 14 deletions frontend/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,20 @@ const sdconverter = new showdown.Converter()
* This page renders the home/landing page for sbh.
*/
function Home() {
const [frontPageText, setFrontPageText] = useState('Loading front page text...');
// "SynBioHub is a design repository for people designing biological constructs. It enables DNA and protein designs to be uploaded, then facilitates sharing and viewing of such designs. SynBioHub also facilitates searching for information about existing useful parts and designs by combining data from a variety of sources."
const [frontPageText, setFrontPageText] = useState('Loading front page text...');
const token = useSelector(state => state.user.token);

useEffect(() => {
const themeData = JSON.parse(localStorage.getItem('theme'), (key,value) => {
if (key === 'frontPageText') {
return sdconverter.makeHtml(value.replace(/\\n/g, '\n'));
}
return value;
});

if (themeData && themeData.frontPageText){
setFrontPageText(
themeData.frontPageText
);
}
// Attempt to retrieve frontPageText from localStorage
const themeData = JSON.parse(localStorage.getItem('theme') || '{}');

if (themeData.frontPageText) {
// Convert Markdown to HTML if data is found
setFrontPageText(sdconverter.makeHtml(themeData.frontPageText.replace(/\\n/g, '\n')));
} else {
// Set fallback text if data is not found
setFrontPageText('Welcome to SynBioHub! Refresh to ensure front page text is loaded.');
}
}, []);

return (
Expand Down
6 changes: 3 additions & 3 deletions frontend/specialAccess/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ export default function Setup({ setInSetupMode }) {
}, [color]);

// change the url to the base url
useEffect(() => {
window.history.pushState({}, '', '/setup');
});
// useEffect(() => {
// window.history.pushState({}, '', '/setup');
// });

return (
<TopLevel doNotTrack={true} navbar={<div></div>} publicPage={true}>
Expand Down

0 comments on commit 279acf9

Please sign in to comment.