Repository: CodeEditApp/CodeEdit
File: CodeEdit/Features/NavigatorArea/ProjectNavigator/ProjectNavigatorToolbarBottom.swift (Swift)

Code before:
    @State var recentsFilter: Bool = false

    var body: some View {
        HStack(spacing: 5) {
            addNewFileButton
            PaneTextField(
                "Filter",
                text: $workspace.navigatorFilter,
                leadingAccessories: {
                    FilterDropDownIconButton(menu: {
                        ForEach([(true, "Folders on top"), (false, "Alphabetically")], id: \.0) { value, title in
                            Button {
                                // Avoid calling the handleFilterChange method
                                if workspace.sortFoldersOnTop != value {
                                    workspace.sortFoldersOnTop = value
                                }
                            } label: {
                                HStack {
                                    if value == workspace.sortFoldersOnTop {
                                        Image(systemName: "checkmark")
                                    }
                                    Text(title)
                                }
                            }
                        }
                    }, isOn: !workspace.navigatorFilter.isEmpty)
                    .padding(.leading, 4)
                    .foregroundStyle(
                        workspace.navigatorFilter.isEmpty
                        ? Color(nsColor: .secondaryLabelColor)
                        : Color(nsColor: .controlAccentColor)
                    )
                    .help("Show files with matching name")
                },
                trailingAccessories: {
                    HStack(spacing: 0) {
                        Toggle(isOn: $recentsFilter) {
                            Image(systemName: "clock")
                        }
                        .help("Show only recent files")
                        Toggle(isOn: $workspace.sourceControlFilter) {
                            Image(systemName: "plusminus.circle")
                        }
                        .help("Show only files with source-control status")
                    }
                    .toggleStyle(.icon(font: .system(size: 14), size: CGSize(width: 18, height: 20)))
                    .padding(.trailing, 2.5)
                },
                clearable: true,
                hasValue: !workspace.navigatorFilter.isEmpty || recentsFilter || workspace.sourceControlFilter
            )

Review comment (suggestion):
A little uglier in code but this would work to get the better checkmark in that menu

```suggestion
                    FilterDropDownIconButton(
                        menu: {
                            Toggle(
                                "Folder on top",
                                isOn: Binding(
                                    get: {
                                        workspace.sortFoldersOnTop
                                    },
                                    set: {
                                        if !workspace.sortFoldersOnTop && $0 {
                                            workspace.sortFoldersOnTop = true
                                        }
                                    }
                                )
                            )
                            Toggle(
                                "Alphabetically",
                                isOn: Binding(
                                    get: {
                                        !workspace.sortFoldersOnTop
                                    },
                                    set: {
                                        if workspace.sortFoldersOnTop && $0 {
                                            workspace.sortFoldersOnTop = false
                                        }
                                    }
                                )
                            )
                        },
                        isOn: !workspace.navigatorFilter.isEmpty
                    )
```

Code after:
    @State var recentsFilter: Bool = false

    var body: some View {
        HStack(spacing: 5) {
            addNewFileButton
            PaneTextField(
                "Filter",
                text: $workspace.navigatorFilter,
                leadingAccessories: {
                    FilterDropDownIconButton(menu: {
                        ForEach([(true, "Folders on top"), (false, "Alphabetically")], id: \.0) { value, title in
                            Toggle(title, isOn: Binding(get: {
                                workspace.sortFoldersOnTop == value
                            }, set: { _ in
                                // Avoid calling the handleFilterChange method
                                if workspace.sortFoldersOnTop != value {
                                    workspace.sortFoldersOnTop = value
                                }
                            }))
                        }
                    }, isOn: !workspace.navigatorFilter.isEmpty)
                    .padding(.leading, 4)
                    .foregroundStyle(
                        workspace.navigatorFilter.isEmpty
                        ? Color(nsColor: .secondaryLabelColor)
                        : Color(nsColor: .controlAccentColor)
                    )
                    .help("Show files with matching name")
                },
                trailingAccessories: {
                    HStack(spacing: 0) {
                        Toggle(isOn: $recentsFilter) {
                            Image(systemName: "clock")
                        }
                        .help("Show only recent files")
                        Toggle(isOn: $workspace.sourceControlFilter) {
                            Image(systemName: "plusminus.circle")
                        }
                        .help("Show only files with source-control status")
                    }
                    .toggleStyle(.icon(font: .system(size: 14), size: CGSize(width: 18, height: 20)))
                    .padding(.trailing, 2.5)
                },
                clearable: true,
                hasValue: !workspace.navigatorFilter.isEmpty || recentsFilter || workspace.sourceControlFilter
            )
        }
        .padding(.horizontal, 5)
        .frame(height: 28, alignment: .center)
        .frame(maxWidth: .infinity)
        .overlay(alignment: .top) {