-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor add content lifecyle management for the content management feature #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor add content lifecyle management for the content management feature #18
Conversation
…ame to version 1.4.0
…ate to ensure it can correctly manage the new ContentStatus property. This resolves the compilation error you previously identified by ensuring the state object is aware of the new field before the BLoC tries to use it.
… which is necessary for the UI to communicate status changes to the CreateCategoryBloc.
…goryStatusChanged event and to include the status field when submitting the new category to the repository.
…This allows administrators to select a ContentStatus when creating a new category. The dropdown is populated with all possible values from the ContentStatus enum.
…f the category being edited. This involves adding the new field to the state class, its constructor, the copyWith method, and the props list for Equatable.
…ry for the UI to inform the EditCategoryBloc when the administrator changes the category's status in the edit form.
… This includes handling the new EditCategoryStatusChanged event, loading the status when the category data is fetched, and including the status in the payload when the form is submitted.
…is allows administrators to see and change the ContentStatus of an existing category.
…elevant columns for content management: Name, Status, and Last Updated. This provides administrators with a clear, at-a-glance overview of each category's state.
…tatus field, its default value, and updates the copyWith method and props list accordingly.
…e_event.dart file. This event will be dispatched from the UI to the BLoC whenever the user changes the value in the new status dropdown.
…usChanged event and to include the status field when creating the Source object for submission.
…lowing administrators to set the ContentStatus when creating a new source.
…. This is a crucial step to allow the EditSourceBloc to manage the lifecycle status of a source being edited.
….dart file. This event is crucial for allowing the UI to communicate status changes from the form to the EditSourceBloc.
…his involves loading the initial status when the source is fetched, adding an event handler to react to changes from the UI, and including the status in the payload when the form is submitted.
…his involves loading the initial status when the source is fetched, adding an event handler to react to changes from the UI, and including the status in the payload when the form is submitted.
… columns for an administrator: Name, Type, Status, and Last Updated. This provides a clear, at-a-glance overview of each source's state.
…ield. This will allow the BLoC to manage the status of a new headline before it's created.
…ne_event.dart file. This event will be used by the UI to notify the BLoC of changes to the headline's status. I've also updated the existing event classes to be final and standardized their props for consistency.
…StatusChanged event. It also modifies the submission logic to include the selected status when creating a new Headline instance.
…eHeadlinePage UI, allowing administrators to set the status when creating a new headline.
…ld. This is necessary for the EditHeadlineBloc to manage the lifecycle status of the headline being edited.
…ary for the UI to communicate status changes to the EditHeadlineBloc. I am also taking this opportunity to modernize the event file by converting the base class to sealed and making the event classes final for better type safety and consistency.
… This includes loading the initial status when the headline data is fetched, adding an event handler for the new EditHeadlineStatusChanged event, and including the updated status in the payload when the form is submitted.
…eadlinePage UI. This allows administrators to view and modify the status of an existing headline.
…eadlinePage UI. This allows administrators to view and modify the status of an existing headline.
…on provides a .l10n() method that will be used to display user-friendly, localized names for each status in the UI. This will resolve the compilation errors we encountered earlier in the data tables.
…d Arabic .arb files. This will provide the necessary strings for the new "Status" and "Last Updated" columns in the data tables, as well as the localized names for the ContentStatus enum values.
…ocalization keys that we added to the .arb files in the previous step. This replaces the placeholder text and connects the enum to the localization system.
…ge. I will update the DropdownButtonFormField to display the localized status names instead of the temporary placeholder text. I also noticed and removed a duplicated dropdown widget from this file to clean up the code.
…Page. I will update the DropdownButtonFormField to display the proper localized status names, replacing the temporary placeholder text.
…. I will update the DropdownButtonFormField for ContentStatus to display the localized status names, replacing the temporary placeholder text.
…ge. I will update the DropdownButtonFormField to display the proper localized status names, replacing the temporary placeholder text.
…data table. I will update the DataCell for the status column to use the .l10n(context) extension method, ensuring the status is displayed in the user's selected language.
…nePage. I will update the DropdownButtonFormField for ContentStatus to display the localized status names, replacing the temporary placeholder text.
…Page. I will update the DropdownButtonFormField to display the proper localized status names, replacing the temporary placeholder text
…e data table. I will update the DataCell for the status column to use the .l10n(context) extension method, ensuring the status is displayed in the user's selected language. I will also clean up unused imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @fulleni, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request significantly enhances the content management feature by introducing a comprehensive content lifecycle management system. It integrates a new ContentStatus
field across categories, headlines, and sources, allowing administrators to define and track the state of content (e.g., active, archived, draft). The changes span from backend data models and BLoC state management to the user interface, where new dropdowns facilitate status selection during content creation and editing, and updated table views provide clear visibility into content status and last modification times. This refactoring improves the usability and robustness of the content management system, providing better control over content visibility and workflow.
Highlights
- Content Lifecycle Management: Introduced a
ContentStatus
field (active, archived, draft) toCategory
,Headline
, andSource
models, enabling lifecycle management for these content types. - UI Integration: Added dropdown fields for selecting
ContentStatus
in the creation and editing forms for categories, headlines, and sources. - Table View Enhancements: Modified the table views for categories, headlines, and sources to display the
ContentStatus
andLast Updated
timestamp, replacing previous columns like 'description' or 'publishedAt' for better content overview. Also enabled row selection to navigate to the respective edit pages. - Localization Support: Added new localization keys for 'Status', 'Last Updated', and the different
ContentStatus
values (Active, Archived, Draft) to support internationalization. - Codebase Refinements: Updated BLoC states and events across content management features to incorporate the new
ContentStatus
, ensuring proper data flow and state management. Minor refactoring ofEquatable
props and class types (sealed
,final
) for improved type safety and immutability. - Dependency Updates: Updated several Flutter package dependencies, including
go_router
,device_preview
, andfreezed_annotation
, along with the Flutter SDK constraint.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces content lifecycle management through a new status
field. The changes are well-structured and consistently applied. My feedback focuses on removing debug code and improving date formatting.
@@ -9,11 +9,13 @@ class AppBlocObserver extends BlocObserver { | |||
void onChange(BlocBase<dynamic> bloc, Change<dynamic> change) { | |||
super.onChange(bloc, change); | |||
log('onChange(${bloc.runtimeType}, $change)'); | |||
print('onChange(${bloc.runtimeType}, $change)'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@override | ||
void onError(BlocBase<dynamic> bloc, Object error, StackTrace stackTrace) { | ||
log('onError(${bloc.runtimeType}, $error, $stackTrace)'); | ||
print('onError(${bloc.runtimeType}, $error, $stackTrace)'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cells: [ | ||
DataCell(Text(category.name)), | ||
DataCell(Text(category.description ?? l10n.notAvailable)), | ||
DataCell(Text(category.status.l10n(context))), | ||
DataCell(Text(category.updatedAt?.toLocal().toString() ?? l10n.notAvailable)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? DateFormatter.formatDate(headline.publishedAt!) | ||
: l10n.unknown, | ||
), | ||
Text(headline.updatedAt?.toLocal().toString() ?? l10n.notAvailable), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DataCell(Text(source.sourceType?.localizedName(l10n) ?? l10n.unknown)), | ||
DataCell(Text(source.status.l10n(context))), | ||
DataCell( | ||
Text(source.updatedAt?.toLocal().toString() ?? l10n.notAvailable), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Status
READY/IN DEVELOPMENT/HOLD
Description
Type of Change