diff options
| author | Fuwn <[email protected]> | 2025-02-18 23:39:51 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-02-19 00:00:29 -0800 |
| commit | 320ce31337ed60cae24a0374fa2d6d79237a6bfe (patch) | |
| tree | ad1e93799efeb8e7a16521e3ab958c911f73f617 /Sora/Views/Post/PostDetailView.swift | |
| parent | feat: Initial commit (diff) | |
| download | sora-testing-320ce31337ed60cae24a0374fa2d6d79237a6bfe.tar.xz sora-testing-320ce31337ed60cae24a0374fa2d6d79237a6bfe.zip | |
feat: Development commit
Diffstat (limited to 'Sora/Views/Post/PostDetailView.swift')
| -rw-r--r-- | Sora/Views/Post/PostDetailView.swift | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/Sora/Views/Post/PostDetailView.swift b/Sora/Views/Post/PostDetailView.swift deleted file mode 100644 index 799339c..0000000 --- a/Sora/Views/Post/PostDetailView.swift +++ /dev/null @@ -1,75 +0,0 @@ -import SwiftUI - -struct PostDetailView: View { - let post: MoebooruPost - @State var loadingStage: PostLoadingState = .loadingPreview - - var body: some View { - VStack { - Link(destination: URL(string: "https://yande.re/post/show/\(post.id)")!) { - AsyncImage(url: post.sampleURL) { image in - image - .resizable() - .scaledToFit() - .onAppear { - self.loadingStage = .loaded - } - } placeholder: { - AsyncImage(url: post.previewURL) { image in - image - .resizable() - .scaledToFit() - .onAppear { - self.loadingStage = .loadingFile - } - } placeholder: { - ProgressView() - .progressViewStyle(LinearProgressViewStyle()) - .padding() - .onAppear { - self.loadingStage = .loadingPreview - } - } - .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) - .id(post.fileURL) - } - .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) - .id(post.fileURL) - } - .buttonStyle(PlainButtonStyle()) - - Spacer() - - VStack(spacing: 5) { - HStack { - Text(post.tags.joined(separator: ", ")) - } - .frame(maxWidth: .infinity, alignment: .leading) - - HStack { - Text(post.createdAt.formatted()) - .frame(maxWidth: .infinity, alignment: .leading) - - Group { - switch loadingStage { - case .loadingPreview: - Text("Loading preview …") - case .loadingFile: - Text("Loading file …") - case .loaded: - EmptyView() - } - } - .padding(.trailing, 5) - } - .frame(maxWidth: .infinity, alignment: .leading) - .foregroundStyle(.secondary) - } - .padding(.horizontal, 10) - .padding(.vertical, 10 / 1.33) - .textSelection(.enabled) - .font(.footnote) - .background(.opacity(0.1)) - } - } -} |