allow to defer or abandon record, add buttons

[?]
Mar 1, 2025, 7:42 PM
D7A7MSIHJS3IAOLEPK52M4CZLDPLO7JB3Y62XACT2AM6UUCPQ6BAC

Dependencies

Change contents

  • replacement in crates/flowers_ui/src/main.rs at line 85
    [4.652][8.131:177]()
    record_msg: Option<text_editor::Content>,
    [4.652]
    [3.1403]
    record_msg: Option<RecordMsg>,
    }
    #[derive(Debug)]
    enum RecordMsg {
    Typing(text_editor::Content),
    Canceled { old_msg: String },
  • replacement in crates/flowers_ui/src/main.rs at line 111
    [8.230][8.230:240]()
    Save,
    [8.230]
    [4.735]
    DeferRecord,
    SaveRecord,
    AbandonRecord,
  • edit in crates/flowers_ui/src/main.rs at line 130
    [10.6718]
    [10.6718]
    Message::LoadedId(id) => {
    state.id = Some(*id);
    Task::none()
    }
  • replacement in crates/flowers_ui/src/main.rs at line 336
    [11.951][10.14006:14054](),[10.14006][10.14006:14054]()
    if state.record_msg.is_some() {
    [11.951]
    [10.14054]
    if repo.changed_files.is_empty() {
    info!("Trying to record with no changed files");
    } else if let Some(RecordMsg::Typing(_)) =
    state.record_msg.as_ref()
    {
  • replacement in crates/flowers_ui/src/main.rs at line 342
    [10.14127][10.14127:14254]()
    } else if repo.changed_files.is_empty() {
    info!("Trying to record with no changed files");
    [10.14127]
    [10.14254]
    return Task::none();
  • replacement in crates/flowers_ui/src/main.rs at line 344
    [10.14279][10.14279:14353]()
    state.record_msg = Some(text_editor::Content::new());
    [10.14279]
    [13.114]
    let content = match state.record_msg.take() {
    Some(RecordMsg::Canceled { old_msg }) => {
    text_editor::Content::with_text(&old_msg)
    }
    None | Some(RecordMsg::Typing(_)) => {
    text_editor::Content::new()
    }
    };
    state.record_msg = Some(RecordMsg::Typing(content));
  • replacement in crates/flowers_ui/src/main.rs at line 360
    [8.648][8.648:714]()
    if let Some(record_msg) = state.record_msg.as_mut() {
    [8.648]
    [8.714]
    if let Some(RecordMsg::Typing(record_msg)) =
    state.record_msg.as_mut()
    {
  • replacement in crates/flowers_ui/src/main.rs at line 367
    [8.782][10.14372:14465]()
    Message::Save => {
    if let Some(record_msg) = state.record_msg.as_ref() {
    [8.782]
    [9.1710]
    Message::SaveRecord => {
    if let Some(RecordMsg::Typing(record_msg)) =
    state.record_msg.as_ref()
    {
  • replacement in crates/flowers_ui/src/main.rs at line 372
    [9.1755][9.1755:1815]()
    if msg.chars().all(|c| c.is_whitespace()) {
    [9.1755]
    [10.14466]
    if msg.trim().is_empty() {
  • replacement in crates/flowers_ui/src/main.rs at line 395
    [10.14755][11.952:987](),[11.987][12.5534:5568]()
    Message::LoadedId(id) => {
    state.id = Some(*id);
    [10.14755]
    [11.1020]
    Message::DeferRecord => {
    if let Some(RecordMsg::Typing(record_msg)) =
    state.record_msg.as_ref()
    {
    let old_msg = record_msg.text();
    state.record_msg = if !old_msg.trim().is_empty() {
    Some(RecordMsg::Canceled { old_msg })
    } else {
    None
    };
    }
    Task::none()
    }
    Message::AbandonRecord => {
    if let Some(RecordMsg::Typing(_)) = state.record_msg.as_ref() {
    state.record_msg = None;
    }
  • edit in crates/flowers_ui/src/main.rs at line 501
    [4.2903]
    [4.2903]
    "a" => Some(Message::AddUntrackedFile),
  • replacement in crates/flowers_ui/src/main.rs at line 504
    [4.3009][6.7538:7598]()
    "a" => Some(Message::AddUntrackedFile),
    [4.3009]
    [7.2052]
    "r" => Some(Message::Record),
  • edit in crates/flowers_ui/src/main.rs at line 506
    [7.2107][8.1348:1398]()
    "r" => Some(Message::Record),
  • replacement in crates/flowers_ui/src/main.rs at line 513
    [8.1479][8.1479:1554]()
    "s" if mods == Modifiers::CTRL => Some(Message::Save),
    [8.1479]
    [8.1554]
    "a" if mods == Modifiers::CTRL => {
    Some(Message::AbandonRecord)
    }
    "d" if mods == Modifiers::CTRL => {
    Some(Message::DeferRecord)
    }
    "s" if mods == Modifiers::CTRL => Some(Message::SaveRecord),
  • replacement in crates/flowers_ui/src/main.rs at line 530
    [10.16523][10.16523:16682]()
    let repo_info = Element::from(row([
    Element::from(text(&repo.dir_name)),
    Element::from(text(": ")),
    Element::from(
    [10.16523]
    [10.16682]
    let repo_info = el(row([
    el(text(&repo.dir_name)),
    el(text(": ")),
    el(
  • replacement in crates/flowers_ui/src/main.rs at line 540
    [10.16864][10.16864:16938]()
    Element::from(column(repo.untracked_files.iter().enumerate().map(
    [10.16864]
    [5.7755]
    el(column(repo.untracked_files.iter().enumerate().map(
  • replacement in crates/flowers_ui/src/main.rs at line 545
    [5.7984][5.7984:8015]()
    Element::from(
    [5.7984]
    [5.8015]
    el(
  • replacement in crates/flowers_ui/src/main.rs at line 556
    [10.16967][10.16967:17039]()
    Element::from(column(repo.changed_files.iter().enumerate().map(
    [10.16967]
    [6.7599]
    el(column(repo.changed_files.iter().enumerate().map(
  • replacement in crates/flowers_ui/src/main.rs at line 561
    [4.3841][4.3841:3872]()
    Element::from(
    [4.3841]
    [6.7627]
    el(
  • replacement in crates/flowers_ui/src/main.rs at line 571
    [4.4169][10.17040:17203]()
    let log = Element::from(column(
    ["todo: commits"]
    .iter()
    .map(|hash| Element::from(text(*hash))),
    ));
    [4.4169]
    [10.17203]
    let log =
    el(column(["todo: commits"].iter().map(|hash| el(text(*hash)))));
  • replacement in crates/flowers_ui/src/main.rs at line 574
    [10.17204][10.17204:17593]()
    let record_msg_editor =
    if let Some(record_msg) = state.record_msg.as_ref() {
    Element::from(
    text_editor(record_msg)
    .placeholder("Type something here...")
    .on_action(Message::EditRecordMsg),
    )
    } else {
    Element::from(row([]))
    };
    [10.17204]
    [4.4170]
    let record_msg_editor = if let Some(RecordMsg::Typing(msg_content)) =
    state.record_msg.as_ref()
    {
    el(column([
    el(text_editor(msg_content)
    .placeholder("Type something here...")
    .on_action(Message::EditRecordMsg)),
    el(row([
    el(button(text("Save")).on_press(Message::SaveRecord)),
    el(button(text("Defer")).on_press(Message::DeferRecord)),
    el(button(text("Abandon"))
    .on_press(Message::AbandonRecord)),
    ])),
    ]))
    } else {
    el(row([]))
    };
  • replacement in crates/flowers_ui/src/main.rs at line 592
    [4.4171][10.17594:18274]()
    Element::from(row([
    Element::from(
    column([
    repo_info,
    Element::from(horizontal_rule(1)),
    Element::from(text("Untracked:")),
    untracked_files,
    Element::from(horizontal_rule(1)),
    Element::from(text("Changed:")),
    changed_files,
    Element::from(horizontal_rule(1)),
    log,
    ])
    .width(Length::FillPortion(1)),
    ),
    Element::from(
    column([record_msg_editor]).width(Length::FillPortion(1)),
    ),
    [4.4171]
    [10.18274]
    el(row([
    el(column([
    repo_info,
    el(horizontal_rule(1)),
    el(text("Untracked:")),
    untracked_files,
    el(horizontal_rule(1)),
    el(text("Changed:")),
    changed_files,
    el(horizontal_rule(1)),
    log,
    ])
    .width(Length::FillPortion(1))),
    el(column([record_msg_editor]).width(Length::FillPortion(1))),
  • replacement in crates/flowers_ui/src/main.rs at line 608
    [8.1953][10.18287:18334]()
    Element::from(text("Loading repo..."))
    [8.1953]
    [10.18334]
    el(text("Loading repo..."))
  • edit in crates/flowers_ui/src/main.rs at line 633
    [4.4777]
    [2.3333]
    }
    fn el<'a, E, M>(e: E) -> Element<'a, M>
    where
    E: Into<Element<'a, M>>,
    {
    e.into()