From 4dc77b77172c1e09f78d05c7ea1b93d071f5b4d0 Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Sun, 30 Mar 2025 19:04:24 -0300 Subject: [PATCH] refactor: migrate chat layout and styles to CSS, remove unused styles and components --- a.sh | 1131 +++++++++++++++++ package.json | 6 +- pnpm-lock.yaml | 57 + .../components/user-auth-form.tsx | 115 +- src/authentication/index.tsx | 169 +-- src/chat/components/chat-layout.tsx | 26 +- src/chat/components/chat/chat-header.tsx | 28 +- src/chat/components/chat/chat-input.tsx | 80 +- src/chat/components/chat/chat-window.tsx | 9 +- src/chat/components/chat/message-list.tsx | 34 +- .../components/projector/image-viewer.tsx | 13 +- .../components/projector/markdown-viewer.tsx | 13 +- .../components/projector/projector-view.tsx | 14 +- .../components/projector/video-player.tsx | 17 +- .../components/selector/person-selector.tsx | 60 +- src/chat/components/sound-initializer.tsx | 22 +- src/chat/components/ui/emoji-picker.tsx | 80 +- src/chat/components/ui/settings-panel.tsx | 42 +- src/chat/index.tsx | 8 +- src/chat/providers/chat-provider.tsx | 105 +- src/chat/providers/sound-provider.tsx | 20 +- src/chat/styles/audio.styles.ts | 120 -- src/chat/styles/chat.styles.ts | 91 -- src/chat/styles/layout.styles.ts | 27 - src/chat/styles/projector.styles.ts | 50 - src/chat/styles/selector.styles.ts | 69 - src/chat/styles/ui.styles.ts | 150 --- src/index.tsx | 276 +--- src/styles/chat.css | 112 ++ src/styles/layout.css | 24 + src/styles/projector.css | 45 + src/styles/selector.css | 87 ++ src/styles/ui.css | 137 ++ 33 files changed, 1984 insertions(+), 1253 deletions(-) create mode 100755 a.sh delete mode 100644 src/chat/styles/audio.styles.ts delete mode 100644 src/chat/styles/chat.styles.ts delete mode 100644 src/chat/styles/layout.styles.ts delete mode 100644 src/chat/styles/projector.styles.ts delete mode 100644 src/chat/styles/selector.styles.ts delete mode 100644 src/chat/styles/ui.styles.ts create mode 100644 src/styles/chat.css create mode 100644 src/styles/layout.css create mode 100644 src/styles/projector.css create mode 100644 src/styles/selector.css create mode 100644 src/styles/ui.css diff --git a/a.sh b/a.sh new file mode 100755 index 0000000..3f3ab8a --- /dev/null +++ b/a.sh @@ -0,0 +1,1131 @@ +#!/bin/bash + +# Create the full directory structure +mkdir -p my-tauri-app/src/chat/{components,lib,providers,styles,types} +mkdir -p my-tauri-app/src/chat/components/{chat,projector,selector,ui} +mkdir -p my-tauri-app/src/styles + +# Create all files with React+HTML equivalents +cat > my-tauri-app/src/chat/components/chat/chat-header.tsx << 'EOL' +import React from 'react'; +import { useChat } from '../../providers/chat-provider'; +import '../../styles/chat.css'; + +export function ChatHeader() { + const { instance } = useChat(); + + return ( +
+
+

+ {instance?.name || 'Chat'} +

+ Online +
+ + +
+ ); +} +EOL + +cat > my-tauri-app/src/chat/components/chat/chat-input.tsx << 'EOL' +import React from 'react'; +import { EmojiPicker } from '../ui/emoji-picker'; +import { useChat } from '../../providers/chat-provider'; +import { useSound } from '../../providers/sound-provider'; +import '../../styles/chat.css'; + +export function ChatInput() { + const [message, setMessage] = React.useState(''); + const [showEmoji, setShowEmoji] = React.useState(false); + const { sendActivity } = useChat(); + const { playSound } = useSound(); + + const handleSend = () => { + if (!message.trim()) return; + playSound('send'); + sendActivity({ + type: 'message', + text: message.trim(), + }); + setMessage(''); + }; + + const handleEmojiSelect = (emoji: string) => { + playSound('click'); + setMessage(prev => prev + emoji); + }; + + return ( + <> +
+ + + + +