Repository: CodeEditApp/CodeEdit
File: CodeEditModules/Modules/AppPreferences/src/Sections/SourceControlPreferences/SourceControlGitView.swift (Swift)

Code before:
//  Created by Nanshi Li on 2022/04/01.
//

import SwiftUI

struct SourceControlGitView: View {

    @State var ignoredFileSelection: IgnoredFiles.ID?

    @StateObject
    private var prefs: AppPreferencesModel = .shared

    var body: some View {
        VStack {
            PreferencesSection("Author Name", hideLabels: false) {
                TextField("Git Author Name", text: $prefs.preferences.sourceControl.git.authorName)
                    .frame(width: 280)
            }

            PreferencesSection("Author Email", hideLabels: false) {
                TextField("Git Email", text: $prefs.preferences.sourceControl.git.authorEmail)
                    .frame(width: 280)
            }

            PreferencesSection("Ignored Files", hideLabels: false) {
                List($prefs.preferences.sourceControl.git.ignoredFiles,
                     selection: $ignoredFileSelection) { ignoredFile in
                    IgnoredFileView(ignoredFile: ignoredFile)
                }.overlay(Group {
                    Color(NSColor.controlBackgroundColor)
                })
                .overlay(Group {
                    if prefs.preferences.sourceControl.git.ignoredFiles.isEmpty {
                        Text("No Ignored Files")
                    }
                }).frame(width: 280, height: 150)
                PreferencesToolbar {
                    bottomToolbar
                }.frame(width: 280, height: 27)
            }

            PreferencesSection("Options", hideLabels: false) {
                Toggle("Prefer to rebase when pulling",
                       isOn: $prefs.preferences.sourceControl.git.preferRebaseWhenPulling)
                    .toggleStyle(.checkbox)
                    .frame(width: 280, alignment: .leading)
                Toggle("Show merge commits in per-file log",
                       isOn: $prefs.preferences.sourceControl.git.showMergeCommitsPerFileLog)
                    .toggleStyle(.checkbox)
                    .frame(width: 280, alignment: .leading)
            }

Review comment (suggestion):
Add a 1pt border around the list so it better separates from the rest.

<img width="1016" alt="Screen Shot 2022-04-14 at 00 22 17" src="https://user-images.githubusercontent.com/9460130/163280036-171c1d66-c4b3-4d57-ab8c-4970d3d1a987.png">

Reference:

<img width="942" alt="Screen Shot 2022-04-14 at 00 26 10" src="https://user-images.githubusercontent.com/9460130/163280293-2006db9d-941d-4997-90c9-a6f770124faa.png">



Code after:
//  Created by Nanshi Li on 2022/04/01.
//

import SwiftUI

struct SourceControlGitView: View {

    @State var ignoredFileSelection: IgnoredFiles.ID?

    @StateObject
    private var prefs: AppPreferencesModel = .shared

    var body: some View {
        VStack {
            PreferencesSection("Author Name", hideLabels: false) {
                TextField("Git Author Name", text: $prefs.preferences.sourceControl.git.authorName)
                    .frame(width: 280)
            }

            PreferencesSection("Author Email", hideLabels: false) {
                TextField("Git Email", text: $prefs.preferences.sourceControl.git.authorEmail)
                    .frame(width: 280)
            }

            PreferencesSection("Ignored Files", hideLabels: false) {
                VStack(spacing: 1) {
                    List($prefs.preferences.sourceControl.git.ignoredFiles,
                         selection: $ignoredFileSelection) { ignoredFile in
                        IgnoredFileView(ignoredFile: ignoredFile)
                    }
                    .overlay(Group {
                        Color(NSColor.controlBackgroundColor)
                    })
                    .overlay(Group {
                        if prefs.preferences.sourceControl.git.ignoredFiles.isEmpty {
                            Text("No Ignored Files")
                        }
                    })
                    .frame(width: 280, height: 150)
                    PreferencesToolbar {
                        bottomToolbar
                    }
                    .frame(width: 280, height: 27)
                }
                .padding(1)
                .background(Rectangle().foregroundColor(Color(NSColor.separatorColor)))
            }

            PreferencesSection("Options", hideLabels: false) {
                Toggle("Prefer to rebase when pulling",
                       isOn: $prefs.preferences.sourceControl.git.preferRebaseWhenPulling)