From 89aa84f151eed76ec9ec4c9c224be5d39c2e3b0c Mon Sep 17 00:00:00 2001 From: Allan Joston Fernandes <54631653+Allan2000-Git@users.noreply.github.com> Date: Sat, 14 Dec 2024 13:02:01 +0530 Subject: [PATCH 1/2] feat(platofrm): Added online/offline status detection in the platform (#585) --- apps/platform/src/app/layout.tsx | 6 +++- .../common/online-status-handler.tsx | 10 ++++++ apps/platform/src/hooks/use-online-status.ts | 33 +++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 apps/platform/src/components/common/online-status-handler.tsx create mode 100644 apps/platform/src/hooks/use-online-status.ts diff --git a/apps/platform/src/app/layout.tsx b/apps/platform/src/app/layout.tsx index d9e2a617..011b6b19 100644 --- a/apps/platform/src/app/layout.tsx +++ b/apps/platform/src/app/layout.tsx @@ -1,6 +1,7 @@ import { Toaster } from '@/components/ui/sonner' import './global.css' import JotaiProvider from '@/components/jotaiProvider' +import OnlineStatusHandler from '@/components/common/online-status-handler' export const metadata = { title: 'Keyshade', @@ -15,7 +16,10 @@ export default function RootLayout({ return ( - {children} + + + {children} + diff --git a/apps/platform/src/components/common/online-status-handler.tsx b/apps/platform/src/components/common/online-status-handler.tsx new file mode 100644 index 00000000..f5685750 --- /dev/null +++ b/apps/platform/src/components/common/online-status-handler.tsx @@ -0,0 +1,10 @@ +'use client' + +import { useOnlineStatus } from "@/hooks/use-online-status"; + +function OnlineStatusHandler() { + useOnlineStatus(); + return null; +} + +export default OnlineStatusHandler; diff --git a/apps/platform/src/hooks/use-online-status.ts b/apps/platform/src/hooks/use-online-status.ts new file mode 100644 index 00000000..e6758e1f --- /dev/null +++ b/apps/platform/src/hooks/use-online-status.ts @@ -0,0 +1,33 @@ +import { useEffect, useRef } from "react" +import { toast } from "sonner"; + +export const useOnlineStatus = () => { + const statusTimeout = useRef(null); + + const statusHandler = () => { + if (statusTimeout.current) { + clearTimeout(statusTimeout.current); + } + + statusTimeout.current = setTimeout(() => { + if (navigator.onLine) { + toast.success("You are back online! Refreshing..."); + setTimeout(() => { + window.location.reload(); + }, 1000); + } else { + toast.error("You are offline"); + } + }, 1000); + }; + + useEffect(() => { + window.addEventListener("online", statusHandler); + window.addEventListener("offline", statusHandler); + + return () => { + window.removeEventListener("online", statusHandler); + window.removeEventListener("offline", statusHandler); + } + }, []); +} \ No newline at end of file From 0fde62b1925d6365483ce23339ac5a5c687aaa55 Mon Sep 17 00:00:00 2001 From: Muntasir Mallik <73852736+muntaxir4@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:01:53 +0530 Subject: [PATCH 2/2] feat(cli): Add functionality to operate on Workspace Membership (#589) Co-authored-by: Rajdip Bhattacharya --- .../emails/components/base-email-template.tsx | 12 ++-- .../src/mail/emails/workspace-invitation.tsx | 15 ++--- .../api/src/mail/emails/workspace-removal.tsx | 6 +- apps/cli/src/commands/workspace.command.ts | 4 +- .../workspace/membership.workspace.ts | 34 ++++++++++ .../accept-invitation.membership.ts | 49 ++++++++++++++ .../cancel-invitation.membership.ts | 55 ++++++++++++++++ .../decline-invitation.membership.ts | 49 ++++++++++++++ .../membership/get-all-members.membership.ts | 64 ++++++++++++++++++ .../workspace/membership/invite.membership.ts | 65 +++++++++++++++++++ .../workspace/membership/leave.membership.ts | 49 ++++++++++++++ .../workspace/membership/remove.membership.ts | 55 ++++++++++++++++ .../transfer-ownership.membership copy.ts | 55 ++++++++++++++++ .../membership/update-role.membership.ts | 61 +++++++++++++++++ .../commands/workspace/role/update.role.ts | 4 +- apps/cli/src/util/controller-instance.ts | 15 ++++- package.json | 2 +- 17 files changed, 571 insertions(+), 23 deletions(-) create mode 100644 apps/cli/src/commands/workspace/membership.workspace.ts create mode 100644 apps/cli/src/commands/workspace/membership/accept-invitation.membership.ts create mode 100644 apps/cli/src/commands/workspace/membership/cancel-invitation.membership.ts create mode 100644 apps/cli/src/commands/workspace/membership/decline-invitation.membership.ts create mode 100644 apps/cli/src/commands/workspace/membership/get-all-members.membership.ts create mode 100644 apps/cli/src/commands/workspace/membership/invite.membership.ts create mode 100644 apps/cli/src/commands/workspace/membership/leave.membership.ts create mode 100644 apps/cli/src/commands/workspace/membership/remove.membership.ts create mode 100644 apps/cli/src/commands/workspace/membership/transfer-ownership.membership copy.ts create mode 100644 apps/cli/src/commands/workspace/membership/update-role.membership.ts diff --git a/apps/api/src/mail/emails/components/base-email-template.tsx b/apps/api/src/mail/emails/components/base-email-template.tsx index 891ddfe0..07dcf422 100644 --- a/apps/api/src/mail/emails/components/base-email-template.tsx +++ b/apps/api/src/mail/emails/components/base-email-template.tsx @@ -42,13 +42,13 @@ export const BaseEmailTemplate: React.FC = ({ {heading} {children} - If you believe this action was taken in error or have any - questions regarding this change, please contact your project - administrator or our support team. + If you believe this action was taken in error or have any + questions regarding this change, please contact your project + administrator or our support team. - We appreciate your understanding and thank you for your - contributions to the project. + We appreciate your understanding and thank you for your + contributions to the project. Cheers, @@ -81,4 +81,4 @@ export const BaseEmailTemplate: React.FC = ({ ) } -export default BaseEmailTemplate \ No newline at end of file +export default BaseEmailTemplate diff --git a/apps/api/src/mail/emails/workspace-invitation.tsx b/apps/api/src/mail/emails/workspace-invitation.tsx index 37b4fc0f..5fab5df7 100644 --- a/apps/api/src/mail/emails/workspace-invitation.tsx +++ b/apps/api/src/mail/emails/workspace-invitation.tsx @@ -33,14 +33,11 @@ export const WorkspaceInvitationEmail = ({ : 'You are Invited to Join the Workspace' return ( - + Dear User, - We're excited to inform you that you've been invited to join a - workspace on Keyshade. Here are the details of your invitation: + We're excited to inform you that you've been invited to join a workspace + on Keyshade. Here are the details of your invitation:
@@ -54,8 +51,8 @@ export const WorkspaceInvitationEmail = ({
- Join the project by clicking the button below - we're excited to - have you! + Join the project by clicking the button below - we're excited to have + you!