Chore: formatting

This commit is contained in:
Pieter Vander Vennet 2023-05-07 23:54:31 +02:00
parent 867cb4dcfb
commit e99485d697
2 changed files with 22 additions and 23 deletions

View file

@ -1,17 +1,17 @@
import Svg from "../../Svg" import Svg from "../../Svg"
import Combine from "../Base/Combine" import Combine from "../Base/Combine"
import {SubtleButton} from "../Base/SubtleButton" import { SubtleButton } from "../Base/SubtleButton"
import Translations from "../i18n/Translations" import Translations from "../i18n/Translations"
import BaseUIElement from "../BaseUIElement" import BaseUIElement from "../BaseUIElement"
import LayoutConfig, {LayoutInformation} from "../../Models/ThemeConfig/LayoutConfig" import LayoutConfig, { LayoutInformation } from "../../Models/ThemeConfig/LayoutConfig"
import {ImmutableStore, Store, UIEventSource} from "../../Logic/UIEventSource" import { ImmutableStore, Store, UIEventSource } from "../../Logic/UIEventSource"
import Loc from "../../Models/Loc" import Loc from "../../Models/Loc"
import UserRelatedState from "../../Logic/State/UserRelatedState" import UserRelatedState from "../../Logic/State/UserRelatedState"
import {Utils} from "../../Utils" import { Utils } from "../../Utils"
import Title from "../Base/Title" import Title from "../Base/Title"
import themeOverview from "../../assets/generated/theme_overview.json" import themeOverview from "../../assets/generated/theme_overview.json"
import {Translation} from "../i18n/Translation" import { Translation } from "../i18n/Translation"
import {TextField} from "../Input/TextField" import { TextField } from "../Input/TextField"
import Locale from "../i18n/Locale" import Locale from "../i18n/Locale"
import SvelteUIElement from "../Base/SvelteUIElement" import SvelteUIElement from "../Base/SvelteUIElement"
import ThemesList from "./ThemesList.svelte" import ThemesList from "./ThemesList.svelte"
@ -37,7 +37,7 @@ export default class MoreScreen extends Combine {
searchTerm = searchTerm.toLowerCase() searchTerm = searchTerm.toLowerCase()
if (searchTerm === "personal") { if (searchTerm === "personal") {
window.location.href = MoreScreen.createUrlFor( window.location.href = MoreScreen.createUrlFor(
{id: "personal"}, { id: "personal" },
false, false,
state state
).data ).data
@ -142,7 +142,7 @@ export default class MoreScreen extends Combine {
content = new Combine([content]).SetClass("flex flex-col justify-center h-24") content = new Combine([content]).SetClass("flex flex-col justify-center h-24")
} }
return new SubtleButton(layout.icon, content, {url, newTab: false}) return new SubtleButton(layout.icon, content, { url, newTab: false })
} }
public static CreateProffessionalSerivesButton() { public static CreateProffessionalSerivesButton() {
@ -150,31 +150,30 @@ export default class MoreScreen extends Combine {
return new Combine([ return new Combine([
new Title(t.hook, 4), new Title(t.hook, 4),
t.hookMore, t.hookMore,
new SubtleButton(undefined, t.button, {url: "./professional.html"}), new SubtleButton(undefined, t.button, { url: "./professional.html" }),
]).SetClass("flex flex-col border border-gray-300 p-2 rounded-lg") ]).SetClass("flex flex-col border border-gray-300 p-2 rounded-lg")
} }
public static MatchesLayout(layout: { public static MatchesLayout(
id: string layout: {
title: any id: string
shortDescription: any title: any
keywords?: any[] shortDescription: any
}, search: string): boolean { keywords?: any[]
if(search === undefined){ },
search: string
): boolean {
if (search === undefined) {
return true return true
} }
search = search.toLocaleLowerCase() search = search.toLocaleLowerCase()
if (search.length > 3 && layout.id.toLowerCase().indexOf(search) >= 0) { if (search.length > 3 && layout.id.toLowerCase().indexOf(search) >= 0) {
return true return true
} }
if(layout.id === "personal"){ if (layout.id === "personal") {
return false return false
} }
const entitiesToSearch = [ const entitiesToSearch = [layout.shortDescription, layout.title, ...(layout.keywords ?? [])]
layout.shortDescription,
layout.title,
...(layout.keywords ?? []),
]
for (const entity of entitiesToSearch) { for (const entity of entitiesToSearch) {
if (entity === undefined) { if (entity === undefined) {
continue continue

View file

@ -9,7 +9,7 @@
import ProfessionalServicesButton from "./ProfessionalServicesButton.svelte" import ProfessionalServicesButton from "./ProfessionalServicesButton.svelte"
import ThemeButton from "./ThemeButton.svelte" import ThemeButton from "./ThemeButton.svelte"
import { LayoutInformation } from "../../Models/ThemeConfig/LayoutConfig" import { LayoutInformation } from "../../Models/ThemeConfig/LayoutConfig"
import MoreScreen from "./MoreScreen"; import MoreScreen from "./MoreScreen"
export let search: UIEventSource<string> export let search: UIEventSource<string>
export let themes: LayoutInformation[] export let themes: LayoutInformation[]