src/structs/apphistory.rs

46e7ed5b32a7417aabe4491e60a597344597d330
youtube-tui/src/structs/apphistory.rs history · blame · raw

39 lines · 987 bytes

 1use std::sync::{Arc, Mutex};
 2
 3use invidious::blocking::Client;
 4
 5use crate::{
 6    app::app::App,
 7    structs::{Page, Row},
 8};
 9
10#[derive(Debug, Clone)]
11pub struct AppHistory {
12    pub page: Page,
13    pub state: Vec<Row>, // Item
14    pub selectable: Vec<Vec<(usize, usize)>>,
15    pub hover: Option<(usize, usize)>, // x, y
16    pub selected: Option<(usize, usize)>,
17    pub client: Client,
18    pub message: Arc<Mutex<Option<String>>>,
19    pub load: bool,
20    pub render: bool,
21    pub popup_focus: bool,
22}
23
24impl From<App> for AppHistory {
25    fn from(original: App) -> Self {
26        Self {
27            page: original.page,
28            state: original.state,
29            selectable: original.selectable,
30            hover: original.hover,
31            selected: original.selected,
32            client: original.client,
33            message: original.message,
34            load: original.load,
35            render: original.render,
36            popup_focus: original.popup_focus,
37        }
38    }
39}