fix syntax

This commit is contained in:
yenminh269 2025-10-19 06:16:07 -05:00
commit 7b0e86ea1b

View file

@ -1,9 +1,8 @@
import React from "react";
import DeleteButton from "src/components/ui/button/delete-button";
import SchematicButton from "../button/schematic-button";
import React, { useMemo, useState } from "react"; import React, { useMemo, useState } from "react";
import { motion } from "motion/react"; import { motion } from "motion/react";
import { Rocket } from "lucide-react"; import { Rocket } from "lucide-react";
import DeleteButton from "src/components/ui/button/delete-button";
import SchematicButton from "../button/schematic-button";
export default function ChatHeader({ title = "Title of Chat" }) { export default function ChatHeader({ title = "Title of Chat" }) {
const isDebug = useMemo(() => { const isDebug = useMemo(() => {
@ -16,7 +15,7 @@ export default function ChatHeader({ title = "Title of Chat" }) {
async function triggerDemoIngest() { async function triggerDemoIngest() {
try { try {
setIngesting(true); setIngesting(true);
const res = await fetch("/api/files/import-demo", { method: "POST" }); const res = await fetch("/api/files/import-demo", { method: "POST" });
const json = await res.json().catch(() => ({})); const json = await res.json().catch(() => ({}));
setToast(`Imported: ${json.imported ?? "?"}, Skipped: ${json.skipped ?? "?"}`); setToast(`Imported: ${json.imported ?? "?"}, Skipped: ${json.skipped ?? "?"}`);
setTimeout(() => setToast(""), 4000); setTimeout(() => setToast(""), 4000);
@ -27,29 +26,30 @@ export default function ChatHeader({ title = "Title of Chat" }) {
setIngesting(false); setIngesting(false);
} }
} }
return ( return (
<div className="w-full flex justify-center"> <div className="w-full flex justify-center">
<header className="text-slate-100 fixed top-4 max-w-3xl w-full px-4"> <header className="text-slate-100 fixed top-4 max-w-3xl w-full px-4">
<div className="flex justify-between items-center gap-4"> <div className="flex justify-between items-center gap-4">
<SchematicButton></SchematicButton> <SchematicButton />
<header className="text-slate-100 fixed top-4 "> <div className="flex items-center gap-3">
<div className="flex items-center gap-3"> <h1 className="text-lg font-semibold shadow-md shadow-indigo-600 bg-gray-900 px-6 py-2 rounded-4xl border-2 border-gray-800">
<h1 className="text-lg font-semibold shadow-md shadow-indigo-600 bg-gray-900 px-6 py-2 rounded-4xl border-2 border-gray-800"> {title}
{title} </h1>
</h1> <DeleteButton />
<DeleteButton></DeleteButton> {isDebug && (
{isDebug && ( <motion.button
<motion.button onClick={triggerDemoIngest}
onClick={triggerDemoIngest} className="bg-gray-800 border-2 border-gray-700 rounded-xl px-3 py-2 flex items-center gap-2"
className="bg-gray-800 border-2 border-gray-700 rounded-xl px-3 py-2 flex items-center gap-2" whileHover={{ scale: 1.05 }}
whileHover={{ scale: 1.05 }} whileTap={{ scale: 0.95 }}
whileTap={{ scale: 0.95 }} disabled={ingesting}
disabled={ingesting} >
> <Rocket size={16} />
<Rocket size={16} /> {ingesting ? "Seeding…" : "Seed Demo Data"}
{ingesting ? "Seeding…" : "Seed Demo Data"} </motion.button>
</motion.button> )}
)} </div>
</div> </div>
{toast && ( {toast && (
<div className="mt-2 text-xs text-slate-300 bg-gray-800/80 border border-gray-700 rounded px-2 py-1 inline-block"> <div className="mt-2 text-xs text-slate-300 bg-gray-800/80 border border-gray-700 rounded px-2 py-1 inline-block">