mirror of
https://github.com/Xithrius/twitch-tui.git
synced 2024-10-04 09:07:33 +03:00
start_screen_channels
-> favorite_channels
This commit is contained in:
parent
319dd347e4
commit
afb64229ad
@ -80,9 +80,9 @@ twitch_emotes = false
|
||||
betterttv_emotes = false
|
||||
# If 7tv emotes should be displayed (requires kitty terminal).
|
||||
seventv_emotes = false
|
||||
# Comma-separated channel names to be displayed at start screen
|
||||
# Channel names to always be displayed in the start screen (dashboard).
|
||||
# Example: ["Xithrius", "RocketLeague", "AntVenom"]
|
||||
start_screen_channels = []
|
||||
favorite_channels = []
|
||||
# What style the border of the terminal should have.
|
||||
# Options: plain, rounded, double, and thick.
|
||||
border_type = "plain"
|
||||
|
@ -122,8 +122,8 @@ pub struct FrontendConfig {
|
||||
pub betterttv_emotes: bool,
|
||||
/// If 7tv emotes should be displayed (requires kitty terminal).
|
||||
pub seventv_emotes: bool,
|
||||
/// Comma-separated channel names to be displayed at start screen.
|
||||
pub start_screen_channels: Vec<String>,
|
||||
/// Channels to always be displayed in the start screen.
|
||||
pub favorite_channels: Vec<String>,
|
||||
/// A border wrapper around [`BorderType`].
|
||||
pub border_type: Border,
|
||||
/// If the usernames should be aligned to the right.
|
||||
@ -173,7 +173,7 @@ impl Default for FrontendConfig {
|
||||
twitch_emotes: false,
|
||||
betterttv_emotes: false,
|
||||
seventv_emotes: false,
|
||||
start_screen_channels: vec![],
|
||||
favorite_channels: vec![],
|
||||
border_type: Border::default(),
|
||||
right_align_usernames: false,
|
||||
}
|
||||
|
@ -118,8 +118,7 @@ impl DashboardWidget {
|
||||
frame.render_widget(current_channel_selection, *v_chunks.next().unwrap());
|
||||
|
||||
frame.render_widget(
|
||||
Paragraph::new("Configured default channels")
|
||||
.style(Style::default().fg(Color::LightRed)),
|
||||
Paragraph::new("Favorite channels").style(Style::default().fg(Color::LightRed)),
|
||||
*v_chunks.next().unwrap(),
|
||||
);
|
||||
|
||||
@ -166,8 +165,7 @@ impl DashboardWidget {
|
||||
|
||||
impl Component for DashboardWidget {
|
||||
fn draw<B: Backend>(&mut self, f: &mut Frame<B>, area: Rect, emotes: Option<&mut Emotes>) {
|
||||
let start_screen_channels_len =
|
||||
self.config.borrow().frontend.start_screen_channels.len() as u16;
|
||||
let favorite_channels_len = self.config.borrow().frontend.favorite_channels.len() as u16;
|
||||
|
||||
let recent_channels_len = self.storage.borrow().get("channels").len() as u16;
|
||||
|
||||
@ -189,9 +187,9 @@ impl Component for DashboardWidget {
|
||||
// Currently selected channel title, content
|
||||
Constraint::Length(2),
|
||||
Constraint::Length(2),
|
||||
// Configured default channels title, content
|
||||
// Favorite channels title, content
|
||||
Constraint::Length(2),
|
||||
Constraint::Length(channel_list_constrainer(start_screen_channels_len)),
|
||||
Constraint::Length(channel_list_constrainer(favorite_channels_len)),
|
||||
// Recent channel title, content
|
||||
Constraint::Length(2),
|
||||
Constraint::Length(channel_list_constrainer(recent_channels_len)),
|
||||
@ -209,7 +207,7 @@ impl Component for DashboardWidget {
|
||||
f,
|
||||
&mut v_chunks,
|
||||
self.config.borrow().twitch.channel.clone(),
|
||||
&self.config.borrow().frontend.start_screen_channels.clone(),
|
||||
&self.config.borrow().frontend.favorite_channels.clone(),
|
||||
);
|
||||
|
||||
self.render_quit_selection_widget(f, &mut v_chunks);
|
||||
@ -240,13 +238,11 @@ impl Component for DashboardWidget {
|
||||
Key::Char('?' | 'h') => return Some(TerminalAction::SwitchState(State::Help)),
|
||||
Key::Char(c) => {
|
||||
if let Some(selection) = c.to_digit(10) {
|
||||
let mut channels =
|
||||
self.config.borrow().frontend.start_screen_channels.clone();
|
||||
channels.extend(self.storage.borrow().get_last_n(
|
||||
"channels",
|
||||
CHANNEL_LIST_AMOUNT as usize,
|
||||
true,
|
||||
));
|
||||
let mut channels = self.config.borrow().frontend.favorite_channels.clone();
|
||||
let mut selected_channels = self.storage.borrow().get("channels");
|
||||
selected_channels.reverse();
|
||||
|
||||
channels.extend(selected_channels);
|
||||
|
||||
if let Some(channel) = channels.get(selection as usize) {
|
||||
let action =
|
||||
|
Loading…
Reference in New Issue
Block a user