Minor left sidebar fixes for notification discovery

This commit is contained in:
Frikky
2025-06-05 00:30:30 +02:00
parent 1faa157fac
commit afe052fc48
2 changed files with 115 additions and 62 deletions
+93 -45
View File
@@ -562,7 +562,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
"& .MuiPaper-root": {
backgroundColor: theme.palette.backgroundColor,
color: theme.palette.text.primary,
borderRadius: 1,
borderRadius: theme.palette.borderRadius/3,
},
"& .MuiList-root": {
backgroundColor: theme.palette.backgroundColor,
@@ -602,6 +602,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
aria-label="theme"
style={{display: 'flex', justifyContent: "center", marginBottom: 10, }}
>
<ToggleButton value="light" aria-label="light theme" style={{ backgroundColor: currentSelectedTheme === "light" ? theme.palette.hoverColor : theme.palette.backgroundColor }}>
<LightModeIcon style={{ color: themeMode === "light" ? darkText : lightText }} />
</ToggleButton>
@@ -622,7 +623,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
}}
style={{fontSize: 18}}
>
<BusinessIcon style={{ marginRight: 5 }} /> Organization
<BusinessIcon style={{ marginRight: 5 }} /> Org Admin
</MenuItem>
</Link>
<Link to="/settings" style={hrefStyle}>
@@ -632,11 +633,13 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
}}
style={{fontSize: 18}}
>
<SettingsIcon style={{ marginRight: 5 }} /> Account
<SettingsIcon style={{ marginRight: 5 }} /> User Account
</MenuItem>
</Link>
<Divider style={{ marginTop: 10, marginBottom: 10, }} />
{/*
<Link to="/admin?admin_tab=notifications" style={hrefStyle}>
<MenuItem
onClick={(event) => {
@@ -644,7 +647,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
}}
style={{fontSize: 18}}
>
<NotificationsIcon style={{ marginRight: 5 }} /> Notifications ({
<NotificationsIcon style={{ marginRight: 5 }} /> Org Notifications ({
notifications === undefined || notifications === null ? 0 :
notifications?.filter((notification) => notification.read === false).length
})
@@ -652,6 +655,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
</Link>
<Divider style={{ marginTop: 10, marginBottom: 10, }} />
*/}
<Link to={userdata && userdata?.org_status?.includes("integration_partner") && userdata?.active_org?.branding?.documentation_link?.length > 0 ? userdata?.active_org?.branding?.documentation_link : "/docs" } target={userdata?.active_org?.branding?.documentation_link?.length > 0 && userdata?.org_status?.includes("integration_partner") ? "_blank" : "_self" } style={hrefStyle}>
<MenuItem
@@ -1425,6 +1429,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
</span>
</Button>
</span>
<IconButton
onClick={() => {
setOpenSecurityTab((prev) => !prev);
@@ -1456,10 +1461,11 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
)}
</IconButton>
</Box>
<Collapse in={openSecurityTab} timeout="auto" unmountOnExit >
<Box
style={{
maxHeight: openSecurityTab && expandLeftNav ? 150 : 0,
maxHeight: openSecurityTab && expandLeftNav ? 185 : 0,
overflow: "hidden",
transition: "max-height 0.3s ease, opacity 0.3s ease",
display: "flex",
@@ -1592,46 +1598,88 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
</Button>
</span>
<span style={{ display: "inline-block", width: "100%" }}>
<Button
component={Link}
to="/admin?tab=locations"
onClick={(event) => {
setCurrentOpenTab("locations");
localStorage.setItem("lastTabOpenByUser", "locations");
}}
variant="text"
sx={{
width: "100%",
height: 35,
color: themeMode === "dark" ? lightText : darkText,
justifyContent: "flex-start",
textTransform: "none",
backgroundColor:
currentOpenTab === "locations"
? themeMode === "dark" ? darkHoverColor : lightHoverColor
: "transparent",
"&:hover": {
backgroundColor: themeMode === "dark" ? darkHoverColor : lightHoverColor,
},
cursor: "pointer",
}}
>
<span style={{ position: "relative", left: !expandLeftNav ? 10 : 0, marginRight: 10, fontSize: 18 }}>
</span>
<span
style={{
display: expandLeftNav ? "inline" : "none",
opacity: expandLeftNav ? 1 : 0,
transition: "opacity 0.3s ease",
fontSize: 18,
color: themeMode === "dark" ? currentOpenTab === "locations" ? theme.palette.text.primary : lightText : darkText,
}}
>
Hybrid Locations
</span>
</Button>
<span style={{ display: "inline-block", width: "100%" }}>
<Button
component={Link}
to="/admin?admin_tab=notifications"
onClick={(event) => {
setCurrentOpenTab("notifications");
localStorage.setItem("lastTabOpenByUser", "notifications");
}}
variant="text"
sx={{
width: "100%",
height: 35,
color: themeMode === "dark" ? lightText : darkText,
justifyContent: "flex-start",
textTransform: "none",
backgroundColor:
currentOpenTab === "notifications"
? themeMode === "dark" ? darkHoverColor : lightHoverColor
: "transparent",
"&:hover": {
backgroundColor: themeMode === "dark" ? darkHoverColor : lightHoverColor,
},
cursor: "pointer",
}}
>
<span style={{ position: "relative", left: !expandLeftNav ? 10 : 0, marginRight: 10, fontSize: 18 }}>
</span>
<span
style={{
display: expandLeftNav ? "inline" : "none",
opacity: expandLeftNav ? 1 : 0,
transition: "opacity 0.3s ease",
fontSize: 18,
color: themeMode === "dark" ? currentOpenTab === "notifications" ? theme.palette.text.primary : lightText : darkText,
}}
>
Notifications
</span>
</Button>
</span>
<span style={{ display: "inline-block", width: "100%" }}>
<Button
component={Link}
to="/admin?tab=locations"
onClick={(event) => {
setCurrentOpenTab("locations");
localStorage.setItem("lastTabOpenByUser", "locations");
}}
variant="text"
sx={{
width: "100%",
height: 35,
color: themeMode === "dark" ? lightText : darkText,
justifyContent: "flex-start",
textTransform: "none",
backgroundColor:
currentOpenTab === "locations"
? themeMode === "dark" ? darkHoverColor : lightHoverColor
: "transparent",
"&:hover": {
backgroundColor: themeMode === "dark" ? darkHoverColor : lightHoverColor,
},
cursor: "pointer",
}}
>
<span style={{ position: "relative", left: !expandLeftNav ? 10 : 0, marginRight: 10, fontSize: 18 }}>
</span>
<span
style={{
display: expandLeftNav ? "inline" : "none",
opacity: expandLeftNav ? 1 : 0,
transition: "opacity 0.3s ease",
fontSize: 18,
color: themeMode === "dark" ? currentOpenTab === "locations" ? theme.palette.text.primary : lightText : darkText,
}}
>
Runtime Locations
</span>
</Button>
</span>
</>): null}
</Box>
+22 -17
View File
@@ -1983,6 +1983,8 @@ const AppCreator = (defaultprops) => {
const schemes = [splitBase[0]];
const basePath = "/" + splitBase.slice(3).join("/");
const newBaseUrl = baseUrl.replaceAll("http//", "http://").replaceAll("https//", "https://")
const data = {
openapi: "3.0.0",
info: {
@@ -1991,7 +1993,7 @@ const AppCreator = (defaultprops) => {
version: "1.0",
"x-logo": fileBase64,
},
servers: [{ url: baseUrl }],
servers: [{ url: newBaseUrl }],
host: host,
basePath: basePath,
schemes: schemes,
@@ -2637,12 +2639,17 @@ const AppCreator = (defaultprops) => {
credentials: "include",
})
.then((response) => {
setAppBuilding(false)
if (response.status === 403) {
var urlParams = new URLSearchParams(window.location.search)
if (urlParams.has("id")) {
toast.error(`Please log in to build this app. If this error persists, please contact ${supportEmail}`)
} else {
toast.error("Failed to save the app as you are not the owner. Redirecting you to the forking page. When there, save again.")
toast.error("Failed to save the app as you are not the owner. Redirecting you to the forking page. If this does not load, please download and re-import the app.", {
autoClose: 10000
})
if (props.match.params.appid !== undefined && props.match.params.appid !== null && props.match.params.appid.length > 0) {
setTimeout(() => {
window.open(`/apps/new?id=${props.match.params.appid}`, "_blank")
@@ -2658,19 +2665,16 @@ const AppCreator = (defaultprops) => {
//throw new Error("NOT 200 :O")
}
setAppBuilding(false);
return response.json();
})
.then((responseJson) => {
if (!responseJson.success) {
if (responseJson.extra !== undefined && responseJson.extra !== null) {
if (responseJson?.success !== true) {
if (responseJson?.extra !== undefined && responseJson?.extra !== null) {
toast("Failed building: " + responseJson.extra);
}
if (responseJson.reason !== undefined) {
} else if (responseJson?.reason !== undefined) {
setErrorCode(responseJson.reason);
if (responseJson.details !== undefined && responseJson.details !== null) {
if (responseJson?.details !== undefined && responseJson?.details !== null) {
toast.error("Failed to build - contact support@shuffler.io: " + responseJson.details, {
autoClose: 60000
})
@@ -2679,7 +2683,8 @@ const AppCreator = (defaultprops) => {
autoClose: 10000
})
}
}
} else {
}
} else {
toast.success("Successfully built openapi app! Added job to rebuild it in your hybrid runtime locations (Orborus).");
if (window.location.pathname.includes("/new")) {
@@ -6117,7 +6122,7 @@ const AppCreator = (defaultprops) => {
value={baseUrl}
helperText={
<span style={{ color: theme.palette.text.primary, marginBottom: "2px" }}>
Must start with http(s):// and CANT end with /.{" "}
Must start with http(s):// and can NOT end with /.{" "}
</span>
}
placeholder="https://api.example.com"
@@ -6136,12 +6141,12 @@ const AppCreator = (defaultprops) => {
toast("URL must start with http(s)://");
}
if (tmpstring.includes("?")) {
var newtmp = tmpstring.split("?")
if (tmpstring.length > 1) {
tmpstring = newtmp[0]
}
}
if (tmpstring.includes("?")) {
var newtmp = tmpstring.split("?")
if (tmpstring.length > 1) {
tmpstring = newtmp[0]
}
}
setBaseUrl(tmpstring);
}}