Skip to content

Commit d21bebe

Browse files
committed
fix(content): update confirmation dialog messages for different content types
- Introduce type-specific confirmation dialogs for publish, archive, restore, and delete actions - Replace generic item-related messages with type (headline, topic, or source) specific messages - Improve user experience by providing more context in confirmation dialogs
1 parent 50ac9b5 commit d21bebe

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

lib/content_management/widgets/content_action_buttons.dart

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,21 @@ class ContentActionButtons extends StatelessWidget {
201201
String itemId,
202202
AppLocalizations l10n,
203203
) {
204+
String itemType;
205+
if (item is Headline) {
206+
itemType = l10n.headline.toLowerCase();
207+
} else if (item is Topic) {
208+
itemType = l10n.topic.toLowerCase();
209+
} else {
210+
itemType = l10n.source.toLowerCase();
211+
}
212+
204213
switch (action) {
205214
case 'publish':
206215
_showConfirmationDialog(
207216
context: context,
208-
title: l10n.publishItemTitle,
209-
content: l10n.publishItemContent,
217+
title: l10n.publishItemTitle(itemType),
218+
content: l10n.publishItemContent(itemType),
210219
confirmText: l10n.publish,
211220
onConfirm: () {
212221
if (item is Headline) {
@@ -227,8 +236,8 @@ class ContentActionButtons extends StatelessWidget {
227236
case 'archive':
228237
_showConfirmationDialog(
229238
context: context,
230-
title: l10n.archiveItemTitle,
231-
content: l10n.archiveItemContent,
239+
title: l10n.archiveItemTitle(itemType),
240+
content: l10n.archiveItemContent(itemType),
232241
confirmText: l10n.archive,
233242
onConfirm: () {
234243
if (item is Headline) {
@@ -249,8 +258,8 @@ class ContentActionButtons extends StatelessWidget {
249258
case 'restore':
250259
_showConfirmationDialog(
251260
context: context,
252-
title: l10n.restoreItemTitle,
253-
content: l10n.restoreItemContent,
261+
title: l10n.restoreItemTitle(itemType),
262+
content: l10n.restoreItemContent(itemType),
254263
confirmText: l10n.restore,
255264
onConfirm: () {
256265
if (item is Headline) {
@@ -271,8 +280,8 @@ class ContentActionButtons extends StatelessWidget {
271280
case 'delete':
272281
_showConfirmationDialog(
273282
context: context,
274-
title: l10n.deleteItemTitle,
275-
content: l10n.deleteItemContent,
283+
title: l10n.deleteItemTitle(itemType),
284+
content: l10n.deleteItemContent(itemType),
276285
confirmText: l10n.deleteForever,
277286
onConfirm: () {
278287
if (item is Headline) {

0 commit comments

Comments
 (0)