|
| 1 | +--- |
| 2 | +title: Account Management |
| 3 | +description: Learn how users can manage their preferences, saved articles, and followed content. |
| 4 | +--- |
| 5 | +import { Card, CardGrid } from '@astrojs/starlight/components'; |
| 6 | + |
| 7 | +The Account section serves as the user's personal hub within the application. From here, they can view their profile, manage their content preferences, access saved articles, and control their sign-in status. |
| 8 | + |
| 9 | +## Core Components |
| 10 | + |
| 11 | +- **`AccountBloc`**: This is the primary BLoC for managing a user's content preferences (`UserContentPreferences`). It listens for changes in the user's authentication state from the `AppBloc`. When a user signs in, it loads their preferences. It also handles all actions related to modifying these preferences, such as saving an article or following a topic. |
| 12 | + |
| 13 | +- **`AccountPage`**: The main UI for this feature. It displays the user's email or an "Anonymous" status, provides a sign-out or link-account button, and offers navigation to sub-pages for managing saved and followed content. |
| 14 | + |
| 15 | +- **`SavedHeadlinesPage`**: A dedicated page that displays a list of all the headlines the user has saved. Users can view or remove articles from this list. |
| 16 | + |
| 17 | +## Key Functionalities |
| 18 | + |
| 19 | +<CardGrid> |
| 20 | + <Card title="Centralized User Preferences" icon="user-cog"> |
| 21 | + The `AccountBloc` is responsible for fetching, creating, and updating a user's `UserContentPreferences` object. This single object holds all of the user's content-related settings, including lists of followed topics, followed sources, and saved headlines. |
| 22 | + </Card> |
| 23 | + <Card title="Saved Articles" icon="bookmark"> |
| 24 | + Users can save any headline for later reading. This action dispatches an `AccountSaveHeadlineToggled` event to the `AccountBloc`. The `SavedHeadlinesPage` then displays a clean, scrollable list of these saved articles. |
| 25 | + </Card> |
| 26 | + <Card title="Followed Content Management" icon="list-check"> |
| 27 | + The "Content Preferences" section allows users to manage the topics and sources they follow. This is where the `AvailableTopicsBloc` and `AvailableSourcesBloc` are used to fetch lists of all available entities that the user can choose to follow or unfollow. |
| 28 | + </Card> |
| 29 | + <Card title="Seamless Anonymous to Authenticated Flow" icon="link"> |
| 30 | + The `AccountPage` intelligently adapts its UI based on the user's status. For anonymous users, it presents a clear call-to-action to "link" their account, providing a smooth transition to the authentication flow to save their preferences permanently. |
| 31 | + </Card> |
| 32 | +</CardGrid> |
0 commit comments