kjuulh
20190ac784
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
62 lines
1.1 KiB
Rust
62 lines
1.1 KiB
Rust
use hyperlog_core::log::GraphItem;
|
|
|
|
use crate::commands::{Command, IntoCommand};
|
|
|
|
#[derive(Debug)]
|
|
pub enum Msg {
|
|
MoveRight,
|
|
MoveLeft,
|
|
MoveDown,
|
|
MoveUp,
|
|
QuitApp,
|
|
OpenCreateItemDialog,
|
|
OpenCreateItemDialogBelow,
|
|
OpenEditItemDialog { item: GraphItem },
|
|
OpenEditor { item: GraphItem },
|
|
Interact,
|
|
|
|
EnterInsertMode,
|
|
EnterViewMode,
|
|
EnterCommandMode,
|
|
|
|
SubmitCommand { command: String },
|
|
|
|
Edit(EditMsg),
|
|
|
|
GraphUpdated(IOEvent<GraphItem>),
|
|
ItemCreated(IOEvent<()>),
|
|
ItemUpdated(IOEvent<()>),
|
|
SectionCreated(IOEvent<()>),
|
|
ItemToggled(IOEvent<()>),
|
|
Archive(IOEvent<()>),
|
|
|
|
OpenUpdateItemDialog(IOEvent<()>),
|
|
|
|
OpenItem(IOEvent<()>),
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub enum IOEvent<T> {
|
|
Initialized,
|
|
Optimistic(T),
|
|
Success(T),
|
|
Failure(String),
|
|
}
|
|
|
|
impl IntoCommand for Msg {
|
|
fn into_command(self) -> crate::commands::Command {
|
|
Command::new(|_| Some(self))
|
|
}
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub enum EditMsg {
|
|
Delete,
|
|
InsertNewLine,
|
|
InsertTab,
|
|
DeleteNext,
|
|
InsertChar(char),
|
|
MoveLeft,
|
|
MoveRight,
|
|
}
|