diff --git a/src/components/Card/Card.tsx b/src/components/Card/Card.tsx index 446bef9c..004ff736 100644 --- a/src/components/Card/Card.tsx +++ b/src/components/Card/Card.tsx @@ -1,7 +1,8 @@ import React, { Key } from "react"; import { withTranslation } from "react-i18next"; -import { CardItem, CardType, Config, SchemeIni, Snippet, VisualConfig } from "../../types/marketplace-types"; +import { t } from "i18next"; +import { CardItem, CardType, Config, SchemeIni, Snippet, VisualConfig } from "../../types/marketplace-types"; import { LOCALSTORAGE_KEYS, CUSTOM_APP_PATH, SNIPPETS_PAGE_URL } from "../../constants"; import { getLocalStorageDataFromKey, @@ -18,7 +19,6 @@ import { openModal } from "../../logic/LaunchModals"; import AuthorsDiv from "./AuthorsDiv"; import TagsDiv from "./TagsDiv"; import Button from "../Button"; -import { t } from "i18next"; const Spicetify = window.Spicetify; export type CardProps = { @@ -140,6 +140,16 @@ class Card extends React.Component initializeExtension(extensionKey)); + + const { current_theme: localTheme } = Spicetify.Config; + localStorage.setItem(LOCALSTORAGE_KEYS.localTheme, localTheme); + const installedTheme = localStorage.getItem(LOCALSTORAGE_KEYS.themeInstalled); + if (installedTheme) { + if (localTheme.toLocaleLowerCase() !== "marketplace") { + Spicetify.showNotification( + t("notifications.wrongLocalTheme"), + true, + 5000, + ); + return; + } + initializeTheme(installedTheme); + } })(); /** diff --git a/src/resources/locales/en.json b/src/resources/locales/en.json index 69eeb18a..121f4a18 100644 --- a/src/resources/locales/en.json +++ b/src/resources/locales/en.json @@ -114,6 +114,9 @@ "save": "Save", "colour_one": "colour", "colour_other": "colours", - "favourite": "favourite" + "favourite": "favourite", + "notifications": { + "wrongLocalTheme": "Please set current_theme in config-xpui.ini to 'marketplace' to install themes using the Marketplace." + } } } diff --git a/src/resources/locales/ru.json b/src/resources/locales/ru.json index ca451a4f..47929268 100644 --- a/src/resources/locales/ru.json +++ b/src/resources/locales/ru.json @@ -114,6 +114,9 @@ "save": "Сохранить", "colour_one": "цвет", "colour_other": "цвета", - "favourite": "избранное" + "favourite": "избранное", + "notifications": { + "wrongLocalTheme": "Пожалуйста, измените значение current_theme в config-xpui.ini на 'marketplace', чтобы устанавливать темы из Маркетплейса" + } } }