Save layoutconfigJSON as preferences, the are saved in the morescreen

This commit is contained in:
Pieter Vander Vennet 2022-02-14 15:41:14 +01:00
parent c874afc745
commit 6cb5803efd
6 changed files with 44 additions and 10 deletions

View file

@ -406,12 +406,31 @@ class AddDependencyLayersToTheme extends DesugaringStep<LayoutConfigJson> {
}
}
class PreparePersonalTheme extends DesugaringStep<LayoutConfigJson> {
private readonly _state: DesugaringContext;
constructor(state: DesugaringContext) {
super("Adds every public layer to the personal theme",["layers"],"PreparePersonalTheme");
this._state = state;
}
convert(json: LayoutConfigJson, context: string): { result: LayoutConfigJson; errors?: string[]; warnings?: string[]; information?: string[] } {
if(json.id !== "personal"){
return {result: json}
}
json.layers = Array.from(this._state.sharedLayers.keys())
return {result: json};
}
}
export class PrepareTheme extends Fuse<LayoutConfigJson> {
constructor(state: DesugaringContext) {
super(
"Fully prepares and expands a theme",
new PreparePersonalTheme(state),
new OnEveryConcat("layers", new SubstituteLayer(state)),
new SetDefault("socialImage", "assets/SocialImage.png", true),
new OnEvery("layers", new PrepareLayer(state)),

View file

@ -105,8 +105,9 @@ export default class FilterConfig {
if(this.options.length > 1){
defaultValue = ""+this.defaultSelection
}else{
// Only a single option
if(this.defaultSelection > 0){
defaultValue = ""+this.defaultSelection
defaultValue = "true"
}
}
const qp = QueryParameters.GetQueryParameter("filter-" + this.id, defaultValue, "State of filter " + this.id)