Skip to content

Commit 6e664ef

Browse files
committed
CardCell теперь используется в BoosterOpenedViewController
1 parent 37aee1d commit 6e664ef

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

BlackMagic/Controllers/BoosterOpenedViewController.swift

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ final class BoosterOpenedViewController: UIViewController {
9696
collectionView.clipsToBounds = false
9797
collectionView.dataSource = self
9898
collectionView.delegate = self
99-
collectionView.register(OpenBoosterCardCell.self, forCellWithReuseIdentifier: OpenBoosterCardCell.identifier)
99+
collectionView.register(CardCell.self, forCellWithReuseIdentifier: CardCell.identifier)
100100

101101
view.addSubview(collectionView)
102102
collectionView.pinTop(to: totalLabel.bottomAnchor, 8)
@@ -157,17 +157,26 @@ extension BoosterOpenedViewController: UICollectionViewDataSource, UICollectionV
157157

158158
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
159159
let cell = collectionView.dequeueReusableCell(
160-
withReuseIdentifier: OpenBoosterCardCell.identifier,
160+
withReuseIdentifier: CardCell.identifier,
161161
for: indexPath
162-
) as! OpenBoosterCardCell
162+
) as! CardCell
163163

164164
let booster = boosterData[indexPath.item]
165-
cell.cardView.configure(
165+
// Преобразуем UserBooster в Card (заполняем тестовыми данными)
166+
let card = Card(
167+
id: UUID().uuidString,
168+
name: booster.setCode, // временно используем setCode как имя
169+
type_line: booster.type.rawValue,
170+
mana_cost: nil,
171+
oracle_text: nil,
172+
rarity: nil,
166173
set: booster.setCode,
167-
type: booster.type.rawValue,
168-
count: 1,
169-
color: UIColor.fromHexString(booster.colorHex ?? "") ?? .systemBlue
174+
set_name: nil,
175+
image_url: nil,
176+
price_usd: nil,
177+
count: 1
170178
)
179+
cell.configure(with: card)
171180
return cell
172181
}
173182

BlackMagic/Models/Card.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ struct Card: Codable, Equatable, CustomStringConvertible {
2828
var description: String {
2929
"Card(name: \(name), set: \(set ?? "-"), rarity: \(rarity ?? "-"))"
3030
}
31-
}
31+
}

0 commit comments

Comments
 (0)