<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import CoreData
import SnapKit
import Shared

class MainSidePanelViewController : SidePanelBaseViewController {

    let bookmarksPanel = BookmarksPanel(folder: nil)
    fileprivate var bookmarksNavController:UINavigationController!
    
    let history = HistoryPanel()

    var bookmarksButton = UIButton()
    var historyButton = UIButton()

    var settingsButton = UIButton()

    let topButtonsView = UIView()
    let addBookmarkButton = UIButton()

    let divider = UIView()
    
    // Buttons swap out the full page, meaning only one can be active at a time
    var pageButtons: Dictionary<UIButton, UIViewController> {
        return [
            bookmarksButton: bookmarksNavController,
            historyButton: history,
        ]
    }

    override func setupUIElements() {
        super.setupUIElements()
        
        bookmarksNavController = UINavigationController(rootViewController: bookmarksPanel)
        bookmarksNavController.view.backgroundColor = UIColor.white
        containerView.addSubview(topButtonsView)

        topButtonsView.addSubview(bookmarksButton)
        topButtonsView.addSubview(historyButton)
        topButtonsView.addSubview(addBookmarkButton)
        topButtonsView.addSubview(settingsButton)
        topButtonsView.addSubview(divider)

        divider.backgroundColor = BraveUX.ColorForSidebarLineSeparators

        settingsButton.setImage(UIImage(named: "settings")?.withRenderingMode(.alwaysTemplate), for: .normal)
        settingsButton.addTarget(self, action: #selector(onClickSettingsButton), for: .touchUpInside)
        settingsButton.accessibilityLabel = Strings.Settings

        bookmarksButton.setImage(UIImage(named: "bookmarklist")?.withRenderingMode(.alwaysTemplate), for: .normal)
        bookmarksButton.accessibilityLabel = Strings.Show_Bookmarks
        
        historyButton.setImage(UIImage(named: "history")?.withRenderingMode(.alwaysTemplate), for: .normal)
        historyButton.accessibilityLabel = Strings.Show_History

        addBookmarkButton.addTarget(self, action: #selector(onClickBookmarksButton), for: .touchUpInside)
        addBookmarkButton.setImage(UIImage(named: "bookmark")?.withRenderingMode(.alwaysTemplate), for: .normal)
        addBookmarkButton.setImage(UIImage(named: "bookmarkMarked")?.withRenderingMode(.alwaysTemplate), for: .selected)
        addBookmarkButton.accessibilityLabel = Strings.Add_Bookmark
        <commit_msg>increase tappable area on left menu top nav<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import CoreData
import SnapKit
import Shared

class MainSidePanelViewController : SidePanelBaseViewController {

    let bookmarksPanel = BookmarksPanel(folder: nil)
    fileprivate var bookmarksNavController:UINavigationController!
    
    let history = HistoryPanel()

    var bookmarksButton = UIButton()
    var historyButton = UIButton()

    var settingsButton = UIButton()

    let topButtonsView = UIView()
    let addBookmarkButton = UIButton()

    let divider = UIView()
    
    // Buttons swap out the full page, meaning only one can be active at a time
    var pageButtons: Dictionary<UIButton, UIViewController> {
        return [
            bookmarksButton: bookmarksNavController,
            historyButton: history,
        ]
    }

    override func setupUIElements() {
        super.setupUIElements()
        
        bookmarksNavController = UINavigationController(rootViewController: bookmarksPanel)
        bookmarksNavController.view.backgroundColor = UIColor.white
        containerView.addSubview(topButtonsView)

        topButtonsView.addSubview(bookmarksButton)
        topButtonsView.addSubview(historyButton)
        topButtonsView.addSubview(addBookmarkButton)
        topButtonsView.addSubview(settingsButton)
        topButtonsView.addSubview(divider)

        divider.backgroundColor = BraveUX.ColorForSidebarLineSeparators

        settingsButton.setImage(UIImage(named: "settings")?.withRenderingMode(.alwaysTemplate), for: .normal)
        settingsButton.addTarget(self, action: #selector(onClickSettingsButton), for: .touchUpInside)
        settingsButton.contentEdgeInsets = UIEdgeInsetsMake(5, 10, 5, 10)
        settingsButton.accessibilityLabel = Strings.Settings

        bookmarksButton.setImage(UIImage(named: "bookmarklist")?.withRenderingMode(.alwaysTemplate), for: .normal)
        bookmarksButton.contentEdgeInsets = UIEdgeInsetsMake(5, 10, 5, 10)
        bookmarksButton.accessibilityLabel = Strings.Show_Bookmarks
        
        historyButton.setImage(UIImage(named: "history")?.withRenderingMode(.alwaysTemplate), for: .normal)
        historyButton.contentEdgeInsets = UIEdgeInsetsMake(5, 10, 5, 10)
        historyButton.accessibilityLabel = Strings.Show_History

        addBookmarkButton.addTarget(self, action: #selector(onClickBookmarksButton), for: .touchUpInside)
        addBookmarkButton.setImage(UIImage(named: "bookmark")?.withRenderingMode(.alwaysTemplate), for: .normal)
        addBookmarkButton.setImage(UIImage(named: "bookmarkMarked")?.withRenderingMode(.alwaysTemplate), for: .selected)
        addBookmarkButton.contentEdgeInsets = UIEdgeInsetsMake(5, 10, 5, 10)
        addBookmarkButton.accessibilityLabel = Strings.Add_Bookmark
        
{'fraction_non_alphanumeric': 0.08118212568987004, 'fraction_numerical': 0.005696991276482108, 'mean_word_length': 3.868284228769497, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1692769', 'n_tokens_mistral': 1561, 'n_tokens_neox': 1513, 'n_words': 329}