This commit is contained in:
yenminh269 2025-10-19 08:17:53 -05:00
commit ded3e57e29
5 changed files with 35 additions and 14 deletions

View file

@ -33,7 +33,6 @@
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.38.0", "@eslint/js": "^9.38.0",
"daisyui": "^5.3.7",
"eslint": "^9.38.0", "eslint": "^9.38.0",
"eslint-plugin-import": "^2.32.0", "eslint-plugin-import": "^2.32.0",
"eslint-plugin-react": "^7.37.5", "eslint-plugin-react": "^7.37.5",
@ -2907,14 +2906,22 @@
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/daisyui": { "node_modules/data-uri-to-buffer": {
"version": "5.3.7", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-5.3.7.tgz", "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
"integrity": "sha512-0+8PaSGift0HlIQABCeZzWOBV5Nx/vsI2TihB9hbaEyZENPlZZz+se2JnAH5rz9gBYTyDLB7NJup8hkREr6WBw==", "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
"dev": true,
"license": "MIT", "license": "MIT",
"funding": { "engines": {
"url": "https://github.com/saadeghi/daisyui?sponsor=1" "node": ">= 12"
}
},
"node_modules/data-uri-to-buffer": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
"integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
"license": "MIT",
"engines": {
"node": ">= 12"
} }
}, },
"node_modules/data-uri-to-buffer": { "node_modules/data-uri-to-buffer": {

View file

@ -40,7 +40,6 @@
"packageManager": ">=npm@10.9.0", "packageManager": ">=npm@10.9.0",
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.38.0", "@eslint/js": "^9.38.0",
"daisyui": "^5.3.7",
"eslint": "^9.38.0", "eslint": "^9.38.0",
"eslint-plugin-import": "^2.32.0", "eslint-plugin-import": "^2.32.0",
"eslint-plugin-react": "^7.37.5", "eslint-plugin-react": "^7.37.5",

View file

@ -43,8 +43,8 @@ app.post('/api/files/import-demo', async (req, res) => {
const distDir = path.resolve(__dirname, 'dist'); const distDir = path.resolve(__dirname, 'dist');
app.use(express.static(distDir)); app.use(express.static(distDir));
// SPA fallback // SPA fallback (Express 5 requires middleware instead of bare '*')
app.get('*', (req, res) => { app.use((req, res) => {
res.sendFile(path.join(distDir, 'index.html')); res.sendFile(path.join(distDir, 'index.html'));
}); });

View file

@ -3,9 +3,17 @@ import { ArrowDown } from "lucide-react";
import { motion } from "motion/react"; import { motion } from "motion/react";
export default function DownButton({ onClick }) { export default function DownButton({ onClick }) {
function handleClick(e) {
if (onClick) return onClick(e);
// default behavior: scroll to bottom of page smoothly
const doc = document.documentElement;
const top = Math.max(doc.scrollHeight, document.body.scrollHeight);
window.scrollTo({ top, behavior: "smooth" });
}
return ( return (
<motion.button <motion.button
onClick={onClick} onClick={handleClick}
className="bg-gray-700 p-2 rounded-2xl file-input border-2 border-gray-600 size-10" className="bg-gray-700 p-2 rounded-2xl file-input border-2 border-gray-600 size-10"
whileHover={{ scale: 1.1 }} whileHover={{ scale: 1.1 }}
whileTap={{ scale: 0.9 }} whileTap={{ scale: 0.9 }}

View file

@ -41,6 +41,13 @@ export default function MessageInput({ onSend }) {
ta.style.height = `${ta.scrollHeight}px`; ta.style.height = `${ta.scrollHeight}px`;
} }
}} }}
onKeyDown={(e) => {
// Enter to submit, Shift+Enter for newline
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
handleSubmit(e);
}
}}
placeholder="Type a message..." placeholder="Type a message..."
rows={1} rows={1}
className="flex-1 mx-2 rounded-md shadow-2sx border-none focus:border-none focus:outline-none resize-none overflow-auto max-h-40" className="flex-1 mx-2 rounded-md shadow-2sx border-none focus:border-none focus:outline-none resize-none overflow-auto max-h-40"