Synced over bugfixes and theme control
This commit is contained in:
@@ -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);
|
||||
}}
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
)
|
||||
});
|
||||
});
|
||||
|
||||
+1794
-647
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)
|
||||
|
||||
Reference in New Issue
Block a user