forked from MapComplete/MapComplete
Fix: build
This commit is contained in:
parent
5644c7a8b8
commit
29ee113e30
1 changed files with 43 additions and 40 deletions
|
@ -10,7 +10,7 @@ import translators from "../../assets/translators.json"
|
||||||
import codeContributors from "../../assets/contributors.json"
|
import codeContributors from "../../assets/contributors.json"
|
||||||
import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
|
import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
|
||||||
import {LayerConfigJson} from "../../Models/ThemeConfig/Json/LayerConfigJson"
|
import {LayerConfigJson} from "../../Models/ThemeConfig/Json/LayerConfigJson"
|
||||||
import usersettings from "../../assets/generated/layers/usersettings.json"
|
import usersettings from "../../assets/generated/usersettings.json"
|
||||||
import Locale from "../../UI/i18n/Locale"
|
import Locale from "../../UI/i18n/Locale"
|
||||||
import LinkToWeblate from "../../UI/Base/LinkToWeblate"
|
import LinkToWeblate from "../../UI/Base/LinkToWeblate"
|
||||||
import FeatureSwitchState from "./FeatureSwitchState"
|
import FeatureSwitchState from "./FeatureSwitchState"
|
||||||
|
@ -21,6 +21,9 @@ import Constants from "../../Models/Constants";
|
||||||
* which layers they enabled, ...
|
* which layers they enabled, ...
|
||||||
*/
|
*/
|
||||||
export default class UserRelatedState {
|
export default class UserRelatedState {
|
||||||
|
public static readonly usersettingsConfig = UserRelatedState.initUserRelatedState()
|
||||||
|
public static readonly availableUserSettingsIds: string[] =
|
||||||
|
UserRelatedState.usersettingsConfig?.tagRenderings?.map((tr) => tr.id) ?? []
|
||||||
/**
|
/**
|
||||||
The user credentials
|
The user credentials
|
||||||
*/
|
*/
|
||||||
|
@ -29,15 +32,10 @@ export default class UserRelatedState {
|
||||||
* The key for mangrove
|
* The key for mangrove
|
||||||
*/
|
*/
|
||||||
public readonly mangroveIdentity: MangroveIdentity
|
public readonly mangroveIdentity: MangroveIdentity
|
||||||
|
|
||||||
public readonly installedUserThemes: Store<string[]>
|
public readonly installedUserThemes: Store<string[]>
|
||||||
|
|
||||||
public readonly showAllQuestionsAtOnce: UIEventSource<boolean>
|
public readonly showAllQuestionsAtOnce: UIEventSource<boolean>
|
||||||
public readonly showTags: UIEventSource<"no" | undefined | "always" | "yes">;
|
public readonly showTags: UIEventSource<"no" | undefined | "always" | "yes">;
|
||||||
|
|
||||||
|
|
||||||
public readonly homeLocation: FeatureSource
|
public readonly homeLocation: FeatureSource
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of seconds that the GPS-locations are stored in memory.
|
* The number of seconds that the GPS-locations are stored in memory.
|
||||||
* Time in seconds
|
* Time in seconds
|
||||||
|
@ -46,18 +44,11 @@ export default class UserRelatedState {
|
||||||
7 * 24 * 60 * 60,
|
7 * 24 * 60 * 60,
|
||||||
"gps_location_retention"
|
"gps_location_retention"
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preferences as tags exposes many preferences and state properties as record.
|
* Preferences as tags exposes many preferences and state properties as record.
|
||||||
* This is used to bridge the internal state with the usersettings.json layerconfig file
|
* This is used to bridge the internal state with the usersettings.json layerconfig file
|
||||||
*/
|
*/
|
||||||
public readonly preferencesAsTags: UIEventSource<Record<string, string>>
|
public readonly preferencesAsTags: UIEventSource<Record<string, string>>
|
||||||
public static readonly usersettingsConfig = new LayerConfig(
|
|
||||||
<LayerConfigJson>usersettings,
|
|
||||||
"userinformationpanel"
|
|
||||||
)
|
|
||||||
public static readonly availableUserSettingsIds: string[] =
|
|
||||||
UserRelatedState.usersettingsConfig.tagRenderings.map((tr) => tr.id)
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
osmConnection: OsmConnection,
|
osmConnection: OsmConnection,
|
||||||
|
@ -107,6 +98,18 @@ export default class UserRelatedState {
|
||||||
this.preferencesAsTags = this.initAmendedPrefs(layout, featureSwitches)
|
this.preferencesAsTags = this.initAmendedPrefs(layout, featureSwitches)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static initUserRelatedState(): LayerConfig {
|
||||||
|
try{
|
||||||
|
|
||||||
|
return new LayerConfig(
|
||||||
|
<LayerConfigJson>usersettings,
|
||||||
|
"userinformationpanel"
|
||||||
|
)
|
||||||
|
}catch(e){
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public GetUnofficialTheme(id: string):
|
public GetUnofficialTheme(id: string):
|
||||||
| {
|
| {
|
||||||
id: string
|
id: string
|
||||||
|
|
Loading…
Reference in a new issue