+
{
+ onChange(`var(--${colorType}-brand)`);
+ }}
+ >
-
-
-
Test
+ {isSelected &&
}
+
+
{colorType.charAt(0).toUpperCase() + colorType.slice(1)}
);
diff --git a/frontend/src/AppBuilder/LeftSidebar/GlobalSettings/ThemeSelect.jsx b/frontend/src/AppBuilder/LeftSidebar/GlobalSettings/ThemeSelect.jsx
index 74817c21c6..c0bc2079c3 100644
--- a/frontend/src/AppBuilder/LeftSidebar/GlobalSettings/ThemeSelect.jsx
+++ b/frontend/src/AppBuilder/LeftSidebar/GlobalSettings/ThemeSelect.jsx
@@ -1,16 +1,56 @@
-import React from 'react';
+import React, { useEffect, useState } from 'react';
import Select from '@/_ui/Select';
import CheckMark from '@/_ui/Icon/bulkIcons/CheckMark';
import { components } from 'react-select';
import { ButtonSolid } from '@/_ui/AppButton/AppButton';
+import useStore from '@/AppBuilder/_stores/store';
+import { shallow } from 'zustand/shallow';
+import { useNavigate } from 'react-router-dom';
+import { getWorkspaceId } from '@/_helpers/utils';
+import { appThemesService } from '../../../../ee/modules/WorkspaceSettings/pages/ManageThemes/service/app_themes.service';
const ThemeSelect = ({ darkMode }) => {
+ const [themesList, setThemesList] = useState([]);
+ const selectedTheme = useStore((state) => state.globalSettings.theme, shallow);
+ const featureAccess = useStore((state) => state?.license?.featureAccess, shallow);
+ const licenseValid = !featureAccess?.licenseStatus?.isExpired && featureAccess?.licenseStatus?.isLicenseValid;
+ const globalSettingsChanged = useStore((state) => state.globalSettingsChanged, shallow);
+ const workspaceId = getWorkspaceId();
+ const appId = useStore((state) => state.app.appId, shallow);
+ const versionId = useStore((state) => state.currentVersionId, shallow);
+ const navigate = useNavigate();
+
+ const fetchAllThemes = async () => {
+ const themes = await appThemesService.fetchAllThemes();
+
+ const options = themes.map((theme) => ({
+ value: theme.id,
+ name: theme.name,
+ label: theme.name,
+ color: theme?.definition?.brand?.colors?.primary?.[darkMode ? 'dark' : 'light'],
+ isDefault: theme?.isDefault,
+ theme: theme,
+ }));
+
+ setThemesList(options);
+ };
+
+ const setTheme = async (themeId) => {
+ await appThemesService.updateAppTheme(appId, versionId, themeId);
+ };
+
+ useEffect(() => {
+ fetchAllThemes();
+ }, []);
+
const customSelectStyles = {
control: (provided) => ({
...provided,
width: '158px',
height: '32px',
minHeight: '32px',
+ flexWrap: 'nowrap',
+ overflow: 'hidden',
}),
input: (provided) => ({
...provided,
@@ -37,6 +77,10 @@ const ThemeSelect = ({ darkMode }) => {
scrollbarWidth: 'none', // Hide scrollbar for Firefox
borderRadius: '8px',
}),
+ menuPortal: (base) => ({
+ ...base,
+ top: base.top + 2, // Adjust the top position
+ }),
option: (provided, state) => ({
...provided,
backgroundColor: state.isFocused
@@ -54,22 +98,44 @@ const ThemeSelect = ({ darkMode }) => {
const CustomOption = (props) => {
const { data, isSelected } = props;
-
return (
{isSelected && (
-
+
+ )}
+
+
{data.label}
+ {data?.isDefault && (
+
+ Default
+
)}
-
-
{data.label}
);
@@ -92,10 +158,12 @@ const ThemeSelect = ({ darkMode }) => {
}}
>
{}}
+ onClick={() => {
+ navigate(`/${workspaceId}/workspace-settings/themes`);
+ }}
variant="tertiary"
leftIcon="addrectangle"
- fill="var(--primary-brand)"
+ fill="#3e63dd"
iconWidth="16"
className="tj-text-xsm theme-create-btn"
>
@@ -112,13 +180,14 @@ const ThemeSelect = ({ darkMode }) => {
Theme