@@ -17,28 +17,36 @@ struct AutoJoinScreen: View {
1717 ZStack {
1818 Rectangle . semiOpaqueWindow ( )
1919 VStack {
20- Text ( event . title ) . font ( . system ( size : 40 ) ) . padding ( . bottom , 2 )
21- Text ( event. meetingLink? . service? . rawValue ?? " " ) . font ( . system ( size : 16 ) )
22- VStack {
23- Text ( getEventDateString ( event) ) . padding ( . bottom , 2 )
24- if #available ( macOS 11 . 0 , * ) {
25- Text ( event . startDate , style : . relative ) . font ( . system ( size : 16 ) )
26- }
20+ HStack {
21+ Image ( nsImage : getIconForMeetingService ( event. meetingLink? . service) )
22+ . resizable ( ) . frame ( width : 25 , height : 25 )
23+ Text ( event. title ) . font ( . title )
24+ }
25+ VStack ( spacing : 10 ) {
26+ Text ( getEventDateString ( event ) )
2727 } . padding ( 15 )
28- HStack ( spacing: 40 ) {
29- Button ( " Dismiss " ) {
30- self . window ? . close ( )
28+ HStack ( spacing: 30 ) {
29+ Button ( action : dismiss ) {
30+ Text ( " general_close " . loco ( ) ) . padding ( . vertical , 5 ) . padding ( . horizontal , 20 )
3131 }
32- Button ( " Join event " ) {
33- self . event. openMeeting ( )
34- self . window? . close ( )
35- } . background ( Color . accentColor. opacity ( 1 ) )
32+ Button ( action: joinEvent) {
33+ Text ( " notifications_meetingbar_join_event_action " . loco ( ) ) . padding ( . vertical, 5 ) . padding ( . horizontal, 25 )
34+ } . background ( Color . accentColor) . cornerRadius ( 5 )
3635 }
3736 }
3837 }
3938 . colorScheme ( . dark)
4039 . frame ( maxWidth: . infinity, maxHeight: . infinity)
4140 }
41+
42+ func dismiss( ) {
43+ window? . close ( )
44+ }
45+
46+ func joinEvent( ) {
47+ event. openMeeting ( )
48+ window? . close ( )
49+ }
4250}
4351
4452public extension View {
@@ -63,34 +71,6 @@ struct VisualEffect: NSViewRepresentable {
6371 func updateNSView( _: NSView , context _: Context ) { }
6472}
6573
66- func getEventDateString( _ event: MBEvent ) -> String {
67- let formatter = DateIntervalFormatter ( )
68- formatter. dateStyle = . none
69- formatter. timeStyle = . short
70- return formatter. string ( from: event. startDate, to: event. endDate)
71- }
72-
73- func generateEvent( ) -> MBEvent {
74- let calendar = MBCalendar ( title: " Fake calendar " , ID: " fake_cal " , source: nil , email: nil , color: . black)
75-
76- let event = MBEvent (
77- ID: " test_event " ,
78- lastModifiedDate: nil ,
79- title: " Test event " ,
80- status: . confirmed,
81- notes: nil ,
82- location: nil ,
83- url: URL ( string: " https://zoom.us/j/5551112222 " ) !,
84- organizer: nil ,
85- startDate: Calendar . current. date ( byAdding: . minute, value: 3 , to: Date ( ) ) !,
86- endDate: Calendar . current. date ( byAdding: . minute, value: 33 , to: Date ( ) ) !,
87- isAllDay: false ,
88- recurrent: false ,
89- calendar: calendar
90- )
91- return event
92- }
93-
9474#Preview {
95- AutoJoinScreen ( event: generateEvent ( ) , window: nil )
75+ AutoJoinScreen ( event: generateFakeEvent ( ) , window: nil )
9676}
0 commit comments