diff --git a/.gitignore b/.gitignore index ea8c4bf..903cc36 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ /target +.claude +/web-ui/target +/web-ui/node_modules +/web-ui/.env +/web-ui/.env.local +/web-ui/dist diff --git a/Cargo.lock b/Cargo.lock index 7a0c5d9..c3f925a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -530,18 +530,28 @@ checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 8b2a424..43cce22 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,3 +10,7 @@ tokio = { version = "1.0", features = ["sync"] } serde = { version = "1.0", features = ["derive", "rc"] } serde_json = "1.0" anyhow = "1.0.97" + +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +async-tungstenite = { version = "0.28", features = ["async-std-runtime"] } +futures-util = "0.3" diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..de2e426 --- /dev/null +++ b/ISSUE_TEMPLATE.md @@ -0,0 +1,186 @@ +# ๐จ Feature Request: Beautiful Web UI with Yew Framework + +## ๐ Summary +Transform the current CLI-based async-chat into a modern, beautiful web application using Yew (Rust + WebAssembly) for the frontend while keeping the existing Rust server backend. + +## ๐ฏ Motivation +- **Better User Experience**: Move from CLI to intuitive web interface +- **Full Rust Stack**: Showcase Rust's capabilities for both frontend and backend +- **Modern Chat Experience**: WhatsApp/Discord-like interface +- **Learning Opportunity**: Demonstrate Yew + WebAssembly in a real project +- **Community Showcase**: Highlight Rust-Cameroon's technical capabilities + +## ๐ Proposed Solution + +### **Tech Stack** +- **Frontend**: Yew + WebAssembly (WASM) +- **Backend**: Keep existing async-std Rust server +- **Communication**: WebSocket for real-time messaging +- **Styling**: TailwindCSS + CSS modules +- **Build Tool**: Trunk for WASM bundling +- **State Management**: Yewdux or built-in Yew state +- **Icons**: Lucide icons or similar +- **WebSocket Client**: gloo-net for browser APIs + +### **Architecture** +``` +โโโโโโโโโโโโโโโโโโโโโโโ WebSocket โโโโโโโโโโโโโโโโโโโโ +โ Yew Frontend โ โโโโโโโโโโโโโโโบ โ Rust Server โ +โ (WebAssembly) โ (JSON msgs) โ (async-std) โ +โ โ โ โ +โ โโโโโโโโโโโโโโโโโโโ โ โ โโโโโโโโโโโโโโโโ โ +โ โ Chat Component โ โ โ โ Group Table โ โ +โ โ Group Component โ โ โ โ Connections โ โ +โ โ Message List โ โ โ โ Broadcasting โ โ +โ โโโโโโโโโโโโโโโโโโโ โ โ โโโโโโโโโโโโโโโโ โ +โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ +``` + +## ๐จ UI/UX Features + +### **Core Features** +- [ ] **Modern Chat Interface**: Clean, responsive design +- [ ] **Real-time Messaging**: Live message updates via WebSocket +- [ ] **Group Management**: Create, join, and switch between groups +- [ ] **Message Bubbles**: Proper chat bubble styling with timestamps +- [ ] **User Identification**: Display usernames/IDs for messages +- [ ] **Responsive Design**: Works on desktop, tablet, and mobile + +### **Enhanced Features** +- [ ] **Dark/Light Theme**: Toggle between themes +- [ ] **Message History**: Scroll through previous messages +- [ ] **Typing Indicators**: Show when someone is typing +- [ ] **Online Status**: Show active users in groups +- [ ] **Notifications**: Browser notifications for new messages +- [ ] **Emoji Support**: Basic emoji picker and rendering +- [ ] **Search Functionality**: Search messages and groups + +### **Advanced Features** (Future) +- [ ] **File Sharing**: Drag & drop file uploads +- [ ] **Voice Messages**: Audio message support +- [ ] **Message Reactions**: React to messages with emojis +- [ ] **User Profiles**: Avatar and profile management +- [ ] **Message Threading**: Reply to specific messages +- [ ] **PWA Support**: Installable web app + +## ๐๏ธ Implementation Plan + +### **Phase 1: Foundation** (Week 1-2) +- [ ] Set up Yew project structure with Trunk +- [ ] Create basic components (App, ChatRoom, MessageList) +- [ ] Implement WebSocket connection to existing server +- [ ] Basic message sending and receiving +- [ ] Simple styling with TailwindCSS + +### **Phase 2: Core Features** (Week 3-4) +- [ ] Group management UI (join/create groups) +- [ ] Message bubble styling and timestamps +- [ ] Responsive layout for different screen sizes +- [ ] Error handling and connection status +- [ ] Message input with Enter key support + +### **Phase 3: Enhanced UX** (Week 5-6) +- [ ] Dark/light theme implementation +- [ ] Message history and scrolling +- [ ] User identification and display +- [ ] Notifications and browser integration +- [ ] Loading states and animations + +### **Phase 4: Polish & Deploy** (Week 7-8) +- [ ] Performance optimizations +- [ ] Cross-browser testing +- [ ] Documentation and setup guides +- [ ] Deployment configuration +- [ ] Demo deployment + +## ๐ ๏ธ Technical Details + +### **Project Structure** +``` +async-chat/ +โโโ server/ # Existing Rust server +โ โโโ src/ +โ โโโ Cargo.toml +โโโ web-ui/ # New Yew frontend +โ โโโ src/ +โ โ โโโ components/ +โ โ โโโ services/ +โ โ โโโ styles/ +โ โ โโโ main.rs +โ โโโ static/ +โ โโโ Cargo.toml +โ โโโ Trunk.toml +โโโ README.md +``` + +### **Key Components** +```rust +// Main app component +#[function_component(App)] +fn app() -> Html { + html! { +