addition of microphone
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// FooterControlsView.swift
|
||||
// nirvana-ios
|
||||
//
|
||||
// Created by Arjun Patel on 12/12/21.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct FooterControlsView: View {
|
||||
@StateObject var viewModel:FooterControlsViewModel = FooterControlsViewModel()
|
||||
|
||||
var body: some View {
|
||||
HStack(alignment: .center) {
|
||||
Spacer()
|
||||
|
||||
Button {
|
||||
print("Button was pressed!")
|
||||
} label: {
|
||||
var icon:String = viewModel.isRecording ? "waveform" : "mic.fill"
|
||||
|
||||
Image(systemName: icon)
|
||||
.foregroundColor(.white)
|
||||
.padding()
|
||||
.background(NirvanaColor.teal)
|
||||
.clipShape(Circle())
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.horizontal, 30)
|
||||
}
|
||||
}
|
||||
|
||||
struct FooterControlsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
FooterControlsView()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// FooterControlsViewModel.swift
|
||||
// nirvana-ios
|
||||
//
|
||||
// Created by Arjun Patel on 12/12/21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
final class FooterControlsViewModel: ObservableObject {
|
||||
@Published var isRecording: Bool = false
|
||||
|
||||
}
|
||||
@@ -12,14 +12,7 @@ struct ChatsCarouselView: View {
|
||||
// current snapped/selected user
|
||||
@State var selectedUserId: String = ""
|
||||
@State var selectedUser: User?
|
||||
|
||||
|
||||
private func getScale(proxy: GeometryProxy) -> CGFloat {
|
||||
let scale:CGFloat = 2
|
||||
|
||||
return scale
|
||||
}
|
||||
|
||||
|
||||
func getSelectedUser(userId: String) -> User {
|
||||
return self.viewModel.carouselUsers.filter{user in
|
||||
return user.id == userId
|
||||
@@ -33,7 +26,6 @@ struct ChatsCarouselView: View {
|
||||
ForEach(viewModel.carouselUsers) { carouselUser in
|
||||
GeometryReader {proxy in
|
||||
let minX = proxy.frame(in: .local).minX
|
||||
let scale = getScale(proxy: proxy)
|
||||
|
||||
Image(carouselUser.profilePictureUrl)
|
||||
.renderingMode(.original)
|
||||
@@ -45,12 +37,12 @@ struct ChatsCarouselView: View {
|
||||
.blur(radius: abs(minX) / 40)
|
||||
.scaleEffect()
|
||||
.padding(40)
|
||||
.frame(maxWidth: UIScreen.main.bounds.width)
|
||||
|
||||
}
|
||||
.tag(carouselUser.id)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: UIScreen.main.bounds.width * 0.8)
|
||||
.tabViewStyle(.page(indexDisplayMode: .never))
|
||||
.onAppear {
|
||||
self.selectedUserId = self.viewModel.carouselUsers.first?.id ?? ""
|
||||
@@ -75,7 +67,7 @@ struct ChatsCarouselView: View {
|
||||
.id(user.id)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 100)
|
||||
.strokeBorder(NirvanaColors.teal, lineWidth: 2)
|
||||
.strokeBorder(NirvanaColor.teal, lineWidth: 2)
|
||||
.opacity(isSelected ? 1 : 0)
|
||||
)
|
||||
.onTapGesture {
|
||||
@@ -83,11 +75,11 @@ struct ChatsCarouselView: View {
|
||||
self.selectedUserId = user.id
|
||||
}
|
||||
}
|
||||
.frame(maxHeight: 75)
|
||||
.frame(maxHeight: 60)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.padding(.vertical, 40)
|
||||
.padding(.top, 40)
|
||||
.padding(.horizontal, 40)
|
||||
|
||||
}
|
||||
|
||||
@@ -14,14 +14,13 @@ struct HomeView: View {
|
||||
|
||||
ChatsCarouselView()
|
||||
|
||||
Text("This is the region for the bottom actions")
|
||||
.padding(.vertical, 10)
|
||||
FooterControlsView()
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth:.infinity, maxHeight: .infinity)
|
||||
.accentColor(NirvanaColors.teal)
|
||||
.background(NirvanaColors.bgLightGrey)
|
||||
.accentColor(NirvanaColor.teal)
|
||||
.background(NirvanaColor.bgLightGrey)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ struct HeaderView: View {
|
||||
Image(systemName: "list.bullet.circle")
|
||||
.font(Font.system(.largeTitle))
|
||||
.padding()
|
||||
.foregroundColor(NirvanaColors.teal)
|
||||
.foregroundColor(NirvanaColor.teal)
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ struct HeaderView: View {
|
||||
|
||||
Text("nirvana")
|
||||
.font(Font.custom("Satisfy-Regular", size: 35))
|
||||
.foregroundColor(NirvanaColors.teal)
|
||||
.foregroundColor(NirvanaColor.teal)
|
||||
.multilineTextAlignment(.center)
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ struct HeaderView: View {
|
||||
Image(systemName: "person.crop.circle.badge.plus")
|
||||
.font(Font.system(.largeTitle))
|
||||
.padding()
|
||||
.foregroundColor(NirvanaColors.teal)
|
||||
.foregroundColor(NirvanaColor.teal)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ struct WelcomeView: View {
|
||||
.font(.title)
|
||||
+ Text("minimalist ")
|
||||
.font(.title)
|
||||
.foregroundColor(NirvanaColors.teal)
|
||||
.foregroundColor(NirvanaColor.teal)
|
||||
+ Text("social media.")
|
||||
.font(.title)
|
||||
|
||||
@@ -50,12 +50,12 @@ struct WelcomeView: View {
|
||||
label: {
|
||||
Text("Start Your Detox")
|
||||
.bold()
|
||||
.foregroundColor(NirvanaColors.white)
|
||||
.foregroundColor(NirvanaColor.white)
|
||||
}
|
||||
)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 25)
|
||||
.background(NirvanaColors.teal)
|
||||
.background(NirvanaColor.teal)
|
||||
.clipShape(Capsule())
|
||||
// .shadow(color: NirvanaColors.teal, radius: 3, x: 1, y: 2)
|
||||
// .cornerRadius(8)
|
||||
@@ -69,7 +69,7 @@ struct WelcomeView: View {
|
||||
.bold()
|
||||
}
|
||||
)
|
||||
.background(NirvanaColors.bgLightGrey)
|
||||
.background(NirvanaColor.bgLightGrey)
|
||||
|
||||
//learn more button to usenirvana.com
|
||||
}
|
||||
@@ -83,9 +83,9 @@ struct WelcomeView: View {
|
||||
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.accentColor(NirvanaColors.teal)
|
||||
.background(NirvanaColors.bgLightGrey)
|
||||
// .background(RadialGradient(gradient: Gradient(colors: [NirvanaColors.teal.opacity(0.1), NirvanaColors.bgLightGrey, NirvanaColors.bgLightGrey]), center: .center, startRadius: 0, endRadius: 200)
|
||||
.accentColor(NirvanaColor.teal)
|
||||
.background(NirvanaColor.bgLightGrey)
|
||||
// .background(RadialGradient(gradient: Gradient(colors: [NirvanaColor.teal.opacity(0.1), NirvanaColor.bgLightGrey, NirvanaColor.bgLightGrey]), center: .center, startRadius: 0, endRadius: 200)
|
||||
// )
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user