chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2024-08-14 13:53:56 +02:00
parent f77570589d
commit 9b8a9337fd
111 changed files with 2911 additions and 1280 deletions

View file

@ -10,7 +10,7 @@ export class IdbLocalStorage {
public static Get<T>(
key: string,
options?: { defaultValue?: T; whenLoaded?: (t: T | null) => void },
options?: { defaultValue?: T; whenLoaded?: (t: T | null) => void }
): UIEventSource<T> {
if (IdbLocalStorage._sourceCache[key] !== undefined) {
return IdbLocalStorage._sourceCache[key]

View file

@ -143,14 +143,14 @@ export default class NameSuggestionIndex {
tags: Record<string, string>,
country: string[],
location?: [number, number],
options?:{
options?: {
/**
* If set, sort by frequency instead of alphabetically
*/
sortByFrequency: boolean
}
): Promise<Mapping[]> {
const mappings: (Mapping & {frequency: number})[] = []
const mappings: (Mapping & { frequency: number })[] = []
const frequencies = await NameSuggestionIndex.fetchFrequenciesFor(type, country)
for (const key in tags) {
if (key.startsWith("_")) {
@ -196,11 +196,11 @@ export default class NameSuggestionIndex {
// As such, it should be "true" but this is not supported
priorityIf: frequency > 0 ? new RegexTag("id", /.*/) : undefined,
searchTerms: { "*": [nsiItem.displayName, nsiItem.id] },
frequency: frequency ?? -1
frequency: frequency ?? -1,
})
}
}
if(options?.sortByFrequency){
if (options?.sortByFrequency) {
mappings.sort((a, b) => b.frequency - a.frequency)
}

View file

@ -17,7 +17,7 @@ export default class ThemeViewStateHashActor {
"The possible hashes are:",
"",
MenuState._menuviewTabs.map((tab) => "`menu:" + tab + "`").join(","),
MenuState._themeviewTabs.map((tab) => "`theme-menu:" + tab + "`").join(",")
MenuState._themeviewTabs.map((tab) => "`theme-menu:" + tab + "`").join(","),
]
/**