feat: removed last bit of workspace in frontend. Fatality!

This commit is contained in:
=
2025-09-16 00:08:41 +05:30
parent 37a80fa1ac
commit ac80242749
356 changed files with 1788 additions and 1890 deletions
@@ -5,7 +5,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Input, Modal, ModalContent } from "@app/components/v2";
import { useWorkspace } from "@app/context";
import { useProject } from "@app/context";
import { useAddTrustedIp, useGetMyIp, useUpdateTrustedIp } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -27,7 +27,7 @@ type Props = {
export const IPAllowlistModal = ({ popUp, handlePopUpClose, handlePopUpToggle }: Props) => {
const { data, isPending } = useGetMyIp();
const { currentWorkspace } = useWorkspace();
const { currentProject } = useProject();
const addTrustedIp = useAddTrustedIp();
const updateTrustedIp = useUpdateTrustedIp();
@@ -65,11 +65,11 @@ export const IPAllowlistModal = ({ popUp, handlePopUpClose, handlePopUpToggle }:
const onIPAllowlistModalSubmit = async ({ ipAddress, comment }: FormData) => {
try {
if (!currentWorkspace?.id) return;
if (!currentProject?.id) return;
if (popUp?.trustedIp?.data) {
await updateTrustedIp.mutateAsync({
workspaceId: currentWorkspace.id,
projectId: currentProject.id,
trustedIpId: (popUp?.trustedIp?.data as { trustedIpId: string })?.trustedIpId,
ipAddress,
comment,
@@ -77,7 +77,7 @@ export const IPAllowlistModal = ({ popUp, handlePopUpClose, handlePopUpToggle }:
});
} else {
await addTrustedIp.mutateAsync({
workspaceId: currentWorkspace.id,
projectId: currentProject.id,
ipAddress,
comment,
isActive: true
@@ -9,7 +9,7 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useSubscription,
useWorkspace
useProject
} from "@app/context";
import { useDeleteTrustedIp } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -20,7 +20,7 @@ import { IPAllowlistTable } from "./IPAllowlistTable";
export const IPAllowlistSection = () => {
const { mutateAsync } = useDeleteTrustedIp();
const { subscription } = useSubscription();
const { currentWorkspace } = useWorkspace();
const { currentProject } = useProject();
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
"trustedIp",
@@ -30,10 +30,10 @@ export const IPAllowlistSection = () => {
const onDeleteTrustedIpSubmit = async (trustedIpId: string) => {
try {
if (!currentWorkspace?.id) return;
if (!currentProject?.id) return;
await mutateAsync({
workspaceId: currentWorkspace.id,
projectId: currentProject.id,
trustedIpId
});
@@ -19,7 +19,7 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useSubscription,
useWorkspace
useProject
} from "@app/context";
import { useGetTrustedIps } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -41,8 +41,8 @@ type Props = {
export const IPAllowlistTable = ({ popUp, handlePopUpOpen, handlePopUpToggle }: Props) => {
const { subscription } = useSubscription();
const { currentWorkspace } = useWorkspace();
const { data, isPending } = useGetTrustedIps(currentWorkspace?.id ?? "");
const { currentProject } = useProject();
const { data, isPending } = useGetTrustedIps(currentProject?.id ?? "");
const formatType = (type: string, prefix?: number) => {
return `${type.slice(0, 2).toUpperCase() + type.slice(2)} ${
@@ -77,10 +77,10 @@ export const IPAllowlistTable = ({ popUp, handlePopUpOpen, handlePopUpToggle }:
<Td>{comment}</Td>
{/* <Td>
<div className="flex items-center">
<FontAwesomeIcon
icon={faCircle}
<FontAwesomeIcon
icon={faCircle}
color="#2ecc71"
/>
/>
<p className="ml-4">Active</p>
</div>
</Td> */}