* Add UserProvider to App component and enhance user data fetching logic
- Integrated UserProvider into the App component to manage user state.
- Updated UserProvider to fetch current user data on token availability and handle token expiration by clearing the token on fetch failure.
- Improved user data fetching logic for better error handling and user experience.
* Enhance Telegram connection handling and error management
- Added logic to handle Telegram account mismatch, providing user feedback and resetting connection state.
- Improved user verification during authentication to ensure the logged-in account matches the Telegram account.
- Refactored connection status checks and error handling for better user experience.
- Introduced a method to clear session and disconnect when account mismatch occurs.
- Updated polling mechanism for authentication status to ensure timely updates.
This update improves the robustness of the Telegram connection process and enhances user feedback during authentication failures.
* ran prettier
* Refactor socket and auth state management for user-specific handling
- Updated socket state management to support multiple users by introducing user-specific selectors and actions.
- Refactored connection status handling in the socket service to dispatch user-specific status updates.
- Enhanced onboarding state management to track completion per user, allowing for more granular control.
- Introduced new selectors for socket and auth states to improve readability and maintainability.
- Updated relevant components to utilize the new user-specific state management.
This update improves the application's ability to handle multiple users and enhances the overall user experience during onboarding and socket connections.
* Enhance MTProto client session management and introduce user-specific session handling
- Updated the MTProtoService to manage sessions per user by storing session data under a user-specific key.
- Modified the initialize method to accept a userId parameter, allowing for user-specific session initialization and management.
- Improved session loading and saving logic to ensure proper handling of user sessions.
- Added a utility function to generate session keys based on userId for better maintainability.
This update enhances the application's ability to handle multiple user sessions effectively.
* Refactor Telegram state management for user-specific handling
- Introduced user-specific state management in the Telegram store, allowing for better handling of multiple users.
- Updated selectors to retrieve state based on the current user, improving data encapsulation and reducing global state dependencies.
- Enhanced reducers and thunks to ensure actions are dispatched with user context, maintaining user-specific data integrity.
- Modified persistence configuration to store Telegram state scoped by user, ensuring isolated state management.
This update significantly improves the application's ability to manage multiple user sessions effectively and enhances overall user experience.
* Enhance MTProtoService connection handling with user-specific initialization
- Updated the checkConnection method to accept an optional userId parameter, allowing for user-specific connection initialization.
- Modified the connection logic to ensure proper initialization only occurs when a userId is provided, improving session management.
- Refactored related thunks to use a consistent naming convention for userId parameters, enhancing code clarity.
This update improves the handling of user sessions in the MTProtoService, aligning with recent enhancements in user-specific state management.
* Refactor Telegram connection handling for user-specific management
- Updated the TelegramConnectionModal to utilize user-specific identifiers for connection status and authentication processes, enhancing session management.
- Refactored related components and selectors to ensure userId is consistently passed and utilized, improving clarity and maintainability.
- Enhanced the ConnectionsPanel and ConnectStep to check for saved sessions based on userId, allowing for better handling of multiple user connections.
This update significantly improves the application's ability to manage user-specific Telegram connections and enhances the overall user experience.
* Refactor Telegram connection logic to simplify session management
- Removed unnecessary userId checks and localStorage interactions from ConnectionsPanel and ConnectStep components, streamlining the connection status determination.
- Updated MTProtoService to manage session data through Redux instead of localStorage, enhancing consistency and maintainability.
- Improved session loading and saving logic to focus solely on Redux state, ensuring better integration with user-specific session handling.
This update enhances the clarity and efficiency of the Telegram connection management process, aligning with recent improvements in user-specific state management.
* Update CLAUDE.md to clarify localStorage usage and emphasize Redux for state management
- Revised documentation to discourage the use of localStorage and sessionStorage for app state, advocating for Redux and Redux Persist instead.
- Added guidelines for removing existing localStorage usage and migrating relevant data to Redux.
- Updated service layer documentation to reflect changes in session management, specifying that session data is now stored in Redux rather than localStorage.
- Enhanced clarity on deep link handling and the prevention of infinite reload loops.
This update aligns with recent improvements in user-specific state management and reinforces best practices for state handling.
* Enhance onboarding process with error handling and API integration
- Updated the Onboarding component to include an API call for marking onboarding as complete, with error handling to provide user feedback.
- Refactored the GetStartedStep component to support asynchronous completion handling, including loading state and error messages.
- Introduced a new onboardingComplete method in the userApi service to facilitate the onboarding completion process.
This update improves the user experience during onboarding by ensuring proper error management and feedback.
* Enhance TelegramConnectionModal with socket connection management and improved initialization flow
- Integrated socket connection handling in the TelegramConnectionModal to ensure the socket is connected when the modal opens, enhancing real-time features.
- Refactored the initialization logic to streamline the connection process, including user verification and error handling.
- Introduced a reference to track the QR code flow state, preventing multiple initiations and improving user experience during authentication.
This update improves the reliability of the Telegram connection process and enhances user feedback during the onboarding experience.
* Refactor Telegram connection checks for improved logic consistency
- Updated the ConnectionsPanel and ConnectStep components to refine the logic for determining if a Telegram connection is established, ensuring that both session string and authentication status are required for a valid connection.
- Simplified className definitions in the UI components for better readability and maintainability.
This update enhances the clarity of connection status checks and improves the overall user experience during the onboarding process.
* Refactor Telegram authentication flow and improve error handling
- Simplified the TelegramLoginButton component by removing complex authentication logic and replacing it with a direct link to the Telegram bot for login.
- Enhanced the Login page to consume a login token from the URL, providing better error handling and user feedback during the authentication process.
- Introduced a new API service for consuming login tokens, ensuring secure retrieval of JWT tokens from the backend.
This update streamlines the authentication experience and improves error management, enhancing overall user experience during login.
- Introduced MTProtoService for managing Telegram client initialization, connection, and message handling.
- Created telegramSlice for Redux state management, including connection and authentication states, user data, chats, messages, and threads.
- Implemented asynchronous actions for initializing the Telegram client, connecting, checking authentication status, and fetching chats and messages.
- Enhanced configuration utility to include Telegram API credentials for improved integration.
These changes establish a robust foundation for Telegram functionality within the application, enhancing user experience and state management.
- Removed UserProvider from the App component, simplifying the structure and relying on the useUser hook for user data management.
- Updated Home component to utilize the useUser hook for fetching user information, improving user experience by displaying the user's first name.
- Refactored Redux store configuration to conditionally include redux-logger in development mode, enhancing debugging capabilities.
- Introduced IS_DEV constant in the config utility to streamline environment checks.
These changes improve the application's architecture by enhancing user data management and refining the development experience.
- Introduced a utility function to check if the application is running in a Tauri desktop environment.
- Updated the deep link URL handling to use Tauri's invoke method for token exchange, with a fallback to the fetch API for browser environments.
- Added conditional setup for deep link listeners to ensure they are only active in Tauri, improving code clarity and functionality.
These changes improve the application's adaptability to different environments and streamline the authentication process for desktop users.
- Removed localStorage interactions for session tokens and user data in the TelegramLoginButton and authSlice, enhancing security and simplifying the codebase.
- Updated the desktop deep link listener to eliminate localStorage usage for user data, streamlining the authentication process.
- Adjusted the Redux store configuration to remove custom storage for backward compatibility, focusing on a cleaner state management approach.
These changes enhance the application's architecture by centralizing state management and improving maintainability.
- Added Redux Toolkit for managing authentication state, replacing Zustand for token handling.
- Implemented authSlice for token management, including setting and clearing tokens with localStorage synchronization.
- Refactored components (Login, Home, TelegramLoginButton) to utilize Redux for token management, enhancing state consistency.
- Updated App component to include Redux Provider and PersistGate for state persistence.
- Removed Zustand-based authStore and socketStore, streamlining the state management approach.
These changes improve the application's architecture by centralizing state management with Redux, enhancing maintainability and scalability.
- Introduced Zustand for managing authentication state, including token storage and user session handling.
- Updated TelegramLoginButton and Home components to utilize the new auth store for setting and clearing tokens.
- Enhanced the desktop deep link listener to store session tokens in the Zustand store, ensuring consistent state management.
- Refactored localStorage interactions for session tokens to improve backward compatibility.
These changes streamline the authentication process and improve state management across the application.
- Introduced a new TelegramLoginButton component to handle user authentication via Telegram.
- Replaced the previous Telegram login button implementation in the Welcome component with the new TelegramLoginButton for improved modularity and code clarity.
- Updated configuration to include TELEGRAM_BOT_ID for seamless integration with the Telegram authentication flow.
These changes enhance the user experience by providing a dedicated component for Telegram login, streamlining the authentication process.
Replace browser fetch() with Rust invoke() for token exchange to bypass
CORS restrictions. Fix deep link listener by removing premature __TAURI__
guard (not available at module load), using lazy dynamic import instead.
Add deepLinkHandled localStorage flag to prevent infinite reload loops
from getCurrent() re-delivering the same URL after navigation. Add
backend auth implementation guide and platform-specific deep link docs.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Moved the openUrl function to a new utility file for better organization and reusability across components.
- Updated import paths in Home and GetStartedStep components to reflect the new location of the openUrl function.
- Simplified error handling in the handleStartCooking function by removing unnecessary try-catch block.
These changes enhance code maintainability and streamline the process of opening URLs in the application.
- Created a new .env file to store the Telegram bot username.
- Added new background images (bg-dark.png, bg.jpg, bg.png) for enhanced visuals.
- Updated App.css and index.css to implement dark mode styles, including color adjustments and background changes.
- Modified Home.tsx to include a button that opens the Telegram bot link.
- Enhanced the configuration file to include the Telegram bot username.
This update improves the user interface with a dark mode theme and integrates Telegram functionality for better user engagement.
- Introduced @tauri-apps/plugin-deep-link for handling deep link events
- Implemented setup for deep link listener in main application entry
- Enhanced Login page to support Telegram authentication via deep links
- Created utility functions for building and handling deep links
- Added configuration for backend URL management
- Updated Tauri configuration to support deep link plugin
This update enhances the user experience by allowing seamless transitions between web and desktop applications through deep linking.