-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1011 from 0x1-company/invite-profile
- Loading branch information
Showing
12 changed files
with
225 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,10 @@ query CurrentUserProfile { | |
coinBalance | ||
} | ||
} | ||
invitationCode { | ||
id | ||
code | ||
} | ||
friends { | ||
...FriendFragment | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
Packages/DependencyPackage/Sources/God/Schema/Objects/InvitationCode.graphql.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// @generated | ||
// This file was automatically generated and should not be edited. | ||
|
||
import ApolloAPI | ||
|
||
public extension God.Objects { | ||
static let InvitationCode = Object( | ||
typename: "InvitationCode", | ||
implementedInterfaces: [] | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Packages/DependencyPackage/Sources/GodTestMock/InvitationCode+Mock.graphql.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// @generated | ||
// This file was automatically generated and should not be edited. | ||
|
||
import ApolloTestSupport | ||
import God | ||
|
||
public class InvitationCode: MockObject { | ||
public static let objectType: Object = God.Objects.InvitationCode | ||
public static let _mockFields = MockFields() | ||
public typealias MockValueCollectionType = Array<Mock<InvitationCode>> | ||
|
||
public struct MockFields { | ||
@Field<String>("code") public var code | ||
@Field<God.ID>("id") public var id | ||
} | ||
} | ||
|
||
public extension Mock where O == InvitationCode { | ||
convenience init( | ||
code: String? = nil, | ||
id: God.ID? = nil | ||
) { | ||
self.init() | ||
_setScalar(code, for: \.code) | ||
_setScalar(id, for: \.id) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
Packages/GodPackage/Sources/ProfileFeature/Sections/InviteSection.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import SwiftUI | ||
import Styleguide | ||
|
||
struct InviteSection: View { | ||
let coinBalance: Int | ||
let code: String | ||
let codeCopyAction: () -> Void | ||
let inviteFriendAction: () -> Void | ||
let shopAction: () -> Void | ||
|
||
var body: some View { | ||
VStack(spacing: 16) { | ||
VStack(spacing: 16) { | ||
InviteTicket(code: code) | ||
.onTapGesture(perform: codeCopyAction) | ||
|
||
Button(action: inviteFriendAction) { | ||
Label { | ||
Text("Invite friend", bundle: .module) | ||
} icon: { | ||
Image(systemName: "square.and.arrow.up") | ||
} | ||
.font(.system(.title3, design: .rounded, weight: .bold)) | ||
.frame(height: 56) | ||
.frame(maxWidth: .infinity) | ||
.foregroundStyle(Color.white) | ||
.background(Color.godBlack) | ||
.clipShape(Capsule()) | ||
} | ||
} | ||
.padding(.vertical, 12) | ||
.padding(.horizontal, 16) | ||
.background(Color.white) | ||
.cornerRadius(16) | ||
|
||
Button(action: shopAction) { | ||
HStack(spacing: 8) { | ||
Text(coinBalance.description) | ||
.font(.system(.title2, design: .rounded, weight: .bold)) | ||
.foregroundStyle(Color.godBlack) | ||
|
||
Text("SHOP", bundle: .module) | ||
.font(.system(.caption, design: .rounded, weight: .bold)) | ||
.frame(width: 57, height: 26) | ||
.foregroundStyle(Color.white) | ||
.background(Color.godYellow.gradient) | ||
.clipShape(Capsule()) | ||
} | ||
.frame(height: 52) | ||
.frame(maxWidth: .infinity) | ||
.background(Color(uiColor: UIColor.secondarySystemBackground)) | ||
.overlay( | ||
RoundedRectangle(cornerRadius: 52 / 2) | ||
.stroke(Color.godTextSecondaryLight, lineWidth: 1) | ||
) | ||
.overlay(alignment: .top) { | ||
Text("COINS", bundle: .module) | ||
.font(.system(.caption, design: .rounded, weight: .bold)) | ||
.padding(.horizontal, 8) | ||
.foregroundStyle(Color.godTextSecondaryLight) | ||
.background(Color(uiColor: UIColor.secondarySystemBackground)) | ||
.offset(y: -7) | ||
} | ||
} | ||
} | ||
.padding(.all, 16) | ||
.background(Color(uiColor: UIColor.secondarySystemBackground)) | ||
.buttonStyle(HoldDownButtonStyle()) | ||
} | ||
} | ||
|
||
#Preview { | ||
InviteSection( | ||
coinBalance: 100, | ||
code: "ABCDEF", | ||
codeCopyAction: {}, | ||
inviteFriendAction: {}, | ||
shopAction: {} | ||
) | ||
} |
Oops, something went wrong.