-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Abstracted shared logic from NavigatorAreaView, InspectorAreaView, and UtilityAreaView into reusable view called WorkspacePanelView. * Updated to latest
- Loading branch information
1 parent
e760191
commit ca35a5d
Showing
14 changed files
with
131 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
CodeEdit/Features/CodeEditUI/Views/WorkspacePanelView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// | ||
// WorkspacePanelView.swift | ||
// CodeEdit | ||
// | ||
// Created by Austin Condiff on 1/4/25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct WorkspacePanelView<Tab: WorkspacePanelTab, ViewModel: ObservableObject>: View { | ||
@ObservedObject var viewModel: ViewModel | ||
@Binding var selectedTab: Tab? | ||
@Binding var tabItems: [Tab] | ||
|
||
@Environment(\.colorScheme) | ||
private var colorScheme | ||
|
||
var sidebarPosition: SettingsData.SidebarTabBarPosition | ||
var darkDivider: Bool | ||
|
||
init( | ||
viewModel: ViewModel, | ||
selectedTab: Binding<Tab?>, | ||
tabItems: Binding<[Tab]>, | ||
sidebarPosition: SettingsData.SidebarTabBarPosition, | ||
darkDivider: Bool = false | ||
) { | ||
self.viewModel = viewModel | ||
self._selectedTab = selectedTab | ||
self._tabItems = tabItems | ||
self.sidebarPosition = sidebarPosition | ||
self.darkDivider = darkDivider | ||
} | ||
|
||
var body: some View { | ||
VStack(spacing: 0) { | ||
if let selection = selectedTab { | ||
selection | ||
} else { | ||
CEContentUnavailableView("No Selection") | ||
} | ||
} | ||
.safeAreaInset(edge: .leading, spacing: 0) { | ||
if sidebarPosition == .side { | ||
HStack(spacing: 0) { | ||
WorkspacePanelTabBar(items: $tabItems, selection: $selectedTab, position: sidebarPosition) | ||
Divider() | ||
.overlay(Color(nsColor: darkDivider && colorScheme == .dark ? .black : .clear)) | ||
} | ||
} | ||
} | ||
.safeAreaInset(edge: .top, spacing: 0) { | ||
if sidebarPosition == .top { | ||
VStack(spacing: 0) { | ||
Divider() | ||
WorkspacePanelTabBar(items: $tabItems, selection: $selectedTab, position: sidebarPosition) | ||
Divider() | ||
} | ||
} else if !darkDivider { | ||
Divider() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...iewModels/NavigatorSidebarViewModel.swift → ...a/ViewModels/NavigatorAreaViewModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.