diff --git a/README.md b/README.md index 48dd63f..661a55f 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,79 @@ -# Welcome to your Expo app ๐Ÿ‘‹ +# Local AI Companion -This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app). +![React Native](https://img.shields.io/badge/React_Native-20232A?style=for-the-badge&logo=react&logoColor=61DAFB) ![Expo](https://img.shields.io/badge/expo-1C1E24?style=for-the-badge&logo=expo&logoColor=#D04A37) ![Zustand](https://img.shields.io/badge/Zustand-443E38?style=for-the-badge&logo=react&logoColor=white) ![LMStudio](https://img.shields.io/badge/Powered_by-LMStudio-5E5DF0?style=for-the-badge) -## Get started +> A fully local, privacy-first AI companion app built with React Native and Expo. Your data never leaves your device. -1. Install dependencies +This application connects directly to your own local AI models, completely offline. Currently in alpha, it pairs flawlessly with the [LMStudio](https://lmstudio.ai) local inference API. We developed and tested it against **Qwen3.5 (without thinking)** to guarantee a smooth, zero-latency experience. - ```bash - npm install - ``` +*Roadmap: Future updates will introduce direct in-app model downloads and support for external APIs.* -2. Start the app +--- - ```bash - npx expo start - ``` +## Features -In the output, you'll find options to open the app in a +- **100% Offline Inference:** Complete privacy. Zero cloud dependency. +- **Plug & Play LMStudio:** Instantly detects and fetches active models from your local server. +- **Persistent Sessions:** Chat histories and settings are saved locally using Zustand and `AsyncStorage`. +- **Developer-Friendly UI:** Real-time markdown rendering with syntax highlighting and 1-click code copying. +- **Minimalist Dark Mode:** High-contrast, distraction-free interface built on NativeWind principles. -- [development build](https://docs.expo.dev/develop/development-builds/introduction/) -- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/) -- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/) -- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo +--- -You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction). +## Quick Start -## Get a fresh project +To run this application, you will need both the frontend development environment and a local AI engine running. -When you're ready, run: +### 1. Model Server (LMStudio) + +1. Extract and open [LMStudio](https://lmstudio.ai/). +2. Download a compatible model (e.g., Llama 3, Qwen2.5, Mistral). +3. Open the **Local Server** tab (`<->`). +4. Enable **CORS** and set the port (default: `1234`). +5. Click **Start Server**. + +> **Note:** If testing on a physical mobile device, locate your machine's local IPv4 address (e.g., `192.168.1.X`). + +### 2. Mobile Client (App) + +Ensure you have [Node.js](https://nodejs.org/) (v18+) and the [Expo Go](https://expo.dev/go) app installed. ```bash -npm run reset-project +git clone https://github.com/evandrodevbr/LocalAiApp.git +cd LocalAiApp +npm install +npx expo start ``` -This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing. +Scan the QR code with Expo Go, or type `i`/`a` to launch a simulator. -## Learn more +### 3. Connection -To learn more about developing your project with Expo, look at the following resources: +1. Open the app and tap the **Settings** icon. +2. Enter your LMStudio server IP and Port (e.g., `192.168.1.X:1234`). +3. Tap **Test Connection**. -- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides). -- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web. +Once connected, your available models will load automatically. -## Join the community +--- -Join our community of developers creating universal apps. +## Bug Reports & Contributing -- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute. -- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions. +Found an issue or have a suggestion? We welcome community involvement! + +๐Ÿ‘‰ **[Report an Issue or Request a Feature](https://github.com/evandrodevbr/LocalAiApp/issues)** + +When creating an issue, please include: + +- A clear description of the bug. +- Steps to reproduce. +- Relevant screenshots or environment details. + +--- + +## Acknowledgments + +Thank you for exploring this project! Our mission is to share knowledge and foster an open-source collaborative ecosystem around offline AI solutions. All feedback, testing, and code contributions are highly appreciated. + +
+
diff --git a/docs/doc Tecnica LM Studio.md b/docs/Documentaรงรฃo de Implementaรงoes Futuras.md similarity index 100% rename from docs/doc Tecnica LM Studio.md rename to docs/Documentaรงรฃo de Implementaรงoes Futuras.md diff --git a/docs/PLAN-chat-ux-improvements.md b/docs/PLAN-chat-ux-improvements.md deleted file mode 100644 index e7286c6..0000000 --- a/docs/PLAN-chat-ux-improvements.md +++ /dev/null @@ -1,168 +0,0 @@ -# PLAN: Chat UX Improvements + Streaming Fix - -> ๐Ÿค– **Agentes:** `@frontend-specialist` + `@mobile-developer` -> **Data:** 2026-03-04 - ---- - -## ๐Ÿ› Bug Crรญtico: ReadableStream not supported - -**Causa raiz:** O `fetch` nativo do React Native (Hermes) nรฃo suporta `response.body.getReader()`. A implementaรงรฃo atual usa a Web Streams API que sรณ funciona em navegadores. - -**Soluรงรฃo:** Usar o pacote `react-native-sse` โ€” cliente SSE leve feito para React Native, que usa `XMLHttpRequest` internamente (sem polyfills pesados). - -```bash -pnpm add react-native-sse -``` - -Reescrever `chatCompletionStream()` em `services/lmStudioApi.ts` para usar `EventSource` do `react-native-sse` no mobile e manter `ReadableStream` no web via `Platform.OS`. - ---- - -## ๐Ÿง  Brainstorm: Rendering de Markdown - -### Contexto -Respostas de LLMs vรชm em Markdown (code blocks, bold, listas, etc). Atualmente renderizamos como `` puro. - -### Option A: `react-native-markdown-display` -- โœ… Leve, customizรกvel por StyleSheet, suporta code blocks -- โŒ Manutenรงรฃo irregular -- ๐Ÿ“Š **Effort:** Low - -### Option B: `@ronradtke/react-native-markdown-display` (fork mantido) -- โœ… Fork ativo e mantido, API idรชntica, melhor suporte Expo -- โœ… Customizaรงรฃo completa de estilos -- โŒ Sem syntax highlighting nativo (adicionรกvel) -- ๐Ÿ“Š **Effort:** Low - -### Option C: Custom parser com regex -- โœ… Zero dependรชncias, 100% controle -- โŒ Muito trabalho, bugs com edge cases -- ๐Ÿ“Š **Effort:** High - -### ๐Ÿ’ก Recomendaรงรฃo -**Option B** (`@ronradtke/react-native-markdown-display`) โ€” fork mantido, baixo esforรงo e cobre 95% dos casos. - ---- - -## ๐Ÿ“‹ Plano de Implementaรงรฃo - -### Fase 1: Bug Fix โ€” Streaming (Prioridade Mรกxima) - -#### [MODIFY] `services/lmStudioApi.ts` -- Instalar `react-native-sse` -- Reescrever `chatCompletionStream()` com dual strategy: - - **Web:** Manter `ReadableStream` (funciona nativamente) - - **Native (iOS/Android):** Usar SSE via `react-native-sse` -- Handling robusto de erros e abort - ---- - -### Fase 2: Markdown Rendering - -#### [ADD] Dependรชncia -```bash -pnpm add @ronradtke/react-native-markdown-display -``` - -#### [MODIFY] `components/chat/MessageBubble.tsx` -- Substituir `` por `` nas mensagens do assistant -- Manter `` para mensagens do user (sรฃo texto simples) -- Estilizar code blocks com fundo escuro, fonte mono -- Estilizar bold, italic, listas, links -- Suporte a inline code com badge de destaque - ---- - -### Fase 3: Message Actions (Copy, Edit, Resend) - -#### [MODIFY] `components/chat/MessageBubble.tsx` -- Adicionar toolbar de aรงรตes abaixo de cada mensagem (aparece via long-press ou sempre visรญvel para assistant) -- **Actions do Assistant:** - - ๐Ÿ“‹ Copy โ€” copia conteรบdo para clipboard (`Clipboard.setStringAsync`) - - ๐Ÿ”„ Regenerate โ€” reenvia a รบltima mensagem do user -- **Actions do User:** - - ๐Ÿ“‹ Copy โ€” copia conteรบdo - - โœ๏ธ Edit โ€” abre o texto no input para ediรงรฃo + reenvio - - ๐Ÿ—‘๏ธ Delete โ€” remove mensagem - -#### [MODIFY] `store/useAppStore.ts` -- Adicionar `deleteMessage(id)` -- Adicionar `editMessage(id, content)` โ€” edita e reprocess -- Adicionar `regenerateLastResponse()` โ€” remove รบltima resposta + reenvia - -#### [MODIFY] `components/chat/ChatInput.tsx` -- Suportar modo "edit" โ€” prรฉ-preencher input com texto da mensagem selecionada -- Mostrar indicador visual de que estรก editando (ex: badge "Editing" + botรฃo cancelar) - -#### [NEW] `components/chat/MessageActions.tsx` -- Componente de aรงรตes reutilizรกvel -- Botรตes com รญcones (Lucide): `Copy`, `Pencil`, `RefreshCw`, `Trash2` -- Touch targets 44px+ (Fitts' Law compliance) -- Haptic feedback nos botรตes (`expo-haptics`) - ---- - -### Fase 4: UI/UX Polish - -#### [MODIFY] `components/chat/MessageBubble.tsx` -- Avatar/รญcone para assistant (Bot icon) e user -- Timestamp discreto abaixo da bolha -- Animaรงรฃo de entrada (fade in + slide up com `react-native-reanimated`) - -#### [MODIFY] `app/chat/index.tsx` -- Empty state quando nรฃo hรก mensagens (รญcone + texto de boas-vindas + sugestรตes de prompts clicรกveis) -- Typing indicator animado (3 dots pulsando) enquanto `isStreaming` e conteรบdo ainda vazio - -#### [MODIFY] `components/chat/ChatInput.tsx` -- Auto-grow do input (jรก faz multiline, melhorar visual) -- Botรฃo de "stop generation" (โน๏ธ) visรญvel durante streaming, substituindo o botรฃo send -- Contador de caracteres sutil para mensagens longas - -#### [MODIFY] `app/chat/_layout.tsx` -- Botรฃo "New Chat" no header (limpa conversa) - ---- - -## ๐Ÿ’ก Sugestรตes Adicionais (Simples de Implementar) - -1. **Sugestรตes de Prompts no Empty State** โ€” 3-4 cards clicรกveis com prompts exemplo ("Explique recursรฃo", "Escreva um haiku") que preenchem o input ao tocar. Melhora onboarding e ajuda o user a comeรงar. - -2. **Persistรชncia de Chat com AsyncStorage** โ€” Salvar mensagens no dispositivo para nรฃo perder ao fechar o app. Usar `zustand/middleware` com `persist`. - -3. **Haptic Feedback nas aรงรตes** โ€” Vibraรงรฃo leve ao enviar mensagem, copiar, e deletar. Premium feel. (`expo-haptics` jรก estรก disponรญvel no Expo). - -4. **Scroll-to-bottom FAB** โ€” Quando o user rola para cima e chega mensagem nova, mostrar um FAB "โ†“" no canto inferior para voltar ao final. Evita perder mensagens novas. - -5. **Configuraรงรฃo de Temperature/Max Tokens no Chat** โ€” Adicionar um menu de "Model Parameters" acessรญvel pelo header (รญcone de slider). Permite ajustar temperatura e max_tokens sem ir em Settings. - -6. **Tema Dark Mode funcional** โ€” O theme toggle existe mas as telas usam cores hardcoded (#FFFFFF, #F3F4F6). Conectar com o sistema `Colors` de `constants/theme.ts` para dark mode real. - -7. **Indicador de tokens usados** โ€” Mostrar contagem de tokens da resposta (retornado pelo `usage` da API) abaixo de cada mensagem assistant. Informativo para quem estรก testando modelos. - -8. **System Prompt configurรกvel** โ€” Input nas Settings para definir o system prompt padrรฃo que รฉ enviado em toda conversa. Permite personalizar o "comportamento" do modelo. - ---- - -## Verificaรงรฃo - -1. Enviar mensagem โ†’ resposta deve aparecer via streaming (sem erro ReadableStream) -2. Resposta do assistant โ†’ renderizada com formataรงรฃo markdown (code blocks, bold, listas) -3. Long-press em mensagem โ†’ botรตes de aรงรฃo aparecem -4. Copiar โ†’ conteรบdo no clipboard -5. Editar mensagem do user โ†’ input preenchido, reenvio funciona -6. Empty state โ†’ sugestรตes de prompt visรญveis -7. Stop generation โ†’ streaming para imediatamente -8. Dark mode โ†’ todas as telas respeitam o tema - ---- - -## Ordem de Execuรงรฃo Recomendada - -| Fase | Prioridade | Esforรงo | -|------|-----------|---------| -| 1. Fix Streaming | ๐Ÿ”ด Crรญtico | Baixo | -| 2. Markdown | ๐ŸŸ  Alto | Baixo | -| 3. Message Actions | ๐ŸŸก Mรฉdio | Mรฉdio | -| 4. UI/UX Polish | ๐ŸŸข Normal | Mรฉdio | -| 5+ Sugestรตes | ๐Ÿ”ต Nice-to-have | Baixo cada | diff --git a/docs/PLAN-local-save-chats.md b/docs/PLAN-local-save-chats.md deleted file mode 100644 index d995bd5..0000000 --- a/docs/PLAN-local-save-chats.md +++ /dev/null @@ -1,91 +0,0 @@ -# Local Save and Auto-Refresh Models Plan - -## 1. Overview -The goal is to implement local data persistence for chats, messages, and server connection settings (IP/Port/API Key), alongside an improved connection workflow that automatically fetches available models upon a successful connection. Finally, a new "Saved Chats" area will be introduced to browse and manage historical conversations. - -## 2. Project Type -**WEB/MOBILE** (Cross-platform Expo/React Native app) - -## 3. Success Criteria -- [ ] Server connection settings (Host, Port) persist across app restarts. -- [ ] Chat sessions and their respective messages are saved locally. -- [ ] Users can view and load previous chats from a new "Saved Chats" screen/drawer. -- [ ] Upon successful connection in Settings, the app automatically fetches and populates the available models list. -- [ ] Zero data loss between soft reloads. - -## 4. Tech Stack -- **State Management & Persistence:** `zustand` + `use-sync-external-store` with React Native Async Storage OR Expo SQLite (decision needed, starting with AsyncStorage via Zustand persist middleware for simplicity). -- **Navigation:** Expo Router (`app/(drawers)` or `app/chats/`). -- **UI:** NativeWind / StyleSheet with `Colors.ts` zinc theme. - -## 5. File Structure Modifications - -```text -โ”œโ”€โ”€ app/ -โ”‚ โ”œโ”€โ”€ chat/ -โ”‚ โ”‚ โ”œโ”€โ”€ index.tsx (Update to handle loading specific chat IDs) -โ”‚ โ”‚ โ””โ”€โ”€ history.tsx [NEW] (Screen for Saved Chats) -โ”‚ โ””โ”€โ”€ settings/ -โ”‚ โ””โ”€โ”€ index.tsx (Update to trigger model refresh on connect) -โ”œโ”€โ”€ store/ -โ”‚ โ””โ”€โ”€ useAppStore.ts (Add persist middleware, add chat history management) -โ””โ”€โ”€ components/ - โ””โ”€โ”€ chat/ - โ””โ”€โ”€ ChatHistoryItem.tsx [NEW] -``` - -## 6. Task Breakdown - -### Task 1: Setup Persistence in App Store -- **Agent:** `frontend-specialist` -- **Skills:** `react-best-practices`, `nodejs-best-practices` -- **Priority:** P1 -- **INPUT:** `useAppStore.ts` -- **OUTPUT:** Zustand store wrapped in `persist` middleware using `AsyncStorage`. -- **VERIFY:** Reloading the app keeps the `serverConfig` and `messages` intact. - -### Task 2: Implement Chat Sessions (Saved Chats) Data Structure -- **Agent:** `frontend-specialist` -- **Skills:** `react-best-practices` -- **Priority:** P1 -- **INPUT:** `useAppStore.ts` -- **OUTPUT:** Add `ChatSession` type (id, title, updatedAt, messages). Create actions `saveCurrentChat`, `loadChat`, `deleteChat`. -- **VERIFY:** Calling `saveCurrentChat` creates a new entry in the persisted `chatSessions` array. - -### Task 3: Auto-Refresh Models on Connection -- **Agent:** `frontend-specialist` -- **Skills:** `api-patterns` -- **Priority:** P2 -- **INPUT:** `app/settings/index.tsx` and `hooks/useLMStudio.ts` -- **OUTPUT:** When `testConnection` succeeds, automatically call `fetchModels` and update the active model if none is selected. -- **VERIFY:** Connecting to a valid server immediately makes the Model selector functional without requiring a manual refresh click. - -### Task 4: Create "Saved Chats" UI Screen -- **Agent:** `frontend-specialist` -- **Skills:** `frontend-design` -- **Priority:** P2 -- **INPUT:** `app/chat/history.tsx` (new) -- **OUTPUT:** A screen listing all saved chats, sorted by `updatedAt` desc, allowing users to tap to load or swipe/click to delete. -- **VERIFY:** Screen renders correctly, respects dark mode (zinc), and loading a chat correctly populates the Chat screen. - -### Task 5: Integrate Save Button / Auto-Save in Chat Screen -- **Agent:** `frontend-specialist` -- **Skills:** `frontend-design` -- **Priority:** P3 -- **INPUT:** `app/chat/index.tsx` -- **OUTPUT:** Header button or automatic mechanism to name and save the current active chat session to history. -- **VERIFY:** User can explicitly snapshot their current conversation. - -## 7. Phase X: Verification -- [x] **Lint:** Pass `npm run lint` -- [x] **Types:** Pass `npx tsc --noEmit` -- [x] **Functionality:** - - Kill the app and reopen -> Connection IP should remaining. - - Connect -> Models load instantly. - - Chat -> Save -> Open History -> Chat is there. - -## โœ… PHASE X COMPLETE -- Lint: โœ… Pass -- Security: โœ… No critical issues -- Build: โœ… Success -- Date: 2026-03-04 diff --git a/docs/PLAN-models-chat-settings.md b/docs/PLAN-models-chat-settings.md deleted file mode 100644 index 815ac70..0000000 --- a/docs/PLAN-models-chat-settings.md +++ /dev/null @@ -1,96 +0,0 @@ -# Plan: Models, Chat & Settings Screens - -This document outlines the implementation plan for adding the Models, Chat, and Settings screens to the LocalAiApp, following the user's choice of **Option C** (Stack Navigation with Actions in Header) and targeting the Qwen 3.5 models (0.5b, 1.5b, 4b) via HuggingFace formats. -The project is a **CROSS-PLATFORM** app built with Expo (iOS, Android, Web/Desktop). - -## Overview -We will implement a responsive, cross-platform Chat interface. On mobile, it will be a full-screen Chat interface with a top-bar header. On desktop/tablet breakpoints, the UI will adapt (e.g., potentially expanding the header actions or bringing settings into a side panel if needed, but primarily focusing on a fluid Chat layout that centers the conversation on wide screens). The application will manage model state through a central store, allowing quick selection from the header. - -## Success Criteria -* The `Chat` screen acts as the primary fluid view, centering the message thread on wide desktop displays max-width to avoid excessively long text lines, while extending full-width on mobile. -* The models (Qwen 3.5 - 0.5b, 1.5b, 4b) can be selected via a dropdown or modal directly from the Chat header. On desktop, this might behave as a popover; on mobile, a bottom sheet. -* A `Settings` screen is accessible via an icon in the Chat header. On mobile, it pushes onto the stack. On desktop, it may appear as a modal or dedicated full-page route optimized for mouse interaction. -* A solid context/state management foundation (e.g., Zustand) is established to hold the current selected model and chat history across screens. -* The UI must adhere to fluid design principles: larger touch targets for mobile (> 44pt), hover states and standard cursor interactions for desktop. No standard templates; use a custom, premium aesthetic. - -## Tech Stack -* **React Native / Expo Router**: For navigation and screen structure. -* **Zustand**: For simple, performant global state management (models state, chat history). -* **Vanilla Stylesheet / Tailwind (if configured)**: For custom, premium UI styling without generic templates. -* **Lucide-React-Native / Expo Vector Icons**: For crisp, recognizable icons in the header and settings. -* *(Future Integration)* `llama.rn` or similar: For actually executing the Qwen models locally on the device (Out of scope for this UI phase, but Settings UI must account for it). - -## File Structure - -``` -โ”œโ”€โ”€ app/ -โ”‚ โ”œโ”€โ”€ index.tsx # Main entry point (Redirects to chat or is the chat) -โ”‚ โ”œโ”€โ”€ chat/ -โ”‚ โ”‚ โ”œโ”€โ”€ _layout.tsx # Defines the Stack Header (Model Selector + Settings Icon) -โ”‚ โ”‚ โ”œโ”€โ”€ index.tsx # The Chat UI (Messages list, input area) -โ”‚ โ”œโ”€โ”€ settings/ -โ”‚ โ”‚ โ”œโ”€โ”€ index.tsx # Settings Screen (Model management, keys, UI prefs) -โ”œโ”€โ”€ components/ -โ”‚ โ”œโ”€โ”€ chat/ -โ”‚ โ”‚ โ”œโ”€โ”€ MessageBubble.tsx # Defines how user/AI messages look -โ”‚ โ”‚ โ”œโ”€โ”€ ChatInput.tsx # The text input area -โ”‚ โ”‚ โ”œโ”€โ”€ ModelSelector.tsx # The dropdown/bottom sheet to pick Qwen models -โ”‚ โ”œโ”€โ”€ ui/ -โ”‚ โ”‚ โ”œโ”€โ”€ IconButton.tsx # Reusable touch-friendly icon button -โ”œโ”€โ”€ store/ -โ”‚ โ”œโ”€โ”€ useAppStore.ts # Zustand store for active model, messages, and settings -โ”œโ”€โ”€ constants/ -โ”‚ โ”œโ”€โ”€ Models.ts # Definitions for Qwen 3.5 (0.5b, 1.5b, 4b) URLs/Configs -``` - -## Task Breakdown - -### 1- Setup Global State & Constants -* **Agent:** `mobile-developer` -* **Skills:** `clean-code` -* **Task:** Create `Models.ts` with configurations for the selected Qwen 3.5 models. Setup a basic Zustand store `useAppStore.ts` to hold the `activeModel`, an array of `messages`, and user preferences. -* **INPUTโ†’OUTPUTโ†’VERIFY:** Input: Empty files. Output: A working Zustand store and constant file. Verify: Can import store into a simple component and read/write values. - -### 2- Implement Stack Navigation Layout & Responsive Shell -* **Agent:** `frontend-specialist` (cross-platform expert) -* **Skills:** `frontend-design`, `react-best-practices` -* **Task:** Update `app/_layout.tsx` (or `app/chat/_layout.tsx`) to use Expo Router's `` navigation. Implement a responsive container that limits max width on desktop sizes to ensure readability, while remaining 100% width on mobile. Configure the header of the `chat` screen to include the `ModelSelector` and Settings icon. -* **INPUTโ†’OUTPUTโ†’VERIFY:** Input: Default Expo Router layout. Output: A cross-platform layout adapting to screen width (`useWindowDimensions`). Verify: Resize browser window (Web) to test breakpoints; launch mobile to confirm header structure. - -### 3- Build Chat Components (Input & Bubbles) -* **Agent:** `frontend-specialist` -* **Skills:** `frontend-design` -* **Task:** Create `components/chat/MessageBubble.tsx` and `components/chat/ChatInput.tsx`. These components must be responsive: message bubbles should have a max-width (e.g., 75% on mobile, 60% on desktop) and inputs should support Enter to send on Web (Shift+Enter for newline) alongside standard mobile keyboard behavior. Add hover states for desktop interactions. -* **INPUTโ†’OUTPUTโ†’VERIFY:** Input: Layout skeleton. Output: Reusable chat components functioning on both touch and mouse interfaces. Verify: Test desktop hover states and Enter-key sending; test mobile touch targets and padding. - -### 4- Build the Chat Screen (List & Integration) -* **Agent:** `mobile-developer` -* **Skills:** `performance-profiling` -* **Task:** Implement `app/chat/index.tsx`. Use `FlatList` (or `FlashList` if available) to render the messages from the global state. Integrate the `ChatInput` at the bottom (handling Keyboard avoiding view correctly). -* **INPUTโ†’OUTPUTโ†’VERIFY:** Input: Chat components. Output: A fully scrollable chat interface that reacts to keyboard input. Verify: Type a message, send it, verify it appears in the list and the list auto-scrolls. - -### 5- Build Model Selector (Header Menu) -* **Agent:** `mobile-developer` -* **Skills:** `mobile-design` -* **Task:** Implement `components/chat/ModelSelector.tsx`. This should be a touchable area in the header that opens a bottom sheet or a contextual menu to switch between the Qwen 3.5 models (0.5b, 1.5b, 4b). -* **INPUTโ†’OUTPUTโ†’VERIFY:** Input: Header layout. Output: Interactive menu for model selection. Verify: Tapping the header opens the menu, selecting a model updates the global state. - -### 6- Build Settings Screen -* **Agent:** `frontend-specialist` -* **Skills:** `frontend-design` -* **Task:** Implement `app/settings/index.tsx`. Group settings into logical sections. On wide screens, this could be a centered card layout; on mobile, a standard list. Add toggles/inputs for configuration with proper focus states for keyboard navigation on Web/Desktop. -* **INPUTโ†’OUTPUTโ†’VERIFY:** Input: Navigation setup. Output: A functional, responsive settings screen. Verify: Navigate to Settings, change sizes from mobile to desktop, check alignment and focus rings. - -## Phase X: Verification Plan - -To verify this cross-platform implementation, the following checklist must be executed once all tasks are complete: - -- [ ] **Linting & Types:** Run `npm run lint` and `npx tsc --noEmit`. Fix any warnings/errors. -- [ ] **Cross-Platform Accessibility:** Audit touch targets for mobile (> 44pt) and verify hover/focus states are present for Desktop users (mouse/keyboard). -- [ ] **Responsive Resizing:** Run `npm run web` and resize the browser horizontally. Ensure text lines in chat don't stretch indefinitely and the input field remains centered/bounded. -- [ ] **Design Constraints Check:** Verify NO purple/violet `#8A2BE2` are used. Ensure UI feels premium on both small and large screens. -- [ ] **Keyboard Handling:** - - *Mobile:* Ensure Keyboard Avoiding View prevents covering the input. - - *Desktop:* Ensure hitting `Enter` sends the message, and `Shift+Enter` adds a newline. -- [ ] **State Persistence (Basic):** Select a model -> Go to Settings -> Change a setting -> Go back to Chat -> Verify the selected model hasn't reset. -- [ ] **Build:** Run `npm run android`, `npm run ios`, and `npm run web` successfully without bundler errors. diff --git a/docs/evandro-design-system.html b/docs/evandro-design-system.html new file mode 100644 index 0000000..4a662fa --- /dev/null +++ b/docs/evandro-design-system.html @@ -0,0 +1,2529 @@ + + + + + +evandro.dev.br โ€” Design System + + + + + + + + +
+ + +
+
+
+ + Design System Completo +
+

+ evandro
+ .dev
+ .br +

+

+ Sistema de identidade visual e componentes para uma empresa de programaรงรฃo. Cada elemento รฉ intencionalmente destilado atรฉ seu essencial. +

+
+
+
4px
+
Base unit
+
+
+
9ร—
+
Type scale
+
+
+
4+
+
Tokens cor
+
+
+
+ +
+
+ + + + + + + + + + + +
+
D โ€” Slash Mark ยท Conceito final
+
Escala: 280ร—200 ยท Viewbox
+
+
+ + + + + +
+
+
+
02 โ€” Cores
+

Color Tokens

+

Sistema semรขntico de tokens. Cada cor tem papel รบnico โ€” nada รฉ decorativo.

+
+
+ +
+
+
Primรกrios
+
+
+
+
--ink
#0A0A0A
+
Logo ยท Texto ยท UI
+
+
+
+
--paper
#F4F2ED
+
Fundo primรกrio
+
+
+
+
--white
#FFFFFF
+
Texto em dark
+
+
+
+
+
Acento & Estado
+
+
+
+
--slash
#E8FF00
+
Acento ยท Logo ยท CTA
+
+
+
+
--meta
#777777
+
Texto secundรกrio
+
+
+
+
--border
rgba(10,10,10,.10)
+
Divisores ยท Bordas
+
+
+
+
+ +
+
Gradiente de Opacidade โ€” --ink
+
+
100%
+
80%
+
40%
+
12%
+
6%
+
+
+
+ + +
+
+
+
03 โ€” Tipografia
+

Type System

+

Duas famรญlias, nove tamanhos, um sistema semรขntico claro.

+
+
+ +
+
+
Token
Amostra
Tamanho
Peso
+
+
+
--display-2xl
+
Ev/
+
clamp(40,72px)
+
800
+
+
+
--display-xl
+
Build. Ship. Scale.
+
48px
+
800
+
+
+
--display-lg
+
Produtos que escalam
+
32px
+
700
+
+
+
--heading-md
+
Arquitetura de Software
+
22px
+
700
+
+
+
--heading-sm
+
Componentes & APIs
+
16px
+
600
+
+
+
--body-lg
+
Construรญmos software com propรณsito e precisรฃo.
+
14px
+
400
+
+
+
--body-md
+
Da arquitetura ao deploy. TypeScript, React, Node.
+
12px
+
400
+
+
+
--label
+
FULL-STACK DEVELOPMENT
+
10px
+
500
+
+
+
--meta
+
v1.0 ยท MIT ยท 2026
+
9px
+
400โ€“500
+
+
+ +
+
+
+
+
+
+
+
+
evandro.config.ts
+
+
// Configuraรงรฃo de tipografia โ€” evandro.dev.br
+import type { Config } from 'tailwindcss'
+
+export const typography = {
+  fonts: {
+    display: 'Syne',    // Tรญtulos, logo, hero
+    mono:    'Geist Mono' // Corpo, UI, cรณdigo
+  },
+  scale: {
+    'display-2xl': 'clamp(40px, 5vw, 72px)',
+    'display-xl':  '48px',
+    'display-lg':  '32px',
+    'heading-md':  '22px',
+    'body-md':     '12px',
+    'label':       '10px',
+  }
+} satisfies Partial<Config>
+
+
+
+ + +
+
+
+
04 โ€” Espaรงamento
+

Spacing Scale

+

Base 4px. Cada token tem um papel semรขntico no layout โ€” nรฃo sรฃo intercambiรกveis.

+
+
+ +
+
+
Token
Visual
px
Uso
+
+
--sp-1
4px
Gap micro
+
--sp-2
8px
Gap รญcone
+
--sp-3
12px
Gap interno
+
--sp-4
16px
Padding btn
+
--sp-6
24px
Padding card
+
--sp-8
32px
Gap seรงรฃo
+
--sp-12
48px
Padding section
+
--sp-16
64px
Padding layout
+
--sp-20
80px
Hero sections
+
--sp-24
96px
Section header
+
+
+ + +
+
+
+
05 โ€” Componentes
+

Component Library

+

Todos os primitivos de UI. Hover nos componentes para ver as interaรงรตes.

+
+
+ +
+ + +
+
Buttons โ€” Variantes
+
+ + + + +
+
+ + + +
+
+ + + +
+
+ +
+
Buttons โ€” Dark Mode
+
+ + + +
+
+ + + +
+
+ + +
+
Badges & Tags
+
+ Default + Online + Entregue + Erro +
+
+ React + TypeScript + Node.js + PostgreSQL + Docker + AWS +
+
+ + +
+
Form Inputs
+
+
Seu email
+ +
+
+
URL do projeto
+
+ https:// + +
+
+ +
+ + +
+
Cards
+
+ +
+
+
+ +
+
+
Desenvolvimento
+
Full-stack ยท React ยท Node
+
+
+
Construรงรฃo de produtos digitais do zero, com arquitetura escalรกvel e cรณdigo de qualidade.
+ +
+ +
+
+
+ +
+
+
Design System
+
UI Kit ยท Tokens ยท Docs
+
+
+
Criaรงรฃo de sistemas de design escalรกveis com documentaรงรฃo e componentes reutilizรกveis.
+ +
+ +
+
+
+ +
+
+
Performance
+
Core Web Vitals ยท SEO
+
+
+
Otimizaรงรฃo de performance com foco em mรฉtricas reais de usuรกrio e SEO tรฉcnico avanรงado.
+ +
+ +
+
+ + +
+
Toggles & Progress
+
+
+
+ Dark mode ativo +
+
+
+ Notificaรงรตes (acento) +
+
+
+ Inativo +
+
+
+
+
TypeScript95%
+
+
+
+
React / Next.js92%
+
+
+
+
Node / Bun88%
+
+
+
+
+ + +
+
Notificaรงรตes & Skeleton
+
+
+
โœ“
+
Deploy concluรญdo
evandro.dev.br em produรงรฃo ร s 14:32
+
+
+
!
+
Build com warning
2 dependรชncias desatualizadas
+
+
+
โœ•
+
Erro no pipeline
Tests falharam em 3 arquivos
+
+
+
+
+
+
+
+
+
+ +
+ + +
+
Tokens de Componentes
+ + + + + + + + + + + + + + + + + + +
ComponenteTokenValorEstado
Button--btn-h-default40pxEstรกvel
Button--btn-h-sm32pxEstรกvel
Button--btn-h-lg52pxEstรกvel
Input--input-h40pxEstรกvel
Card--card-radius8pxEstรกvel
Badge--badge-radius999pxEstรกvel
Tooltip--tooltip-delay300msBeta
+
+
+ + +
+
+
+
06 โ€” Iconografia
+

Icon Style

+

Estilo: Stroke 1.5px, corners arredondados, 24ร—24 viewport. Hover para ver interaรงรฃo.

+
+
+ +
+ +
code
+
package
+
api
+
perf
+
deploy
+
git
+
slack
+
security
+ +
time
+
add
+
check
+
search
+
coffee
+
arrow
+
layout
+
light
+
+
+ + +
+
+
+
07 โ€” Animaรงรฃo
+

Motion System

+

Hover nos cards para ver as animaรงรตes. Motion nรฃo รฉ decoraรงรฃo โ€” tem semรขntica.

+
+
+ +
+
+
+
Fade ยท Entrada/Saรญda
+
opacity ยท 400ms ease-out
+
+
+
+
Slide ยท Navegaรงรฃo
+
transform ยท 400ms ease-out
+
+
+
+
Scale ยท Micro-interaรงรฃo
+
scale + rotate ยท 400ms spring
+
+
+ +
+
+
+
+
motion.config.ts
+
+
// Curvas de easing do sistema โ€” nunca use ease padrรฃo do CSS
+export const easing = {
+  // Entradas de UI โ€” sensaรงรฃo de gravidade natural
+  out:    'cubic-bezier(.16, 1, .3, 1)',
+  // Saรญdas โ€” rรกpido para nรฃo bloquear o usuรกrio
+  in:     'cubic-bezier(.4, 0, 1, 1)',
+  // Micro-interaรงรตes crรญticas (botรฃo, link)
+  spring: 'cubic-bezier(.34, 1.56, .64, 1)',
+}
+
+export const duration = {
+  instant: 100,  // hover state
+  fast:    200,  // botรตes, toggles
+  normal:  350,  // modais, drawers
+  slow:    600,  // page transitions
+}
+
+
+
+ + +
+
+
+
08 โ€” Voz da Marca
+

Brand Voice

+

Como a marca fala. Tom tรฉcnico, direto, sem ego. Como o melhor dev sรชnior que vocรช conhece.

+
+
+ +
+
+
โšก
+
Direto
+
Nรฃo: prolixo
+
+
+
๐Ÿง 
+
Tรฉcnico
+
Nรฃo: vago
+
+
+
๐Ÿค
+
Honesto
+
Nรฃo: vendedor
+
+
+
๐ŸŽฏ
+
Confiante
+
Nรฃo: arrogante
+
+
+ +
+
+
+ โœ“ Use isso +
+
+
"Entregamos APIs que processam 50k req/s. Sem mรกgica โ€” arquitetura sรณlida e cรณdigo testado."
+
Especรญfico, verificรกvel, sem exagero. Mostra competรชncia atravรฉs de dado concreto.
+
+
+
+
+ โœ• Evite isso +
+
+
"Somos apaixonados por inovaรงรฃo e entregamos soluรงรตes digitais de alta performance para o seu negรณcio."
+
Genรฉrico, vazio, poderia ser de qualquer empresa. Nรฃo diz nada de real.
+
+
+
+
+ โœ“ Use isso +
+
+
"Projeto tem bug crรญtico no checkout. Corrijo em 4h ou รฉ de graรงa."
+
Comprometimento real, prazo especรญfico, accountability. Isso cria confianรงa.
+
+
+
+
+ โœ• Evite isso +
+
+
"Vamos analisar a situaรงรฃo e alinhar as expectativas para encontrar a melhor soluรงรฃo possรญvel."
+
Corporativรชs sem substรขncia. Fuga de responsabilidade disfarรงada de profissionalismo.
+
+
+
+
+ + +
+
+
+
09 โ€” Aplicaรงรตes
+

Brand in the Wild

+

A identidade em contextos reais de uso.

+
+
+ +
+ + +
+
Cartรฃo de Visita ยท 85ร—54mm
+
+
+
+
+
evandro.dev.br
+
FULL-STACK DEVELOPMENT
+
+ + + + + + + + +
+
+
+ evandro.dev.br
+ contato@evandro.dev.br
+ github.com/evandro +
+
+
+
+
+ + +
+
GitHub Profile Banner ยท 1280ร—640px
+
+ +
+
+ + +
+
+
Full-Stack Developer ยท Santa Catarina, BR
+
+ evandro.dev.br +
+
+ +
+ + + + + + + + +
+
+ + +
+
+ TypeScript + React + Next.js + Node.js + PostgreSQL + Docker + AWS +
+
+
+
8+
+
Anos
+
+
+
40+
+
Projetos
+
+
+
100%
+
Commit
+
+
+
+
+
+ + +
+
Assinatura de Email
+ +
+ + +
+
Favicon & App Icons
+
+
+
+ + + + + + + + +
+ App Store ยท 180px +
+
+
+
+ + + + + + + + +
+ 64px +
+
+
+ + + + + + + + +
+ 32px +
+
+
+ + + + + + + + +
+ 16px +
+
+
+
+ +
+
+ + + + +
+ +