Skip to content

Commit

Permalink
feat: add reset button to post form menu
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon committed Oct 29, 2024
1 parent 817ab25 commit 5fc2ee7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/i18n/aria/aria.i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ recentlyUsedEmojis: "Recently used emojis"
renoteConfirm: "Are you sure you want to renote this note?"
renoteToChannel: "Renote to a channel"
renotedBy(rich): "Renoted by {user}"
reset: "Reset"
rotate: "Rotate"
scale: "Scale"
selectIcon: "Select an icon"
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/strings.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// To regenerate, run: `dart run slang`
///
/// Locales: 31
/// Strings: 54622 (1762 per locale)
/// Strings: 54623 (1762 per locale)
// coverage:ignore-file
// ignore_for_file: type=lint, unused_import
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/strings_en_US.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ class TranslationsAriaEnUs {
const TextSpan(text: 'Renoted by '),
user,
]);
String get reset => 'Reset';
String get rotate => 'Rotate';
String get scale => 'Scale';
String get selectIcon => 'Select an icon';
Expand Down
23 changes: 23 additions & 0 deletions lib/view/widget/post_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import '../../provider/post_notifier_provider.dart';
import '../../provider/timeline_tab_settings_provider.dart';
import '../../util/extract_mentions.dart';
import '../../util/future_with_dialog.dart';
import '../dialog/confirmation_dialog.dart';
import '../dialog/post_confirmation_dialog.dart';
import '../dialog/user_select_dialog.dart';
import '../page/channel/channels_page.dart';
Expand Down Expand Up @@ -514,6 +515,28 @@ class PostForm extends HookConsumerWidget {
title: Text(t.misskey.reactionAcceptance),
),
),
PopupMenuItem(
onTap: () async {
final confirmed = await confirm(
context,
message: t.misskey.resetAreYouSure,
);
if (!context.mounted) return;
if (confirmed) {
ref
.read(
postNotifierProvider(account.value).notifier,
)
.reset();
}
},
child: ListTile(
leading: const Icon(Icons.delete),
title: Text(t.aria.reset),
iconColor: colors.error,
textColor: colors.error,
),
),
],
child: const Padding(
padding: EdgeInsets.all(8.0),
Expand Down

0 comments on commit 5fc2ee7

Please sign in to comment.