Skip to content

Commit

Permalink
[#70] 알림 뷰 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
kimsoomin20221789 committed Aug 30, 2024
1 parent 8048269 commit 08e3403
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Spon-Us.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
804F99B52C80CA48005D286F /* FirebaseStorage in Frameworks */ = {isa = PBXBuildFile; productRef = 804F99B42C80CA48005D286F /* FirebaseStorage */; };
804F99B72C80CA48005D286F /* FirebaseStorageCombine-Community in Frameworks */ = {isa = PBXBuildFile; productRef = 804F99B62C80CA48005D286F /* FirebaseStorageCombine-Community */; };
804F99B92C80D45A005D286F /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 804F99B82C80D45A005D286F /* GoogleService-Info.plist */; };
804F99BD2C8190D8005D286F /* AlarmView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 804F99BC2C8190D8005D286F /* AlarmView.swift */; };
8065E24D2C332A63001B35DD /* NavigationBackBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8065E24C2C332A63001B35DD /* NavigationBackBar.swift */; };
8065E24F2C333070001B35DD /* SignUpIdView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8065E24E2C333070001B35DD /* SignUpIdView.swift */; };
8065E2512C3427AB001B35DD /* SignUpPWView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8065E2502C3427AB001B35DD /* SignUpPWView.swift */; };
Expand Down Expand Up @@ -132,6 +133,7 @@
3B82D8B62C3253E3008E0138 /* MypageViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MypageViewModel.swift; sourceTree = "<group>"; };
804F99B82C80D45A005D286F /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../김수민대학교/프로젝트/스포너스 Security/GoogleService-Info.plist"; sourceTree = "<group>"; };
804F99BA2C80DE2C005D286F /* Spon-UsDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Spon-UsDebug.entitlements"; sourceTree = "<group>"; };
804F99BC2C8190D8005D286F /* AlarmView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlarmView.swift; sourceTree = "<group>"; };
8065E24C2C332A63001B35DD /* NavigationBackBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBackBar.swift; sourceTree = "<group>"; };
8065E24E2C333070001B35DD /* SignUpIdView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignUpIdView.swift; sourceTree = "<group>"; };
8065E2502C3427AB001B35DD /* SignUpPWView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignUpPWView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -287,6 +289,22 @@
path = Company;
sourceTree = "<group>";
};
804F99BB2C8190B5005D286F /* Alarm */ = {
isa = PBXGroup;
children = (
804F99BE2C8190F0005D286F /* View */,
);
path = Alarm;
sourceTree = "<group>";
};
804F99BE2C8190F0005D286F /* View */ = {
isa = PBXGroup;
children = (
804F99BC2C8190D8005D286F /* AlarmView.swift */,
);
path = View;
sourceTree = "<group>";
};
8065E24B2C332A1F001B35DD /* Componenet */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -380,6 +398,7 @@
DFBE0B742BE601C400246814 /* Spon-Us */ = {
isa = PBXGroup;
children = (
804F99BB2C8190B5005D286F /* Alarm */,
804F99BA2C80DE2C005D286F /* Spon-UsDebug.entitlements */,
804F99B82C80D45A005D286F /* GoogleService-Info.plist */,
8065E24B2C332A1F001B35DD /* Componenet */,
Expand Down Expand Up @@ -637,6 +656,7 @@
files = (
80CF29E62C29943C00CACA53 /* DetailAgreeView.swift in Sources */,
3B0927342C3CC20E00777EEC /* TermsOfUseView.swift in Sources */,
804F99BD2C8190D8005D286F /* AlarmView.swift in Sources */,
DFBE0BAA2BF2F81C00246814 /* CompanyProfileView.swift in Sources */,
DFBE0B9E2BEB14F000246814 /* HomeViewModel.swift in Sources */,
DFBE0BDC2BF5B60C00246814 /* ClubProfileView.swift in Sources */,
Expand Down
168 changes: 168 additions & 0 deletions Spon-Us/Alarm/View/AlarmView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
//
// AlarmUIView.swift
// Spon-Us
//
// Created by 김수민 on 8/30/24.
//

import SwiftUI

enum AlarmColumn {
case send
case receive
}

struct AlarmView: View {
@State var selectedColumn: AlarmColumn = .send

var body: some View {
VStack(spacing: 0) {
ColumnView(column: $selectedColumn)
.frame(height: 56)
.padding(20)

if selectedColumn == .send {
SendView()
} else {
ReceivedView()
}
}
}
}

struct ColumnView: View {
@Binding var column: AlarmColumn
var body: some View {
HStack(spacing: 17) {
Button(action: {column = .send}) {
Text("보낸 제안")
.font(.T4KrBd)
.foregroundColor(column == .send ? Color.textPrimary : Color.textDisabled)
.padding(.horizontal, 44)
.padding(.vertical, 8)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(column == .send ? Color.white : Color.bgTertiary)
.cornerRadius(12)
}
Button(action: {column = .receive}) {
Text("받은 제안")
.font(.T4KrBd)
.foregroundColor(column == .receive ? Color.textPrimary : Color.textDisabled)
.padding(.horizontal, 44)
.padding(.vertical, 8)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(column == .receive ? Color.white : Color.bgTertiary)
.cornerRadius(12)
}
}
.padding(.horizontal, 12)
.padding(.vertical, 8)
.background(Color.bgTertiary)
.cornerRadius(20)
}
}

enum SendResult {
case success
case reject
}


struct SendView: View {
var body: some View {
ScrollView {
SendAlarmCell(result: .success, name: "무신사", email: "")
SendAlarmCell(result: .reject, name: "무신사", email: "")
SendAlarmCell(result: .reject, name: "무신사", email: "")
SendAlarmCell(result: .success, name: "무신사", email: "")
}.padding(.horizontal, 20)
}
}

struct SendAlarmCell: View {
let result: SendResult
let name: String
let email: String?
let image: String = "Image"
var isRead: Bool = false

var body: some View {
if result == .success {
HStack(alignment: .top, spacing: 0) {
Image(image)
.resizable()
.frame(width: 40, height: 40)
.padding(.top, 12)
.padding(.trailing, 20)

VStack(alignment: .leading, spacing: 2) {
Text(name)
.font(.B2KrMd)
.foregroundColor(.textSecondary)
Text("제안이 수락됐어요")
.font(.T4KrBd)
.foregroundColor(isRead == true ? .textPrimary : .textBrand)
Text("이메일을 확인하고 기업과 컨택해 보세요.")
.font(.B4KrMd)
.foregroundColor(.textTertiary)
}
.frame(width: .infinity)
Spacer()
Button(action: {/*이메일 창 이동*/}) {
Text("이메일 확인")
.font(.B2KrMd)
.foregroundColor(.textSecondary)
.padding(.horizontal, 10)
.padding(.vertical, 6)
.background(Color.bgTertiary)
.cornerRadius(12)
.overlay(
RoundedRectangle(cornerRadius: 12)
.inset(by: 0.5)
.stroke(Color.line200, lineWidth: 1))
}
.padding(.top, 18)
}
} else {
HStack(alignment: .top, spacing: 0) {
Image(image)
.resizable()
.frame(width: 40, height: 40)
.padding(.top, 12)
.padding(.trailing, 20)

VStack(alignment: .leading) {
Text(name)
.font(.B2KrMd)
.foregroundColor(Color.textDisabled)
Text("제안이 거절됐어요")
.font(.T4KrBd)
.foregroundColor(Color.textDisabled)
}
.frame(width: .infinity, height: .infinity)
.padding(.vertical, 12)
Spacer()
}
}
}
}
struct ReceivedView: View {
var body: some View {
EmptyView()
}
}

struct EmptyView: View {
var body: some View {
VStack() {
Spacer()
Text("제안 여부가 없어요")
.font(.T4KrMd)
.foregroundColor(.textDisabled)
Spacer()
}
}
}
#Preview {
AlarmView()
}

0 comments on commit 08e3403

Please sign in to comment.