diff --git a/Shared/Home/HomeView.swift b/Shared/Home/HomeView.swift index e7285e2c..7bb5537a 100644 --- a/Shared/Home/HomeView.swift +++ b/Shared/Home/HomeView.swift @@ -36,26 +36,26 @@ struct HomeView: View { #if os(tvOS) Group { if showOpenActionsInHome { - OpenVideosButton(text: "Open Video", imageSystemName: "globe") { + AccentButton(text: "Open Video", imageSystemName: "globe") { NavigationModel.shared.presentingOpenVideos = true } } - OpenVideosButton(text: "Locations", imageSystemName: "globe") { + AccentButton(text: "Locations", imageSystemName: "globe") { NavigationModel.shared.presentingAccounts = true } - OpenVideosButton(text: "Settings", imageSystemName: "gear") { + AccentButton(text: "Settings", imageSystemName: "gear") { NavigationModel.shared.presentingSettings = true } } #else if showOpenActionsInHome { - OpenVideosButton(text: "Files", imageSystemName: "folder") { + AccentButton(text: "Files", imageSystemName: "folder") { NavigationModel.shared.presentingFileImporter = true } - OpenVideosButton(text: "Paste", imageSystemName: "doc.on.clipboard.fill") { + AccentButton(text: "Paste", imageSystemName: "doc.on.clipboard.fill") { OpenVideosModel.shared.openURLsFromClipboard(playbackMode: .playNow) } - OpenVideosButton(imageSystemName: "ellipsis") { + AccentButton(imageSystemName: "ellipsis") { NavigationModel.shared.presentingOpenVideos = true } .frame(maxWidth: 40) diff --git a/Shared/Views/OpenVideosButton.swift b/Shared/Views/AccentButton.swift similarity index 74% rename from Shared/Views/OpenVideosButton.swift rename to Shared/Views/AccentButton.swift index 34709396..bd3696e2 100644 --- a/Shared/Views/OpenVideosButton.swift +++ b/Shared/Views/AccentButton.swift @@ -1,8 +1,10 @@ import SwiftUI -struct OpenVideosButton: View { +struct AccentButton: View { var text: String? var imageSystemName: String? + var maxWidth: CGFloat? = .infinity + var bold = true var action: () -> Void = {} var body: some View { @@ -13,12 +15,13 @@ struct OpenVideosButton: View { } if let text { Text(text.localized()) - .fontWeight(.bold) + .fontWeight(bold ? .bold : .regular) } } .padding(.vertical, 10) + .padding(.horizontal, 10) .frame(minHeight: 45) - .frame(maxWidth: .infinity) + .frame(maxWidth: maxWidth) .contentShape(Rectangle()) } .foregroundColor(.accentColor) @@ -34,6 +37,6 @@ struct OpenVideosButton: View { struct OpenVideosButton_Previews: PreviewProvider { static var previews: some View { - OpenVideosButton(text: "Open Videos", imageSystemName: "play.circle.fill") + AccentButton(text: "Open Videos", imageSystemName: "play.circle.fill") } } diff --git a/Shared/Views/OpenVideosView.swift b/Shared/Views/OpenVideosView.swift index e87d33a2..4684c552 100644 --- a/Shared/Views/OpenVideosView.swift +++ b/Shared/Views/OpenVideosView.swift @@ -171,7 +171,7 @@ struct OpenVideosView: View { } var openURLsButton: some View { - OpenVideosButton(text: "Open", imageSystemName: "network") { + AccentButton(text: "Open", imageSystemName: "network") { openURLs(urlsToOpenFromText) } .disabled(urlsToOpenFromText.isEmpty) @@ -183,7 +183,7 @@ struct OpenVideosView: View { } var openFromClipboardButton: some View { - OpenVideosButton(text: "Paste", imageSystemName: "doc.on.clipboard.fill") { + AccentButton(text: "Paste", imageSystemName: "doc.on.clipboard.fill") { OpenVideosModel.shared.openURLsFromClipboard( removeQueueItems: removeQueueItems, playbackMode: playbackMode @@ -192,7 +192,7 @@ struct OpenVideosView: View { } var openFilesButton: some View { - OpenVideosButton(text: "Open Files", imageSystemName: "folder") { + AccentButton(text: "Open Files", imageSystemName: "folder") { presentingFileImporter = true } } diff --git a/Yattee.xcodeproj/project.pbxproj b/Yattee.xcodeproj/project.pbxproj index 1a48fb61..7a29d390 100644 --- a/Yattee.xcodeproj/project.pbxproj +++ b/Yattee.xcodeproj/project.pbxproj @@ -447,9 +447,9 @@ 3761ABFF26F0F8DE00AA496F /* EnvironmentValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3761ABFC26F0F8DE00AA496F /* EnvironmentValues.swift */; }; 3763495126DFF59D00B9A393 /* AppSidebarRecents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3763495026DFF59D00B9A393 /* AppSidebarRecents.swift */; }; 3763495226DFF59D00B9A393 /* AppSidebarRecents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3763495026DFF59D00B9A393 /* AppSidebarRecents.swift */; }; - 37635FE4291EA6CF00C11E79 /* OpenVideosButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37635FE3291EA6CF00C11E79 /* OpenVideosButton.swift */; }; - 37635FE5291EA6CF00C11E79 /* OpenVideosButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37635FE3291EA6CF00C11E79 /* OpenVideosButton.swift */; }; - 37635FE6291EA6CF00C11E79 /* OpenVideosButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37635FE3291EA6CF00C11E79 /* OpenVideosButton.swift */; }; + 37635FE4291EA6CF00C11E79 /* AccentButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37635FE3291EA6CF00C11E79 /* AccentButton.swift */; }; + 37635FE5291EA6CF00C11E79 /* AccentButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37635FE3291EA6CF00C11E79 /* AccentButton.swift */; }; + 37635FE6291EA6CF00C11E79 /* AccentButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37635FE3291EA6CF00C11E79 /* AccentButton.swift */; }; 3763C989290C7A50004D3B5F /* OpenVideosView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3763C988290C7A50004D3B5F /* OpenVideosView.swift */; }; 3763C98A290C7A50004D3B5F /* OpenVideosView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3763C988290C7A50004D3B5F /* OpenVideosView.swift */; }; 3763C98B290C7A50004D3B5F /* OpenVideosView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3763C988290C7A50004D3B5F /* OpenVideosView.swift */; }; @@ -1264,7 +1264,7 @@ 375F740F289DC35A00747050 /* PlayerBackendView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerBackendView.swift; sourceTree = ""; }; 3761ABFC26F0F8DE00AA496F /* EnvironmentValues.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnvironmentValues.swift; sourceTree = ""; }; 3763495026DFF59D00B9A393 /* AppSidebarRecents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppSidebarRecents.swift; sourceTree = ""; }; - 37635FE3291EA6CF00C11E79 /* OpenVideosButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenVideosButton.swift; sourceTree = ""; }; + 37635FE3291EA6CF00C11E79 /* AccentButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccentButton.swift; sourceTree = ""; }; 3763C988290C7A50004D3B5F /* OpenVideosView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenVideosView.swift; sourceTree = ""; }; 37648B68286CF5F1003D330B /* TVControls.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TVControls.swift; sourceTree = ""; }; 376527BA285F60F700102284 /* PlayerTimeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerTimeModel.swift; sourceTree = ""; }; @@ -1827,7 +1827,7 @@ 371CC7732946963000979C1A /* ListingStyleButtons.swift */, 37030FF627B0347C00ECDDAA /* MPVPlayerView.swift */, 37E70926271CDDAE00D34DDE /* OpenSettingsButton.swift */, - 37635FE3291EA6CF00C11E79 /* OpenVideosButton.swift */, + 37635FE3291EA6CF00C11E79 /* AccentButton.swift */, 3763C988290C7A50004D3B5F /* OpenVideosView.swift */, 37FEF11227EFD8580033912F /* PlaceholderCell.swift */, 3769C02D2779F18600DDB3EA /* PlaceholderProgressView.swift */, @@ -3190,7 +3190,7 @@ 374C053B2724614F009BDDBE /* PlayerTVMenu.swift in Sources */, 37A9965A26D6F8CA006E3224 /* HorizontalCells.swift in Sources */, 37EBD8CA27AF26C200F1C24B /* MPVBackend.swift in Sources */, - 37635FE4291EA6CF00C11E79 /* OpenVideosButton.swift in Sources */, + 37635FE4291EA6CF00C11E79 /* AccentButton.swift in Sources */, 37D526DE2720AC4400ED2F5E /* VideosAPI.swift in Sources */, 37484C2526FC83E000287258 /* InstanceForm.swift in Sources */, 37DD9DBD2785D60300539416 /* ScrollViewMatcher.swift in Sources */, @@ -3391,7 +3391,7 @@ 37030FFC27B0398000ECDDAA /* MPVClient.swift in Sources */, 3751B4B327836902000B7DF4 /* SearchPage.swift in Sources */, 3782B9532755667600990149 /* String+Format.swift in Sources */, - 37635FE5291EA6CF00C11E79 /* OpenVideosButton.swift in Sources */, + 37635FE5291EA6CF00C11E79 /* AccentButton.swift in Sources */, 378E9C3D2945565500B2D696 /* SubscriptionsView.swift in Sources */, 3776ADD7287381240078EBC4 /* Captions.swift in Sources */, 37E70924271CD43000D34DDE /* WelcomeScreen.swift in Sources */, @@ -3750,7 +3750,7 @@ 37F7D82E289EB05F00E2B3D0 /* SettingsPickerModifier.swift in Sources */, 374AB3DD28BCAF7E00DF56FB /* SeekType.swift in Sources */, 374C053727242D9F009BDDBE /* SponsorBlockSettings.swift in Sources */, - 37635FE6291EA6CF00C11E79 /* OpenVideosButton.swift in Sources */, + 37635FE6291EA6CF00C11E79 /* AccentButton.swift in Sources */, 377ABC42286E4AD5009C986F /* InstancesManifest.swift in Sources */, 37C069802725C8D400F7F6CB /* CMTime+DefaultTimescale.swift in Sources */, 37EBD8CC27AF26C200F1C24B /* MPVBackend.swift in Sources */,