diff --git a/src/app/favicon.ico b/src/app/favicon.ico
deleted file mode 100644
index 718d6fe..0000000
Binary files a/src/app/favicon.ico and /dev/null differ
diff --git a/src/app/fonts/GeistMonoVF.woff b/src/app/fonts/GeistMonoVF.woff
deleted file mode 100644
index f2ae185..0000000
Binary files a/src/app/fonts/GeistMonoVF.woff and /dev/null differ
diff --git a/src/app/fonts/GeistVF.woff b/src/app/fonts/GeistVF.woff
deleted file mode 100644
index 1b62daa..0000000
Binary files a/src/app/fonts/GeistVF.woff and /dev/null differ
diff --git a/src/app/globals.css b/src/app/globals.css
deleted file mode 100644
index 13d40b8..0000000
--- a/src/app/globals.css
+++ /dev/null
@@ -1,27 +0,0 @@
-@tailwind base;
-@tailwind components;
-@tailwind utilities;
-
-:root {
- --background: #ffffff;
- --foreground: #171717;
-}
-
-@media (prefers-color-scheme: dark) {
- :root {
- --background: #0a0a0a;
- --foreground: #ededed;
- }
-}
-
-body {
- color: var(--foreground);
- background: var(--background);
- font-family: Arial, Helvetica, sans-serif;
-}
-
-@layer utilities {
- .text-balance {
- text-wrap: balance;
- }
-}
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
deleted file mode 100644
index a36cde0..0000000
--- a/src/app/layout.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import type { Metadata } from "next";
-import localFont from "next/font/local";
-import "./globals.css";
-
-const geistSans = localFont({
- src: "./fonts/GeistVF.woff",
- variable: "--font-geist-sans",
- weight: "100 900",
-});
-const geistMono = localFont({
- src: "./fonts/GeistMonoVF.woff",
- variable: "--font-geist-mono",
- weight: "100 900",
-});
-
-export const metadata: Metadata = {
- title: "Create Next App",
- description: "Generated by create next app",
-};
-
-export default function RootLayout({
- children,
-}: Readonly<{
- children: React.ReactNode;
-}>) {
- return (
-
-
- {children}
-
-
- );
-}
diff --git a/src/app/page.tsx b/src/app/page.tsx
deleted file mode 100644
index 6fe62d1..0000000
--- a/src/app/page.tsx
+++ /dev/null
@@ -1,101 +0,0 @@
-import Image from "next/image";
-
-export default function Home() {
- return (
-
-
-
-
- -
- Get started by editing{" "}
-
- src/app/page.tsx
-
- .
-
- - Save and see your changes instantly.
-
-
-
-
-
-
- );
-}
diff --git a/src/components/Header.tsx b/src/components/Header.tsx
new file mode 100644
index 0000000..9a585b7
--- /dev/null
+++ b/src/components/Header.tsx
@@ -0,0 +1,9 @@
+const Header = () => (
+
+
+ Stock Price Application
+
+
+ )
+
+ export default Header
\ No newline at end of file
diff --git a/src/components/StockPrice.tsx b/src/components/StockPrice.tsx
new file mode 100644
index 0000000..b8fc481
--- /dev/null
+++ b/src/components/StockPrice.tsx
@@ -0,0 +1,52 @@
+import { useState } from 'react'
+
+const StockPrice = () => {
+ const [symbol, setSymbol] = useState('')
+ const [price, setPrice] = useState(null)
+ const [error, setError] = useState('')
+
+ const fetchStockPrice = async () => {
+ setError('')
+ try {
+ const res = await fetch(`/api/quote?symbol=${symbol}`)
+ const data = await res.json()
+ if (data.error) {
+ setError(data.error)
+ } else {
+ setPrice(data.c)
+ }
+ } catch (err) {
+ setError('Failed to fetch stock price')
+ }
+ }
+
+ return (
+
+
setSymbol(e.target.value)}
+ className="border p-2 mr-2"
+ />
+
+ {price !== null && (
+
+
Current Price: ${price}
+
+ )}
+ {error && (
+
+ )}
+
+ )
+}
+
+export default StockPrice
\ No newline at end of file
diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx
new file mode 100644
index 0000000..6c6a9ea
--- /dev/null
+++ b/src/pages/_app.tsx
@@ -0,0 +1,6 @@
+import '../styles/globals.css'
+import type { AppProps } from 'next/app'
+
+export default function App({ Component, pageProps }: AppProps) {
+ return
+}
\ No newline at end of file
diff --git a/src/pages/api/quote.ts b/src/pages/api/quote.ts
new file mode 100644
index 0000000..8c14c8b
--- /dev/null
+++ b/src/pages/api/quote.ts
@@ -0,0 +1,20 @@
+import type { NextApiRequest, NextApiResponse } from "next";
+import { fetchQuote } from "../../utils/sparkle";
+
+export default async function handler(
+ req: NextApiRequest,
+ res: NextApiResponse
+) {
+ const { symbol } = req.query;
+ if (!symbol || typeof symbol !== "string") {
+ res.status(400).json({ error: "Invalid symbol" });
+ return;
+ }
+
+ try {
+ const quote = await fetchQuote(symbol);
+ res.status(200).json(quote);
+ } catch (error) {
+ res.status(500).json({ error: "Error fetching quote" });
+ }
+}
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
new file mode 100644
index 0000000..6880145
--- /dev/null
+++ b/src/pages/index.tsx
@@ -0,0 +1,11 @@
+import Header from '../components/Header'
+import StockPrice from '../components/StockPrice'
+
+export default function Home() {
+ return (
+
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/src/styles/globals.css b/src/styles/globals.css
new file mode 100644
index 0000000..bd6213e
--- /dev/null
+++ b/src/styles/globals.css
@@ -0,0 +1,3 @@
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
\ No newline at end of file
diff --git a/src/utils/sparkle.ts b/src/utils/sparkle.ts
new file mode 100644
index 0000000..d7494ec
--- /dev/null
+++ b/src/utils/sparkle.ts
@@ -0,0 +1,10 @@
+const SPARKLE_BASE_URL = process.env.NEXT_PUBLIC_SPARKLE_BASE_URL;
+
+export const fetchQuote = async (symbol: string) => {
+ const url = `${SPARKLE_BASE_URL}/quote?symbol=${symbol}`
+ const res = await fetch(url)
+ if (!res.ok) {
+ throw new Error('Error fetching quote')
+ }
+ return res.json()
+}
\ No newline at end of file