From 99e389b4b4ea5df96ebe6ded52d69bd5b4b134ca Mon Sep 17 00:00:00 2001
From: Bryan Montz <bryanmontz@me.com>
Date: Mon, 7 Oct 2024 06:35:22 -0500
Subject: [PATCH] improve performance of NoteOptionsButton #1458

---
 CHANGELOG.md                                  |  1 +
 .../Components/Button/NoteOptionsButton.swift | 22 +++++++++----------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9c9060af7..80bb58148 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Update Xcode to version 15.4, adding compatibility for Xcode 16.
 - Reduced spammy "Failed to parse Follow" log messages.
 - Upgraded fastlane to version 2.223.1.
+- Improved performance of NoteOptionsButton. [#1458](https://github.com/planetary-social/nos/issues/1458)
 
 ## [0.2.1] - 2024-10-01Z
 
diff --git a/Nos/Views/Components/Button/NoteOptionsButton.swift b/Nos/Views/Components/Button/NoteOptionsButton.swift
index d156ca8c1..b1c61bac4 100644
--- a/Nos/Views/Components/Button/NoteOptionsButton.swift
+++ b/Nos/Views/Components/Button/NoteOptionsButton.swift
@@ -28,51 +28,51 @@ struct NoteOptionsButton: View {
                     // This hack fixes a weird issue where the confirmationDialog wouldn't be shown sometimes. ¯\_(ツ)_/¯
                     .background(showingOptions == true ? .clear : .clear)
             }
-            .confirmationDialog(String(localized: .localizable.share), isPresented: $showingOptions) {
-                Button(String(localized: .localizable.copyNoteIdentifier)) {
+            .confirmationDialog("share", isPresented: $showingOptions) {
+                Button("copyNoteIdentifier") {
                     analytics.copiedNoteIdentifier()
                     copyMessageIdentifier()
                 }
-                Button(String(localized: .localizable.shareNote)) {
+                Button("shareNote") {
                     showingShare = true
                     analytics.sharedNoteLink()
                 }
                 if !note.isStub {
-                    Button(String(localized: .localizable.copyNoteText)) {
+                    Button("copyNoteText") {
                         analytics.copiedNoteText()
                         copyMessage()
                     }
-                    Button(String(localized: .localizable.viewSource)) {
+                    Button("viewSource") {
                         analytics.viewedNoteSource()
                         showingSource = true
                     }
                     if note.author != currentUser.author {
-                        Button(String(localized: .localizable.reportNote)) {
+                        Button("reportNote") {
                             showingReportMenu = true
                         }
                     }
                 }
                 if note.author == currentUser.author {
-                    Button(String(localized: .localizable.deleteNote), role: .destructive) {
+                    Button("deleteNote", role: .destructive) {
                         confirmDelete = true
                     }
                 }
             }
             .reportMenu($showingReportMenu, reportedObject: .note(note))
             .alert(
-                String(localized: .localizable.confirmDelete),
+                "confirmDelete",
                 isPresented: $confirmDelete,
                 actions: {
-                    Button(String(localized: .localizable.confirm), role: .destructive) {
+                    Button("confirm", role: .destructive) {
                         analytics.deletedNote()
                         Task { await deletePost() }
                     }
-                    Button(String(localized: .localizable.cancel), role: .cancel) {
+                    Button("cancel", role: .cancel) {
                         confirmDelete = false
                     }
                 },
                 message: {
-                    Text(.localizable.deleteNoteConfirmation)
+                    Text("deleteNoteConfirmation")
                 }
             )
             .sheet(isPresented: $showingSource) {