-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ubq-testing/ui-upgrade
feat: ui upgrade
- Loading branch information
Showing
9 changed files
with
166 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from "react"; | ||
|
||
export default function DialogueBox({ title, content }) { | ||
return ( | ||
<div className="dialogue-box"> | ||
<h2>{title}</h2> | ||
<p>{content}</p> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Link from "next/link"; | ||
|
||
export default function NavBar() { | ||
return ( | ||
<div className="flex items-center p-4 justify-center text-center gap-14 "> | ||
<Link className="text-2xl font-bold" href="/"> | ||
Chat | ||
</Link> | ||
<Link className="text-2xl font-bold" href="/docs"> | ||
Data | ||
</Link> | ||
<Link className="text-2xl font-bold" href="/data"> | ||
Docs | ||
</Link> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
'use client'; | ||
"use client"; | ||
|
||
import { useChat } from 'ai/react'; | ||
import { useChat } from "ai/react"; | ||
|
||
export default function Chat() { | ||
export default function Dual() { | ||
const { messages, input, handleInputChange, handleSubmit, data } = useChat(); | ||
return ( | ||
<div className="flex flex-col w-full max-w-md py-24 mx-auto stretch"> | ||
{messages.length > 0 | ||
? messages.map(m => ( | ||
<div key={m.id} className="whitespace-pre-wrap"> | ||
{m.role === 'user' ? 'User: ' : 'AI: '} | ||
{m.content} | ||
</div> | ||
)) | ||
: null} | ||
<div className="flex"> | ||
<div className="flex flex-col w-full max-w-md py-24 mx-auto stretch"> | ||
{messages.length > 0 | ||
? messages.map((m) => ( | ||
<div key={m.id} className="whitespace-pre-wrap"> | ||
{m.role === "user" ? "User: " : "AI: "} | ||
{m.content} | ||
</div> | ||
)) | ||
: null} | ||
|
||
<form onSubmit={handleSubmit}> | ||
<input | ||
className="fixed bottom-0 w-full max-w-md p-2 mb-8 border border-gray-300 rounded shadow-xl" | ||
value={input} | ||
placeholder="Say something..." | ||
onChange={handleInputChange} | ||
/> | ||
</form> | ||
<form onSubmit={handleSubmit}> | ||
<input | ||
className="fixed bottom-0 w-full max-w-md p-2 mb-8 border border-gray-300 rounded shadow-xl" | ||
value={input} | ||
placeholder="Say something..." | ||
onChange={handleInputChange} | ||
/> | ||
</form> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import DialogueBox from "@/app/components/dialogue"; | ||
import React from "react"; | ||
|
||
const content = ` | ||
This is just an example dialogue box that wil be used later. | ||
`; | ||
|
||
export default function DataPage() { | ||
return ( | ||
<div> | ||
<h1>Data Page</h1> | ||
<p>This is the Data page content.</p> | ||
|
||
<DialogueBox title="Dialogue Box 1" content={content} /> | ||
|
||
<DialogueBox title="Dialogue Box 2" content={content} /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"use client"; | ||
import React, { useEffect, useState } from "react"; | ||
import ReactMarkdown from "react-markdown"; | ||
|
||
const demoDoc = ` | ||
# Docs Page | ||
[Google](www.google.com) | ||
- list 1 | ||
- list 2 | ||
- list 3 | ||
\`\` quote \`\` | ||
\`\`\`javascript | ||
function example() { | ||
return 'Hello, Markdown!'; | ||
} | ||
\`\`\` | ||
`; | ||
|
||
export default function DocsPage() { | ||
const [markdown, setMarkdown] = useState(""); | ||
|
||
useEffect(() => { | ||
setMarkdown(demoDoc); | ||
}, []); | ||
|
||
return ( | ||
<div> | ||
<h1>Docs Page</h1> | ||
<div className="markdown-content"> | ||
<ReactMarkdown children={markdown} /> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export const metadata = { | ||
title: "Create Next App", | ||
description: "Generated by create next app", | ||
}; | ||
|
||
export default function DualLayout(props: { | ||
children: React.ReactNode; | ||
data: React.ReactNode; | ||
docs: React.ReactNode; | ||
}) { | ||
return ( | ||
<div className="grid grid-cols-3 shrink"> | ||
{props.data} | ||
{props.children} | ||
{props.docs} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"use client"; | ||
|
||
import { useChat } from "ai/react"; | ||
|
||
export default function Dual() { | ||
const { messages, input, handleInputChange, handleSubmit, data } = useChat(); | ||
return ( | ||
<div className="flex"> | ||
<div className="flex flex-col w-full max-w-md py-24 mx-auto stretch"> | ||
{messages.length > 0 | ||
? messages.map((m) => ( | ||
<div key={m.id} className="whitespace-pre-wrap"> | ||
{m.role === "user" ? "User: " : "AI: "} | ||
{m.content} | ||
</div> | ||
)) | ||
: null} | ||
|
||
<form onSubmit={handleSubmit}> | ||
<input | ||
className="fixed bottom-0 w-full max-w-md p-2 mb-8 border border-gray-300 rounded shadow-xl" | ||
value={input} | ||
placeholder="Say something..." | ||
onChange={handleInputChange} | ||
/> | ||
</form> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters