From d91b4e6fa1b22632c6d9a3438b2e9291d01503dd Mon Sep 17 00:00:00 2001 From: Lakhan Baheti <94619783+1akhanBaheti@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:35:29 +0530 Subject: [PATCH] fix: bug fixes & UI improvements (#2819) * fix: profile setting fields border * fix: webhooks empty state UI * fix: cycle delete redirection from cycle detail * fix: integration access restriction --- web/components/api-token/empty-state.tsx | 2 +- web/components/cycles/delete-modal.tsx | 7 +++ .../integration/single-integration-card.tsx | 44 ++++++++++++++--- web/components/web-hooks/empty-webhooks.tsx | 46 +++++++++-------- .../[workspaceSlug]/me/profile/index.tsx | 5 +- .../settings/webhooks/index.tsx | 8 ++- web/public/empty-state/web-hook.svg | 49 +++++++++++++++++++ 7 files changed, 126 insertions(+), 35 deletions(-) create mode 100644 web/public/empty-state/web-hook.svg diff --git a/web/components/api-token/empty-state.tsx b/web/components/api-token/empty-state.tsx index 77618049f..fab8a9683 100644 --- a/web/components/api-token/empty-state.tsx +++ b/web/components/api-token/empty-state.tsx @@ -11,7 +11,7 @@ import emptyApiTokens from "public/empty-state/api-token.svg"; const ApiTokenEmptyState = () => { const router = useRouter(); return ( -
+
empty
No API Tokens
diff --git a/web/components/cycles/delete-modal.tsx b/web/components/cycles/delete-modal.tsx index f5024b3a2..aa28ea153 100644 --- a/web/components/cycles/delete-modal.tsx +++ b/web/components/cycles/delete-modal.tsx @@ -1,4 +1,6 @@ import { Fragment, useState } from "react"; +// next +import { useRouter } from "next/router"; import { Dialog, Transition } from "@headlessui/react"; import { observer } from "mobx-react-lite"; import { AlertTriangle } from "lucide-react"; @@ -27,6 +29,8 @@ export const CycleDeleteModal: React.FC = observer((props) => { const { setToastAlert } = useToast(); // states const [loader, setLoader] = useState(false); + const router = useRouter(); + const { cycleId } = router.query; const formSubmit = async () => { setLoader(true); @@ -38,6 +42,9 @@ export const CycleDeleteModal: React.FC = observer((props) => { title: "Success!", message: "Cycle deleted successfully.", }); + + if (cycleId) router.replace(`/${workspaceSlug}/projects/${projectId}/cycles`); + handleClose(); } catch (error) { setToastAlert({ diff --git a/web/components/integration/single-integration-card.tsx b/web/components/integration/single-integration-card.tsx index f5ff2b326..e0781b3f9 100644 --- a/web/components/integration/single-integration-card.tsx +++ b/web/components/integration/single-integration-card.tsx @@ -11,7 +11,7 @@ import { IntegrationService } from "services/integrations"; import useToast from "hooks/use-toast"; import useIntegrationPopup from "hooks/use-integration-popup"; // ui -import { Button, Loader } from "@plane/ui"; +import { Button, Loader, Tooltip } from "@plane/ui"; // icons import GithubLogo from "public/services/github.png"; import SlackLogo from "public/services/slack.png"; @@ -46,8 +46,11 @@ const integrationService = new IntegrationService(); export const SingleIntegrationCard: React.FC = observer(({ integration }) => { const { appConfig: { envConfig }, + user: { currentWorkspaceRole }, } = useMobxStore(); + const isUserAdmin = currentWorkspaceRole === 20; + const [deletingIntegration, setDeletingIntegration] = useState(false); const router = useRouter(); @@ -127,13 +130,40 @@ export const SingleIntegrationCard: React.FC = observer(({ integration }) {workspaceIntegrations ? ( isInstalled ? ( - + + + ) : ( - + + + ) ) : ( diff --git a/web/components/web-hooks/empty-webhooks.tsx b/web/components/web-hooks/empty-webhooks.tsx index d6ed6f2cd..d6a5d58de 100644 --- a/web/components/web-hooks/empty-webhooks.tsx +++ b/web/components/web-hooks/empty-webhooks.tsx @@ -1,28 +1,32 @@ -import { FC } from "react"; -import Link from "next/link"; -import { Button } from "@plane/ui"; +// next +import { useRouter } from "next/router"; import Image from "next/image"; -import EmptyWebhookLogo from "public/empty-state/issue.svg"; +// ui +import { Button } from "@plane/ui"; +// assets +import EmptyWebhook from "public/empty-state/web-hook.svg"; -interface IWebHookLists { - workspaceSlug: string; -} - -export const EmptyWebhooks: FC = (props) => { - const { workspaceSlug } = props; +export const EmptyWebhooks = () => { + const router = useRouter(); return ( -
-
- empty-webhook image - -
No Webhooks
-

Create webhooks to receive real-time updates and automate actions

- - - +
+
+ empty +
No Webhooks
+ { +

+ Create webhooks to receive real-time updates and automate actions +

+ } +
); diff --git a/web/pages/[workspaceSlug]/me/profile/index.tsx b/web/pages/[workspaceSlug]/me/profile/index.tsx index 33813fa52..a6ae7c784 100644 --- a/web/pages/[workspaceSlug]/me/profile/index.tsx +++ b/web/pages/[workspaceSlug]/me/profile/index.tsx @@ -303,7 +303,8 @@ const ProfilePage: NextPageWithLayout = () => { value={value} onChange={onChange} label={value ? value.toString() : "Select your role"} - buttonClassName={errors.role ? "border-red-500 bg-red-500/10" : ""} + buttonClassName={errors.role ? "border-red-500 bg-red-500/10" : "border-none"} + className="rounded-md border !border-custom-border-200" width="w-full" input > @@ -369,6 +370,8 @@ const ProfilePage: NextPageWithLayout = () => { options={timeZoneOptions} onChange={onChange} optionsClassName="w-full" + buttonClassName={"border-none"} + className="rounded-md border !border-custom-border-200" input /> )} diff --git a/web/pages/[workspaceSlug]/settings/webhooks/index.tsx b/web/pages/[workspaceSlug]/settings/webhooks/index.tsx index ce650e81c..f311741b8 100644 --- a/web/pages/[workspaceSlug]/settings/webhooks/index.tsx +++ b/web/pages/[workspaceSlug]/settings/webhooks/index.tsx @@ -31,7 +31,7 @@ const WebhooksPage: NextPage = observer(() => { return ( }> -
+
{loader ? (
@@ -41,10 +41,8 @@ const WebhooksPage: NextPage = observer(() => { {Object.keys(webhooks).length > 0 ? ( ) : ( -
-
- -
+
+
)} diff --git a/web/public/empty-state/web-hook.svg b/web/public/empty-state/web-hook.svg new file mode 100644 index 000000000..f8e32d3e5 --- /dev/null +++ b/web/public/empty-state/web-hook.svg @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +