From 8fc359e6de1a1d09f1633d5ec8c86b29cbdac54d Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 2 Aug 2025 13:45:13 +0100 Subject: [PATCH 01/15] fix(router): add routes for archived headlines, topics, and sources pages --- lib/router/router.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/router/router.dart b/lib/router/router.dart index 151a0754..0832377d 100644 --- a/lib/router/router.dart +++ b/lib/router/router.dart @@ -10,6 +10,9 @@ import 'package:flutter_news_app_web_dashboard_full_source_code/authentication/b import 'package:flutter_news_app_web_dashboard_full_source_code/authentication/view/authentication_page.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/authentication/view/email_code_verification_page.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/authentication/view/request_code_page.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/view/archived_headlines_page.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/view/archived_sources_page.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/view/archived_topics_page.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/view/content_management_page.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/view/create_headline_page.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/view/create_source_page.dart'; @@ -199,20 +202,17 @@ GoRouter createRouter({ GoRoute( path: Routes.archivedHeadlines, name: Routes.archivedHeadlinesName, - builder: (context, state) => - const Placeholder(), + builder: (context, state) => const ArchivedHeadlinesPage(), ), GoRoute( path: Routes.archivedTopics, name: Routes.archivedTopicsName, - builder: (context, state) => - const Placeholder(), + builder: (context, state) => const ArchivedTopicsPage(), ), GoRoute( path: Routes.archivedSources, name: Routes.archivedSourcesName, - builder: (context, state) => - const Placeholder(), + builder: (context, state) => const ArchivedSourcesPage(), ), ], ), From 0b41d856e593a30d962837b655f4d3525faa6542 Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 2 Aug 2025 14:17:30 +0100 Subject: [PATCH 02/15] fix(create-headline): filter sources and topics by active status --- .../bloc/create_headline/create_headline_bloc.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/content_management/bloc/create_headline/create_headline_bloc.dart b/lib/content_management/bloc/create_headline/create_headline_bloc.dart index eb0e2eec..68655f5c 100644 --- a/lib/content_management/bloc/create_headline/create_headline_bloc.dart +++ b/lib/content_management/bloc/create_headline/create_headline_bloc.dart @@ -54,9 +54,11 @@ class CreateHeadlineBloc final [sourcesResponse, topicsResponse] = await Future.wait([ _sourcesRepository.readAll( sort: [const SortOption('updatedAt', SortOrder.desc)], + filter: {'status': ContentStatus.active.name}, ), _topicsRepository.readAll( sort: [const SortOption('updatedAt', SortOrder.desc)], + filter: {'status': ContentStatus.active.name}, ), ]); From bb3af280d943ba1e729252b405820af586873a69 Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 2 Aug 2025 14:17:35 +0100 Subject: [PATCH 03/15] fix(edit-headline): filter sources and topics by active status --- .../bloc/edit_headline/edit_headline_bloc.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/content_management/bloc/edit_headline/edit_headline_bloc.dart b/lib/content_management/bloc/edit_headline/edit_headline_bloc.dart index c562b64a..788bba18 100644 --- a/lib/content_management/bloc/edit_headline/edit_headline_bloc.dart +++ b/lib/content_management/bloc/edit_headline/edit_headline_bloc.dart @@ -55,9 +55,11 @@ class EditHeadlineBloc extends Bloc { _headlinesRepository.read(id: _headlineId), _sourcesRepository.readAll( sort: [const SortOption('updatedAt', SortOrder.desc)], + filter: {'status': ContentStatus.active.name}, ), _topicsRepository.readAll( sort: [const SortOption('updatedAt', SortOrder.desc)], + filter: {'status': ContentStatus.active.name}, ), ]); From a0c3c6fd8cf8d7ee88ca6b5310d4ef8201dd37a8 Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 2 Aug 2025 14:19:10 +0100 Subject: [PATCH 04/15] fix(create-source): filter countries and languages by active status --- .../bloc/create_source/create_source_bloc.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/content_management/bloc/create_source/create_source_bloc.dart b/lib/content_management/bloc/create_source/create_source_bloc.dart index 38a68a9f..7a6beee6 100644 --- a/lib/content_management/bloc/create_source/create_source_bloc.dart +++ b/lib/content_management/bloc/create_source/create_source_bloc.dart @@ -54,9 +54,11 @@ class CreateSourceBloc extends Bloc { final responses = await Future.wait([ _countriesRepository.readAll( sort: [const SortOption('name', SortOrder.asc)], + filter: {'status': ContentStatus.active.name}, ), _languagesRepository.readAll( sort: [const SortOption('name', SortOrder.asc)], + filter: {'status': ContentStatus.active.name}, ), ]); final countriesPaginated = responses[0] as PaginatedResponse; From 2c781a2fa865544f92fdb47be5e4fdd993b0ea6f Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 2 Aug 2025 14:23:20 +0100 Subject: [PATCH 05/15] fix(edit-source): filter countries and languages by active status --- lib/content_management/bloc/edit_source/edit_source_bloc.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/content_management/bloc/edit_source/edit_source_bloc.dart b/lib/content_management/bloc/edit_source/edit_source_bloc.dart index 7e1a1135..c5644573 100644 --- a/lib/content_management/bloc/edit_source/edit_source_bloc.dart +++ b/lib/content_management/bloc/edit_source/edit_source_bloc.dart @@ -56,9 +56,11 @@ class EditSourceBloc extends Bloc { _sourcesRepository.read(id: _sourceId), _countriesRepository.readAll( sort: [const SortOption('name', SortOrder.asc)], + filter: {'status': ContentStatus.active.name}, ), _languagesRepository.readAll( sort: [const SortOption('name', SortOrder.asc)], + filter: {'status': ContentStatus.active.name}, ), ]); From 4d5ad8478b01482922721c230663dff5824a9d75 Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 2 Aug 2025 14:25:13 +0100 Subject: [PATCH 06/15] fix(dashboard): ensure recent headlines are filtered by active status --- lib/dashboard/bloc/dashboard_bloc.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/dashboard/bloc/dashboard_bloc.dart b/lib/dashboard/bloc/dashboard_bloc.dart index 2056cbe9..6047199e 100644 --- a/lib/dashboard/bloc/dashboard_bloc.dart +++ b/lib/dashboard/bloc/dashboard_bloc.dart @@ -33,6 +33,7 @@ class DashboardBloc extends Bloc { _headlinesRepository.readAll( pagination: const PaginationOptions(limit: 5), sort: const [SortOption('updatedAt', SortOrder.desc)], + filter: {'status': ContentStatus.active.name}, ), ]); From f92ccfe783b19f4e7c9af1ecfc45b6aa14d36824 Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 2 Aug 2025 15:08:12 +0100 Subject: [PATCH 07/15] fix(archived-headlines): restore headline and update state with restored headline --- .../archived_headlines_bloc.dart | 3 +- .../archived_headlines_state.dart | 5 +++ .../view/archived_headlines_page.dart | 37 +++++++++++++------ 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/lib/content_management/bloc/archived_headlines/archived_headlines_bloc.dart b/lib/content_management/bloc/archived_headlines/archived_headlines_bloc.dart index d2dccfa3..ac4d22f3 100644 --- a/lib/content_management/bloc/archived_headlines/archived_headlines_bloc.dart +++ b/lib/content_management/bloc/archived_headlines/archived_headlines_bloc.dart @@ -75,10 +75,11 @@ class ArchivedHeadlinesBloc emit(state.copyWith(headlines: updatedHeadlines)); try { - await _headlinesRepository.update( + final restoredHeadline = await _headlinesRepository.update( id: event.id, item: headlineToRestore.copyWith(status: ContentStatus.active), ); + emit(state.copyWith(restoredHeadline: restoredHeadline)); } on HttpException catch (e) { emit(state.copyWith(headlines: originalHeadlines, exception: e)); } catch (e) { diff --git a/lib/content_management/bloc/archived_headlines/archived_headlines_state.dart b/lib/content_management/bloc/archived_headlines/archived_headlines_state.dart index 1f900012..57fcec10 100644 --- a/lib/content_management/bloc/archived_headlines/archived_headlines_state.dart +++ b/lib/content_management/bloc/archived_headlines/archived_headlines_state.dart @@ -16,6 +16,7 @@ class ArchivedHeadlinesState extends Equatable { this.cursor, this.hasMore = false, this.exception, + this.restoredHeadline, }); final ArchivedHeadlinesStatus status; @@ -23,6 +24,7 @@ class ArchivedHeadlinesState extends Equatable { final String? cursor; final bool hasMore; final HttpException? exception; + final Headline? restoredHeadline; ArchivedHeadlinesState copyWith({ ArchivedHeadlinesStatus? status, @@ -30,6 +32,7 @@ class ArchivedHeadlinesState extends Equatable { String? cursor, bool? hasMore, HttpException? exception, + Headline? restoredHeadline, }) { return ArchivedHeadlinesState( status: status ?? this.status, @@ -37,6 +40,7 @@ class ArchivedHeadlinesState extends Equatable { cursor: cursor ?? this.cursor, hasMore: hasMore ?? this.hasMore, exception: exception ?? this.exception, + restoredHeadline: restoredHeadline, ); } @@ -47,5 +51,6 @@ class ArchivedHeadlinesState extends Equatable { cursor, hasMore, exception, + restoredHeadline, ]; } diff --git a/lib/content_management/view/archived_headlines_page.dart b/lib/content_management/view/archived_headlines_page.dart index b0886e16..8be2ec14 100644 --- a/lib/content_management/view/archived_headlines_page.dart +++ b/lib/content_management/view/archived_headlines_page.dart @@ -4,6 +4,7 @@ import 'package:data_table_2/data_table_2.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/archived_headlines/archived_headlines_bloc.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/content_management_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/app_localizations.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart'; import 'package:intl/intl.dart'; @@ -35,16 +36,27 @@ class _ArchivedHeadlinesView extends StatelessWidget { ), body: Padding( padding: const EdgeInsets.all(AppSpacing.lg), - child: BlocBuilder( - builder: (context, state) { - if (state.status == ArchivedHeadlinesStatus.loading && - state.headlines.isEmpty) { - return LoadingStateWidget( - icon: Icons.newspaper, - headline: l10n.loadingArchivedHeadlines, - subheadline: l10n.pleaseWait, - ); + child: BlocListener( + listenWhen: (previous, current) => + previous.status != current.status, + listener: (context, state) { + if (state.status == ArchivedHeadlinesStatus.success && + state.restoredHeadline != null) { + context.read().add( + const LoadHeadlinesRequested(limit: kDefaultRowsPerPage), + ); } + }, + child: BlocBuilder( + builder: (context, state) { + if (state.status == ArchivedHeadlinesStatus.loading && + state.headlines.isEmpty) { + return LoadingStateWidget( + icon: Icons.newspaper, + headline: l10n.loadingArchivedHeadlines, + subheadline: l10n.pleaseWait, + ); + } if (state.status == ArchivedHeadlinesStatus.failure) { return FailureStateWidget( @@ -116,16 +128,17 @@ class _ArchivedHeadlinesView extends StatelessWidget { dataRowHeight: 56, columnSpacing: AppSpacing.md, horizontalMargin: AppSpacing.md, - ), ), - ], + ), ); - }, + }, + ), ), ), ); } } +} class _HeadlinesDataSource extends DataTableSource { _HeadlinesDataSource({ From 5dba3cf8b4b2252ded0f8479285b51f87381a826 Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 2 Aug 2025 15:09:57 +0100 Subject: [PATCH 08/15] fix(archived-headlines): enhance listener to react to restored headline changes --- lib/content_management/view/archived_headlines_page.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/content_management/view/archived_headlines_page.dart b/lib/content_management/view/archived_headlines_page.dart index 8be2ec14..30d739bb 100644 --- a/lib/content_management/view/archived_headlines_page.dart +++ b/lib/content_management/view/archived_headlines_page.dart @@ -38,7 +38,8 @@ class _ArchivedHeadlinesView extends StatelessWidget { padding: const EdgeInsets.all(AppSpacing.lg), child: BlocListener( listenWhen: (previous, current) => - previous.status != current.status, + previous.status != current.status || + previous.restoredHeadline != current.restoredHeadline, listener: (context, state) { if (state.status == ArchivedHeadlinesStatus.success && state.restoredHeadline != null) { @@ -138,7 +139,6 @@ class _ArchivedHeadlinesView extends StatelessWidget { ); } } -} class _HeadlinesDataSource extends DataTableSource { _HeadlinesDataSource({ From 9e2fb922e4c6f5f4771a079bdda3661371361bb7 Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 2 Aug 2025 15:34:56 +0100 Subject: [PATCH 09/15] fix(archived-topics): update state with restored topic and trigger relevant events --- .../archived_topics/archived_topics_bloc.dart | 3 ++- .../view/archived_topics_page.dart | 24 +++++++++++++++---- topics_event.dart | 0 3 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 topics_event.dart diff --git a/lib/content_management/bloc/archived_topics/archived_topics_bloc.dart b/lib/content_management/bloc/archived_topics/archived_topics_bloc.dart index 6cb1f198..7e3a66c4 100644 --- a/lib/content_management/bloc/archived_topics/archived_topics_bloc.dart +++ b/lib/content_management/bloc/archived_topics/archived_topics_bloc.dart @@ -74,10 +74,11 @@ class ArchivedTopicsBloc emit(state.copyWith(topics: updatedTopics)); try { - await _topicsRepository.update( + final restoredTopic = await _topicsRepository.update( id: event.id, item: topicToRestore.copyWith(status: ContentStatus.active), ); + emit(state.copyWith(restoredTopic: restoredTopic)); } on HttpException catch (e) { emit(state.copyWith(topics: originalTopics, exception: e)); } catch (e) { diff --git a/lib/content_management/view/archived_topics_page.dart b/lib/content_management/view/archived_topics_page.dart index a86ff729..a2f9672f 100644 --- a/lib/content_management/view/archived_topics_page.dart +++ b/lib/content_management/view/archived_topics_page.dart @@ -4,6 +4,8 @@ import 'package:data_table_2/data_table_2.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/archived_topics/archived_topics_bloc.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/content_management_bloc.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/dashboard/bloc/dashboard_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/app_localizations.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart'; import 'package:intl/intl.dart'; @@ -35,10 +37,21 @@ class _ArchivedTopicsView extends StatelessWidget { ), body: Padding( padding: const EdgeInsets.all(AppSpacing.lg), - child: BlocBuilder( - builder: (context, state) { - if (state.status == ArchivedTopicsStatus.loading && - state.topics.isEmpty) { + child: BlocListener( + listenWhen: (previous, current) => + previous.restoredTopic != current.restoredTopic, + listener: (context, state) { + if (state.restoredTopic != null) { + context + .read() + .add(const LoadTopicsRequested(limit: kDefaultRowsPerPage)); + context.read().add( DashboardSummaryLoaded()); + } + }, + child: BlocBuilder( + builder: (context, state) { + if (state.status == ArchivedTopicsStatus.loading && + state.topics.isEmpty) { return LoadingStateWidget( icon: Icons.topic, headline: l10n.loadingArchivedTopics, @@ -116,7 +129,8 @@ class _ArchivedTopicsView extends StatelessWidget { ), ], ); - }, + }, + ), ), ), ); diff --git a/topics_event.dart b/topics_event.dart new file mode 100644 index 00000000..e69de29b From 7338f957fcac3d85186925d1b554b465589d289e Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 2 Aug 2025 15:37:33 +0100 Subject: [PATCH 10/15] fix(archived-sources): restore source and update state with restored source --- .../archived_sources_bloc.dart | 3 ++- .../archived_sources_state.dart | 5 ++++ .../view/archived_sources_page.dart | 24 +++++++++++++++---- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/lib/content_management/bloc/archived_sources/archived_sources_bloc.dart b/lib/content_management/bloc/archived_sources/archived_sources_bloc.dart index 6ceaf534..45fa8efb 100644 --- a/lib/content_management/bloc/archived_sources/archived_sources_bloc.dart +++ b/lib/content_management/bloc/archived_sources/archived_sources_bloc.dart @@ -74,10 +74,11 @@ class ArchivedSourcesBloc emit(state.copyWith(sources: updatedSources)); try { - await _sourcesRepository.update( + final restoredSource = await _sourcesRepository.update( id: event.id, item: sourceToRestore.copyWith(status: ContentStatus.active), ); + emit(state.copyWith(restoredSource: restoredSource)); } on HttpException catch (e) { emit(state.copyWith(sources: originalSources, exception: e)); } catch (e) { diff --git a/lib/content_management/bloc/archived_sources/archived_sources_state.dart b/lib/content_management/bloc/archived_sources/archived_sources_state.dart index ded6188c..4685a4d2 100644 --- a/lib/content_management/bloc/archived_sources/archived_sources_state.dart +++ b/lib/content_management/bloc/archived_sources/archived_sources_state.dart @@ -16,6 +16,7 @@ class ArchivedSourcesState extends Equatable { this.cursor, this.hasMore = false, this.exception, + this.restoredSource, }); final ArchivedSourcesStatus status; @@ -23,6 +24,7 @@ class ArchivedSourcesState extends Equatable { final String? cursor; final bool hasMore; final HttpException? exception; + final Source? restoredSource; ArchivedSourcesState copyWith({ ArchivedSourcesStatus? status, @@ -30,6 +32,7 @@ class ArchivedSourcesState extends Equatable { String? cursor, bool? hasMore, HttpException? exception, + Source? restoredSource, }) { return ArchivedSourcesState( status: status ?? this.status, @@ -37,6 +40,7 @@ class ArchivedSourcesState extends Equatable { cursor: cursor ?? this.cursor, hasMore: hasMore ?? this.hasMore, exception: exception ?? this.exception, + restoredSource: restoredSource, ); } @@ -47,5 +51,6 @@ class ArchivedSourcesState extends Equatable { cursor, hasMore, exception, + restoredSource, ]; } diff --git a/lib/content_management/view/archived_sources_page.dart b/lib/content_management/view/archived_sources_page.dart index 1a56338c..32f66c19 100644 --- a/lib/content_management/view/archived_sources_page.dart +++ b/lib/content_management/view/archived_sources_page.dart @@ -4,6 +4,8 @@ import 'package:data_table_2/data_table_2.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/archived_sources/archived_sources_bloc.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/content_management_bloc.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/dashboard/bloc/dashboard_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/app_localizations.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart'; import 'package:intl/intl.dart'; @@ -35,10 +37,21 @@ class _ArchivedSourcesView extends StatelessWidget { ), body: Padding( padding: const EdgeInsets.all(AppSpacing.lg), - child: BlocBuilder( - builder: (context, state) { - if (state.status == ArchivedSourcesStatus.loading && - state.sources.isEmpty) { + child: BlocListener( + listenWhen: (previous, current) => + previous.restoredSource != current.restoredSource, + listener: (context, state) { + if (state.restoredSource != null) { + context.read().add( + const LoadSourcesRequested(limit: kDefaultRowsPerPage), + ); + context.read().add(DashboardSummaryLoaded()); + } + }, + child: BlocBuilder( + builder: (context, state) { + if (state.status == ArchivedSourcesStatus.loading && + state.sources.isEmpty) { return LoadingStateWidget( icon: Icons.source, headline: l10n.loadingArchivedSources, @@ -116,7 +129,8 @@ class _ArchivedSourcesView extends StatelessWidget { ), ], ); - }, + }, + ), ), ), ); From 47189b0e5f202f3e90f0811963a8cc9707ce8d0c Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 2 Aug 2025 15:38:06 +0100 Subject: [PATCH 11/15] fix(archived-topics): add restoredTopic field to ArchivedTopicsState --- .../bloc/archived_topics/archived_topics_state.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/content_management/bloc/archived_topics/archived_topics_state.dart b/lib/content_management/bloc/archived_topics/archived_topics_state.dart index 4ac21997..e13a7850 100644 --- a/lib/content_management/bloc/archived_topics/archived_topics_state.dart +++ b/lib/content_management/bloc/archived_topics/archived_topics_state.dart @@ -16,6 +16,7 @@ class ArchivedTopicsState extends Equatable { this.cursor, this.hasMore = false, this.exception, + this.restoredTopic, }); final ArchivedTopicsStatus status; @@ -23,6 +24,7 @@ class ArchivedTopicsState extends Equatable { final String? cursor; final bool hasMore; final HttpException? exception; + final Topic? restoredTopic; ArchivedTopicsState copyWith({ ArchivedTopicsStatus? status, @@ -30,6 +32,7 @@ class ArchivedTopicsState extends Equatable { String? cursor, bool? hasMore, HttpException? exception, + Topic? restoredTopic, }) { return ArchivedTopicsState( status: status ?? this.status, @@ -37,6 +40,7 @@ class ArchivedTopicsState extends Equatable { cursor: cursor ?? this.cursor, hasMore: hasMore ?? this.hasMore, exception: exception ?? this.exception, + restoredTopic: restoredTopic, ); } @@ -47,5 +51,6 @@ class ArchivedTopicsState extends Equatable { cursor, hasMore, exception, + restoredTopic, ]; } From 0fb49ebbd284b09e9df79ea42fb928cfec1b9ae1 Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 2 Aug 2025 15:39:28 +0100 Subject: [PATCH 12/15] chore: absolete file deleted --- topics_event.dart | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 topics_event.dart diff --git a/topics_event.dart b/topics_event.dart deleted file mode 100644 index e69de29b..00000000 From 043bc86941b65455ee0eb404db8bb5b959cf8231 Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 2 Aug 2025 15:45:56 +0100 Subject: [PATCH 13/15] fix: add DashboardBloc import and trigger DashboardSummaryLoaded on headline, source, and topic creation --- lib/content_management/view/create_headline_page.dart | 2 ++ lib/content_management/view/create_source_page.dart | 2 ++ lib/content_management/view/create_topic_page.dart | 2 ++ 3 files changed, 6 insertions(+) diff --git a/lib/content_management/view/create_headline_page.dart b/lib/content_management/view/create_headline_page.dart index 9e454cc1..eab8a59b 100644 --- a/lib/content_management/view/create_headline_page.dart +++ b/lib/content_management/view/create_headline_page.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/content_management_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/create_headline/create_headline_bloc.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/dashboard/bloc/dashboard_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/shared/shared.dart'; import 'package:go_router/go_router.dart'; @@ -88,6 +89,7 @@ class _CreateHeadlineViewState extends State<_CreateHeadlineView> { // Refresh the list to show the new headline const LoadHeadlinesRequested(limit: kDefaultRowsPerPage), ); + context.read().add(DashboardSummaryLoaded()); context.pop(); } if (state.status == CreateHeadlineStatus.failure) { diff --git a/lib/content_management/view/create_source_page.dart b/lib/content_management/view/create_source_page.dart index a2f02498..59c96e4d 100644 --- a/lib/content_management/view/create_source_page.dart +++ b/lib/content_management/view/create_source_page.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/content_management_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/create_source/create_source_bloc.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/dashboard/bloc/dashboard_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/source_type_l10n.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/shared/shared.dart'; @@ -88,6 +89,7 @@ class _CreateSourceViewState extends State<_CreateSourceView> { // Refresh the list to show the new source const LoadSourcesRequested(limit: kDefaultRowsPerPage), ); + context.read().add(DashboardSummaryLoaded()); context.pop(); } if (state.status == CreateSourceStatus.failure) { diff --git a/lib/content_management/view/create_topic_page.dart b/lib/content_management/view/create_topic_page.dart index 575ca938..80822d2b 100644 --- a/lib/content_management/view/create_topic_page.dart +++ b/lib/content_management/view/create_topic_page.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/content_management_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/create_topic/create_topic_bloc.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/dashboard/bloc/dashboard_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/shared/shared.dart'; import 'package:go_router/go_router.dart'; @@ -85,6 +86,7 @@ class _CreateTopicViewState extends State<_CreateTopicView> { // Refresh the list to show the new topic const LoadTopicsRequested(limit: kDefaultRowsPerPage), ); + context.read().add(DashboardSummaryLoaded()); context.pop(); } if (state.status == CreateTopicStatus.failure) { From 4d4b7217b2201d380101706f7b3b03f0edb081b6 Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 2 Aug 2025 15:46:50 +0100 Subject: [PATCH 14/15] fix: add DashboardBloc import and trigger DashboardSummaryLoaded in edit headline, source, and topic pages --- lib/content_management/view/edit_headline_page.dart | 2 ++ lib/content_management/view/edit_source_page.dart | 2 ++ lib/content_management/view/edit_topic_page.dart | 2 ++ 3 files changed, 6 insertions(+) diff --git a/lib/content_management/view/edit_headline_page.dart b/lib/content_management/view/edit_headline_page.dart index 62e182d8..eb2ada1d 100644 --- a/lib/content_management/view/edit_headline_page.dart +++ b/lib/content_management/view/edit_headline_page.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/content_management_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/edit_headline/edit_headline_bloc.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/dashboard/bloc/dashboard_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/shared/shared.dart'; import 'package:go_router/go_router.dart'; @@ -116,6 +117,7 @@ class _EditHeadlineViewState extends State<_EditHeadlineView> { context.read().add( const LoadHeadlinesRequested(limit: kDefaultRowsPerPage), ); + context.read().add(DashboardSummaryLoaded()); context.pop(); } if (state.status == EditHeadlineStatus.failure) { diff --git a/lib/content_management/view/edit_source_page.dart b/lib/content_management/view/edit_source_page.dart index 21ca1dcb..1637aa4d 100644 --- a/lib/content_management/view/edit_source_page.dart +++ b/lib/content_management/view/edit_source_page.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/content_management_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/edit_source/edit_source_bloc.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/dashboard/bloc/dashboard_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/source_type_l10n.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/shared/shared.dart'; @@ -113,6 +114,7 @@ class _EditSourceViewState extends State<_EditSourceView> { context.read().add( const LoadSourcesRequested(limit: kDefaultRowsPerPage), ); + context.read().add(DashboardSummaryLoaded()); context.pop(); } if (state.status == EditSourceStatus.failure) { diff --git a/lib/content_management/view/edit_topic_page.dart b/lib/content_management/view/edit_topic_page.dart index 92f24213..6cf89486 100644 --- a/lib/content_management/view/edit_topic_page.dart +++ b/lib/content_management/view/edit_topic_page.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/content_management_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/edit_topic/edit_topic_bloc.dart'; +import 'package:flutter_news_app_web_dashboard_full_source_code/dashboard/bloc/dashboard_bloc.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart'; import 'package:flutter_news_app_web_dashboard_full_source_code/shared/shared.dart'; import 'package:go_router/go_router.dart'; @@ -110,6 +111,7 @@ class _EditTopicViewState extends State<_EditTopicView> { context.read().add( const LoadTopicsRequested(limit: kDefaultRowsPerPage), ); + context.read().add(DashboardSummaryLoaded()); context.pop(); } if (state.status == EditTopicStatus.failure) { From a199db051bb67d61cc8b97162a2bde25fa6c3866 Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 2 Aug 2025 15:50:49 +0100 Subject: [PATCH 15/15] fix: correct DataTable closing brackets in ArchivedHeadlinesView --- lib/content_management/view/archived_headlines_page.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/content_management/view/archived_headlines_page.dart b/lib/content_management/view/archived_headlines_page.dart index 30d739bb..0898c4de 100644 --- a/lib/content_management/view/archived_headlines_page.dart +++ b/lib/content_management/view/archived_headlines_page.dart @@ -129,8 +129,9 @@ class _ArchivedHeadlinesView extends StatelessWidget { dataRowHeight: 56, columnSpacing: AppSpacing.md, horizontalMargin: AppSpacing.md, + ), ), - ), + ], ); }, ),