Synced over bugfixes and theme control

This commit is contained in:
Frikky
2025-05-23 12:10:38 +02:00
parent 065f6f9332
commit c0aaebaff6
8 changed files with 1898 additions and 698 deletions
+2 -5
View File
@@ -39,7 +39,7 @@ const Branding = (props) => {
const theme = getTheme(themeMode, brandColor)
const [selectedBrandColor, setSelectedBrandColor] = useState(theme?.palette?.main || "#FF8544")
const [selectedBrandName, setSelectedBrandName] = useState(selectedOrganization?.branding?.brand_name || "")
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
const [isLoading,setIsLoading] = useState(false);
const handleEditOrg = (joinStatus) => {
@@ -391,7 +391,7 @@ const Branding = (props) => {
</div>
{ integrationPartner ? (
{integrationPartner ? (
<>
<Divider style={{marginTop: 50, marginBottom: 50, color: theme.palette.defaultBorder}} />
<Typography style={{fontSize: 24, fontWeight: "bold"}}>
@@ -414,9 +414,6 @@ const Branding = (props) => {
if (changingTheme === true) {
return
}
toast.info("Changing theme to " + newTheme + ". Please wait a moment.")
setChangingTheme(true)
handleEditOrg(newTheme);
}}
+41 -5
View File
@@ -403,7 +403,6 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
const handleChangeTheme = (newTheme) => {
toast.info("Changing theme to " + newTheme + " - please wait!");
const data = {
"org_id": userdata?.active_org?.id,
@@ -449,6 +448,38 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
});
};
const handleUpdateTheme = (newTheme) => {
const data = {
"user_id": userdata?.id,
"theme": newTheme,
}
const url = globalUrl + `/api/v1/users/updateuser`;
fetch(url, {
mode: "cors",
method: "PUT",
body: JSON.stringify(data),
credentials: "include",
crossDomain: true,
withCredentials: true,
headers: {
"Content-Type": "application/json; charset=utf-8",
},
}).then((response) =>
response.json().then((responseJson) => {
if (responseJson["success"] === false) {
toast("Failed updating theme: ", responseJson.reason);
} else {
handleThemeChange(newTheme);
setCurrentSelectedTheme(newTheme);
}
})
).catch((error) => {
console.log("Error changing theme: ", error);
});
};
const removeCookie = (name, path = "/") => {
@@ -487,6 +518,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
console.error("Logout error:", error);
});
};
console.log("userdata: ", userdata);
const avatarMenu = (
<span>
<IconButton
@@ -543,7 +575,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
},
}}
>
{userdata && (
{userdata && (userdata?.org_status?.includes("integration_partner") && userdata?.org_status?.includes("sub_org")) ? null : (
<>
<ToggleButtonGroup
value={currentSelectedTheme}
@@ -555,7 +587,11 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
if (newTheme === currentSelectedTheme) {
return;
}
handleChangeTheme(newTheme);
if (userdata?.org_status?.includes("integration_partner")){
handleChangeTheme(newTheme);
}else {
handleUpdateTheme(newTheme);
}
}}
aria-label="theme"
style={{display: 'flex', justifyContent: "center", marginBottom: 10, }}
@@ -1648,7 +1684,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
<Button
component={Link}
to={isCloud ? "/admin?admin_tab=billingstats" : "/admin?admin_tab=locations"}
to={isCloud ? "/admin" : "/admin"}
onClick={(event) => {
setCurrentOpenTab("admin");
localStorage.setItem("lastTabOpenByUser", "admin");
@@ -2070,4 +2106,4 @@ const ModalView = memo(({searchBarModalOpen, setSearchBarModalOpen, globalUrl, s
</Dialog>
)
)
});
});
File diff suppressed because it is too large Load Diff
@@ -132,7 +132,7 @@ const CodeEditor = (props) => {
fieldname,
contentLoading,
editorData,
handleSubflowParamChange,
handleTriggerParamChange,
setAiQueryModalOpen,
fullScreenMode,
environment,
@@ -212,7 +212,7 @@ const CodeEditor = (props) => {
const triggerField = searchParams.get('trigger_field');
const triggerName = searchParams.get('trigger_name');
const conditionId = searchParams.get('condition_id');
const conditionField = searchParams.get('field');
const conditionField = searchParams.get('condition_field');
useEffect(() => {
if (actionId === undefined || actionId === null) {
@@ -251,7 +251,7 @@ const CodeEditor = (props) => {
setSelectedCondition(condition);
// Update available variables when condition changes
updateAvailableVariables(actionlist);
}, [conditionId, fieldName])
}, [conditionId, conditionField])
// Extract variable updating logic into a separate function
const updateAvailableVariables = (actionlist) => {
@@ -2588,7 +2588,7 @@ const CodeEditor = (props) => {
// Handle condition fields
if (conditionField !== null && handleConditionFieldChange !== undefined) {
handleConditionFieldChange(conditionField, fieldName, fixedcodedata);
handleConditionFieldChange(conditionField, fixedcodedata);
}
// Handle action fields
else if (actionId !== undefined && actionId !== null && actionId.length > 0) {
@@ -2596,7 +2596,7 @@ const CodeEditor = (props) => {
}
// Handle trigger fields
else if (triggerId !== undefined && triggerId !== null && triggerId.length > 0) {
handleSubflowParamChange(triggerId, triggerField, fixedcodedata)
handleTriggerParamChange(triggerId, triggerField, fixedcodedata)
}
setExpansionModalOpen(false)