src/structs/apphistory.rs

2a2a2fa4a5238515d8e2b21c975824c74f72606c
youtube-tui/src/structs/apphistory.rs history · blame · raw

37 lines · 913 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}
22
23impl From<App> for AppHistory {
24    fn from(original: App) -> Self {
25        Self {
26            page: original.page,
27            state: original.state,
28            selectable: original.selectable,
29            hover: original.hover,
30            selected: original.selected,
31            client: original.client,
32            message: original.message,
33            load: original.load,
34            render: original.render,
35        }
36    }
37}