Skip to content

Feature content management #14

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

Merged
merged 48 commits into from
Jul 1, 2025
Merged

Feature content management #14

merged 48 commits into from
Jul 1, 2025

Conversation

fulleni
Copy link
Member

@fulleni fulleni commented Jul 1, 2025

Status

IN DEVELOPMENT

Description

Feature content management

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

fulleni added 30 commits July 1, 2025 07:05
- Added data_table_2 package
- For enhanced table rendering
- Added events for headlines
- Added events for categories
- Added events for sources
- Define content management state
- Add status, data, and cursors
- Implement copyWith method
- Manages Headlines, Categories, Sources
- Implements CRUD operations
- Implements pagination
- Handles loading states
- Added tab controller
- Added bloc listener
- Added floating action button
- Implemented data table for categories
- Added loading and failure states
- Implemented delete functionality
- Implemented edit functionality
- Implemented headline listing
- Added edit and delete actions
- Integrated pagination
- Implemented data table for sources
- Added loading and failure states
- Implemented pagination
- Added edit and delete actions
- Added keys for headlines
- Added keys for categories
- Added keys for sources
- Added loading states strings
- Added table headers strings
- Added no data found strings
- Added create headline route
- Added create/edit category routes
- Added create/edit source routes
- Added formatDate method
- Encapsulated logic in class
- Added edit headline route
- Added edit headline name
- Added description for settings tab
…loc to the MultiBlocProvider in lib/app/view/app.dart. The application should now correctly provide the ContentManagementBloc to the ContentManagementPage and its sub-pages
- Simplified routes structure
- Improved navigation flow
- Removed FAB
- Added add button to appBar
- Adjusted spacing
- Define events for the edit category bloc
- Loaded, NameChanged, DescriptionChanged, etc
- Defines EditCategoryStatus enum
- Implements EditCategoryState class
- Includes form validation logic
- Implemented edit category logic
- Added state management with bloc
- Handles loading, updates, submission
- Implemented edit category UI
- Added bloc logic
- Integrated with repository
- Added EditCategoryPage
- Passed categoryId to the page
- Added translations for edit category screen
- Included success and error messages
- Added labels for icon URL field
- Prevents update with no original data
- Displays error message
- Added events for data changes
- Added event for form submission
fulleni added 18 commits July 1, 2025 21:35
- Implemented state management
- Added EditSourceStatus enum
- Defined state variables
- Manages state of single source editing
- Fetches source and countries data
- Handles form input changes
- Submits updated source data
- Implemented edit source form
- Added bloc for state management
- Integrated with data repository
- Added route for editing sources
- Uses EditSourcePage component
- Added source edit strings
- Added source type strings
- Added headquarters string
- Created EditHeadlineEvent class
- Added events for data changes
- Added submit event
- Implemented state management
- Added status enum
- Defined form validation
- Manages headline editing state
- Handles loading data
- Handles form submissions
- Implements state updates
- Implemented EditHeadlinePage
- Added EditHeadlineBloc
- Added form to edit headline
- Connect route to EditHeadlinePage
- Added edit headline title
- Added success message
- Added loading message
- Added image URL label
- Added update error message
- Added new strings to localizations
- Supports 'Edit Headline' screen
- Includes success/error messages
- Added data load event
- Added title change event
- Added description change event
- Added submit event
- Manage headline creation state
- Load sources and categories
- Handle form input changes
- Submit new headline to repository
- Added CreateHeadlineStatus enum
- Implemented CreateHeadlineState class
- Added form validation logic
- Implemented form for new headlines
- Added bloc for state management
- Handles loading, success, error states
- Added createHeadline key
- Added success message key
- Added loading data key
Copy link

@gemini-code-assist gemini-code-assist bot left a 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 delivers the core functionality for content management within the dashboard application. It provides a structured approach to managing headlines, categories, and sources through dedicated BLoC components and user interfaces for listing, creating, and editing these entities. The changes also include necessary updates to routing, internationalization, and minor code quality adjustments.

Highlights

  • Content Management Feature Implementation: I've introduced a comprehensive content management feature, enabling CRUD operations for Headlines, Categories, and Sources. This includes dedicated BLoC patterns for overall content management, as well as specific BLoCs for creating and editing individual content items.
  • User Interface Enhancements: The placeholder pages for Headlines, Categories, and Sources have been replaced with functional UIs utilizing PaginatedDataTable2 for displaying and managing data. New forms for creating and editing these content types have also been added.
  • Routing and State Management Integration: The application's GoRouter configuration has been updated to include new routes for the content management section, including specific paths for create and edit forms. The main App BLoC now integrates the new ContentManagementBloc.
  • Internationalization Support: Numerous new localization strings have been added to support the new content management features, covering various UI elements, messages, and data labels in both English and Arabic.
  • Linter Rule Adjustments: The analysis_options.yaml file has been updated to ignore avoid_redundant_argument_values and unnecessary_null_checks linter rules, and an unused_field ignore has been added to app_bloc.dart.
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

  1. 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.

@fulleni fulleni merged commit d083f59 into main Jul 1, 2025
1 check failed
@fulleni fulleni deleted the feature_content_management branch July 1, 2025 22:13
Copy link

@gemini-code-assist gemini-code-assist bot left a 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 a significant new feature for content management, including BLoCs and UI for listing, creating, and editing headlines, categories, and sources. The structure is well-organized. My review focuses on correctness and robustness, including a typo in a BLoC method name, unsafe handling of route parameters, and missing user confirmation for destructive delete actions. Addressing these points will improve the robustness of the new code.

on<LoadSourcesRequested>(_onLoadSourcesRequested);
on<CreateSourceRequested>(_onCreateSourceRequested);
on<UpdateSourceRequested>(_onUpdateSourceRequested);
on<DeleteSourceRequested>(_onOnDeleteSourceRequested);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There's a typo in the event handler registration. The method is likely intended to be _onDeleteSourceRequested to match the event and other handlers.

    on<DeleteSourceRequested>(_onDeleteSourceRequested);

}
}

Future<void> _onOnDeleteSourceRequested(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There's a typo in this method name. It should be _onDeleteSourceRequested to be consistent with the other handlers and to match the fix for the event registration.

  Future<void> _onDeleteSourceRequested(

Comment on lines +153 to +155
// Dispatch delete event
context.read<ContentManagementBloc>().add(
DeleteCategoryRequested(category.id),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Deleting an item is a destructive action that should require confirmation from the user to prevent accidental data loss. Please add a confirmation dialog before dispatching the DeleteCategoryRequested event.

Comment on lines +166 to +168
context.read<ContentManagementBloc>().add(
DeleteHeadlineRequested(headline.id),
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Deleting an item is a destructive action that should require confirmation from the user to prevent accidental data loss. Please add a confirmation dialog before dispatching the DeleteHeadlineRequested event.

Comment on lines +158 to +160
context.read<ContentManagementBloc>().add(
DeleteSourceRequested(source.id),
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Deleting an item is a destructive action that should require confirmation from the user to prevent accidental data loss. Please add a confirmation dialog before dispatching the DeleteSourceRequested event.

path: Routes.editHeadline,
name: Routes.editHeadlineName,
builder: (context, state) {
final id = state.pathParameters['id']!;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Force-unwrapping the id from pathParameters with ! is unsafe. If the route is ever navigated to without the id parameter, this will cause a runtime crash. Please add a null check for the id and handle the case where it's missing, for example by showing an error page or redirecting. This applies to all edit routes (editHeadline, editCategory, editSource).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant