Skip to content

Commit 87b0d27

Browse files
authored
fix: apply biome fixes (#761)
1 parent 5032c0c commit 87b0d27

File tree

4 files changed

+72
-98
lines changed

4 files changed

+72
-98
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@
4747
"semver": "^7.6.0"
4848
},
4949
"private": true
50-
}
50+
}
+46-66
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,61 @@
11
import { t } from "i18next";
22
import React from "react";
33

4-
import {
5-
LATEST_RELEASE_URL,
6-
MARKETPLACE_VERSION,
7-
RELEASES_URL,
8-
} from "../../../constants";
4+
import { LATEST_RELEASE_URL, MARKETPLACE_VERSION, RELEASES_URL } from "../../../constants";
95
import { getMarkdownHTML } from "../../../logic/Utils";
106

117
async function fetchLatestReleaseInfo(): Promise<{
12-
version: string;
13-
changelog: string | null;
8+
version: string;
9+
changelog: string | null;
1410
} | null> {
15-
try {
16-
const result = await fetch(LATEST_RELEASE_URL);
17-
const resultJson = await result.json();
18-
const { body, tag_name, message } = resultJson;
19-
return body && tag_name && !message
20-
? {
21-
version: tag_name.replace("v", ""),
22-
changelog: await getMarkdownHTML(
23-
body.match(/## What's Changed([\s\S]*?)(\r\n\r|\n\n##)/)[1],
24-
"spicetify",
25-
"marketplace",
26-
),
27-
}
28-
: null;
29-
} catch (error) {
30-
console.error(error);
31-
return null;
32-
}
11+
try {
12+
const result = await fetch(LATEST_RELEASE_URL);
13+
const resultJson = await result.json();
14+
const { body, tag_name, message } = resultJson;
15+
return body && tag_name && !message
16+
? {
17+
version: tag_name.replace("v", ""),
18+
changelog: await getMarkdownHTML(body.match(/## What's Changed([\s\S]*?)(\r\n\r|\n\n##)/)[1], "spicetify", "marketplace")
19+
}
20+
: null;
21+
} catch (error) {
22+
console.error(error);
23+
return null;
24+
}
3325
}
3426

3527
function UpdateModal(): React.ReactElement {
36-
const [releaseInfo, setReleaseInfo] = React.useState<{
37-
version: string;
38-
changelog: string | null;
39-
} | null>(null);
28+
const [releaseInfo, setReleaseInfo] = React.useState<{
29+
version: string;
30+
changelog: string | null;
31+
} | null>(null);
4032

41-
React.useEffect(() => {
42-
fetchLatestReleaseInfo().then((releaseInfo) => setReleaseInfo(releaseInfo));
43-
}, []);
33+
React.useEffect(() => {
34+
fetchLatestReleaseInfo().then((releaseInfo) => setReleaseInfo(releaseInfo));
35+
}, []);
4436

45-
return (
46-
<div id="marketplace-update-container">
47-
<div id="marketplace-update-description">
48-
<h4>{t("updateModal.description")}</h4>
49-
<a href={`${RELEASES_URL}/tag/v${MARKETPLACE_VERSION}`}>
50-
{t("updateModal.currentVersion", { version: MARKETPLACE_VERSION })}
51-
</a>
52-
<a href={`${RELEASES_URL}/tag/v${releaseInfo?.version}`}>
53-
{t("updateModal.latestVersion", { version: releaseInfo?.version })}
54-
</a>
55-
</div>
56-
<hr />
57-
<div id="marketplace-update-whats-changed">
58-
<h3 className="marketplace-update-header">
59-
{t("updateModal.whatsChanged")}
60-
</h3>
61-
<details>
62-
<summary>{t("updateModal.seeChangelog")}</summary>
63-
<ul
64-
dangerouslySetInnerHTML={{ __html: releaseInfo?.changelog ?? "" }}
65-
/>
66-
</details>
67-
</div>
68-
<hr />
69-
<div id="marketplace-update-guide">
70-
<h3 className="marketplace-update-header">
71-
{t("updateModal.howToUpgrade")}
72-
</h3>
73-
<a href="https://github.com/spicetify/marketplace/wiki/Installation">
74-
{t("updateModal.viewGuide")}
75-
</a>
76-
</div>
77-
</div>
78-
);
37+
return (
38+
<div id="marketplace-update-container">
39+
<div id="marketplace-update-description">
40+
<h4>{t("updateModal.description")}</h4>
41+
<a href={`${RELEASES_URL}/tag/v${MARKETPLACE_VERSION}`}>{t("updateModal.currentVersion", { version: MARKETPLACE_VERSION })}</a>
42+
<a href={`${RELEASES_URL}/tag/v${releaseInfo?.version}`}>{t("updateModal.latestVersion", { version: releaseInfo?.version })}</a>
43+
</div>
44+
<hr />
45+
<div id="marketplace-update-whats-changed">
46+
<h3 className="marketplace-update-header">{t("updateModal.whatsChanged")}</h3>
47+
<details>
48+
<summary>{t("updateModal.seeChangelog")}</summary>
49+
<ul dangerouslySetInnerHTML={{ __html: releaseInfo?.changelog ?? "" }} />
50+
</details>
51+
</div>
52+
<hr />
53+
<div id="marketplace-update-guide">
54+
<h3 className="marketplace-update-header">{t("updateModal.howToUpgrade")}</h3>
55+
<a href="https://github.com/spicetify/marketplace/wiki/Installation">{t("updateModal.viewGuide")}</a>
56+
</div>
57+
</div>
58+
);
7959
}
8060

8161
export default UpdateModal;

src/constants.ts

+23-27
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
import { version } from "../package.json";
2-
import { TabItemConfig } from "./types/marketplace-types";
2+
import type { TabItemConfig } from "./types/marketplace-types";
33

44
export const MARKETPLACE_VERSION = version;
55

66
const STORAGE_KEY_PREFIX = "marketplace";
77
export const LOCALSTORAGE_KEYS = {
8-
installedExtensions: `${STORAGE_KEY_PREFIX}:installed-extensions`,
9-
installedSnippets: `${STORAGE_KEY_PREFIX}:installed-snippets`,
10-
installedThemes: `${STORAGE_KEY_PREFIX}:installed-themes`,
11-
activeTab: `${STORAGE_KEY_PREFIX}:active-tab`,
12-
tabs: `${STORAGE_KEY_PREFIX}:tabs`,
13-
sort: `${STORAGE_KEY_PREFIX}:sort`,
14-
// Theme installed store the localsorage key of the theme (e.g. marketplace:installed:NYRI4/Comfy-spicetify/user.css)
15-
themeInstalled: `${STORAGE_KEY_PREFIX}:theme-installed`,
16-
localTheme: `${STORAGE_KEY_PREFIX}:local-theme`,
17-
albumArtBasedColor: `${STORAGE_KEY_PREFIX}:albumArtBasedColors`,
18-
albumArtBasedColorMode: `${STORAGE_KEY_PREFIX}:albumArtBasedColorsMode`,
19-
albumArtBasedColorVibrancy: `${STORAGE_KEY_PREFIX}:albumArtBasedColorsVibrancy`,
20-
colorShift: `${STORAGE_KEY_PREFIX}:colorShift`,
8+
installedExtensions: `${STORAGE_KEY_PREFIX}:installed-extensions`,
9+
installedSnippets: `${STORAGE_KEY_PREFIX}:installed-snippets`,
10+
installedThemes: `${STORAGE_KEY_PREFIX}:installed-themes`,
11+
activeTab: `${STORAGE_KEY_PREFIX}:active-tab`,
12+
tabs: `${STORAGE_KEY_PREFIX}:tabs`,
13+
sort: `${STORAGE_KEY_PREFIX}:sort`,
14+
// Theme installed store the localsorage key of the theme (e.g. marketplace:installed:NYRI4/Comfy-spicetify/user.css)
15+
themeInstalled: `${STORAGE_KEY_PREFIX}:theme-installed`,
16+
localTheme: `${STORAGE_KEY_PREFIX}:local-theme`,
17+
albumArtBasedColor: `${STORAGE_KEY_PREFIX}:albumArtBasedColors`,
18+
albumArtBasedColorMode: `${STORAGE_KEY_PREFIX}:albumArtBasedColorsMode`,
19+
albumArtBasedColorVibrancy: `${STORAGE_KEY_PREFIX}:albumArtBasedColorsVibrancy`,
20+
colorShift: `${STORAGE_KEY_PREFIX}:colorShift`
2121
};
2222

2323
// Initalize topbar tabs
2424
// Data initalized in TabBar.js
2525
export const ALL_TABS: TabItemConfig[] = [
26-
{ name: "Extensions", enabled: true },
27-
{ name: "Themes", enabled: true },
28-
{ name: "Snippets", enabled: true },
29-
{ name: "Apps", enabled: true },
30-
{ name: "Installed", enabled: true },
26+
{ name: "Extensions", enabled: true },
27+
{ name: "Themes", enabled: true },
28+
{ name: "Snippets", enabled: true },
29+
{ name: "Apps", enabled: true },
30+
{ name: "Installed", enabled: true }
3131
];
3232

3333
// Max GitHub API items per page
@@ -39,16 +39,12 @@ export const CUSTOM_APP_PATH = "/marketplace";
3939
// Used in Card.tsx
4040
export const MAX_TAGS = 4;
4141

42-
export const SNIPPETS_PAGE_URL =
43-
"https://github.com/spicetify/marketplace/blob/main/src/resources/snippets.ts";
42+
export const SNIPPETS_PAGE_URL = "https://github.com/spicetify/marketplace/blob/main/src/resources/snippets.ts";
4443

45-
export const SNIPPETS_URL =
46-
"https://raw.githubusercontent.com/spicetify/marketplace/main/resources/snippets.json";
44+
export const SNIPPETS_URL = "https://raw.githubusercontent.com/spicetify/marketplace/main/resources/snippets.json";
4745

48-
export const BLACKLIST_URL =
49-
"https://raw.githubusercontent.com/spicetify/marketplace/main/resources/blacklist.json";
46+
export const BLACKLIST_URL = "https://raw.githubusercontent.com/spicetify/marketplace/main/resources/blacklist.json";
5047

5148
export const RELEASES_URL = "https://github.com/spicetify/marketplace/releases";
5249

53-
export const LATEST_RELEASE_URL =
54-
"https://api.github.com/repos/spicetify/marketplace/releases/latest";
50+
export const LATEST_RELEASE_URL = "https://api.github.com/repos/spicetify/marketplace/releases/latest";

src/logic/FetchRemotes.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,8 @@ export const fetchCssSnippets = async () => {
314314

315315
// Because the card component looks for an imageURL prop
316316
if (snip.preview) {
317-
snip.imageURL = snip.preview.startsWith("http")
318-
? snip.preview
319-
: `https://raw.githubusercontent.com/spicetify/marketplace/main/${snip.preview}`;
320-
delete snip.preview;
317+
snip.imageURL = snip.preview.startsWith("http") ? snip.preview : `https://raw.githubusercontent.com/spicetify/marketplace/main/${snip.preview}`;
318+
snip.preview = undefined;
321319
}
322320

323321
accum.push(snip);

0 commit comments

Comments
 (0)