diff --git a/components/Settings/AppSettings/Appearance.vue b/components/Settings/AppSettings/Appearance.vue index 1d93ed6..0668a4e 100644 --- a/components/Settings/AppSettings/Appearance.vue +++ b/components/Settings/AppSettings/Appearance.vue @@ -9,7 +9,7 @@
+ @click="changeTheme(styleLayout.style, style)">
+ @click="changeTheme(styleLayout.layout, layout)">
{ const metadataMatch = styleData.match(/\/\*([\s\S]*?)\*\//); if (!metadataMatch) { - alert(`Failed to fetch metadata for a theme, panicing`) + alert(`Failed to fetch metadata for a theme, panicking`) return } @@ -101,20 +101,20 @@ async function parseTheme(url: string): Promise { let previewImageUrl: string | undefined for (const line of commentContent) { - const line_array = line.split("=") - if (line_array.length === 2) { - switch (line_array[0].trim()) { + const lineArray = line.split("=") + if (lineArray.length === 2) { + switch (lineArray[0].trim()) { case "displayName": - displayName = line_array[1].trim() + displayName = lineArray[1].trim() break case "complementaryColor": - complementaryColor = line_array[1].trim() + complementaryColor = lineArray[1].trim() break case "previewGradient": - previewGradient = line_array[1].trim() + previewGradient = lineArray[1].trim() break case "previewImageUrl": - previewImageUrl = `${layoutFolder}/${line_array[1].trim()}` + previewImageUrl = `${layoutFolder}/${lineArray[1].trim()}` break } } @@ -137,8 +137,8 @@ async function parseTheme(url: string): Promise { async function parseThemeLayout( folder: string, - incomingThemeList: Array, - outputThemeList: Array) { + incomingThemeList: string[], + outputThemeList: Theme[]) { for (const theme of incomingThemeList) { const parsedThemeData = await parseTheme(`${folder}/${theme}`) @@ -148,11 +148,11 @@ async function parseThemeLayout( } } -const styles: Array = []; -const layouts: Array = []; +const styles: Theme[] = []; +const layouts: Theme[] = []; -const styleList: any = await $fetch(`${styleFolder}/styles.json`) -const layoutList: any = await $fetch(`${layoutFolder}/layouts.json`) +const styleList = await $fetch(`${styleFolder}/styles.json`) +const layoutList = await $fetch(`${layoutFolder}/layouts.json`) if (Array.isArray(styleList)) { await parseThemeLayout(styleFolder, styleList, styles) @@ -161,8 +161,8 @@ if (Array.isArray(layoutList)) { await parseThemeLayout(layoutFolder, layoutList, layouts) } -function changeTheme(themeType: StyleLayout, theme: Theme) { - if (themeType == StyleLayout.style) { +function changeTheme(themeType: styleLayout, theme: Theme) { + if (themeType == styleLayout.style) { settingSave("selectedThemeStyle", theme.themeUrl) } else { settingSave("selectedThemeLayout", theme.themeUrl)