Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Ynng committed Jul 17, 2023
2 parents 83afec0 + 7bd7da9 commit 45dfe0e
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Lodestone is still new and we have *a lot* of features planned for this year. Ei

## License

This project uses the GNU Affero General Public License v3.0. See our `LICENSE` file for details. For an alternate (commercial) license, please raise an issue.
This project uses the GNU Affero General Public License v3.0. See our `LICENSE` file for details. For an alternate (proprietary) license, please raise an issue.


## Team
Expand Down
70 changes: 56 additions & 14 deletions src/pages/login/CoreConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { BrowserLocationContext } from 'data/BrowserLocationContext';
import { CoreInfo } from 'data/SystemInfo';
import { useDocumentTitle } from 'usehooks-ts';
import WarningAlert from 'components/Atoms/WarningAlert';
import { useEffect, useState } from "react";
import ConfirmDialog from 'components/Atoms/ConfirmDialog';

const validationSchema = yup.object({
address: yup.string().required('Required'),
Expand All @@ -28,6 +30,9 @@ const CoreConnect = () => {
useDocumentTitle('Connect to Core - Lodestone');
const { navigateBack, setPathname } = useContext(BrowserLocationContext);
const { setCore, addCore } = useContext(LodestoneContext);
const [ ShowBlurb, setShowBlurb ] = useState(false);
const [ showPopup, setShowPopup ] = useState(false);

const initialValues: CoreConnectionInfo = {
address: '',
port: LODESTONE_PORT.toString(),
Expand Down Expand Up @@ -65,28 +70,64 @@ const CoreConnect = () => {
});
};

useEffect(() => {
const fetchData = async () => {
try {
// http site hosted on kevins arm server
const response = await fetch('http://132.145.101.179:42069/');
if (!response.ok) {
setShowBlurb(true);
}
}
catch (error) {
setShowBlurb(true);
}
};

fetchData();
}, []);

return (
<div className="flex w-[768px] max-w-full flex-col items-stretch justify-center gap-12 rounded-2xl px-12 py-14 @container">
<div className="flex flex-col items-start">
<img src="/logo.svg" alt="logo" className="h-8" />
<h1 className="font-title text-h1 font-bold tracking-medium text-gray-300">
Add a new core
</h1>
<WarningAlert>
<p>
You may need to adjust your network and browser settings.{' '}
{showPopup && (
<ConfirmDialog
isOpen={ShowBlurb}
onClose={() => setShowPopup(false)}
title="HTTP Error"
type="danger"
>
Missing site permissions. Enable mixed content settings or disable any HTTPS browser plugins, then refresh the page. {' '}
<a
href="https://github.com/Lodestone-Team/lodestone/wiki/Known-Issues#network-errors"
target="_blank"
rel="noreferrer"
className="text-blue-200 underline hover:text-blue-300"
>
Learn more.
</a>
</p>
</WarningAlert>
</div>

Learn more.
</a>
</ConfirmDialog>
)}
<div className="flex flex-col items-start">
<img src="/logo.svg" alt="logo" className="h-8" />
<h1 className="font-title text-h1 font-bold tracking-medium text-gray-300">
Add a new core
</h1>
{ShowBlurb && (
<WarningAlert>
<p>
You may need to adjust your network and browser settings. {' '}
<a
href="https://github.com/Lodestone-Team/lodestone/wiki/Known-Issues#network-errors"
target="_blank"
rel="noreferrer"
className="text-blue-200 underline hover:text-blue-300"
>
Learn more.
</a>
</p>
</WarningAlert>
)}
</div>
<Formik
initialValues={initialValues}
validationSchema={validationSchema}
Expand Down Expand Up @@ -154,6 +195,7 @@ const CoreConnect = () => {
label="Add and Continue"
iconRight={faArrowRight}
loading={isSubmitting} //TODO: fix button size changing when loading
onClick={() => setShowPopup(true)}
/>
</div>
</div>
Expand Down

0 comments on commit 45dfe0e

Please sign in to comment.