Skip to content

Commit

Permalink
feat(Studio.Design): add project details and privacy mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Milkeyyy committed Dec 27, 2024
1 parent 4804f53 commit 4e6a1cb
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
8 changes: 8 additions & 0 deletions websites/S/Studio.Design/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,13 @@
"website",
"editor",
"nocode"
],
"settings": [
{
"id": "privacy",
"title": "Privacy Mode",
"icon": "fad fa-user-secret",
"value": false
}
]
}
30 changes: 27 additions & 3 deletions websites/S/Studio.Design/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ presence.on("UpdateData", async () => {
largeImageKey: "https://i.imgur.com/zjBdwQ8.png",
startTimestamp: browsingTimestamp,
},
[privacy] = await Promise.all([presence.getSetting<boolean>("privacy")]),
{ pathname } = document.location;

switch (pathname) {
Expand All @@ -24,7 +25,15 @@ presence.on("UpdateData", async () => {
default:
// Project Dashboard
if (pathname.includes("/projects/") && pathname.includes("/dashboard/")) {
presenceData.details = "Project Dashboard";
if (privacy) presenceData.details = "Project Dashboard";
else {
// Project Name
presenceData.details = `${
document.querySelector(
".LayoutPdDashboard > header > div._flex._gap-8._flex-initial._flex-row.o-layout-project-dashboard-header-left._mr-auto._h-full._py-6._pl-24 > div > button > div > p"
).textContent
} | Dashboard`;
}
// Home
if (pathname.includes("/home")) {
// Project Settings
Expand Down Expand Up @@ -55,13 +64,28 @@ presence.on("UpdateData", async () => {
// Payment
} else if (pathname === "/payment")
presenceData.details = "Managing Payment Settings...";
// Workspace
else if (pathname.includes("/workspace/"))
presenceData.details = "Managing Workspace...";
// Editor
else if (
pathname.includes("/projects/") &&
pathname.includes("/editor/")
) {
presenceData.details = "Design Editor";
presenceData.state = "Editing Pages...";
if (privacy) {
presenceData.details = "Design Editor";
presenceData.state = "Editing Pages...";
} else {
// Project Name
presenceData.details = `${
document.querySelector(".HeaderNavProject > div.block > p")
.textContent
} | Design Editor`;
// Page Title
presenceData.state = `Editing: ${
document.querySelector(".HeaderNavPage > div.block > p").textContent
}`;
}
}
}

Expand Down

0 comments on commit 4e6a1cb

Please sign in to comment.