-
-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP][POC] update swiftfin tvos signin #1113
Closed
+169
−165
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
Swiftfin tvOS/Views/UserSignInView/Components/PublicUserGrid.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,70 @@ | ||
// | ||
// Swiftfin is subject to the terms of the Mozilla Public | ||
// License, v2.0. If a copy of the MPL was not distributed with this | ||
// file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
// | ||
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors | ||
// | ||
|
||
import JellyfinAPI | ||
import SwiftUI | ||
|
||
// TODO: change from list to grid button | ||
|
||
extension UserSignInView { | ||
|
||
struct PublicUserGrid: View { | ||
|
||
private let user: UserDto | ||
private let client: JellyfinClient | ||
private let action: () -> Void | ||
|
||
init( | ||
user: UserDto, | ||
client: JellyfinClient, | ||
action: @escaping () -> Void | ||
) { | ||
self.user = user | ||
self.client = client | ||
self.action = action | ||
} | ||
|
||
@ViewBuilder | ||
private var personView: some View { | ||
RelativeSystemImageView(systemName: "person.fill", ratio: 0.5) | ||
.foregroundStyle(.secondary) | ||
.clipShape(.circle) | ||
.aspectRatio(1, contentMode: .fill) | ||
.frame(width: 100, height: 100) | ||
} | ||
|
||
var body: some View { | ||
Button { | ||
action() | ||
} label: { | ||
VStack { | ||
ImageView(user.profileImageSource(client: client)) | ||
.image { image in | ||
image | ||
.posterBorder(ratio: 0.5, of: \.width) | ||
} | ||
.placeholder { _ in | ||
personView | ||
} | ||
.failure { | ||
personView | ||
} | ||
.aspectRatio(1, contentMode: .fill) | ||
.clipShape(.circle) | ||
.frame(width: 100, height: 100) | ||
|
||
Text(user.name ?? .emptyDash) | ||
.foregroundStyle(.primary) | ||
.lineLimit(1) | ||
} | ||
} | ||
// .buttonStyle(.card) | ||
.foregroundStyle(.primary) | ||
} | ||
} | ||
} |
81 changes: 0 additions & 81 deletions
81
Swiftfin tvOS/Views/UserSignInView/Components/PublicUserRow.swift
This file was deleted.
Oops, something went wrong.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing the buttons, but this needs to be in a
HStack
like before. This is a deliberate design decision for these being different sections, and they should be equally sized. Additionally, the public user section can be of any size and requiring to scroll through them isn't desirable.