src/structs/apphistory.rs

2737f153106b44565bbbab1d0b08ab3067071283
youtube-tui/src/structs/apphistory.rs history · blame · raw

47 lines · 1250 bytes

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