@@ -33,7 +33,7 @@ const VendorOverviewPage = lazy(() => import("./pages/VendorOverviewPage"));
|
|||||||
const SettingsPage = lazy(() => import("./pages/SettingsPage"));
|
const SettingsPage = lazy(() => import("./pages/SettingsPage"));
|
||||||
const CreatePeoplePage = lazy(() => import("./pages/CreatePeoplePage"));
|
const CreatePeoplePage = lazy(() => import("./pages/CreatePeoplePage"));
|
||||||
const FrameworkOverviewPage = lazy(
|
const FrameworkOverviewPage = lazy(
|
||||||
() => import("./pages/FrameworkOverviewPage")
|
() => import("./pages/FrameworkOverviewPage"),
|
||||||
);
|
);
|
||||||
const ControlOverviewPage = lazy(() => import("./pages/ControlOverviewPage"));
|
const ControlOverviewPage = lazy(() => import("./pages/ControlOverviewPage"));
|
||||||
const PeopleOverviewPage = lazy(() => import("./pages/PeopleOverviewPage"));
|
const PeopleOverviewPage = lazy(() => import("./pages/PeopleOverviewPage"));
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ interface OrganizationContextType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const OrganizationContext = createContext<OrganizationContextType | undefined>(
|
const OrganizationContext = createContext<OrganizationContextType | undefined>(
|
||||||
undefined
|
undefined,
|
||||||
);
|
);
|
||||||
|
|
||||||
export function useOrganization() {
|
export function useOrganization() {
|
||||||
const context = useContext(OrganizationContext);
|
const context = useContext(OrganizationContext);
|
||||||
if (context === undefined) {
|
if (context === undefined) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"useOrganization must be used within an OrganizationProvider"
|
"useOrganization must be used within an OrganizationProvider",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ function BreadcrumbFrameworkOverview() {
|
|||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
{ frameworkId: frameworkId! },
|
{ frameworkId: frameworkId! },
|
||||||
{ fetchPolicy: "store-or-network" }
|
{ fetchPolicy: "store-or-network" },
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -133,7 +133,7 @@ function BreadcrumbPeopleOverview() {
|
|||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
{ peopleId: peopleId! },
|
{ peopleId: peopleId! },
|
||||||
{ fetchPolicy: "store-or-network" }
|
{ fetchPolicy: "store-or-network" },
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -177,7 +177,7 @@ function BreadcrumbVendorOverview() {
|
|||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
{ vendorId: vendorId! },
|
{ vendorId: vendorId! },
|
||||||
{ fetchPolicy: "store-or-network" }
|
{ fetchPolicy: "store-or-network" },
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -215,7 +215,7 @@ function BreadcrumbControlOverview() {
|
|||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
{ frameworkId: frameworkId!, controlId: controlId! },
|
{ frameworkId: frameworkId!, controlId: controlId! },
|
||||||
{ fetchPolicy: "store-or-network" }
|
{ fetchPolicy: "store-or-network" },
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ function CreatePeoplePageContent({
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const peopleConnectionId = ConnectionHandler.getConnectionID(
|
const peopleConnectionId = ConnectionHandler.getConnectionID(
|
||||||
data.viewer.organization.id,
|
data.viewer.organization.id,
|
||||||
"PeopleListPage_peoples"
|
"PeopleListPage_peoples",
|
||||||
);
|
);
|
||||||
|
|
||||||
createPeople({
|
createPeople({
|
||||||
@@ -189,7 +189,7 @@ function CreatePeoplePageContent({
|
|||||||
newEmails[index] = e.target.value;
|
newEmails[index] = e.target.value;
|
||||||
handleFieldChange(
|
handleFieldChange(
|
||||||
"additionalEmailAddresses",
|
"additionalEmailAddresses",
|
||||||
newEmails
|
newEmails,
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -199,11 +199,11 @@ function CreatePeoplePageContent({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
const newEmails =
|
const newEmails =
|
||||||
formData.additionalEmailAddresses.filter(
|
formData.additionalEmailAddresses.filter(
|
||||||
(_, i) => i !== index
|
(_, i) => i !== index,
|
||||||
);
|
);
|
||||||
handleFieldChange(
|
handleFieldChange(
|
||||||
"additionalEmailAddresses",
|
"additionalEmailAddresses",
|
||||||
newEmails
|
newEmails,
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -251,7 +251,7 @@ function CreatePeoplePageContent({
|
|||||||
"rounded-full px-4 py-1 text-sm transition-colors",
|
"rounded-full px-4 py-1 text-sm transition-colors",
|
||||||
formData.kind === "EMPLOYEE"
|
formData.kind === "EMPLOYEE"
|
||||||
? "bg-blue-100 text-blue-900 ring-2 ring-blue-600 ring-offset-2"
|
? "bg-blue-100 text-blue-900 ring-2 ring-blue-600 ring-offset-2"
|
||||||
: "bg-gray-100 text-gray-900 hover:bg-gray-200"
|
: "bg-gray-100 text-gray-900 hover:bg-gray-200",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
Employee
|
Employee
|
||||||
@@ -263,7 +263,7 @@ function CreatePeoplePageContent({
|
|||||||
"rounded-full px-4 py-1 text-sm transition-colors",
|
"rounded-full px-4 py-1 text-sm transition-colors",
|
||||||
formData.kind === "CONTRACTOR"
|
formData.kind === "CONTRACTOR"
|
||||||
? "bg-purple-100 text-purple-900 ring-2 ring-purple-600 ring-offset-2"
|
? "bg-purple-100 text-purple-900 ring-2 ring-purple-600 ring-offset-2"
|
||||||
: "bg-gray-100 text-gray-900 hover:bg-gray-200"
|
: "bg-gray-100 text-gray-900 hover:bg-gray-200",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
Contractor
|
Contractor
|
||||||
@@ -293,7 +293,7 @@ function CreatePeoplePageContent({
|
|||||||
|
|
||||||
export default function CreatePeoplePage() {
|
export default function CreatePeoplePage() {
|
||||||
const [queryRef, loadQuery] = useQueryLoader<CreatePeoplePageQueryType>(
|
const [queryRef, loadQuery] = useQueryLoader<CreatePeoplePageQueryType>(
|
||||||
createPeoplePageQuery
|
createPeoplePageQuery,
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ function FrameworkListPageContent({
|
|||||||
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-2">
|
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-2">
|
||||||
{frameworks.map((framework) => {
|
{frameworks.map((framework) => {
|
||||||
const validatedControls = framework.controls.edges.filter(
|
const validatedControls = framework.controls.edges.filter(
|
||||||
(edge) => edge?.node?.state === "IMPLEMENTED"
|
(edge) => edge?.node?.state === "IMPLEMENTED",
|
||||||
).length;
|
).length;
|
||||||
const totalControls = framework.controls.edges.length;
|
const totalControls = framework.controls.edges.length;
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ function FrameworkListPageFallback() {
|
|||||||
|
|
||||||
export default function FrameworkListPage() {
|
export default function FrameworkListPage() {
|
||||||
const [queryRef, loadQuery] = useQueryLoader<FrameworkListPageQueryType>(
|
const [queryRef, loadQuery] = useQueryLoader<FrameworkListPageQueryType>(
|
||||||
FrameworkListPageQuery
|
FrameworkListPageQuery,
|
||||||
);
|
);
|
||||||
|
|
||||||
const { currentOrganization } = useOrganization();
|
const { currentOrganization } = useOrganization();
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ function PeopleListContent({
|
|||||||
}) {
|
}) {
|
||||||
const data = usePreloadedQuery<PeopleListPageQueryType>(
|
const data = usePreloadedQuery<PeopleListPageQueryType>(
|
||||||
peopleListPageQuery,
|
peopleListPageQuery,
|
||||||
queryRef
|
queryRef,
|
||||||
);
|
);
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const [isPending, startTransition] = useTransition();
|
const [isPending, startTransition] = useTransition();
|
||||||
@@ -216,8 +216,8 @@ function PeopleListContent({
|
|||||||
{person?.kind === "EMPLOYEE"
|
{person?.kind === "EMPLOYEE"
|
||||||
? "Employee"
|
? "Employee"
|
||||||
: person?.kind === "CONTRACTOR"
|
: person?.kind === "CONTRACTOR"
|
||||||
? "Contractor"
|
? "Contractor"
|
||||||
: "Vendor"}
|
: "Vendor"}
|
||||||
</Badge>
|
</Badge>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
@@ -227,7 +227,7 @@ function PeopleListContent({
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (
|
if (
|
||||||
window.confirm(
|
window.confirm(
|
||||||
"Are you sure you want to delete this person?"
|
"Are you sure you want to delete this person?",
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
deletePeople({
|
deletePeople({
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ function VendorListContent({
|
|||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
const data = usePreloadedQuery<VendorListPageQueryType>(
|
const data = usePreloadedQuery<VendorListPageQueryType>(
|
||||||
vendorListPageQuery,
|
vendorListPageQuery,
|
||||||
queryRef
|
queryRef,
|
||||||
);
|
);
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const [isPending, startTransition] = useTransition();
|
const [isPending, startTransition] = useTransition();
|
||||||
@@ -335,7 +335,7 @@ function VendorListContent({
|
|||||||
e.preventDefault(); // Prevent navigation
|
e.preventDefault(); // Prevent navigation
|
||||||
if (
|
if (
|
||||||
window.confirm(
|
window.confirm(
|
||||||
"Are you sure you want to delete this vendor?"
|
"Are you sure you want to delete this vendor?",
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
deleteVendor({
|
deleteVendor({
|
||||||
|
|||||||
Reference in New Issue
Block a user