Skip to content

Commit

Permalink
Merge pull request #54 from Amanmahe/main
Browse files Browse the repository at this point in the history
Added Images,Enhanced Design, Improved Navigation, and Interactive Features
  • Loading branch information
lorforlinux authored Nov 19, 2024
2 parents 60e038a + 85321b5 commit 078abcd
Show file tree
Hide file tree
Showing 24 changed files with 369 additions and 419 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "biosignal-recorder-web",
"name": "Chords",
"version": "0.1.0",
"private": true,
"scripts": {
Expand Down
Binary file removed public/assets/dark/HeroSignalsClean.png
Binary file not shown.
Binary file added public/steps/1.webp
Binary file not shown.
Binary file added public/steps/2.webp
Binary file not shown.
Binary file added public/steps/3.webp
Binary file not shown.
Binary file added public/steps/4.webp
Binary file not shown.
Binary file added public/steps/5.webp
Binary file not shown.
Binary file added public/steps/6.webp
Binary file not shown.
26 changes: 0 additions & 26 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -99,29 +99,3 @@
border-color: hsl(var(--gray-light));
}
}

.loader {
position: fixed;
top: 70%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 9999; /* Ensure the loader is on top of other content */
}

.spinner {
border: 4px solid rgba(0, 0, 0, 0.1);
border-radius: 50%;
border-top: 4px solid #000;
width: 50px;
height: 50px;
animation: spin 1s linear infinite;
}

@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
title: "Chords",
description: "Web Serial based BioSignal recorder applicaion.",
description: "Web Serial based Biopotential Signal recorder applicaion.",
};

const lobsterTwo = Lobster_Two({
Expand Down
8 changes: 4 additions & 4 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ const page = () => {
<>
<div className="flex flex-col">
<HeadSection />
<Separator className="mt-20" />
<Separator className="mt-12" />
<Steps />
<Separator className="mt-20" />
<Separator className="mt-12" />
<Features />
<Separator className="mt-20" />
<Separator className="mt-12" />
<TechStack />
<Separator className="mt-20" />
<Separator className="mt-12" />
<FAQSection />
<Footer />
</div>
Expand Down
7 changes: 2 additions & 5 deletions src/components/Canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ const Canvas = forwardRef(
[Zoom, numChannels]
);




const createCanvases = () => {
if (!canvasContainerRef.current) return;

Expand Down Expand Up @@ -164,7 +161,7 @@ const Canvas = forwardRef(
canvas.width = canvasContainerRef.current.clientWidth ;
const canvasHeight = (canvasContainerRef.current.clientHeight / numChannels) ;
canvas.height = canvasHeight;
canvas.className = "w-full h-full block rounded-2xl";
canvas.className = "w-full h-full block rounded-xl";

// Create a badge for the channel number
const badge = document.createElement("div");
Expand Down Expand Up @@ -304,7 +301,7 @@ const Canvas = forwardRef(
}, [createCanvases,]);

return (
<main className=" flex flex-col flex-[1_1_0%] min-h-100 bg-highlight rounded-2xl m-4 relative"
<main className=" flex flex-col flex-[1_1_0%] min-h-80 bg-highlight rounded-2xl m-4 relative"
ref={canvasContainerRef}
>
</main>
Expand Down
38 changes: 20 additions & 18 deletions src/components/Connection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {

interface ConnectionProps {
onPauseChange: (pause: boolean) => void; // Callback to pass pause state to parent
dataSteam: (data: number[]) => void;
datastream: (data: number[]) => void;
Connection: (isConnected: boolean) => void;
selectedBits: BitSelection;
setSelectedBits: React.Dispatch<React.SetStateAction<BitSelection>>;
Expand All @@ -52,7 +52,7 @@ interface ConnectionProps {

const Connection: React.FC<ConnectionProps> = ({
onPauseChange,
dataSteam,
datastream,
Connection,
setSelectedBits,
isDisplay,
Expand Down Expand Up @@ -204,22 +204,23 @@ const Connection: React.FC<ConnectionProps> = ({
connectToDevice();
}
};
let lastConnectedPort: SerialPort | null = null;

const connectToDevice = async () => {
try {
if (portRef.current && portRef.current.readable) {
await disconnectDevice();
}

const port = await navigator.serial.requestPort();
const port = lastConnectedPort || await navigator.serial.requestPort();
await port.open({ baudRate: 230400 });
Connection(true);
setIsConnected(true);
onPauseChange(true);
setIsDisplay(true);
isConnectedRef.current = true;
portRef.current = port;

lastConnectedPort = port;
toast.success("Connection Successful", {
description: (
<div className="mt-2 flex flex-col space-y-1">
Expand Down Expand Up @@ -358,7 +359,7 @@ const Connection: React.FC<ConnectionProps> = ({
}
const counter = packet[2]; // Extract the counter value from the packet
channelData.push(counter); // Add the counter to the channel data
dataSteam(channelData); // Pass the channel data to the LineData function for further processing
datastream(channelData); // Pass the channel data to the LineData function for further processing

if (isRecordingRef.current) {
// Check if recording is enabled
Expand Down Expand Up @@ -741,7 +742,7 @@ const Connection: React.FC<ConnectionProps> = ({
<div className="absolute left-4 flex items-center mx-0 px-0 space-x-1">
{isRecordingRef.current && (
<div className="flex items-center space-x-1 w-min ml-2">
<button className="flex items-center justify-center px-3 py-2 select-none min-w-20 bg-primary text-destructive whitespace-nowrap rounded"
<button className="flex items-center justify-center px-3 py-2 select-none min-w-20 bg-primary text-destructive whitespace-nowrap rounded-xl"
>
{formatTime(elapsedTime)}
</button>
Expand All @@ -753,7 +754,7 @@ const Connection: React.FC<ConnectionProps> = ({
>
<PopoverTrigger asChild>
<Button
className="flex items-center justify-center px-3 py-2 select-none min-w-12 text-destructive whitespace-nowrap rounded"
className="flex items-center justify-center px-3 py-2 select-none min-w-12 text-destructive whitespace-nowrap rounded-xl"
variant="destructive"
>
{endTimeRef.current === null ? (
Expand Down Expand Up @@ -818,7 +819,7 @@ const Connection: React.FC<ConnectionProps> = ({
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<Button className="bg-primary gap-2" onClick={handleClick}>
<Button className="flex items-center justify-center gap-1 py-2 px-6 sm:py-3 sm:px-8 rounded-xl font-semibold" onClick={handleClick}>
{isConnected ? (
<>
Disconnect
Expand Down Expand Up @@ -846,7 +847,7 @@ const Connection: React.FC<ConnectionProps> = ({
<Tooltip>
<TooltipTrigger asChild>
<Button
className="rounded-r-none"
className="rounded-xl rounded-r-none"
onClick={decreaseZoom}
disabled={Zoom === 1 || !isDisplay}
>
Expand Down Expand Up @@ -882,7 +883,7 @@ const Connection: React.FC<ConnectionProps> = ({
<Tooltip>
<TooltipTrigger asChild>
<Button
className="rounded-l-none"
className="rounded-xl rounded-l-none"
onClick={increaseZoom}
disabled={Zoom === 10 || !isDisplay}

Expand All @@ -906,7 +907,7 @@ const Connection: React.FC<ConnectionProps> = ({
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<Button onClick={togglePause}>
<Button className="rounded-xl" onClick={togglePause}>
{isDisplay ? (
<Pause className="h-5 w-5" />
) : (
Expand All @@ -929,6 +930,7 @@ const Connection: React.FC<ConnectionProps> = ({
<Tooltip>
<TooltipTrigger asChild>
<Button
className="rounded-xl"
onClick={handleRecord}
disabled={isRecordButtonDisabled || !isDisplay}
>
Expand Down Expand Up @@ -958,7 +960,7 @@ const Connection: React.FC<ConnectionProps> = ({
<Tooltip>
<TooltipTrigger asChild>
<Button
className="rounded-r-none"
className="rounded-xl rounded-r-none"
onClick={saveData}
disabled={!hasData}
>
Expand All @@ -976,30 +978,30 @@ const Connection: React.FC<ConnectionProps> = ({
<Tooltip>
<TooltipTrigger asChild>
<Button
className="rounded-r-none mr-1"
className="rounded-xl rounded-r-none mr-1"
onClick={saveData}
disabled={!hasData}
>
<Download size={16} />
</Button>
</TooltipTrigger>
<TooltipContent>
<p>Save Data as Zip</p>
<p>Save Recording</p>
</TooltipContent>
</Tooltip>

<Tooltip>
<TooltipTrigger asChild>
<Button
className="rounded-l-none"
className="rounded-xl rounded-l-none"
onClick={deleteDataFromIndexedDB}
disabled={!hasData}
>
<Trash2 size={20} />
</Button>
</TooltipTrigger>
<TooltipContent>
<p>Delete All Data</p>
<p>Delete Recording</p>
</TooltipContent>
</Tooltip>
</div>
Expand All @@ -1015,7 +1017,7 @@ const Connection: React.FC<ConnectionProps> = ({
<Tooltip>
<TooltipTrigger asChild>
<Button
className="rounded-r-none"
className="rounded-xl rounded-r-none"
onClick={decreaseCanvas}
disabled={canvasCount === 1 || !isDisplay || recData}
>
Expand Down Expand Up @@ -1059,7 +1061,7 @@ const Connection: React.FC<ConnectionProps> = ({
<Tooltip>
<TooltipTrigger asChild>
<Button
className="rounded-l-none"
className="rounded-xl rounded-l-none"
onClick={increaseCanvas}
disabled={canvasCount >= 6 || !isDisplay || recData}
>
Expand Down
4 changes: 2 additions & 2 deletions src/components/DataPass.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const DataPass = () => {
pauseRef.current = newPauseState;
};

const dataSteam = useCallback((data: number[]) => {
const datastream = useCallback((data: number[]) => {

if (canvasRef.current) {
canvasRef.current.updateData(data); // Assuming data is the new data to be displayed
Expand Down Expand Up @@ -58,7 +58,7 @@ const DataPass = () => {
)}
<Connection
onPauseChange={handlePauseChange}
dataSteam={dataSteam}
datastream={datastream}
Connection={setIsConnected}
selectedBits={selectedBits}
setSelectedBits={setSelectedBits}
Expand Down
14 changes: 8 additions & 6 deletions src/components/LandingComp/FAQSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const FAQSection = () => {
answer: (
<>
Chords supports an array format: [A0, A1, ..., A5, counter], where
A0-A5 are raw signal values and counter is a uint8_t (0-255). Array
A0-A5 are raw signal values and counter is a uint8_t (0-255). Array
example : [468, 472, 463, 466, 465, 434, 10]. For implementation
details, see our{" "}
<Link
Expand Down Expand Up @@ -166,11 +166,13 @@ const FAQSection = () => {
},
];
return (
<section className="w-full py-8 pb-12 md:pb-24 lg:pb-24 mx-auto lg:md:sm:px-0 px-3">
<h1 className="text-3xl font-bold text-center text-foreground md:text-4xl lg:text-5xl">
Frequently Asked Questions
</h1>
<div className="mx-auto mt-8 max-w-6xl">
<section className="w-full pb-8 md:pb-24 lg:pb-24 mx-auto lg:md:sm:px-0 px-4 md:px-24 lg:px-12">
<div className="mx-auto mt-8 max-w-6xl xl:px-8 ">
<div className="space-y-4">
<h1 className="text-2xl font-bold tracking-wide sm:text-3xl md:text-3xl text-left text-foreground pb-8">
Frequently Asked Questions
</h1>
</div>
<Accordion type="single" collapsible className=" max-w-7xl">
{FAQs.map((faq, index) => (
<AccordionItem value={`item-${index}`} key={index}>
Expand Down
Loading

0 comments on commit 078abcd

Please sign in to comment.