more fixes

This commit is contained in:
r-III03
2025-01-25 22:57:50 -05:00
parent ee3335d16e
commit e6c6e35665
7 changed files with 246 additions and 218 deletions

View File

@@ -1,5 +1,7 @@
"use client" /*
"use client"
import Head from 'next/head';
import React from 'react'; import React from 'react';
import { Navbar } from '@/components/navbar'; import { Navbar } from '@/components/navbar';
import { Footer } from '@/components/footer'; import { Footer } from '@/components/footer';
@@ -23,6 +25,61 @@ export default function RootLayout({ children }: { children: React.ReactNode })
</html> </html>
) )
} }
*/
import type { Metadata } from "next"
import { Inter } from "next/font/google"
import "./globals.css"
import { Mic } from "lucide-react"
const inter = Inter({ subsets: ["latin"] })
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en">
<body className={inter.className}>
<div className="flex flex-col min-h-screen">
<header className="bg-primary text-primary-foreground shadow-md">
<div className="container mx-auto px-4 py-4 flex items-center justify-between">
<div className="flex items-center space-x-2">
<Mic className="h-6 w-6" />
<h1 className="text-2xl font-bold">PostCare</h1>
</div>
<nav>
<ul className="flex space-x-4">
<li>
<a href="#" className="hover:underline">
Home
</a>
</li>
<li>
<a href="#" className="hover:underline">
About
</a>
</li>
<li>
<a href="#" className="hover:underline">
Contact
</a>
</li>
</ul>
</nav>
</div>
</header>
<main className="flex-grow">{children}</main>
<footer className="bg-muted mt-8">
<div className="container mx-auto px-4 py-6 text-center">
</div>
</footer>
</div>
</body>
</html>
)
}

View File

@@ -1,106 +0,0 @@
/*
"use client"
import { Hero } from "@/components/hero";
import { Facts } from "@/components/facts";
import Link from "next/link";
export default function Home() {
return (
<div className="items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
<Hero />
<Facts />
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100vh' }}>
<Link href="/transcribe">
<button>Go to Transcribe Page</button>
</Link>
</div>
</div>
);
}
*/
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;
--popover: 0 0% 100%;
--popover-foreground: 222.2 84% 4.9%;
--card: 0 0% 100%;
--card-foreground: 222.2 84% 4.9%;
--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;
--primary: 222.2 47.4% 11.2%;
--primary-foreground: 210 40% 98%;
--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;
--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 40% 98%;
--ring: 215 20.2% 65.1%;
--radius: 0.5rem;
}
.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
--muted: 217.2 32.6% 17.5%;
--muted-foreground: 215 20.2% 65.1%;
--popover: 222.2 84% 4.9%;
--popover-foreground: 210 40% 98%;
--card: 222.2 84% 4.9%;
--card-foreground: 210 40% 98%;
--border: 217.2 32.6% 17.5%;
--input: 217.2 32.6% 17.5%;
--primary: 210 40% 98%;
--primary-foreground: 222.2 47.4% 11.2%;
--secondary: 217.2 32.6% 17.5%;
--secondary-foreground: 210 40% 98%;
--accent: 217.2 32.6% 17.5%;
--accent-foreground: 210 40% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 0 85.7% 97.3%;
--ring: 217.2 32.6% 17.5%;
}
}
@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}

23
src/app/(web)/page.tsx Normal file
View File

@@ -0,0 +1,23 @@
"use client"
import { Hero } from "@/components/hero";
import { Facts } from "@/components/facts";
import Link from "next/link";
export default function Home() {
return (
<div className="items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
<Hero />
<Facts />
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100vh' }}>
<Link href="/transcribe">
<button>Go to Transcribe Page</button>
</Link>
</div>
</div>
);
}

View File

@@ -1,7 +1,7 @@
/* /*
"use client"; "use client";
//import Hero1 from '@/components/Hero1'
//IMPORT THE HERO1 FUNCTION TO MAKE THE TRANSCRIBE PAGE LOOK BETTER
import React, { useState, useRef } from "react"; import React, { useState, useRef } from "react";
import axios from "axios"; import axios from "axios";
@@ -18,48 +18,59 @@ const AudioTranscriber: React.FC = () => {
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => { const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
if (event.target.files && event.target.files.length > 0) { if (event.target.files && event.target.files.length > 0) {
setFile(event.target.files[0]); setFile(event.target.files[0]);
console.log("File selected:", event.target.files[0].name);
} }
}; };
// Send the file to the backend for transcription // Handle file transcription
const handleTranscription = async (audioFile: File) => { const handleTranscription = async (audioFile: File) => {
if (!audioFile) {
alert("No audio file to transcribe!");
return;
}
console.log("Starting transcription for:", audioFile.name);
const formData = new FormData(); const formData = new FormData();
formData.append("file", audioFile); formData.append("file", audioFile);
setLoading(true); setLoading(true);
setError(null); setError(null); // Clear previous errors
try { try {
const response = await axios.post("/api/transcribe", formData, { const response = await axios.post("http://localhost:8000/transcribe", formData, {
headers: { headers: {
"Content-Type": "multipart/form-data", "Content-Type": "multipart/form-data",
}, },
}); });
// Handle missing transcription property in the response console.log("Transcription response:", response.data);
if (response.data && response.data.transcription) { if (response.data && response.data.transcription) {
setTranscription(response.data.transcription); setTranscription(response.data.transcription);
} else { } else {
setError("No transcription available."); setError("Unexpected response format. Check backend API.");
console.error("Invalid response format:", response.data);
} }
} catch (error) { } catch (error) {
console.error("Error during transcription:", error); console.error("Error transcribing audio:", error);
setError("Failed to transcribe audio. Please try again."); setError("Failed to transcribe audio. Please try again.");
} finally { } finally {
setLoading(false); setLoading(false);
} }
}; };
// Start recording audio // Start recording audio
const startRecording = async () => { const startRecording = async () => {
try { try {
const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
console.log("Microphone access granted.");
mediaRecorderRef.current = new MediaRecorder(stream); mediaRecorderRef.current = new MediaRecorder(stream);
audioChunksRef.current = []; audioChunksRef.current = []; // Reset audio chunks
mediaRecorderRef.current.ondataavailable = (event) => { mediaRecorderRef.current.ondataavailable = (event) => {
if (event.data.size > 0) { if (event.data.size > 0) {
console.log("Audio chunk received:", event.data);
audioChunksRef.current.push(event.data); audioChunksRef.current.push(event.data);
} }
}; };
@@ -68,11 +79,15 @@ const AudioTranscriber: React.FC = () => {
const audioBlob = new Blob(audioChunksRef.current, { type: "audio/mp3" }); const audioBlob = new Blob(audioChunksRef.current, { type: "audio/mp3" });
const audioFile = new File([audioBlob], "recording.mp3", { type: "audio/mp3" }); const audioFile = new File([audioBlob], "recording.mp3", { type: "audio/mp3" });
console.log("Recording stopped. Blob created:", audioBlob);
setFile(audioFile); // Save the recorded file setFile(audioFile); // Save the recorded file
setTranscription("Processing transcription for recorded audio...");
await handleTranscription(audioFile); // Automatically transcribe await handleTranscription(audioFile); // Automatically transcribe
}; };
mediaRecorderRef.current.start(); mediaRecorderRef.current.start();
console.log("Recording started.");
setRecording(true); setRecording(true);
} catch (error) { } catch (error) {
console.error("Error starting recording:", error); console.error("Error starting recording:", error);
@@ -83,6 +98,7 @@ const AudioTranscriber: React.FC = () => {
// Stop recording audio // Stop recording audio
const stopRecording = () => { const stopRecording = () => {
if (mediaRecorderRef.current) { if (mediaRecorderRef.current) {
console.log("Stopping recording...");
mediaRecorderRef.current.stop(); mediaRecorderRef.current.stop();
setRecording(false); setRecording(false);
} }
@@ -90,19 +106,25 @@ const AudioTranscriber: React.FC = () => {
return ( return (
<div> <div>
<h1>Audio Transcription Tool</h1> <h1>
<center>
Audio Transcription
</center>
</h1>
<div> <div>
<h2>Upload or Record Audio</h2> <h2>Upload or Record Audio</h2>
{/* File Upload */ //}
/*
<input type="file" accept="audio/*" onChange={handleFileChange} /> <input type="file" accept="audio/*" onChange={handleFileChange} />
<button <button onClick={() => file && handleTranscription(file)} disabled={loading || !file}>
onClick={() => file && handleTranscription(file)}
disabled={loading || !file}
>
{loading ? "Transcribing..." : "Transcribe"} {loading ? "Transcribing..." : "Transcribe"}
</button> </button>
</div> </div>
{/* Recording Controls */ //}
/*
<div> <div>
<h2>Record Audio</h2> <h2>Record Audio</h2>
{!recording ? ( {!recording ? (
@@ -114,13 +136,23 @@ const AudioTranscriber: React.FC = () => {
)} )}
</div> </div>
{transcription && ( {/* Transcription Result */ //}
/*
<div> <div>
<h2>Transcription:</h2> <h2>Transcription:</h2>
{loading ? (
<p>Processing transcription...</p>
) : transcription ? (
<p>{transcription}</p> <p>{transcription}</p>
</div> ) : (
<p>No transcription available yet.</p>
)} )}
</div>
{/* Error Message */ //}
/*
{error && ( {error && (
<div style={{ color: "red" }}> <div style={{ color: "red" }}>
<strong>Error:</strong> {error} <strong>Error:</strong> {error}
@@ -131,10 +163,8 @@ const AudioTranscriber: React.FC = () => {
}; };
export default AudioTranscriber; export default AudioTranscriber;
*/ */
"use client" "use client"
import type React from "react" import type React from "react"

View File

@@ -2,86 +2,69 @@
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
body {
font-family: Arial, Helvetica, sans-serif;
}
@layer base { @layer base {
:root { :root {
--background: 0 0% 100%; --background: 0 0% 100%;
--foreground: 0 0% 3.9%; --foreground: 222.2 84% 4.9%;
--card: 0 0% 100%;
--card-foreground: 0 0% 3.9%; --muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;
--popover: 0 0% 100%; --popover: 0 0% 100%;
--popover-foreground: 0 0% 3.9%; --popover-foreground: 222.2 84% 4.9%;
--primary: 0 0% 9%;
--primary-foreground: 0 0% 98%; --card: 0 0% 100%;
--secondary: 0 0% 96.1%; --card-foreground: 222.2 84% 4.9%;
--secondary-foreground: 0 0% 9%;
--muted: 0 0% 96.1%; --border: 214.3 31.8% 91.4%;
--muted-foreground: 0 0% 45.1%; --input: 214.3 31.8% 91.4%;
--accent: 0 0% 96.1%;
--accent-foreground: 0 0% 9%; --primary: 222.2 47.4% 11.2%;
--primary-foreground: 210 40% 98%;
--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;
--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;
--destructive: 0 84.2% 60.2%; --destructive: 0 84.2% 60.2%;
--destructive-foreground: 0 0% 98%; --destructive-foreground: 210 40% 98%;
--border: 0 0% 89.8%;
--input: 0 0% 89.8%; --ring: 215 20.2% 65.1%;
--ring: 0 0% 3.9%;
--chart-1: 12 76% 61%;
--chart-2: 173 58% 39%;
--chart-3: 197 37% 24%;
--chart-4: 43 74% 66%;
--chart-5: 27 87% 67%;
--radius: 0.5rem; --radius: 0.5rem;
--sidebar-background: 0 0% 98%;
--sidebar-foreground: 240 5.3% 26.1%;
--sidebar-primary: 240 5.9% 10%;
--sidebar-primary-foreground: 0 0% 98%;
--sidebar-accent: 240 4.8% 95.9%;
--sidebar-accent-foreground: 240 5.9% 10%;
--sidebar-border: 220 13% 91%;
--sidebar-ring: 217.2 91.2% 59.8%;
} }
.dark { .dark {
--background: 0 0% 3.9%; --background: 222.2 84% 4.9%;
--foreground: 0 0% 98%; --foreground: 210 40% 98%;
--card: 0 0% 3.9%;
--card-foreground: 0 0% 98%; --muted: 217.2 32.6% 17.5%;
--popover: 0 0% 3.9%; --muted-foreground: 215 20.2% 65.1%;
--popover-foreground: 0 0% 98%;
--primary: 0 0% 98%; --popover: 222.2 84% 4.9%;
--primary-foreground: 0 0% 9%; --popover-foreground: 210 40% 98%;
--secondary: 0 0% 14.9%;
--secondary-foreground: 0 0% 98%; --card: 222.2 84% 4.9%;
--muted: 0 0% 14.9%; --card-foreground: 210 40% 98%;
--muted-foreground: 0 0% 63.9%;
--accent: 0 0% 14.9%; --border: 217.2 32.6% 17.5%;
--accent-foreground: 0 0% 98%; --input: 217.2 32.6% 17.5%;
--primary: 210 40% 98%;
--primary-foreground: 222.2 47.4% 11.2%;
--secondary: 217.2 32.6% 17.5%;
--secondary-foreground: 210 40% 98%;
--accent: 217.2 32.6% 17.5%;
--accent-foreground: 210 40% 98%;
--destructive: 0 62.8% 30.6%; --destructive: 0 62.8% 30.6%;
--destructive-foreground: 0 0% 98%; --destructive-foreground: 0 85.7% 97.3%;
--border: 0 0% 14.9%;
--input: 0 0% 14.9%; --ring: 217.2 32.6% 17.5%;
--ring: 0 0% 83.1%;
--chart-1: 220 70% 50%;
--chart-2: 160 60% 45%;
--chart-3: 30 80% 55%;
--chart-4: 280 65% 60%;
--chart-5: 340 75% 55%;
--sidebar-background: 240 5.9% 10%;
--sidebar-foreground: 240 4.8% 95.9%;
--sidebar-primary: 224.3 76.3% 48%;
--sidebar-primary-foreground: 0 0% 100%;
--sidebar-accent: 240 3.7% 15.9%;
--sidebar-accent-foreground: 240 4.8% 95.9%;
--sidebar-border: 240 3.7% 15.9%;
--sidebar-ring: 217.2 91.2% 59.8%;
}
.centered-content {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 100vw;
} }
} }

View File

@@ -0,0 +1,41 @@
"use client"
import Link from "next/link"
import { Button } from "@/components/ui/button"
export function Hero1() {
return (
<section className="mx-auto my-auto bg-white dark:bg-gray-900">
<div className="grid max-w-screen-xl px-4 py-8 mx-auto lg:gap-8 xl:gap-0 lg:py-16 lg:grid-cols-12">
<div className="mr-auto place-self-center lg:col-span-7">
<h1 className="max-w-2xl mb-4 text-4xl font-extrabold tracking-tight leading-none md:text-5xl xl:text-6xl dark:text-white">
Revolutionize Your HealthCare
</h1>
<p className="max-w-2xl mb-6 font-light text-gray-500 lg:mb-8 md:text-lg lg:text-xl dark:text-gray-400">
Improving your recovery journey with personalized care.
</p>
<Button>
<Link
href="/get-started"
className="inline-flex items-center justify-center px-5 py-3 mr-3 text-base font-medium text-center rounded-lg bg-primary-700 hover:bg-primary-800 "
>
Get started
<svg
className="w-5 h-5 ml-2 -mr-1"
fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
>
<path
fillRule="evenodd"
d="M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z"
clipRule="evenodd"
></path>
</svg>
</Link>
</Button>
</div>
</div>
</section>
)
}

View File

@@ -1,20 +1,20 @@
"use client" "use client"
import { AlignLeft } from "lucide-react"
import { Card, CardContent } from "./ui/card"
export function Facts() { export function Facts() {
return ( return (
<section className="mx-auto my-auto bg-white dark:bg-gray-900"> <section className="mx-auto my-auto bg-white dark:bg-gray-900">
<div className="grid max-w-screen-xl px-4 py-8 mx-auto lg:gap-8 xl:gap-0 lg:py-16 lg:grid-cols-12"> <Card>
<div className="mr-auto place-self-center lg:col-span-7"> <CardContent>
<h1 className=" max-w-2xl mb-4 text-4xl font-extrabold tracking-tight leading-none md:text-5xl xl:text-6xl dark:text-white"> <h1>
Our Mission OUR MISSION
</h1> </h1>
<p className="float-right max-w-2xl mb-6 font-light text-gray-500 lg:mb-8 md:text-lg lg:text-xl dark:text-gray-400"> <AlignLeft> PostCare we want to ensure the health of those throughout the world.</AlignLeft>
At PostCare we want to ensure the health of those throughout the world. <AlignLeft>Our goal is to make sure that our services can ensure clarity and accessibility</AlignLeft>
Our goal is to make sure that our services can ensure clarity and accessibility <AlignLeft>As well as a smooth experience</AlignLeft>
<center>As well as a smooth experience</center> </CardContent>
</p> </Card>
</div>
</div>
</section> </section>
) )
} }