Skip to content

Commit

Permalink
[Feat] LOL MatchCardView Prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
JungDohyeon committed Nov 21, 2024
1 parent 4b6b391 commit d8e4a77
Show file tree
Hide file tree
Showing 10 changed files with 250 additions and 32 deletions.
20 changes: 16 additions & 4 deletions GameLink-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
CDA1CBED2CEF84850041116B /* UserProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDA1CBEC2CEF84850041116B /* UserProfileView.swift */; };
CDA1CBEF2CEF8FEB0041116B /* RankCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDA1CBEE2CEF8FEB0041116B /* RankCardView.swift */; };
CDA1CBF32CEF948E0041116B /* RankEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDA1CBF22CEF948E0041116B /* RankEntity.swift */; };
CDA1CBF52CEF95870041116B /* RankType.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDA1CBF42CEF95870041116B /* RankType.swift */; };
CDA1CBF72CEF9D390041116B /* UserMatchListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDA1CBF62CEF9D390041116B /* UserMatchListView.swift */; };
CDA1CBF92CEF9D5D0041116B /* LOLMatchDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDA1CBF82CEF9D5D0041116B /* LOLMatchDTO.swift */; };
CDA1CBFB2CEF9F7C0041116B /* MatchCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDA1CBFA2CEF9F7C0041116B /* MatchCardView.swift */; };
CDA1CBFD2CEFA0820041116B /* LOLMatchEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDA1CBFC2CEFA0820041116B /* LOLMatchEntity.swift */; };
CDC0C5812CEA61D1002988BF /* ChatroomDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC0C5802CEA61D1002988BF /* ChatroomDTO.swift */; };
CDC0C5842CEA63E6002988BF /* ChatroomEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC0C5832CEA63E6002988BF /* ChatroomEntity.swift */; };
CDC0C5862CEA6733002988BF /* ChatroomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC0C5852CEA6733002988BF /* ChatroomView.swift */; };
Expand Down Expand Up @@ -139,7 +142,10 @@
CDA1CBEC2CEF84850041116B /* UserProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileView.swift; sourceTree = "<group>"; };
CDA1CBEE2CEF8FEB0041116B /* RankCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RankCardView.swift; sourceTree = "<group>"; };
CDA1CBF22CEF948E0041116B /* RankEntity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RankEntity.swift; sourceTree = "<group>"; };
CDA1CBF42CEF95870041116B /* RankType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RankType.swift; sourceTree = "<group>"; };
CDA1CBF62CEF9D390041116B /* UserMatchListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserMatchListView.swift; sourceTree = "<group>"; };
CDA1CBF82CEF9D5D0041116B /* LOLMatchDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LOLMatchDTO.swift; sourceTree = "<group>"; };
CDA1CBFA2CEF9F7C0041116B /* MatchCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MatchCardView.swift; sourceTree = "<group>"; };
CDA1CBFC2CEFA0820041116B /* LOLMatchEntity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LOLMatchEntity.swift; sourceTree = "<group>"; };
CDC0C5802CEA61D1002988BF /* ChatroomDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatroomDTO.swift; sourceTree = "<group>"; };
CDC0C5832CEA63E6002988BF /* ChatroomEntity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatroomEntity.swift; sourceTree = "<group>"; };
CDC0C5852CEA6733002988BF /* ChatroomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatroomView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -266,7 +272,6 @@
CD8CD2A52CEBB7C800DD7BB4 /* GameType.swift */,
CD8CD2A92CEBC02F00DD7BB4 /* GameFilter.swift */,
CD8CD2AC2CEC796B00DD7BB4 /* ChattingViewDestination.swift */,
CDA1CBF42CEF95870041116B /* RankType.swift */,
);
path = Enum;
sourceTree = "<group>";
Expand Down Expand Up @@ -302,6 +307,7 @@
CD8CD2B12CEC7BBB00DD7BB4 /* GLNavigationBar.swift */,
CDF1F09F2CECFCBF0033F03F /* CachedImageView.swift */,
CDA1CBEE2CEF8FEB0041116B /* RankCardView.swift */,
CDA1CBFA2CEF9F7C0041116B /* MatchCardView.swift */,
);
path = Core;
sourceTree = "<group>";
Expand All @@ -319,6 +325,7 @@
children = (
CD277DAF2CCE25F300BE57C4 /* ProfileMainView.swift */,
CDA1CBEC2CEF84850041116B /* UserProfileView.swift */,
CDA1CBF62CEF9D390041116B /* UserMatchListView.swift */,
);
path = View;
sourceTree = "<group>";
Expand All @@ -328,6 +335,7 @@
children = (
CDC0C5832CEA63E6002988BF /* ChatroomEntity.swift */,
CDA1CBF22CEF948E0041116B /* RankEntity.swift */,
CDA1CBFC2CEFA0820041116B /* LOLMatchEntity.swift */,
);
path = Entity;
sourceTree = "<group>";
Expand Down Expand Up @@ -490,6 +498,7 @@
CDF1F0A72CECFE150033F03F /* GameInfoDTO.swift */,
CDF1F0A92CECFE220033F03F /* ChampionDTO.swift */,
CDA1CBEA2CEF2C230041116B /* RankDTO.swift */,
CDA1CBF82CEF9D5D0041116B /* LOLMatchDTO.swift */,
);
path = Entity;
sourceTree = "<group>";
Expand Down Expand Up @@ -709,19 +718,21 @@
CDF1F0A02CECFCBF0033F03F /* CachedImageView.swift in Sources */,
CDF1F0AC2CED103C0033F03F /* UserCarouselCardView.swift in Sources */,
CD277DB02CCE25F300BE57C4 /* ProfileMainView.swift in Sources */,
CDA1CBFD2CEFA0820041116B /* LOLMatchEntity.swift in Sources */,
CDD5CD2C2CA47B0D00208740 /* AuthView.swift in Sources */,
CD534BF92CD3EA60003F3CA6 /* ReissueDTO.swift in Sources */,
CDD5CD342CA4839B00208740 /* UserAPI.swift in Sources */,
CDA1CBF92CEF9D5D0041116B /* LOLMatchDTO.swift in Sources */,
CDCB985B2C9DE61200DF9FD3 /* ChattingListView.swift in Sources */,
CDD5CD3D2CA4864700208740 /* OAuthDTO.swift in Sources */,
CD760A3E2CE5E9CF006AEB85 /* GLColor.swift in Sources */,
CD929F1B2CD2B27400E67E4E /* GLTextFieldType.swift in Sources */,
CDCB988D2C9DEA5C00DF9FD3 /* UserDefaultsWrapper.swift in Sources */,
CD8CD2A82CEBBB4600DD7BB4 /* FlowRowLayoutView.swift in Sources */,
CDA1CBF52CEF95870041116B /* RankType.swift in Sources */,
CDA1CBED2CEF84850041116B /* UserProfileView.swift in Sources */,
CDCB988B2C9DEA4A00DF9FD3 /* Config.swift in Sources */,
CD277DB72CCE2A5E00BE57C4 /* RiotService.swift in Sources */,
CDA1CBF72CEF9D390041116B /* UserMatchListView.swift in Sources */,
CDF1F09C2CECFC930033F03F /* ImageCacheManager.swift in Sources */,
CD277DB22CCE260900BE57C4 /* ProfileViewModel.swift in Sources */,
CD8CD2AD2CEC796B00DD7BB4 /* ChattingViewDestination.swift in Sources */,
Expand All @@ -737,6 +748,7 @@
CDD5CD3F2CA48AE400208740 /* Utils.swift in Sources */,
CD8CD2A42CEBB35000DD7BB4 /* ChattingFilterDetailView.swift in Sources */,
CDD5CD382CA4850F00208740 /* BaseService.swift in Sources */,
CDA1CBFB2CEF9F7C0041116B /* MatchCardView.swift in Sources */,
CD277DC22CCE2F5B00BE57C4 /* DefaultRiotService.swift in Sources */,
CD277DC42CCE2F9B00BE57C4 /* DefaultChatService.swift in Sources */,
CD8CD2AA2CEBC02F00DD7BB4 /* GameFilter.swift in Sources */,
Expand Down
41 changes: 41 additions & 0 deletions GameLink-iOS/Domain/Entity/LOLMatchEntity.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// LOLMatchEntity.swift
// GameLink-iOS
//
// Created by 정도현 on 11/22/24.
//

import Foundation

public struct LOLMatchEntity: Hashable {
let matchId: String
let matchType: LOLGameType
let championName: String
let doubleKills: Int
let firstBloodKill: Bool
let teamPosition: LOLPosition
let pentaKills: Int
let assists: Int
let deaths: Int
let kills: Int
let kda: Double
let firstBloodAssist: Bool
let firstTowerAssist: Bool
let firstTowerKill: Bool
let goldPerMinute: Int
let gameEndedInEarlySurrender: Bool
let gameEndedInSurrender: Bool
let timePlayed: Int
let totalMinionsKilled: Int
let win: Bool
let soloKills: Int
let legendaryCount: Int
let damagePerMinute: Int
let dragonTakedowns: Int
let epicMonsterSteals: Int
let baronTakedowns: Int
let voidMonsterKill: Int
let perfectDragonSoulsTaken: Int
let elderDragonMultikills: Int
let killParticipation: Int
}
2 changes: 1 addition & 1 deletion GameLink-iOS/Domain/Entity/RankEntity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

public struct RankEntity: Hashable {
let type: RankType
let type: LOLGameType
let tier: LOLTier
let rank: String
let leaguePoints: Int
Expand Down
22 changes: 0 additions & 22 deletions GameLink-iOS/Domain/Enum/RankType.swift

This file was deleted.

128 changes: 128 additions & 0 deletions GameLink-iOS/Feature/Core/MatchCardView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
//
// MatchCardView.swift
// GameLink-iOS
//
// Created by 정도현 on 11/22/24.
//

import SwiftUI

public struct MatchCardView: View {

let matchData: LOLMatchEntity

public init(matchData: LOLMatchEntity) {
self.matchData = matchData
}

public var body: some View {
HStack(spacing: 0) {
Rectangle()
.fill(matchData.win ? .blue : .errorRed)
.frame(width: 8)
.padding(.trailing, 10)

VStack(alignment: .leading, spacing: 0) {
Text(matchData.matchType.korName)
.glFont(.body2Bold)
.foregroundStyle(matchData.win ? .blue : .errorRed)
.padding(.bottom, 2)

Text(matchData.win ? "승리" : "패배")
.glFont(.body2)
.foregroundStyle(.glGray2)

Spacer()
}
.padding(.vertical, 10)

Spacer()

if let positionImage = matchData.teamPosition.positionImage {
Image(uiImage: positionImage)
.resizable()
.frame(width: 50, height: 50)
}
}
.padding(.trailing, 14)
.frame(height: 100)
.background(
matchData.win ? .winBlue : .glLooseRed
)
.clipShape(.rect(cornerRadius: 8))
}
}

#Preview {
VStack {
MatchCardView(
matchData: LOLMatchEntity(
matchId: "string",
matchType: .freeRank,
championName: "아트록스",
doubleKills: 1,
firstBloodKill: true,
teamPosition: .mid,
pentaKills: 0,
assists: 5,
deaths: 3,
kills: 5,
kda: 3.3,
firstBloodAssist: true,
firstTowerAssist: true,
firstTowerKill: true,
goldPerMinute: 300,
gameEndedInEarlySurrender: true,
gameEndedInSurrender: true,
timePlayed: 0,
totalMinionsKilled: 0,
win: true,
soloKills: 0,
legendaryCount: 0,
damagePerMinute: 0,
dragonTakedowns: 0,
epicMonsterSteals: 0,
baronTakedowns: 0,
voidMonsterKill: 0,
perfectDragonSoulsTaken: 0,
elderDragonMultikills: 0,
killParticipation: 0
)
)
MatchCardView(
matchData: LOLMatchEntity(
matchId: "string",
matchType: .freeRank,
championName: "아트록스",
doubleKills: 1,
firstBloodKill: true,
teamPosition: .top,
pentaKills: 0,
assists: 5,
deaths: 3,
kills: 5,
kda: 3.3,
firstBloodAssist: true,
firstTowerAssist: true,
firstTowerKill: true,
goldPerMinute: 300,
gameEndedInEarlySurrender: true,
gameEndedInSurrender: true,
timePlayed: 0,
totalMinionsKilled: 0,
win: false,
soloKills: 0,
legendaryCount: 0,
damagePerMinute: 0,
dragonTakedowns: 0,
epicMonsterSteals: 0,
baronTakedowns: 0,
voidMonsterKill: 0,
perfectDragonSoulsTaken: 0,
elderDragonMultikills: 0,
killParticipation: 0
)
)
}
.padding()
}
4 changes: 2 additions & 2 deletions GameLink-iOS/Feature/Core/RankCardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private extension RankCardView {
func topInfo() -> some View {
HStack(spacing: 10) {
VStack(alignment: .leading, spacing: 0) {
Text(rankData.type.korTitle)
Text(rankData.type.korName)
.glFont(.body2Bold)
.foregroundStyle(.glPrimary1)
.padding(.vertical, 4)
Expand Down Expand Up @@ -89,7 +89,7 @@ private extension RankCardView {

#Preview {
RankCardView(rankData: RankEntity(
type: .solo,
type: .soloRank,
tier: .bronze,
rank: "III",
leaguePoints: 40,
Expand Down
18 changes: 18 additions & 0 deletions GameLink-iOS/Feature/Profile/View/UserMatchListView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// UserMatchListView.swift
// GameLink-iOS
//
// Created by 정도현 on 11/22/24.
//

import SwiftUI

struct UserMatchListView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}

#Preview {
UserMatchListView()
}
4 changes: 2 additions & 2 deletions GameLink-iOS/Feature/Profile/View/UserProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ private extension UserProfileView {
func rankInfo() -> some View {
ScrollView(.horizontal, showsIndicators: false) {
LazyHStack(spacing: 10) {
RankCardView(rankData: RankDTO.toRankEntity(type: .solo, data: userData.soloRank))
RankCardView(rankData: RankDTO.toRankEntity(type: .team, data: userData.teamRank))
RankCardView(rankData: RankDTO.toRankEntity(type: .soloRank, data: userData.soloRank))
RankCardView(rankData: RankDTO.toRankEntity(type: .freeRank, data: userData.teamRank))
}
.padding(.horizontal, GridRules.globalHorizontalPadding)
}
Expand Down
41 changes: 41 additions & 0 deletions GameLink-iOS/Networks/Sources/Entity/LOLMatchDTO.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// LOLMatchDTO.swift
// GameLink-iOS
//
// Created by 정도현 on 11/22/24.
//

import Foundation

public struct LOLMatchDTO: Codable, Hashable {
let matchId: String
let matchType: String
let championName: String
let doubleKills: Int
let firstBloodKill: Bool
let teamPosition: String
let pentaKills: Int
let assists: Int
let deaths: Int
let kills: Int
let kda: Double
let firstBloodAssist: Bool
let firstTowerAssist: Bool
let firstTowerKill: Bool
let goldPerMinute: Int
let gameEndedInEarlySurrender: Bool
let gameEndedInSurrender: Bool
let timePlayed: Int
let totalMinionsKilled: Int
let win: Bool
let soloKills: Int
let legendaryCount: Int
let damagePerMinute: Int
let dragonTakedowns: Int
let epicMonsterSteals: Int
let baronTakedowns: Int
let voidMonsterKill: Int
let perfectDragonSoulsTaken: Int
let elderDragonMultikills: Int
let killParticipation: Int
}
2 changes: 1 addition & 1 deletion GameLink-iOS/Networks/Sources/Entity/RankDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public struct RankDTO: Codable, Hashable {
}

public extension RankDTO {
static func toRankEntity(type: RankType, data: RankDTO) -> RankEntity {
static func toRankEntity(type: LOLGameType, data: RankDTO) -> RankEntity {
return RankEntity(
type: type,
tier: LOLTier.stringToLOLTier(tier: data.tier),
Expand Down

0 comments on commit d8e4a77

Please sign in to comment.