1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
use crateAnnotation;
use Scrollable;
use ;
/// Builds a text layout for displaying an `Annotation`.
///
/// This function creates a `LinearLayout` that represents the formatted text of an `Annotation`.
/// The layout consists of two elements:
///
/// 1. A timestamp indicating when the annotation was created, formatted as a human-readable string,
/// followed by a separator.
///
/// 2. The textual content of the annotation.
///
/// # Arguments
///
/// - `annotation`: A reference to the `Annotation` instance that contains the timestamp and content
/// to be displayed.
///
/// # Returns
///
/// - A `LinearLayout` containing the formatted text elements.
///
/// # Examples
///
/// ```
/// let annotation = Annotation {
/// content: "This is an example annotation.".to_string(),
/// created_at: 1632172800000, // Timestamp in milliseconds
/// };
///
/// let annotation_layout = build_annotation_text(&annotation);
/// ```
/// Builds a scrollable layout for displaying a list of annotations.
///
/// This function creates a scrollable view that presents a list of annotations in a user-friendly
/// format. The layout includes a message for when there are no annotations, and for each annotation
/// in the list, it includes a formatted text layout created using the `build_annotation_text` function.
///
/// # Arguments
///
/// - `annotations`: A reference to a slice of `Annotation` instances representing the list of
/// annotations to be displayed.
///
/// # Returns
///
/// - A `ScrollView<LinearLayout>` containing the formatted annotations and optional messages.
///
/// # Examples
///
/// ```
/// let annotations: Vec<Annotation> = vec![
/// Annotation {
/// content: "This is an example annotation 1.".to_string(),
/// created_at: 1632172800000,
/// },
/// Annotation {
/// content: "This is an example annotation 2.".to_string(),
/// created_at: 1632172900000,
/// },
/// ];
///
/// let annotations_layout = build_annotations_layout(&annotations);
/// ```
/// Runs the Text User Interface (TUI) for annotating and displaying a list of annotations.
///
/// This function initializes and runs a Cursive-based Text User Interface (TUI) to interactively
/// annotate and display a list of annotations. It creates a user-friendly interface that includes
/// a list of annotations with timestamps and content.
///
/// # Arguments
///
/// - `annotations`: A vector of `Annotation` instances representing the list of annotations to be displayed
/// and interacted with in the TUI.
///
/// # Examples
///
/// ```
/// let annotations: Vec<Annotation> = vec![
/// Annotation {
/// content: "This is an example annotation 1.".to_string(),
/// created_at: 1632172800000,
/// },
/// Annotation {
/// content: "This is an example annotation 2.".to_string(),
/// created_at: 1632172900000,
/// },
/// ];
///
/// run_annotate_tui(annotations);
/// ```