Refactor Prettier configuration to adhere to code style guidelines

This commit is contained in:
mauro 🤙
2024-09-15 14:46:10 +00:00
parent e7b4be867f
commit f71d765d16
91 changed files with 16139 additions and 25613 deletions

View File

@@ -1,4 +1,14 @@
export const LOGO_COLORS = [
"black", "blue", "brown", "buff", "indigo", "mantis", "orchid", "pink", "tangerine", "turqoise", "white", "yellow"
]
"black",
"blue",
"brown",
"buff",
"indigo",
"mantis",
"orchid",
"pink",
"tangerine",
"turqoise",
"white",
"yellow",
];

File diff suppressed because it is too large Load Diff

View File

@@ -1,46 +1,46 @@
export const releases: any = {
WindowsInstaller: "zen.installer.exe",
WindowsInstallerGeneric: "zen.installer-generic.exe",
WindowsZip: "zen.win-specific.zip",
WindowsZipGeneric: "zen.win-generic.zip",
WindowsInstaller: "zen.installer.exe",
WindowsInstallerGeneric: "zen.installer-generic.exe",
MacOS: "zen.macos-aarch64.dmg",
MacOSIntel: "zen.macos-x64.dmg",
WindowsZip: "zen.win-specific.zip",
WindowsZipGeneric: "zen.win-generic.zip",
Linux: "zen.linux-specific.tar.bz2",
LinuxGeneric: "zen.linux-generic.tar.bz2",
MacOS: "zen.macos-aarch64.dmg",
MacOSIntel: "zen.macos-x64.dmg",
LinuxAppImage: "zen-specific.AppImage",
LinuxAppImageGeneric: "zen-generic.AppImage",
Linux: "zen.linux-specific.tar.bz2",
LinuxGeneric: "zen.linux-generic.tar.bz2",
LinuxAppImage: "zen-specific.AppImage",
LinuxAppImageGeneric: "zen-generic.AppImage",
};
// platform
// -> arch
// -> file
export const releaseTree: any = {
windows: {
specific: {
installer: "WindowsInstaller",
portable: "WindowsZip",
},
generic: {
installer: "WindowsInstallerGeneric",
portable: "WindowsZipGeneric",
},
},
macos: {
generic: "MacOSIntel",
specific: "MacOS",
},
linux: {
specific: {
portable: "Linux",
appimage: "LinuxAppImage",
},
generic: {
portable: "LinuxGeneric",
appimage: "LinuxAppImageGeneric",
},
},
windows: {
specific: {
installer: "WindowsInstaller",
portable: "WindowsZip",
},
generic: {
installer: "WindowsInstallerGeneric",
portable: "WindowsZipGeneric",
},
},
macos: {
generic: "MacOSIntel",
specific: "MacOS",
},
linux: {
specific: {
portable: "Linux",
appimage: "LinuxAppImage",
},
generic: {
portable: "LinuxGeneric",
appimage: "LinuxAppImageGeneric",
},
},
};

View File

@@ -5,25 +5,25 @@ import { useServerInsertedHTML } from "next/navigation";
import { ServerStyleSheet, StyleSheetManager } from "styled-components";
export default function StyledComponentsRegistry({
children,
children,
}: {
children: React.ReactNode;
children: React.ReactNode;
}) {
// Only create stylesheet once with lazy initial state
// x-ref: https://reactjs.org/docs/hooks-reference.html#lazy-initial-state
const [styledComponentsStyleSheet] = useState(() => new ServerStyleSheet());
// Only create stylesheet once with lazy initial state
// x-ref: https://reactjs.org/docs/hooks-reference.html#lazy-initial-state
const [styledComponentsStyleSheet] = useState(() => new ServerStyleSheet());
useServerInsertedHTML(() => {
const styles = styledComponentsStyleSheet.getStyleElement();
styledComponentsStyleSheet.instance.clearTag();
return <>{styles}</>;
});
useServerInsertedHTML(() => {
const styles = styledComponentsStyleSheet.getStyleElement();
styledComponentsStyleSheet.instance.clearTag();
return <>{styles}</>;
});
if (typeof window !== "undefined") return <>{children}</>;
if (typeof window !== "undefined") return <>{children}</>;
return (
<StyleSheetManager sheet={styledComponentsStyleSheet.instance}>
{children}
</StyleSheetManager>
);
return (
<StyleSheetManager sheet={styledComponentsStyleSheet.instance}>
{children}
</StyleSheetManager>
);
}

View File

@@ -1,55 +1,63 @@
export interface ZenTheme {
name: string
description: string
image: string
downloadUrl: string
id: string
homepage?: string
readme: string
preferences?: string
isColorTheme: boolean
author: string
version: string
name: string;
description: string;
image: string;
downloadUrl: string;
id: string;
homepage?: string;
readme: string;
preferences?: string;
isColorTheme: boolean;
author: string;
version: string;
}
const THEME_API = "https://zen-browser.github.io/theme-store/themes.json";
const CACHE_OPTIONS = { next: {
revalidate: 60,
} } as RequestInit;
const CACHE_OPTIONS = {
next: {
revalidate: 60,
},
} as RequestInit;
export async function getAllThemes() {
// Fetch from the API
const response = await fetch(THEME_API, CACHE_OPTIONS);
const themes = await response.json();
// transform in to a ZenTheme[] as it is currently an object
let themesArray: ZenTheme[] = [];
for (let key in themes) {
themesArray.push(themes[key]);
}
return themesArray;
// Fetch from the API
const response = await fetch(THEME_API, CACHE_OPTIONS);
const themes = await response.json();
// transform in to a ZenTheme[] as it is currently an object
let themesArray: ZenTheme[] = [];
for (let key in themes) {
themesArray.push(themes[key]);
}
return themesArray;
}
export function getThemesFromSearch(themes: ZenTheme[], query: string, tags: string[]): ZenTheme[] {
let filtered = themes.filter((theme) => theme.name.toLowerCase().includes(query.toLowerCase()));
if (tags.includes("all")) return filtered;
const isSearchingForColorScheme = tags.includes("color-scheme");
const isSearchingForUtility = !isSearchingForColorScheme && tags.includes("utility");
return filtered.filter((theme) => {
if (isSearchingForColorScheme && theme.isColorTheme) return true;
if (isSearchingForUtility && !theme.isColorTheme) return true;
return false;
});
export function getThemesFromSearch(
themes: ZenTheme[],
query: string,
tags: string[],
): ZenTheme[] {
let filtered = themes.filter((theme) =>
theme.name.toLowerCase().includes(query.toLowerCase()),
);
if (tags.includes("all")) return filtered;
const isSearchingForColorScheme = tags.includes("color-scheme");
const isSearchingForUtility =
!isSearchingForColorScheme && tags.includes("utility");
return filtered.filter((theme) => {
if (isSearchingForColorScheme && theme.isColorTheme) return true;
if (isSearchingForUtility && !theme.isColorTheme) return true;
return false;
});
}
export async function getThemeFromId(id: string) {
return (await getAllThemes()).find((theme) => theme.id === id);
return (await getAllThemes()).find((theme) => theme.id === id);
}
export async function getThemeMarkdown(theme: ZenTheme) {
return (await fetch(theme.readme, CACHE_OPTIONS)).text();
return (await fetch(theme.readme, CACHE_OPTIONS)).text();
}
export function getThemeAuthorLink(theme: ZenTheme): string {
return `https://github.com/${theme.author}`;
return `https://github.com/${theme.author}`;
}

View File

@@ -1,6 +1,6 @@
import { type ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function ny(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
return twMerge(clsx(inputs));
}