mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-28 18:57:42 +02:00
feat(chat): integrate chat project into monorepo with full app structure
- Restructure chat as apps/mobile, apps/web, apps/landing, backend - Add NestJS backend for secure Azure OpenAI API calls - Remove exposed API key from mobile app (security fix) - Add shared chat-types package - Create SvelteKit web app scaffold - Create Astro landing page scaffold - Update pnpm workspace configuration - Add project-level CLAUDE.md documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
fcf3a344b1
commit
c638a7ffee
155 changed files with 22622 additions and 348 deletions
50
chat/apps/mobile/hooks/useChatInput.ts
Normal file
50
chat/apps/mobile/hooks/useChatInput.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import { useState } from 'react';
|
||||
import { useAppTheme } from '../theme/ThemeProvider';
|
||||
|
||||
interface UseChatInputProps {
|
||||
onSend: (message: string) => void;
|
||||
isLoading?: boolean;
|
||||
initialText?: string;
|
||||
placeholder?: string;
|
||||
maxLength?: number;
|
||||
}
|
||||
|
||||
interface UseChatInputReturn {
|
||||
text: string;
|
||||
setText: (text: string) => void;
|
||||
handleSend: () => void;
|
||||
canSend: boolean;
|
||||
isLoading: boolean;
|
||||
isDarkMode: boolean;
|
||||
placeholder: string;
|
||||
}
|
||||
|
||||
export default function useChatInput({
|
||||
onSend,
|
||||
isLoading = false,
|
||||
initialText = '',
|
||||
placeholder = 'Nachricht eingeben...',
|
||||
maxLength = 1000,
|
||||
}: UseChatInputProps): UseChatInputReturn {
|
||||
const [text, setText] = useState(initialText);
|
||||
const { isDarkMode } = useAppTheme();
|
||||
|
||||
const canSend = text.trim().length > 0 && !isLoading;
|
||||
|
||||
const handleSend = () => {
|
||||
if (canSend) {
|
||||
onSend(text.trim());
|
||||
setText('');
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
text,
|
||||
setText,
|
||||
handleSend,
|
||||
canSend,
|
||||
isLoading,
|
||||
isDarkMode,
|
||||
placeholder,
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue