Skip to content

Commit

Permalink
Website updates - sitemap, dataset. page, experiment editor (#234)
Browse files Browse the repository at this point in the history
* add: experimentInfo to fusion export

* add: experiment editor for people running custom studies

* add: collect experimentInfo when starting recording

* add: support for uploading dataset to ipfs - needs more testing

* add: make /recordings be the base for experiments & allow url filter by activityId

* add: sitemap

* edit: blog content page

* edit: switch to using /recordings across the site

* add: update site copy and add custom 404 page

* add: update packages & .env reference

* add: display list of locally stored datasets

* add: progress bar component

* add: support for deleting datasets
  • Loading branch information
oreHGA authored Aug 14, 2024
1 parent 216022d commit 0c8b9b2
Show file tree
Hide file tree
Showing 27 changed files with 12,101 additions and 4,859 deletions.
11 changes: 7 additions & 4 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
env: {
NEXT_PUBLIC_FUSION_NOSTR_PUBLIC_KEY: "5f3a52d8027cdde03a41857e98224dafd69495204d93071199aa86921aa02674",
NEXT_PUBLIC_FUSION_RELAY_URL: "wss://relay.usefusion.ai",
NEXT_PUBLIC_NEUROFUSION_BACKEND_URL: "https://neurofusionbackendprd.azurewebsites.net",
async rewrites() {
return [
{
source: "/sitemap.xml",
destination: "/api/sitemap",
},
];
},
};
15,643 changes: 11,392 additions & 4,251 deletions frontend/package-lock.json

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"lint:fix": "eslint . --cache --ext .ts,.tsx --fix"
},
"dependencies": {
"@codesandbox/sandpack-react": "^2.18.2",
"@ethereum-attestation-service/eas-sdk": "^2.5.0",
"@helia/unixfs": "^3.0.7",
"@hookform/resolvers": "^3.1.1",
"@magic-sdk/admin": "^2.0.0",
"@microsoft/applicationinsights-react-js": "^17.3.0",
Expand All @@ -23,9 +25,10 @@
"@radix-ui/react-dialog": "^1.0.4",
"@radix-ui/react-dropdown-menu": "^2.0.5",
"@radix-ui/react-tabs": "^1.0.4",
"@tanstack/react-query": "^4.29.25",
"@tanstack/react-query": "^4.36.1",
"@types/archiver": "^5.3.3",
"@types/file-saver": "^2.0.5",
"@web3modal/wagmi": "^5.0.11",
"aw-client": "^0.3.7",
"axios": "^1.4.0",
"class-variance-authority": "^0.7.0",
Expand All @@ -39,11 +42,13 @@
"fast-sha256": "^1.3.0",
"file-saver": "^2.0.5",
"gray-matter": "^4.0.3",
"helia": "^4.2.5",
"idb": "^8.0.0",
"jszip": "^3.10.1",
"lucide-react": "0.261.0",
"magic-sdk": "^18.4.1",
"markdown-it": "^13.0.2",
"multiformats": "^13.2.2",
"muse-js": "^3.3.0",
"next": "^14.2.3",
"next-auth": "^4.22.3",
Expand All @@ -56,7 +61,10 @@
"react-typist-component": "^1.0.5",
"rooks": "^7.14.1",
"rxjs": "^7.8.1",
"sharp": "^0.33.4",
"tailwind-merge": "^1.14.0",
"viem": "^2.19.1",
"wagmi": "^2.12.4",
"zod": "^3.21.4"
},
"devDependencies": {
Expand Down Expand Up @@ -96,4 +104,4 @@
"tailwindcss": "^3.3.3",
"typescript": "5.1.6"
}
}
}
5 changes: 5 additions & 0 deletions frontend/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
User-agent: *
Allow: /

Sitemap: https://usefusion.ai/sitemap.xml
Sitemap: https://usefusion.app/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ export const NeurosityModal: FC<INeurosityModalProps> = ({ isOpen, onCloseModal
<Button
type="submit"
onClick={() => {
window.location.href = "/playground";
window.location.href = "/recordings";
}}
>
Go to Recording Playground
Go to Recordings
</Button>
</div>
</Dialog.Content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const FeatureSection = ({ isResearch = false }) => {
<div className="flex flex-col md:flex-row items-center justify-between gap-y-6">
<div>
<FusionFeature feature={fusionFeatures[2]} />
<ButtonLink intent="outlined" href="/playground" size="xl" className="mt-4 w-full md:w-11/12">
<ButtonLink intent="outlined" href="/recordings" size="xl" className="mt-4 w-full md:w-11/12">
Use NeuroFusion Explorer!
</ButtonLink>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ export const HeroSection = ({ isResearch = false }) => {
<h1 className="font-body text-3xl font-semibold sm:text-6xl">
The simplest way to do brain and behavior <span className="text-primary-gradient">research at scale</span>{" "}
</h1>

<p className="block text-base leading-8 text-gray-500 dark:text-gray-400 md:text-xl">
Use NeuroFusion Explorer to remotely collect and analyze EEG data from your cognitive and behavioral
studies.
</p>
<div className="mt-10 flex flex-col items-center justify-center gap-x-6 gap-y-2 md:flex-row">
<ButtonLink
onClick={handleClick}
intent="outlined"
href="/playground"
href="/recordings"
size="xl"
className="mt-4 w-full md:w-11/12"
>
Expand All @@ -31,12 +34,13 @@ export const HeroSection = ({ isResearch = false }) => {
</div>
) : (
<>
<div className="flex w-full max-w-2xl flex-col space-y-10 text-center md:min-w-[300px]">
<div className="flex w-full max-w-3xl flex-col space-y-10 text-center md:min-w-[300px]">
<h1 className="font-body text-3xl font-semibold sm:text-6xl">
Personal Insights to <span className="text-primary-gradient">Guide Your Actions</span>
Personal Insights to <br />
<span className="text-primary-gradient">Guide Your Daily Actions</span>
</h1>
<p className="block text-base leading-8 text-gray-500 dark:text-gray-400 md:text-xl">
Use Fusion to understand and improve your productivity, physical and mental health.
Use Fusion Copilot to improve your productivity, physical and mental health.
</p>
</div>
<div className="mt-10 flex flex-col items-center justify-center gap-x-6 gap-y-2 md:flex-row">
Expand Down
12 changes: 12 additions & 0 deletions frontend/src/components/lab/experiment-editor.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Sandpack } from "@codesandbox/sandpack-react";

export const ExperimentEditor: React.FC = () => {
const files = {};

return (
<div className="experiment-editor">
<h2>Experiment Editor</h2>
<Sandpack files={files} theme="light" template="static" />
</div>
);
};
2 changes: 1 addition & 1 deletion frontend/src/components/lab/experiment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const Experiment: FC<IExperiment> = (experiment) => {
userNpub: session.data?.user?.email,
},
});
await museEEGService.startRecording();
await museEEGService.startRecording(experimentInfo);
}
}

Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/lab/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./experiment";
export * from "./signalquality";
export * from "./experiment-editor";
12 changes: 6 additions & 6 deletions frontend/src/components/layouts/dashboard-layout/sidebar/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ export const sidebarLinks = [
{
icon: LayoutDashboard,
title: "Recordings",
href: "/playground",
href: "/recordings",
},
{
icon: HardDrive,
title: "Datasets",
href: "/datasets",
},
{
icon: SignalHigh,
title: "Analysis",
href: "/analysis",
},
// {
// icon: HardDrive,
// title: "Datasets",
// href: "/datasets",
// },
{
icon: PenBox,
title: "Quests",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/modals/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./onboarding-modal";
112 changes: 112 additions & 0 deletions frontend/src/components/modals/onboarding-modal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import React, { useEffect, useState } from "react";
import { Button, Dialog, DialogContent, DialogDescription, DialogTitle } from "~/components/ui";

const OnboardingModal: React.FC = () => {
const [showCapabilitiesModal, setShowCapabilitiesModal] = useState(false);
const [showDataHandlingModal, setShowDataHandlingModal] = useState(false);

useEffect(() => {
const viewedOnboarding = localStorage.getItem("viewedOnboarding");
if (viewedOnboarding !== "true") {
setShowCapabilitiesModal(true);
}
}, []);

const handleCapabilitiesNext = () => {
setShowCapabilitiesModal(false);
setShowDataHandlingModal(true);
};

const handleDataHandlingPrevious = () => {
setShowCapabilitiesModal(true);
setShowDataHandlingModal(false);
};

const handleDataHandlingGetStarted = () => {
setShowDataHandlingModal(false);
localStorage.setItem("viewedOnboarding", "true");
};

const handleCloseCapabilities = () => {
setShowCapabilitiesModal(false);
};

const handleCloseDataHandling = () => {
setShowDataHandlingModal(false);
};
return (
<div>
{showCapabilitiesModal && (
<CapabilitiesModal onNext={handleCapabilitiesNext} onCancel={handleCloseCapabilities} />
)}
{showDataHandlingModal && (
<DataHandlingModal
onPrevious={handleDataHandlingPrevious}
onGetStarted={handleDataHandlingGetStarted}
onClose={handleCloseDataHandling}
/>
)}
</div>
);
};

interface CapabilitiesModalProps {
onNext: () => void;
onCancel: () => void;
}

const CapabilitiesModal: React.FC<CapabilitiesModalProps> = ({ onNext, onCancel }) => {
return (
<Dialog open={true} onOpenChange={onCancel}>
<DialogContent>
<DialogTitle>Welcome to Fusion</DialogTitle>
<DialogDescription>
Here's what you can do with Fusion:
<div className="list-disc ml-6 mt-2">
<p>Record brain activity during cognitive experiments</p>
<p>Respond to prompts on mobile devices</p>
</div>
</DialogDescription>
<div className="flex justify-end mt-4">
<Button intent="primary" onClick={onNext}>
Next
</Button>
<Button intent="dark" onClick={onCancel} className="ml-2">
Cancel
</Button>
</div>
</DialogContent>
</Dialog>
);
};

interface DataHandlingModalProps {
onPrevious: () => void;
onGetStarted: () => void;
onClose: () => void;
}

const DataHandlingModal: React.FC<DataHandlingModalProps> = ({ onPrevious, onGetStarted, onClose }) => {
return (
<Dialog open={true} onOpenChange={onClose}>
<DialogContent>
<DialogTitle>Data Handling in Fusion</DialogTitle>
<DialogDescription>
How Fusion handles your data:
<ul className="list-disc ml-6 mt-2">
<li>Assigns anonymous identities with no email required</li>
<li>Stores data locally on your device</li>
</ul>
</DialogDescription>
<div className="flex justify-end mt-4">
<Button onClick={onPrevious}>Previous</Button>
<Button intent="dark" onClick={onGetStarted} className="ml-2">
Get Started
</Button>
</div>
</DialogContent>
</Dialog>
);
};

export { CapabilitiesModal, DataHandlingModal, OnboardingModal };
1 change: 1 addition & 0 deletions frontend/src/components/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export * from "./avatar/avatar";
export * from "./dialog/dialog";
export * from "./dropdown-menu/dropdown-menu";
export * from "./card/blog-card";
export * from "./progress-bar";
2 changes: 1 addition & 1 deletion frontend/src/components/ui/logo/logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface LinkProps extends VariantProps<typeof logoStyles> {

export const Logo: FC<LinkProps> = ({ withText, size, className, neuro }) => {
return (
<Link href={neuro ? "/playground" : "/"} className="inline-flex items-center">
<Link href={neuro ? "/recordings" : "/"} className="inline-flex items-center">
<Image
src="/images/logo.png"
alt="Neurofusion Logo"
Expand Down
24 changes: 24 additions & 0 deletions frontend/src/components/ui/progress-bar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export const CircularProgress: React.FC<{ percentage: number }> = ({ percentage }) => {
return (
<svg width="50" height="50" viewBox="0 0 120 120">
<circle cx="60" cy="60" r="45" stroke="gray" strokeWidth="15" fill="none" />
<circle
cx="60"
cy="60"
r="45"
stroke="blue"
strokeWidth="15"
fill="none"
strokeDasharray="282.7"
strokeDashoffset={((100 - percentage) / 100) * 2 * Math.PI * 45}
className="progress"
/>
<text x="60" y="70" textAnchor="middle" fill="white" fontSize="30px">{`${Math.floor(percentage)}%`}</text>
<style jsx>{`
.progress {
transition: stroke-dashoffset 0.02s linear;
}
`}</style>
</svg>
);
};
Loading

0 comments on commit 0c8b9b2

Please sign in to comment.