chore: refactored menu c91d0648
Steve · 2025-12-25 21:27 1 file(s) · +29 −35
Titan/Views/BrowserToolbar.swift +29 −35
122 122
123 123
    private var menuButton: some View {
124 124
        Menu {
125 -
            Button {
126 -
                onShowTabs()
127 -
            } label: {
128 -
                Label("Tabs (\(tabCount))", systemImage: "square.on.square")
129 -
            }
130 -
125 +
            // New Tab
131 126
            Button {
132 127
                onNewTab()
133 128
            } label: {
134 129
                Label("New Tab", systemImage: "plus")
135 130
            }
136 -
137 -
            Button {
138 -
                onCloseTab()
139 -
            } label: {
140 -
                Label("Close Tab", systemImage: "xmark")
141 -
            }
142 -
            .disabled(!canCloseTab)
143 -
144 -
            Divider()
145 -
146 -
            Button {
147 -
                onShowSettings()
148 -
            } label: {
149 -
                Label("Settings", systemImage: "gear")
150 -
            }
151 -
152 -
            Divider()
153 -
154 -
            Button {
155 -
                onShowBookmarks()
156 -
            } label: {
157 -
                Label("Bookmarks", systemImage: "book")
158 -
            }
159 -
131 +
            
132 +
            // Add to Bookmarks
160 133
            Button {
161 134
                onAddBookmark()
162 135
            } label: {
163 136
                if isBookmarked {
164 137
                    Label("Bookmarked", systemImage: "bookmark.fill")
165 138
                } else {
166 -
                    Label("Add Bookmark", systemImage: "bookmark")
139 +
                    Label("Add to Bookmarks", systemImage: "bookmark")
167 140
                }
168 141
            }
169 142
            .disabled(urlText.isEmpty || isBookmarked)
170 143
144 +
            Divider()
145 +
146 +
            // History
171 147
            Button {
172 148
                onShowHistory()
173 149
            } label: {
174 150
                Label("History", systemImage: "clock")
175 151
            }
176 152
177 -
            Divider()
178 -
153 +
            // Settings
179 154
            Button {
180 -
                onGoHome()
155 +
                onShowSettings()
181 156
            } label: {
182 -
                Label("Home", systemImage: "house")
157 +
                Label("Settings", systemImage: "gear")
183 158
            }
159 +
160 +
            Divider()
161 +
162 +
            // Bottom section: Bookmarks | Tabs as large square buttons with labels
163 +
            ControlGroup {
164 +
                Button {
165 +
                    onShowBookmarks()
166 +
                } label: {
167 +
                    Label("Bookmarks", systemImage: "book")
168 +
                }
169 +
170 +
                Button {
171 +
                    onShowTabs()
172 +
                } label: {
173 +
                    Label("All Tabs", systemImage: "square.on.square")
174 +
                }
175 +
            }
176 +
            .controlGroupStyle(.menu)
184 177
        } label: {
185 178
            Image(systemName: "ellipsis.circle")
186 179
                .font(.title2)
187 180
                .foregroundStyle(themeSettings.toolbarButtonColor)
188 181
                .frame(width: 44, height: 44)
189 182
        }
183 +
        .menuOrder(.fixed)
190 184
        .glassEffect(.regular.interactive())
191 185
        .transition(.opacity.combined(with: .scale(scale: 0.8)))
192 186
    }