diff --git a/All In.xcodeproj/project.pbxproj b/All In.xcodeproj/project.pbxproj index 1395b4d..58a81e9 100644 --- a/All In.xcodeproj/project.pbxproj +++ b/All In.xcodeproj/project.pbxproj @@ -79,6 +79,7 @@ D0EB53232DA4A97E00F988EB /* SellContractView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0EB53222DA4A94000F988EB /* SellContractView.swift */; }; D0EB53262DA4AF3E00F988EB /* SellSelectedContractView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0EB53252DA4AF3E00F988EB /* SellSelectedContractView.swift */; }; D0F6A9F62BD887F100D75BAD /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = D0F6A9F52BD887F100D75BAD /* SnapKit */; }; + D8DFE21D2D9097B600A441F6 /* BetCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8DFE21C2D9097B600A441F6 /* BetCard.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -167,6 +168,7 @@ D0B4A2532DA6EA3300A1722C /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; D0B4A25B2DA6F45200A1722C /* Keys.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Keys.xcconfig; sourceTree = ""; }; D0CD31812BD5A2F500E7136C /* NetworkManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = ""; }; + D8DFE21C2D9097B600A441F6 /* BetCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BetCard.swift; sourceTree = ""; }; D0EB53222DA4A94000F988EB /* SellContractView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SellContractView.swift; sourceTree = ""; }; D0EB53252DA4AF3E00F988EB /* SellSelectedContractView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SellSelectedContractView.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -349,6 +351,7 @@ 897DFBD82CCED80600246B0D /* ContractCard.swift */, 897DFBD92CCED80600246B0D /* PlayerContractSheetView.swift */, 897DFBDA2CCED80600246B0D /* TabBar.swift */, + D8DFE21C2D9097B600A441F6 /* BetCard.swift */, ); path = Views; sourceTree = ""; @@ -686,6 +689,7 @@ 29C9CBE02D9DCB2F00E38F7A /* SportPill.swift in Sources */, D0EB53262DA4AF3E00F988EB /* SellSelectedContractView.swift in Sources */, 897DFBFC2CCED80C00246B0D /* Color+Extension.swift in Sources */, + D8DFE21D2D9097B600A441F6 /* BetCard.swift in Sources */, 29C9CBE22D9DDE5A00E38F7A /* RarityPackSheetView.swift in Sources */, 897DFBFD2CCED80C00246B0D /* Date+Extension.swift in Sources */, 897DFBFE2CCED80C00246B0D /* NSNumberFormatter.swift in Sources */, diff --git a/All In/Features/Shared/Views/BetCard.swift b/All In/Features/Shared/Views/BetCard.swift new file mode 100644 index 0000000..9e1990e --- /dev/null +++ b/All In/Features/Shared/Views/BetCard.swift @@ -0,0 +1,71 @@ +// +// BetCard.swift +// All In +// +// Created by Hsia Lu wu on 3/23/25. +// + +import SwiftUI + +struct BetCard: View { + + @State private var contract: Contract + @State private var player: Player + + init(contract: Contract) { + _contract = State(initialValue: contract) + _player = State(initialValue: Contract.getPlayer(contract)) + } + + var body: some View { + // info + HStack(alignment: .center) { + // player image + Image("Player\(player.number)") + .resizable() + .frame(width: 37, height: 37) + + // info + VStack(alignment: .leading) { + Text("\(Contract.getPlayer(contract).firstName) \(Contract.getPlayer(contract).lastName) v. \(contract.opposingTeam)") + .font(.system(size: 16)) + .foregroundStyle(Constants.Colors.white) + + // TODO: missing date and sport field for contracts + Text("\(Date().monthDayFormat) | Men's Ice Hockey") + .font(.system(size: 12)) + .foregroundStyle(Constants.Colors.white) + + // TODO: event + Text("\(contract.event)") + .font(.system(size: 12)) + .foregroundStyle(Constants.Colors.white) + } + + VStack { + Text("Cost: \(contract.buyPrice)") + .font(.system(size: 12, weight: .regular)) + .foregroundStyle(Constants.Colors.orange) + + Text("Gain: \(contract.value)") + .font(.system(size: 12, weight: .regular)) + .foregroundStyle(Constants.Colors.lightGreen) + } + } + .padding(.horizontal, 16) + .padding(.vertical, 16) + .frame(maxWidth: .infinity) + .background(Constants.Colors.blackBlue) + .cornerRadius(16) + // Card border + .overlay( + RoundedRectangle(cornerRadius: 16) + .stroke(LinearGradient(gradient: Constants.Colors.gradient, startPoint: .topLeading, endPoint: .bottomTrailing), lineWidth: 2) + ) + .padding(.horizontal, 24) + } +} + +#Preview { + BetCard(contract: Contract.dummyData[0]) +} diff --git a/All In/Features/Shared/Views/ContractCard.swift b/All In/Features/Shared/Views/ContractCard.swift index ba9c06f..fb2fa59 100644 --- a/All In/Features/Shared/Views/ContractCard.swift +++ b/All In/Features/Shared/Views/ContractCard.swift @@ -24,14 +24,6 @@ struct ContractCard: View { showSheet = true } label: { ZStack(alignment: .bottom) { - RoundedRectangle(cornerRadius: 16) - .inset(by: 0.5) - .stroke(Constants.Colors.grey00, lineWidth: 2) - .frame(width: 150, height: 150) - .background(.white) - .cornerRadius(16) - .shadow(color: Constants.Colors.grey00, radius: 5, x: 0, y: 4) - VStack(alignment: .center, spacing: 26) { VStack { ZStack { diff --git a/All In/Utils/Constants.swift b/All In/Utils/Constants.swift index f306a9e..240c6b5 100644 --- a/All In/Utils/Constants.swift +++ b/All In/Utils/Constants.swift @@ -35,15 +35,14 @@ struct Constants { static let gradientLavender = Color(hex: 0x7D97FE) static let blackBlue = Color(hex: 0x201E2D) static let backgroundBlack = Color(hex: 0x15141B) + // System + static let background = Color(hex: 0x15141B) // Charts static let greenChart = Color(hex: 0x47CD89) static let redChart = Color(hex: 0xF97066) static let moneyGreen = Color(hex: 0x47CD89) - // System - static let background = Color(hex: 0x15141B) - // Gradient static let gradient = Gradient( colors: [ @@ -53,7 +52,6 @@ struct Constants { Constants.Colors.gradientLavender ] ) - } enum Fonts {