wip: rename phrase

This commit is contained in:
🪞👃🪞 2024-10-11 10:18:09 +03:00
parent db2a2efa63
commit 4081c23aea
2 changed files with 21 additions and 2 deletions

View file

@ -52,7 +52,18 @@ impl Content for PhrasePool<Tui> {
} else {
color //Color::Rgb(28, 35, 25)
}))?;
if self.focused && i == self.phrase { add(&CORNERS)?; }
match self.mode {
None => {
if self.focused && i == self.phrase { add(&CORNERS)?; }
},
Some(PhrasePoolMode::Rename(phrase)) => {
if self.focused && i == phrase {
add(&CORNERS)?;
add(&"Rename")?;
}
}
}
Ok(())
})
)
@ -104,6 +115,9 @@ impl Handle<Tui> for PhrasePool<Tui> {
let mut phrase = self.phrases[self.phrase].write().unwrap();
phrase.color = random_color();
},
key!(KeyCode::Char('n')) => { // change name
self.mode = Some(PhrasePoolMode::Rename(self.phrase));
},
_ => return Ok(None),
}
return Ok(Some(true))