timeline: refactor tabs into TimelineView
TimelineView is a filtered view of a timeline. We will use this for future tab rendering. We also introduce a new "selection" concept for selecting notes on different timeline views. This is in preparation for vim keybindings.
This commit is contained in:
@@ -1,15 +1,21 @@
|
||||
use crate::time::time_ago_since;
|
||||
use crate::timecache::TimeCached;
|
||||
use nostrdb::{Note, NoteReply, NoteReplyBuf};
|
||||
use nostrdb::{Note, NoteKey, NoteReply, NoteReplyBuf};
|
||||
use std::collections::HashMap;
|
||||
use std::time::Duration;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct NoteCache {
|
||||
pub cache: HashMap<NoteKey, CachedNote>,
|
||||
}
|
||||
|
||||
pub struct CachedNote {
|
||||
reltime: TimeCached<String>,
|
||||
pub reply: NoteReplyBuf,
|
||||
pub bar_open: bool,
|
||||
}
|
||||
|
||||
impl NoteCache {
|
||||
impl CachedNote {
|
||||
pub fn new(note: &Note<'_>) -> Self {
|
||||
let created_at = note.created_at();
|
||||
let reltime = TimeCached::new(
|
||||
@@ -18,7 +24,7 @@ impl NoteCache {
|
||||
);
|
||||
let reply = NoteReply::new(note.tags()).to_owned();
|
||||
let bar_open = false;
|
||||
NoteCache {
|
||||
CachedNote {
|
||||
reltime,
|
||||
reply,
|
||||
bar_open,
|
||||
|
||||
Reference in New Issue
Block a user