|
|
@@ -119,6 +119,7 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
119
|
119
|
private let savedJobsDocumentView = JobListingsDocumentView()
|
|
120
|
120
|
private let savedJobsStack = NSStackView()
|
|
121
|
121
|
private let settingsPageContainer = NSView()
|
|
|
122
|
+ private weak var appearanceModeSegment: NSSegmentedControl?
|
|
122
|
123
|
private let cvMakerPageContainer = NSView()
|
|
123
|
124
|
private lazy var cvMakerPageView: CVMakerPageView = {
|
|
124
|
125
|
CVMakerPageView()
|
|
|
@@ -1557,6 +1558,23 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
1557
|
1558
|
contentStack.alignment = .leading
|
|
1558
|
1559
|
contentStack.translatesAutoresizingMaskIntoConstraints = false
|
|
1559
|
1560
|
|
|
|
1561
|
+ let appearanceTitle = NSTextField(labelWithString: "Appearance")
|
|
|
1562
|
+ appearanceTitle.font = .systemFont(ofSize: 12, weight: .semibold)
|
|
|
1563
|
+ appearanceTitle.textColor = Theme.secondaryText
|
|
|
1564
|
+ appearanceTitle.alignment = .left
|
|
|
1565
|
+
|
|
|
1566
|
+ let themeSegment = makeAppearanceModeSegment()
|
|
|
1567
|
+ appearanceModeSegment = themeSegment
|
|
|
1568
|
+ let appearanceSection = makeSettingsSection(rows: [
|
|
|
1569
|
+ makeSettingsRow(title: "Theme", systemImage: "circle.lefthalf.filled", accessory: themeSegment, tapAction: nil)
|
|
|
1570
|
+ ])
|
|
|
1571
|
+
|
|
|
1572
|
+ let appearanceStack = NSStackView(views: [appearanceTitle, appearanceSection])
|
|
|
1573
|
+ appearanceStack.orientation = .vertical
|
|
|
1574
|
+ appearanceStack.spacing = 14
|
|
|
1575
|
+ appearanceStack.alignment = .leading
|
|
|
1576
|
+ appearanceStack.translatesAutoresizingMaskIntoConstraints = false
|
|
|
1577
|
+
|
|
1560
|
1578
|
let settingsSection = makeSettingsSection(rows: [
|
|
1561
|
1579
|
makeSettingsRow(title: "Share App", systemImage: "square.and.arrow.up", accessory: nil, tapAction: #selector(didTapShareApp)),
|
|
1562
|
1580
|
makeSettingsRow(title: "More Apps", systemImage: "square.grid.2x2", accessory: nil, tapAction: #selector(didTapMoreApps))
|
|
|
@@ -1580,6 +1598,7 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
1580
|
1598
|
aboutStack.alignment = .leading
|
|
1581
|
1599
|
aboutStack.translatesAutoresizingMaskIntoConstraints = false
|
|
1582
|
1600
|
|
|
|
1601
|
+ contentStack.addArrangedSubview(appearanceStack)
|
|
1583
|
1602
|
contentStack.addArrangedSubview(settingsSection)
|
|
1584
|
1603
|
contentStack.addArrangedSubview(aboutStack)
|
|
1585
|
1604
|
settingsPageContainer.addSubview(contentStack)
|
|
|
@@ -1588,6 +1607,8 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
1588
|
1607
|
contentStack.leadingAnchor.constraint(equalTo: settingsPageContainer.leadingAnchor, constant: 42),
|
|
1589
|
1608
|
contentStack.trailingAnchor.constraint(lessThanOrEqualTo: settingsPageContainer.trailingAnchor, constant: -42),
|
|
1590
|
1609
|
contentStack.topAnchor.constraint(equalTo: settingsPageContainer.topAnchor, constant: 48),
|
|
|
1610
|
+ appearanceStack.widthAnchor.constraint(equalTo: contentStack.widthAnchor),
|
|
|
1611
|
+ appearanceSection.widthAnchor.constraint(equalTo: appearanceStack.widthAnchor),
|
|
1591
|
1612
|
settingsSection.widthAnchor.constraint(equalTo: contentStack.widthAnchor),
|
|
1592
|
1613
|
aboutStack.widthAnchor.constraint(equalTo: contentStack.widthAnchor),
|
|
1593
|
1614
|
aboutSection.widthAnchor.constraint(equalTo: aboutStack.widthAnchor),
|
|
|
@@ -1595,6 +1616,26 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
1595
|
1616
|
])
|
|
1596
|
1617
|
}
|
|
1597
|
1618
|
|
|
|
1619
|
+ private func makeAppearanceModeSegment() -> NSSegmentedControl {
|
|
|
1620
|
+ let segment = NSSegmentedControl(
|
|
|
1621
|
+ labels: ["System", "Light", "Dark"],
|
|
|
1622
|
+ trackingMode: .selectOne,
|
|
|
1623
|
+ target: self,
|
|
|
1624
|
+ action: #selector(appearanceModeChanged(_:))
|
|
|
1625
|
+ )
|
|
|
1626
|
+ segment.translatesAutoresizingMaskIntoConstraints = false
|
|
|
1627
|
+ segment.segmentStyle = .automatic
|
|
|
1628
|
+ segment.selectedSegment = AppAppearanceManager.shared.mode.segmentIndex
|
|
|
1629
|
+ segment.setContentHuggingPriority(.required, for: .horizontal)
|
|
|
1630
|
+ segment.setContentCompressionResistancePriority(.required, for: .horizontal)
|
|
|
1631
|
+ return segment
|
|
|
1632
|
+ }
|
|
|
1633
|
+
|
|
|
1634
|
+ @objc private func appearanceModeChanged(_ sender: NSSegmentedControl) {
|
|
|
1635
|
+ guard let mode = AppAppearanceManager.Mode(segmentIndex: sender.selectedSegment) else { return }
|
|
|
1636
|
+ AppAppearanceManager.shared.mode = mode
|
|
|
1637
|
+ }
|
|
|
1638
|
+
|
|
1598
|
1639
|
private func makeSettingsSection(rows: [NSView]) -> NSView {
|
|
1599
|
1640
|
let section = NSStackView()
|
|
1600
|
1641
|
section.orientation = .vertical
|