Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: always show currently applied themes in list

Abdullah Atta8431150f0ac4
diff --git a/apps/web/src/dialogs/settings/components/themes-selector.tsx b/apps/web/src/dialogs/settings/components/themes-selector.tsx
index 64e8bf74a..8d3079cde 100644
--- a/apps/web/src/dialogs/settings/components/themes-selector.tsx
+++ b/apps/web/src/dialogs/settings/components/themes-selector.tsx
@@ -23,7 +23,6 @@ import { Box, Button, Flex, Input, Text } from "@theme-ui/components";
import { CheckCircleOutline, Loading } from "../../../components/icons";
import {
THEME_COMPATIBILITY_VERSION,
- ThemeDefinition,
getPreviewColors,
validateTheme
} from "@notesnook/theme";
@@ -218,13 +217,20 @@ function ThemesList() {
) : (
<VirtuosoGrid
customScrollParent={parentScrollRef.current || undefined}
- data={themes.data?.pages.flatMap((a) => a.themes) || []}
+ data={[
+ {
+ ...darkTheme,
+ previewColors: getPreviewColors(darkTheme)
+ },
+ {
+ ...lightTheme,
+ previewColors: getPreviewColors(lightTheme)
+ },
+ ...(themes.data?.pages.flatMap((a) => a.themes) || [])
+ ]}
endReached={() =>
themes.hasNextPage ? themes.fetchNextPage() : null
}
- components={{
- Header: GridHeader
- }}
context={{ darkTheme, lightTheme, setTheme }}
computeItemKey={(_index, item) => item.id}
itemContent={(_index, theme) => (
@@ -243,39 +249,6 @@ function ThemesList() {
);
}
-const GridHeader = (props: {
- context?: {
- darkTheme: ThemeDefinition;
- lightTheme: ThemeDefinition;
- setTheme: (theme: ThemeMetadata) => Promise<void>;
- };
-}) => {
- const { darkTheme, lightTheme, setTheme } = props.context || {};
- if (!darkTheme || !lightTheme || !setTheme) return null;
- return (
- <div className="virtuoso-grid-list">
- <ThemeItem
- theme={{
- ...darkTheme,
- previewColors: getPreviewColors(darkTheme)
- }}
- isApplied={true}
- isApplying={false}
- setTheme={setTheme}
- />
- <ThemeItem
- theme={{
- ...lightTheme,
- previewColors: getPreviewColors(lightTheme)
- }}
- isApplied={true}
- isApplying={false}
- setTheme={setTheme}
- />
- </div>
- );
-};
-
type ThemeItemProps = {
theme: ThemeMetadata;
isApplied: boolean;