Skip to content

Commit

Permalink
added messages for rate limiting + fixed sign up messages + added log…
Browse files Browse the repository at this point in the history
…ged in indicator to command palette + moved supabase variables to env to prevent misuse
  • Loading branch information
yashs662 committed Jul 21, 2023
1 parent 8e66080 commit 42cfbd4
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 95 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rust-kanban"
version = "0.7.0"
version = "0.7.1"
authors = ["Yash Sharma <yashs662@gmail.com>"]
edition = "2021"
license = "MIT"
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[![Crates.io](https://img.shields.io/crates/v/rust-kanban.svg)](https://crates.io/crates/rust-kanban)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fyashs662%2Frust_kanban.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fyashs662%2Frust_kanban?ref=badge_shield)

![rust_kanban](https://user-images.githubusercontent.com/66156000/232308620-3e96d818-81f3-4229-b58e-c09bc0b067e4.png)
## Kanban App for the terminal written in rust
Expand Down Expand Up @@ -102,6 +101,3 @@
![Matrix](https://user-images.githubusercontent.com/66156000/232308312-56cebb9f-eb93-4a20-8758-4a1e9db96c35.png)
- Cyberpunk
![Cyberpunk](https://user-images.githubusercontent.com/66156000/232308321-4eeec180-6f05-4b49-948a-1166792ad25e.png)

## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fyashs662%2Frust_kanban.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fyashs662%2Frust_kanban?ref=badge_large)
25 changes: 17 additions & 8 deletions src/app/app_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2498,7 +2498,7 @@ pub async fn handle_general_actions(app: &mut App, key: Key) -> AppReturn {
next_focus_key, prev_focus_key), None);
}
}
UiMode::LoadSave => {
UiMode::LoadLocalSave => {
app.load_save_prv(false);
app.dispatch(IoEvent::LoadLocalPreview).await;
}
Expand Down Expand Up @@ -2613,7 +2613,7 @@ pub async fn handle_general_actions(app: &mut App, key: Key) -> AppReturn {
next_focus_key, prev_focus_key), None);
}
}
UiMode::LoadSave => {
UiMode::LoadLocalSave => {
app.load_save_next(false);
app.dispatch(IoEvent::LoadLocalPreview).await;
}
Expand Down Expand Up @@ -2843,7 +2843,7 @@ pub async fn handle_general_actions(app: &mut App, key: Key) -> AppReturn {
AppReturn::Continue
}
UiMode::NewCard => handle_new_card_action(app),
UiMode::LoadSave => {
UiMode::LoadLocalSave => {
app.dispatch(IoEvent::LoadSaveLocal).await;
AppReturn::Continue
}
Expand Down Expand Up @@ -3057,13 +3057,22 @@ pub async fn handle_general_actions(app: &mut App, key: Key) -> AppReturn {
}
Action::DeleteCard => {
match app.state.ui_mode {
UiMode::LoadSave => {
UiMode::LoadLocalSave => {
// run delete task in background
app.dispatch(IoEvent::DeleteSave).await;
app.dispatch(IoEvent::DeleteLocalSave).await;
tokio::time::sleep(Duration::from_millis(IO_EVENT_WAIT_TIME)).await;
app.dispatch(IoEvent::LoadLocalPreview).await;
AppReturn::Continue
}
UiMode::LoadCloudSave => {
// run delete task in background
app.dispatch(IoEvent::DeleteCloudSave).await;
tokio::time::sleep(Duration::from_millis(IO_EVENT_WAIT_TIME)).await;
app.dispatch(IoEvent::GetCloudData).await;
tokio::time::sleep(Duration::from_millis(IO_EVENT_WAIT_TIME)).await;
app.dispatch(IoEvent::LoadCloudPreview).await;
AppReturn::Continue
}
_ => {
if !UiMode::view_modes().contains(&app.state.ui_mode) {
return AppReturn::Continue;
Expand Down Expand Up @@ -4675,7 +4684,7 @@ pub async fn handle_mouse_action(app: &mut App, mouse_action: Mouse) -> AppRetur
}
}
}
UiMode::LoadSave => {
UiMode::LoadLocalSave => {
if left_button_pressed {
if app.state.mouse_focus == Some(Focus::CloseButton) {
handle_go_to_prv_ui_mode(app);
Expand Down Expand Up @@ -4942,7 +4951,7 @@ async fn handle_main_menu_action(app: &mut App) -> AppReturn {
}
MainMenuItem::LoadSave => {
app.state.prev_ui_mode = Some(UiMode::MainMenu);
app.state.ui_mode = UiMode::LoadSave;
app.state.ui_mode = UiMode::LoadLocalSave;
}
}
}
Expand Down Expand Up @@ -5170,7 +5179,7 @@ pub async fn handle_go_to_previous_ui_mode(app: &mut App) -> AppReturn {
}
AppReturn::Continue
}
UiMode::LoadSave => {
UiMode::LoadLocalSave => {
app.state.load_save_state = ListState::default();
if app.state.prev_ui_mode == Some(app.state.ui_mode) {
app.state.ui_mode = UiMode::MainMenu;
Expand Down
12 changes: 6 additions & 6 deletions src/app/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub enum UiMode {
LogsOnly,
NewBoard,
NewCard,
LoadSave,
LoadLocalSave,
CreateTheme,
Login,
SignUp,
Expand Down Expand Up @@ -139,7 +139,7 @@ impl UiMode {
"Logs Only" => Some(UiMode::LogsOnly),
"New Board" => Some(UiMode::NewBoard),
"New Card" => Some(UiMode::NewCard),
"Load a Save" => Some(UiMode::LoadSave),
"Load a Save" => Some(UiMode::LoadLocalSave),
"Create Theme" => Some(UiMode::CreateTheme),
_ => None,
}
Expand All @@ -162,7 +162,7 @@ impl UiMode {
"LogsOnly" => Some(UiMode::LogsOnly),
"NewBoard" => Some(UiMode::NewBoard),
"NewCard" => Some(UiMode::NewCard),
"LoadSave" => Some(UiMode::LoadSave),
"LoadSave" => Some(UiMode::LoadLocalSave),
"CreateTheme" => Some(UiMode::CreateTheme),
_ => None,
}
Expand Down Expand Up @@ -212,7 +212,7 @@ impl UiMode {
Focus::CardDueDate,
Focus::SubmitButton,
],
UiMode::LoadSave => vec![Focus::Body],
UiMode::LoadLocalSave => vec![Focus::Body],
UiMode::CreateTheme => vec![Focus::ThemeEditor, Focus::SubmitButton, Focus::ExtraFocus],
UiMode::Login => vec![
Focus::Title,
Expand Down Expand Up @@ -308,7 +308,7 @@ impl UiMode {
ui_helper::render_new_board_form(rect, app);
}
UiMode::NewCard => ui_helper::render_new_card_form(rect, app),
UiMode::LoadSave => {
UiMode::LoadLocalSave => {
ui_helper::render_load_a_save(rect, app);
}
UiMode::CreateTheme => ui_helper::render_create_theme(rect, app),
Expand Down Expand Up @@ -338,7 +338,7 @@ impl fmt::Display for UiMode {
UiMode::LogsOnly => write!(f, "Logs Only"),
UiMode::NewBoard => write!(f, "New Board"),
UiMode::NewCard => write!(f, "New Card"),
UiMode::LoadSave => write!(f, "Load a Save (Local)"),
UiMode::LoadLocalSave => write!(f, "Load a Save (Local)"),
UiMode::CreateTheme => write!(f, "Create Theme"),
UiMode::Login => write!(f, "Login"),
UiMode::SignUp => write!(f, "Sign Up"),
Expand Down
Loading

0 comments on commit 42cfbd4

Please sign in to comment.