From 46a655784f8daa551049fca45683b3e6fb48b777 Mon Sep 17 00:00:00 2001 From: Jacob Date: Thu, 11 Jul 2024 11:47:12 -0300 Subject: [PATCH] ceo calendar --- video/video-94-ceo/AiExtensions.swift | 96 +++++++++++++++++++++++++++ video/video-94-ceo/ceo.html | 85 ++++++++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 video/video-94-ceo/AiExtensions.swift create mode 100644 video/video-94-ceo/ceo.html diff --git a/video/video-94-ceo/AiExtensions.swift b/video/video-94-ceo/AiExtensions.swift new file mode 100644 index 0000000..f2b39ee --- /dev/null +++ b/video/video-94-ceo/AiExtensions.swift @@ -0,0 +1,96 @@ + + + +import SwiftUI + +struct GlowbyScreen: View { + // This is a designated area where the OpenAI model can add or modify code. + // To enable the screen, set this value to true + // If it is false, the screen won't be visible in the app + static let enabled = true + + // Change the title according to the assigned task + // This will be the name of the screen in the app + static let title = "Interactive Calendar" + + @State private var selectedEvent: Event? = nil + + struct Event: Identifiable { + let id = UUID() + let title: String + let description: String + let image: String + } + + let events: [Int: Event] = [ + 1: Event(title: "Event 1", description: "Meeting with investors", image: "https://picsum.photos/200/300?business"), + 7: Event(title: "Event 2", description: "Product launch", image: "https://picsum.photos/200/300?tech") + ] + + var body: some View { + VStack { + Text("Calendar") + .font(.largeTitle) + .bold() + .padding() + + LazyVGrid(columns: Array(repeating: GridItem(.flexible()), count: 7), spacing: 10) { + ForEach(1...31, id: \.self) { day in + ZStack { + RoundedRectangle(cornerRadius: 10) + .fill(Color.gray.opacity(0.2)) + .frame(height: 50) + if let event = events[day] { + VStack { + Text("\(day)") + Text(event.title) + .font(.caption) + .padding(4) + .background(Color.blue) + .foregroundColor(.white) + .cornerRadius(5) + .onTapGesture { + selectedEvent = event + } + } + } else { + Text("\(day)") + } + } + } + } + .padding() + + if let event = selectedEvent { + VStack { + Text(event.title) + .font(.title) + .bold() + Text(event.description) + .padding() + AsyncImage(url: URL(string: event.image)) { image in + image + .resizable() + .aspectRatio(contentMode: .fit) + .frame(maxWidth: 300) + } placeholder: { + ProgressView() + } + Button("Close") { + selectedEvent = nil + } + .padding() + .background(Color.blue) + .foregroundColor(.white) + .cornerRadius(10) + } + .padding() + .background(Color.white) + .cornerRadius(10) + .shadow(radius: 10) + .transition(.scale) + } + } + .frame(maxWidth: 360) + } +} diff --git a/video/video-94-ceo/ceo.html b/video/video-94-ceo/ceo.html new file mode 100644 index 0000000..036a22d --- /dev/null +++ b/video/video-94-ceo/ceo.html @@ -0,0 +1,85 @@ + + + + + + + Interactive Calendar + + + + +
+

Calendar

+
+
Sun
+
Mon
+
Tue
+
Wed
+
Thu
+
Fri
+
Sat
+
1
Event 1
+
2
+
3
+
4
+
5
+
6
+
7
Event 2
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
+
+ + + + + + +