Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Trading Dashboard UI Layout #48

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions app/assistant-config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
export let assistantId = ""; // set your assistant ID here

if (assistantId === "") {
assistantId = process.env.OPENAI_ASSISTANT_ID;
}
export const assistantId = "asst_G3YhFH5MCu6PKOhGHVefg4Qk";
22 changes: 22 additions & 0 deletions app/components/DashboardLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use client';
import Link from 'next/link';

export default function DashboardLayout({ children }: { children: React.ReactNode }) {
return (
<div className="flex min-h-screen bg-gray-50">
<aside className="w-64 bg-white border-r">
<nav className="flex flex-col p-4 space-y-2">
<Link href="/" className="p-2 rounded hover:bg-gray-100">Dashboard</Link>
<Link href="/watchlist" className="p-2 rounded hover:bg-gray-100">Watchlists</Link>
<Link href="/portfolio" className="p-2 rounded hover:bg-gray-100">Portfolio</Link>
<Link href="/heatmap" className="p-2 rounded hover:bg-gray-100">Market Heatmap</Link>
<Link href="/analytics" className="p-2 rounded hover:bg-gray-100">Analytics</Link>
</nav>
</aside>

<main className="flex-1 p-6 overflow-auto">
{children}
</main>
</div>
);
}
19 changes: 19 additions & 0 deletions app/components/StockPrice.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use client';

import { useEffect, useState } from 'react';

export default function StockPrice({ ticker }) {
const [price, setPrice] = useState(null);

useEffect(() => {
fetch(`/api/tiingo?ticker=${ticker}`)
.then(res => res.json())
.then(data => setPrice(data.price));
}, [ticker]);

return (
<div>
<h2>{ticker} current price: ${price || 'Loading...'}</h2>
</div>
);
}
19 changes: 6 additions & 13 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
import { Inter } from "next/font/google";
import "./globals.css";
import Warnings from "./components/warnings";
import { assistantId } from "./assistant-config";
const inter = Inter({ subsets: ["latin"] });
import DashboardLayout from './components/DashboardLayout';
import './globals.css';

export const metadata = {
title: "Assistants API Quickstart",
description: "A quickstart template using the Assistants API with OpenAI",
icons: {
icon: "/openai.svg",
},
title: 'AlphaGPT Trading App',
description: 'Advanced Trading Dashboard powered by AlphaGPT',
};

export default function RootLayout({ children }) {
return (
<html lang="en">
<body className={inter.className}>
{assistantId ? children : <Warnings />}
<img className="logo" src="/openai.svg" alt="OpenAI Logo" />
<body>
<DashboardLayout>{children}</DashboardLayout>
</body>
</html>
);
Expand Down
32 changes: 5 additions & 27 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
"use client";

import React from "react";
import styles from "./page.module.css";

const Home = () => {
const categories = {
"Basic chat": "basic-chat",
"Function calling": "function-calling",
"File search": "file-search",
All: "all",
};

export default function Home() {
return (
<main className={styles.main}>
<div className={styles.title}>
Explore sample apps built with Assistants API
</div>
<div className={styles.container}>
{Object.entries(categories).map(([name, url]) => (
<a key={name} className={styles.category} href={`/examples/${url}`}>
{name}
</a>
))}
</div>
<main className="flex min-h-screen flex-col items-center justify-between p-24 bg-gray-900 text-white">
<h1 className="text-4xl font-bold mb-4">🚀 AlphaGPT Trading Assistant 🚀</h1>
<p className="text-lg">Your all-in-one, powerful trading dashboard.</p>
</main>
);
};

export default Home;
}