Skip to content

Commit

Permalink
feat: init AlbumView
Browse files Browse the repository at this point in the history
  • Loading branch information
angristan committed Jul 21, 2021
1 parent 452f847 commit 95f2a1d
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
4 changes: 4 additions & 0 deletions firstfm.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
8226AB2426998FAB007ECE5F /* TopCountryArtistsResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8226AB2326998FAB007ECE5F /* TopCountryArtistsResponse.swift */; };
822E9A8A26A89BFE00C5307B /* UserTopArtistsResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 822E9A8926A89BFE00C5307B /* UserTopArtistsResponse.swift */; };
822E9A8C26A8CFAC00C5307B /* TrackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 822E9A8B26A8CFAC00C5307B /* TrackView.swift */; };
822E9A8E26A8D5F300C5307B /* AlbumView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 822E9A8D26A8D5F300C5307B /* AlbumView.swift */; };
82505CDF2675074E00CCCB58 /* ArtistRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82505CDC2675074E00CCCB58 /* ArtistRow.swift */; };
82505CE02675074E00CCCB58 /* ChartListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82505CDD2675074E00CCCB58 /* ChartListView.swift */; };
82505CE12675074E00CCCB58 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82505CDE2675074E00CCCB58 /* ContentView.swift */; };
Expand Down Expand Up @@ -107,6 +108,7 @@
8226AB2326998FAB007ECE5F /* TopCountryArtistsResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopCountryArtistsResponse.swift; sourceTree = "<group>"; };
822E9A8926A89BFE00C5307B /* UserTopArtistsResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserTopArtistsResponse.swift; sourceTree = "<group>"; };
822E9A8B26A8CFAC00C5307B /* TrackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackView.swift; sourceTree = "<group>"; };
822E9A8D26A8D5F300C5307B /* AlbumView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlbumView.swift; sourceTree = "<group>"; };
82505CDC2675074E00CCCB58 /* ArtistRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArtistRow.swift; sourceTree = "<group>"; };
82505CDD2675074E00CCCB58 /* ChartListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChartListView.swift; sourceTree = "<group>"; };
82505CDE2675074E00CCCB58 /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -213,6 +215,7 @@
82505CDE2675074E00CCCB58 /* ContentView.swift */,
82A006C426797C3E0009BD71 /* SearchView.swift */,
822E9A8B26A8CFAC00C5307B /* TrackView.swift */,
822E9A8D26A8D5F300C5307B /* AlbumView.swift */,
);
name = Views;
path = firstfm/Views;
Expand Down Expand Up @@ -553,6 +556,7 @@
82D5B4D62696E0E100716931 /* ScrobbledTrackRowView.swift in Sources */,
82A006C526797C3E0009BD71 /* SearchView.swift in Sources */,
821493A42694C427007A21C8 /* UserInfoResponse.swift in Sources */,
822E9A8E26A8D5F300C5307B /* AlbumView.swift in Sources */,
82C282EA26A3354E000E5F41 /* FriendRow.swift in Sources */,
82844E012673991F00578DD4 /* FirstfmApp.swift in Sources */,
825F0F8D26A5E8BB007BA84B /* ArtistInfo.swift in Sources */,
Expand Down
61 changes: 61 additions & 0 deletions firstfm/Views/AlbumView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import SwiftUI
import Kingfisher

struct AlbumView: View {
var album: ArtistAlbum

var body: some View {
GeometryReader { _ in
ScrollView {
GeometryReader { geometry in
ZStack {
if geometry.frame(in: .global).minY <= 0 {
KFImage.url(URL(string: !self.album.image.isEmpty ? self.album.image[0].url : "https://www.nme.com/wp-content/uploads/2021/04/twice-betterconceptphoto-2020.jpg")!)
.resizable()
.loadImmediately()
.aspectRatio(contentMode: .fill)
.overlay(TintOverlayView().opacity(0.2))
.frame(width: geometry.size.width, height: geometry.size.height)
.offset(y: geometry.frame(in: .global).minY/9)
.clipped()
} else {
KFImage.url(URL(string: !self.album.image.isEmpty ? self.album.image[0].url : "https://www.nme.com/wp-content/uploads/2021/04/twice-betterconceptphoto-2020.jpg")!)
.resizable()
.loadImmediately()
.aspectRatio(contentMode: .fill)
.overlay(TintOverlayView().opacity(0.2))
.frame(width: geometry.size.width, height: geometry.size.height + geometry.frame(in: .global).minY)
.clipped()
.offset(y: -geometry.frame(in: .global).minY)
}
}
}.frame(height: 300)

HStack {
VStack {
Text("Scrobbles")
Text("50k")
}
VStack {
Text("Listeners")
Text("52k")
}
}.offset(y: -50)
HStack {
Text("tag")
Text("tag")
Text("tag")
Text("tag")
}
Text("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.")
Divider()
Text("[img] Artist ->")
Divider()
Text("Tracklist")
Text("1 Rolling")
Text("2 Memory")
}
}

}
}
2 changes: 1 addition & 1 deletion firstfm/Views/Artist/TopArtistAlbumsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct TopArtistAlbumsView: View {
if !albums.isEmpty {
ForEach(albums, id: \.name) { album in
NavigationLink(
destination: Color(.red),
destination: AlbumView(album: album),
label: {
VStack {
KFImage.url(URL(string: album.image[0].url != "" ? album.image[0].url : "https://lastfm.freetls.fastly.net/i/u/64s/4128a6eb29f94943c9d206c08e625904.webp" )!)
Expand Down

0 comments on commit 95f2a1d

Please sign in to comment.