Skip to content

Commit

Permalink
chore(launchpad): update text and logic for reset if discord_id change
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandSherwin committed Jun 4, 2024
1 parent 8430660 commit 2849220
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 4 additions & 4 deletions node-launchpad/src/components/beta_programme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ impl Component for BetaProgramme {
);
f.render_widget(input, layer_two[1]);

let text = Paragraph::new(" Changing the username will lead to loss of earned.\n rewards. The nodes will be restarted to reflect\n the change.");
let text = Paragraph::new(" Changing your Username will reset all nodes,\n and any Nanos left on this device will be\n lost.");
f.render_widget(text.fg(GHOST_WHITE), layer_two[2]);

let dash = Block::new()
Expand All @@ -240,8 +240,8 @@ impl Component for BetaProgramme {
f.render_widget(dash, layer_two[3]);

let buttons_layer = Layout::horizontal(vec![
Constraint::Percentage(50),
Constraint::Percentage(50),
Constraint::Percentage(55),
Constraint::Percentage(45),
])
.split(layer_two[4]);

Expand All @@ -257,7 +257,7 @@ impl Component for BetaProgramme {
Style::default().fg(EUCALYPTUS)
};
let button_yes = Line::from(vec![Span::styled(
"Modify Username [Enter]",
"Save Username [Enter]",
button_yes_style,
)]);
f.render_widget(button_yes, buttons_layer[1]);
Expand Down
10 changes: 4 additions & 6 deletions node-launchpad/src/components/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,12 @@ impl Component for Home {
}
}
Action::StoreDiscordUserName(username) => {
let reset_safenode_services = (self.discord_username != username)
&& !self.discord_username.is_empty()
&& !self.node_services.is_empty();
let has_changed = self.discord_username != username;
let we_have_nodes = !self.node_services.is_empty();

self.discord_username = username;

// todo: The discord_username popup should warn people that if nodes are running, they will be reset.
// And the earnings will be lost.
if reset_safenode_services {
if we_have_nodes && has_changed {
self.lock_registry = Some(LockRegistryState::ResettingNodes);
info!("Resetting safenode services because the discord username was reset.");
let action_sender = self.get_actions_sender()?;
Expand Down

0 comments on commit 2849220

Please sign in to comment.