Skip to content

Commit

Permalink
Daily push
Browse files Browse the repository at this point in the history
  • Loading branch information
elsoazemelet committed Apr 16, 2024
1 parent 3900e55 commit c82b957
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/renderer/config-blocks/ActionBlockInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ interface Information {
hideIcon: boolean;
rounding?: "top" | "bottom";
compositeLua?: LuaScript[];
syntaxPreprocessor?: string;
}
6 changes: 4 additions & 2 deletions src/renderer/main/panels/configuration/Configuration.store.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ const luaminOptions = {
};

export class ConfigObject {
constructor({ short, script }) {
constructor({ short, script, scriptForSyntaxCheck }) {
this.short = short;
this.script = script;
this.scriptForSyntaxCheck = scriptForSyntaxCheck ?? script;
this.id = uuidv4();

let res = getComponentInformation({ short: short });
Expand Down Expand Up @@ -100,6 +101,7 @@ export class ConfigObject {
//TODO: Rework composite blocks in a way, so this exception
//does not occure.
let code = this.script;
/*
if (this.short !== "cb" && !this.short.startsWith("x")) {
if (code.startsWith("elseif")) {
code = code.replace("elseif", "if");
Expand All @@ -117,7 +119,7 @@ export class ConfigObject {
if (this.short === "raw") {
return true;
}
}
}*/

try {
//Is this necessary?
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/main/panels/configuration/Configuration.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@
}
function handleConfigUpdate(e) {
const { index, short, script } = e.detail;
updateAction(index, short, script);
const { index, config } = e.detail;
updateAction(index, config);
sendCurrentConfigurationToGrid();
const target = ConfigTarget.getCurrent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@
}
function handleOutput(e) {
const { short, script, scriptForSyntaxCheck } = e.detail;
dispatch("update", {
index: index,
short: e.detail.short,
script: e.detail.script,
config: new ConfigObject({
short: short,
script: script,
scriptForSyntaxCheck: scriptForSyntaxCheck,
}),
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,14 @@ export function insertAction(
}
}

export function updateAction(index: number, short: string, script: string) {
export function updateAction(index: number, newConfig: ConfigObject) {
const { short, script, scriptForSyntaxCheck } = newConfig;
configManager.update((s: ConfigList) => {
const config = s[index];
if (typeof config !== "undefined") {
config.short = short;
config.script = script;
config.scriptForSyntaxCheck = scriptForSyntaxCheck;
}
return s;
});
Expand Down

0 comments on commit c82b957

Please sign in to comment.