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 LayerConfig from "../../Models/ThemeConfig/LayerConfig"
|
||||
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 LinkToWeblate from "../../UI/Base/LinkToWeblate"
|
||||
import FeatureSwitchState from "./FeatureSwitchState"
|
||||
|
@ -21,6 +21,9 @@ import Constants from "../../Models/Constants";
|
|||
* which layers they enabled, ...
|
||||
*/
|
||||
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
|
||||
*/
|
||||
|
@ -29,15 +32,10 @@ export default class UserRelatedState {
|
|||
* The key for mangrove
|
||||
*/
|
||||
public readonly mangroveIdentity: MangroveIdentity
|
||||
|
||||
public readonly installedUserThemes: Store<string[]>
|
||||
|
||||
public readonly showAllQuestionsAtOnce: UIEventSource<boolean>
|
||||
public readonly showTags: UIEventSource<"no" | undefined | "always" | "yes">;
|
||||
|
||||
|
||||
public readonly homeLocation: FeatureSource
|
||||
|
||||
/**
|
||||
* The number of seconds that the GPS-locations are stored in memory.
|
||||
* Time in seconds
|
||||
|
@ -46,18 +44,11 @@ export default class UserRelatedState {
|
|||
7 * 24 * 60 * 60,
|
||||
"gps_location_retention"
|
||||
)
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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(
|
||||
osmConnection: OsmConnection,
|
||||
|
@ -107,6 +98,18 @@ export default class UserRelatedState {
|
|||
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):
|
||||
| {
|
||||
id: string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue