ui done for one convo
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// Convo.swift
|
||||
// nirvana-ios
|
||||
//
|
||||
// Created by Arjun Patel on 12/29/21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import FirebaseFirestoreSwift
|
||||
import FirebaseFirestore
|
||||
|
||||
enum ConvoState: String, Codable {
|
||||
case connected
|
||||
case disconnected
|
||||
}
|
||||
|
||||
struct Convo: Identifiable, Codable {
|
||||
@DocumentID var id: String?
|
||||
var leaderUserId: String
|
||||
var receiverUserId: String
|
||||
|
||||
var agoraToken: String
|
||||
|
||||
var state: ConvoState
|
||||
|
||||
var Users: [String]?
|
||||
|
||||
@ServerTimestamp var startedTimestamp: Date?
|
||||
@ServerTimestamp var endedTimestamp: Date?
|
||||
}
|
||||
|
||||
//struct DetailConvo: Convo {
|
||||
// func getRelativeStartTime() {
|
||||
//
|
||||
// }
|
||||
//}
|
||||
@@ -7,9 +7,39 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
// test convos
|
||||
let testConvos: [Convo] = [
|
||||
Convo(leaderUserId: "VWVPKCrNmMeZlkEeZxuJ0Wsgq0C3", receiverUserId: "zd6PpD3TmnQUDoy6noS9aZpuPWr1", agoraToken: "006c8dfd65deb5c4741bd564085627139d0IAAIlYcWj21zCp4jq/WS2BMaiMYlKSax7ohIjzBx1BtpWAx+f9gAAAAAEADQ943gX6LOYQEAAQBfos5h", state: .connected)
|
||||
]
|
||||
|
||||
struct ConvosView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
ScrollView([.horizontal]) {
|
||||
HStack {
|
||||
ForEach(0..<testConvos.count, id: \.self) {index in
|
||||
|
||||
|
||||
ZStack(alignment: .topTrailing) {
|
||||
Circle()
|
||||
.foregroundColor(NirvanaColor.dimTeal.opacity(0.4))
|
||||
|
||||
ZStack {
|
||||
Color.clear
|
||||
ProfilePictureOverlap()
|
||||
.shadow(radius: 10)
|
||||
}
|
||||
|
||||
Text("+2")
|
||||
.padding(5)
|
||||
.font(.caption)
|
||||
.foregroundColor(Color.white)
|
||||
.background(NirvanaColor.dimTeal)
|
||||
.cornerRadius(100)
|
||||
}
|
||||
.frame(width: 100, height: 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,3 +48,26 @@ struct ConvosView_Previews: PreviewProvider {
|
||||
ConvosView()
|
||||
}
|
||||
}
|
||||
|
||||
struct ProfilePictureOverlap: View {
|
||||
let numberAttendees:Int = 5
|
||||
let offset:Int = 15
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
ForEach(0..<numberAttendees, id: \.self) {attendeeIndex in
|
||||
if attendeeIndex < 3 {
|
||||
Image(Avatars.avatarSystemNames[attendeeIndex+1])
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.background(NirvanaColor.dimTeal)
|
||||
.clipShape(Circle())
|
||||
.offset(x: CGFloat((-15 * attendeeIndex)) + 15)
|
||||
.frame(width: 50)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user