Okay, let's re-focus this entirely on the React UI development for a Telegram-like chat application. We'll assume the backend and real-time communication infrastructure are handled by other means, and we'll concentrate on building the user interface and client-side logic.
This will be a series of prompts, each focusing on a specific aspect of the UI build.
Prompt Part 1: Project Setup, Core Layout & Authentication UI
Goal: Establish the React project structure, core layout components, routing, state management, and the UI for authentication.
Prompt:
"You are a Senior Frontend Engineer specializing in React and TypeScript. Your task is to design and outline the React UI implementation for a real-time chat application, mirroring Telegram's look and feel, without focusing on backend integration details at this stage.
Core Stack for UI Development:
- Framework/Library: React (latest version)
- Language: TypeScript
- Tooling: Vite (for project setup and development server)
- Routing: React Router v6
- State Management: Redux Toolkit or Zustand (choose one and justify briefly)
- Styling: Tailwind CSS (for utility-first styling)
- Component Library (Optional but recommended): Consider using a library like Headless UI or Radix UI for accessible components if needed, or build custom components with Tailwind.
UI Requirements:
-
Project Setup:
- Initialize a new React project using Vite with the TypeScript template (
npm create vite@latest my-tele-chat --template react-ts).
- Set up React Router v6 for navigation between different views.
- Configure your chosen state management library (Redux Toolkit/Zustand) for global state management.
- Configure Tailwind CSS.
-
Core Application Layout:
- Design a two-panel layout:
- Left Panel: Primarily for the chat list, contacts, and potentially settings/menu.
- Right Panel: The main content area, displaying the selected chat window or profile details.
- Create reusable layout components (e.g.,
AppLayout, Sidebar, MainContentArea).
- Implement placeholder components for these sections initially.
-
Authentication UI:
- Login Screen:
- Input fields for phone number (with country code selector UI).
- Input field for OTP code received via SMS (after phone number submission).
- Optional field for 2FA password after OTP verification.
- Clear branding and visual appeal.
- Registration Screen:
- Similar flow to Login but for new users.
- Fields: Phone number, OTP, Name, Username, Bio, Avatar Upload UI.
- State Management for Auth: Plan how user authentication state (logged in/out, user data) will be managed globally.
-
Routing Strategy:
- Define routes for:
/login
/register
/app (main application view, protected route)
/app/chats/:chatId (specific chat view)
/app/settings
/app/profile/:userId
Deliverables:
Provide a detailed description of the component structure, state management strategy for authentication, routing configuration, and the visual design considerations for the Login/Registration screens and the main App Layout. Explain the choice of state management library."
Prompt Part 2: Chat List & Conversation View UI
Goal: Develop the UI for displaying the list of chats and the main chat window where messages are exchanged.
Prompt:
"Building upon the 'TeleChat' UI foundation, focus on creating the Chat List and the Main Chat Window components.
Core Stack: React, TypeScript, Vite, React Router, Redux Toolkit/Zustand, Tailwind CSS.
UI Requirements:
-
Chat List Component (ChatList.tsx):
- Structure: A scrollable list.
- Each Chat Item (
ChatItem.tsx):
- Display user/group/channel avatar (circular image).
- Display display name (bold).
- Display last message snippet (truncated text).
- Display timestamp of the last message (aligned to the right).
- Display an unread message count badge (if applicable).
- Highlight the currently selected chat item.
- Include a visual indicator for online/offline status (a small dot next to the avatar).
- State Management: How will the list of chats be fetched and updated in the UI state? How will the "active" chat be managed and communicated to the main chat window?
-
Main Chat Window Component (ChatWindow.tsx):
- Header Area:
- Display the current chat's avatar, display name, and potentially online status/member count.
- Include buttons for accessing chat details, search, or options menu.
- Message Display Area:
- A scrollable container for messages.
- Each Message Bubble (
MessageBubble.tsx):
- Distinguish between sent (right-aligned, distinct color) and received (left-aligned, different color) messages.
- Display sender's name (if in a group/channel and not the current user).
- Display message text.
- Display timestamp for each message.
- Handle different message types (text, images, files, voice messages) with appropriate UI elements.
- Implement visual indicators for read receipts (e.g., single tick, double tick).
- Support for message replies (show quoted message above the current message).
- Handle edited messages with an 'edited' label.
- Implement infinite scrolling for loading older messages as the user scrolls up.
- Implement scroll-to-bottom functionality when new messages arrive.
- Display a "typing..." indicator if a user is typing.
- Message Input Area:
- Text input field for typing messages.
- Attach file/media button (emoji, paperclip icons).
- Send button.
- Voice message recording button (microphone icon).
- When the user types, send a "typing" event (conceptually).
Deliverables:
Provide a detailed breakdown of the component hierarchy for the chat list and chat window, including prop definitions for key components like ChatItem and MessageBubble. Describe the state management approach for managing the list of chats, the currently selected chat, and incoming real-time updates (messages, presence, typing indicators)."
Prompt Part 3: User Profiles, Settings & Media Upload UI
Goal: Create the UI for user profiles, application settings, and handling media uploads.
Prompt:
"Focus on developing the user-facing UI for User Profiles, Application Settings, and the Media Upload Experience for 'TeleChat'.
Core Stack: React, TypeScript, Vite, React Router, Redux Toolkit/Zustand, Tailwind CSS.
UI Requirements:
-
User Profile View (UserProfile.tsx):
- Profile Header:
- Large display avatar.
- Full display name.
- Username (@username).
- Phone number (visibility controlled by privacy settings).
- Status (online, last seen timestamp - visibility controlled by privacy).
- Bio Section: Display user's bio.
- Shared Media/Files Section: Placeholder for viewing media exchanged with this user (future feature).
- Action Buttons: "Block User", "Delete Chat", "Message".
- Edit Profile: If viewing own profile, provide an "Edit Profile" button that transitions to an editable view.
-
Edit Profile View (EditProfile.tsx):
- Input fields for: Display Name, Username, Bio.
- Avatar upload component:
- Display current avatar.
- Button to change avatar.
- File input that supports image selection.
- Image preview before confirmation.
- Save/Cancel buttons.
-
Settings View (Settings.tsx):
- Organize settings into logical sections (e.g., Account, Chat Settings, Notifications, Privacy).
- Account Section:
- Link to view/edit profile.
- Option to change password (requires current password).
- 2FA Setup UI: Placeholder for enabling/disabling Two-Factor Authentication (e.g., QR code display, secret input, verification code input).
- Chat Settings:
- Option for font size, theme (Dark/Light mode toggle).
- Wallpaper settings (placeholder).
- Privacy Section:
- "Last Seen" privacy control (radio buttons/select: Everyone, My Contacts, Nobody).
- "Profile Photo" privacy control.
- "Forwarded Messages" privacy (show your name on forwarded messages).
- "Blocked Users" list and management UI.
- Notifications Section:
- Notification sounds, vibration settings.
- Mute specific chats/channels UI.
-
Media Upload UI:
- File Picker Integration: When the attachment icon is clicked in the chat input:
Deliverables:
Describe the component structure for UserProfile, EditProfile, and Settings. Detail the UI elements for each setting option. Explain the user flow for uploading various media types, including previews and progress indication. Specify how these views would be navigated to from the main layout."
Prompt Part 4: Advanced Messaging Interactions & UI Polish
Goal: Implement the UI for advanced message features and polish the overall user experience.
Prompt:
"Enhance the 'TeleChat' UI by implementing features for Advanced Message Interactions and performing general UI Polish to elevate the user experience.
Core Stack: React, TypeScript, Vite, React Router, Redux Toolkit/Zustand, Tailwind CSS.
UI Requirements:
-
Message Actions (Context Menus):
- When a user clicks/long-presses a message bubble:
- Display a context menu with options:
Reply, Forward, Edit (if applicable), React, Delete, Copy.
- Reply UI: When 'Reply' is selected, the message should be quoted and displayed above the input field, linked to the original message ID.
- Forward UI: Implement a modal or bottom sheet that allows selecting another chat/contact to forward the message to.
- Edit UI: If 'Edit' is selected for a user's own message, the message content should populate the input field, with an 'edited' label displayed once saved.
- Delete UI: Implement confirmation dialogs for deleting messages (for self, or potentially for all).
- React UI: Provide an emoji picker interface (or a limited set of common reactions) to attach an emoji to a message. Display reactions below the message bubble.
-
Message Status Indicators:
- Read Receipts: Visually indicate message status within the chat window (e.g., single grey tick for sent, double grey tick for delivered, double blue tick for read). Show these on sent messages.
- Timestamp: Ensure each message has a clear timestamp.
-
Pinned Messages:
- UI for pinning a message (via context menu).
- A persistent banner at the top of the chat window displaying the pinned message with a "go to pinned message" button and a close/unpin option.
-
Typing Indicators:
- Display "User X is typing..." or "User X is recording audio..." dynamically above the input field or in the chat header.
-
Global & Chat Search UI:
- Global Search: A persistent search bar (e.g., in the sidebar or app header) to search for users, groups, and channels. Display results in a dedicated search view or modal.
- Chat Search: An icon within the chat window header to initiate search within that specific conversation. Display search results overlaid or in a dedicated panel within the chat view.
-
UI Polish & Performance:
- Dark/Light Mode Toggle: Implement a switch to toggle between themes.
Deliverables:
Detail the component design for message context menus, reply/forward UI, reaction display, pinned message banner, typing indicators, and search interfaces. Explain how these interactive elements would be implemented using React's state and event handling, and how they fit into the existing ChatWindow and ChatList components. Describe the visual feedback for loading and error states."
Prompt Part 5: Channels, More Media & Group Admin UIs
Goal: Design the UI for Channels, enhanced media sharing (audio, files), and group administration features.
Prompt:
"Focus on the UI implementation for Channels, additional Media Sharing capabilities (audio, files), and Group Administration features within the 'TeleChat' application.
Core Stack: React, TypeScript, Vite, React Router, Redux Toolkit/Zustand, Tailwind CSS.
UI Requirements:
-
Channels UI:
- Channel Creation: A modal or form for creating public/private channels (name, description, avatar, public/private toggle).
- Channel List Item: Similar to
ChatItem, but clearly indicating it's a channel.
- Channel View:
- Header similar to group chats.
- Message display area.
- Input area: For regular users, this might be read-only or hidden, indicating only admins can post. For admins, it functions normally.
- Member List: Display channel subscribers.
-
Enhanced Media Sharing UI:
- Audio Message Recording:
- In the message input area: A microphone icon.
- On click: Start recording (display duration, stop button, discard button, send button).
- Sending: The recorded audio is attached to a message.
- Playback: In
MessageBubble, display an audio player UI (play/pause button, progress bar, duration).
- File Sharing UI:
- When selecting 'Document' or generic file:
- File input for any file type.
- In
MessageBubble: Display a file icon (based on MIME type), file name, file size, and a download button.
- Show upload/download progress indicators.
-
Group Administration UI:
- Group Info/Details View: Accessible from the chat header.
- Member List:
- Display all members with their role (Admin, Member).
- Admin action options (visible to admins):
- Promote to Admin / Demote Admin.
- Ban/Unban User.
- Kick User.
- Set User Permissions (future).
- Group Settings:
- Option for Admins to set "Slow Mode" (e.g., X seconds between messages per user). Display a visual indicator for slow mode in the chat.
- Manage invitation links.
- Change group permissions for members.
-
Notifications UI:
- Push Notification Prompt: Implement the browser's permission prompt for push notifications when relevant.
- In-App Notification Banner: A floating banner at the top of the screen (when not in the relevant chat) for new messages, mentions, or other important events.
Deliverables:
Provide component design outlines for channel creation, channel view, audio message playback, file message display, and the various group admin action UIs within the member list or group settings. Detail the UI for notification prompts and in-app banners."
Prompt Part 6: Final Polish, Privacy, and Deployment Prep UI
Goal: Cover the remaining UI aspects, including privacy settings, contact management, and essential UI polish for a production-ready feel.
Prompt:
"Complete the 'TeleChat' UI design by focusing on Privacy Controls, Contact Management, and final UI Polish aspects, including preparation for a production-like feel.
Core Stack: React, TypeScript, Vite, React Router, Redux Toolkit/Zustand, Tailwind CSS.
UI Requirements:
-
Privacy & Security UI:
- Last Seen & Profile Photo Privacy: Implement clear UI controls (e.g., radio buttons, dropdowns) within the Settings -> Privacy section to manage visibility.
- Blocked Users List: In Settings -> Privacy, display a list of blocked users. Each item should show their name/username and an 'Unblock' button.
- App Passcode Lock: Implement a modal that appears on app launch (or after a timeout) requiring a passcode (client-side lock, not for authentication). Include UI for setting/changing this passcode.
- Active Sessions: (Placeholder UI) A section in Settings to view active sessions on other devices and a button to "Terminate Session" (UI action only for now).
-
Contact Management UI:
- Contacts List View: A dedicated screen or modal accessible from the sidebar/menu, displaying all contacts, sortable alphabetically. Each contact item should be clickable to view their profile or start a chat.
- Add Contact: A search interface to find users by username and add them to contacts.
-
Advanced Feature UIs (Placeholders/Conceptual):
- Location Sharing: UI elements to share current location or live location.
- Polls: UI for creating and displaying polls within chats.
- Stickers: UI for browsing and sending sticker packs.
- GIF Search: Integration with a GIF provider API to search and send GIFs.
-
General UI Polish & Enhancements:
- Tooltips: Add informative tooltips for icons and buttons.
- Accessibility: Ensure basic accessibility practices are considered (e.g., keyboard navigation, ARIA attributes where appropriate, semantic HTML).
- Transitions & Animations: Refine animations for a smoother feel (e.g., message entry, sidebar collapse, modal transitions).
- Empty States: Design how lists (chat list, contacts, search results) look when they are empty.
- Error Boundaries: Implement React Error Boundaries for graceful UI handling of unexpected errors.
Deliverables:
Describe the UI components and user flows for managing privacy settings, viewing/unblocking contacts, and the passcode lock feature. Outline the conceptual UI for advanced features. Provide guidelines for general UI polish, accessibility, and handling empty states."
These prompts break down the UI development into logical, manageable steps, focusing purely on what the user sees and interacts with in React.