mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-01-17 23:34:19 +01:00
tidy: move ColumnKind to its own file
timeline file is starting to get messy Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
45
src/column.rs
Normal file
45
src/column.rs
Normal file
@@ -0,0 +1,45 @@
|
||||
use enostr::Pubkey;
|
||||
use std::fmt::Display;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum PubkeySource {
|
||||
Explicit(Pubkey),
|
||||
DeckAuthor,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ListKind {
|
||||
Contact(PubkeySource),
|
||||
}
|
||||
|
||||
///
|
||||
/// What kind of column is it?
|
||||
/// - Follow List
|
||||
/// - Notifications
|
||||
/// - DM
|
||||
/// - filter
|
||||
/// - ... etc
|
||||
#[derive(Debug)]
|
||||
pub enum ColumnKind {
|
||||
List(ListKind),
|
||||
Universe,
|
||||
|
||||
/// Generic filter
|
||||
Generic,
|
||||
}
|
||||
|
||||
impl Display for ColumnKind {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
ColumnKind::List(ListKind::Contact(_src)) => f.write_str("Contacts"),
|
||||
ColumnKind::Generic => f.write_str("Timeline"),
|
||||
ColumnKind::Universe => f.write_str("Universe"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ColumnKind {
|
||||
pub fn contact_list(pk: PubkeySource) -> Self {
|
||||
ColumnKind::List(ListKind::Contact(pk))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user