Sources/OrgstarMobile/FlashcardScreen.swift

4752dd3a1e83428b7d3360dbd60184ea42644ead
orgstar/Sources/OrgstarMobile/FlashcardScreen.swift

29 lines · 992 bytes

 1#if os(iOS)
 2import OrgApp
 3import SwiftUI
 4
 5/// The flashcard review on iPhone and iPad, full screen. `done` closes it, with a card's file
 6/// and heading to open when Open in Editor was chosen.
 7struct FlashcardScreen: View {
 8    let done: (String?, Int) -> Void
 9    @State private var review: FlashcardReview
10
11    init(workspace: WorkspaceModel, session: DocumentSession, done: @escaping (String?, Int) -> Void) {
12        self.done = done
13        _review = State(initialValue: FlashcardReview(workspace: workspace, session: session))
14    }
15
16    var body: some View {
17        NavigationStack {
18            FlashcardReviewView(review: review) { path, offset in done(path, offset) }
19                .navigationTitle("Review")
20                .navigationBarTitleDisplayMode(.inline)
21                .toolbar {
22                    ToolbarItem(placement: .cancellationAction) {
23                        Button("Done") { done(nil, 0) }
24                    }
25                }
26        }
27    }
28}
29#endif
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form