Skip to content

Commit

Permalink
feat: ui for startup commands
Browse files Browse the repository at this point in the history
  • Loading branch information
BrewingWeasel committed Nov 8, 2023
1 parent 20ceaad commit 5819db0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src-ui/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pub fn SettingsChanger(settings: Resource<(), Settings>) -> impl IntoView {
let (note_fields, set_note_fields) = create_signal(old_settings.note_fields);

let (css, set_css) = create_signal(old_settings.css.unwrap_or_default());
let (commands, set_commands) =
create_signal(old_settings.to_run.unwrap_or_default().join("\n"));

let new_dicts = old_settings
.dicts
Expand Down Expand Up @@ -113,6 +115,12 @@ pub fn SettingsChanger(settings: Resource<(), Settings>) -> impl IntoView {
<SimpleTextAreaSetting readsig=css writesig=set_css name="css" desc="Css Styling"/>
<hr/>

<hr/>
<h2>Automatically run commands</h2>
<p>Be very very careful with what you put in here</p>
<SimpleTextAreaSetting readsig=commands writesig=set_commands name="commands" desc="Commands to run on launch"/>
<hr/>

<button
class="parsebutton"
on:click=move |_| {
Expand All @@ -124,6 +132,7 @@ pub fn SettingsChanger(settings: Resource<(), Settings>) -> impl IntoView {
updater.note_type = note();
updater.note_fields = note_fields();
updater.css = if css().is_empty() { None } else { Some(css()) };
updater.to_run = if commands().is_empty() { None } else { Some(commands().split('\n').map(|v| v.to_string()).collect()) };
updater.dicts = dicts().iter().map(|(_, (r, _))| r()).collect();
let mut updated_templates = HashMap::new();
for (_, (readdeck, _)) in templates() {
Expand Down

0 comments on commit 5819db0

Please sign in to comment.