-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: multi tenancy - add tenant removal form (#542)
* feat: add a danger zone into General Settings of the organization with removal mutation --------- Co-authored-by: Michal Kleszcz <[email protected]>
- Loading branch information
Showing
36 changed files
with
734 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...bapp-libs/webapp-core/src/components/alertDialog/__tests__/alertDialog.component.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { fireEvent, screen } from '@testing-library/react'; | ||
import React from 'react'; | ||
|
||
import { | ||
AlertDialog, | ||
AlertDialogAction, | ||
AlertDialogCancel, | ||
AlertDialogContent, | ||
AlertDialogDescription, | ||
AlertDialogFooter, | ||
AlertDialogHeader, | ||
AlertDialogTitle, | ||
AlertDialogTrigger, | ||
} from '../'; | ||
import { render } from '../../../tests/utils/rendering'; | ||
|
||
const triggerText = 'Open'; | ||
const titleText = 'Title'; | ||
const descriptionText = 'Description'; | ||
const cancelCTA = 'Cancel'; | ||
const actionCTA = 'Continue'; | ||
|
||
const Component = () => ( | ||
<AlertDialog> | ||
<AlertDialogTrigger>{triggerText}</AlertDialogTrigger> | ||
<AlertDialogContent> | ||
<AlertDialogHeader> | ||
<AlertDialogTitle>{titleText}</AlertDialogTitle> | ||
<AlertDialogDescription>{descriptionText}</AlertDialogDescription> | ||
</AlertDialogHeader> | ||
<AlertDialogFooter> | ||
<AlertDialogCancel>{cancelCTA}</AlertDialogCancel> | ||
<AlertDialogAction>{actionCTA}</AlertDialogAction> | ||
</AlertDialogFooter> | ||
</AlertDialogContent> | ||
</AlertDialog> | ||
); | ||
|
||
describe('AlertDialog: Component', () => { | ||
it('should render trigger only when not pressed', async () => { | ||
render(<Component />); | ||
|
||
expect(await screen.findByText(triggerText)).toBeInTheDocument(); | ||
expect(screen.queryByText(titleText)).not.toBeInTheDocument(); | ||
}); | ||
|
||
it('should render content when pressed', async () => { | ||
render(<Component />); | ||
|
||
expect(screen.queryByText(titleText)).not.toBeInTheDocument(); | ||
expect(screen.queryByText(descriptionText)).not.toBeInTheDocument(); | ||
|
||
const button = await screen.findByText(triggerText); | ||
fireEvent.click(button); | ||
|
||
expect(await screen.findByText(titleText)).toBeInTheDocument(); | ||
expect(await screen.findByText(descriptionText)).toBeInTheDocument(); | ||
}); | ||
}); |
9 changes: 9 additions & 0 deletions
9
packages/webapp-libs/webapp-core/src/components/alertDialog/alertDialog.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'; | ||
|
||
const AlertDialog = AlertDialogPrimitive.Root; | ||
|
||
const AlertDialogTrigger = AlertDialogPrimitive.Trigger; | ||
|
||
const AlertDialogPortal = AlertDialogPrimitive.Portal; | ||
|
||
export { AlertDialog, AlertDialogPortal, AlertDialogTrigger }; |
45 changes: 45 additions & 0 deletions
45
packages/webapp-libs/webapp-core/src/components/alertDialog/alertDialog.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { | ||
AlertDialog, | ||
AlertDialogAction, | ||
AlertDialogCancel, | ||
AlertDialogContent, | ||
AlertDialogDescription, | ||
AlertDialogFooter, | ||
AlertDialogHeader, | ||
AlertDialogTitle, | ||
AlertDialogTrigger, | ||
} from './'; | ||
|
||
type Story = StoryObj<typeof AlertDialog>; | ||
|
||
const meta: Meta<typeof AlertDialog> = { | ||
title: 'Core/AlertDialog', | ||
component: AlertDialog, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default: Story = { | ||
render: () => ( | ||
<div className="p-8"> | ||
<AlertDialog> | ||
<AlertDialogTrigger>Open</AlertDialogTrigger> | ||
<AlertDialogContent> | ||
<AlertDialogHeader> | ||
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle> | ||
<AlertDialogDescription> | ||
This action cannot be undone. This will permanently delete your account and remove your data from our | ||
servers. | ||
</AlertDialogDescription> | ||
</AlertDialogHeader> | ||
<AlertDialogFooter> | ||
<AlertDialogCancel>Cancel</AlertDialogCancel> | ||
<AlertDialogAction>Continue</AlertDialogAction> | ||
</AlertDialogFooter> | ||
</AlertDialogContent> | ||
</AlertDialog> | ||
</div> | ||
), | ||
}; |
14 changes: 14 additions & 0 deletions
14
.../webapp-core/src/components/alertDialog/alertDialogAction/alertDialogAction.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'; | ||
import * as React from 'react'; | ||
|
||
import { cn } from '../../../lib/utils'; | ||
import { buttonVariants } from '../../buttons/button/button.styles'; | ||
|
||
export const AlertDialogAction = React.forwardRef< | ||
React.ElementRef<typeof AlertDialogPrimitive.Action>, | ||
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action> | ||
>(({ className, ...props }, ref) => ( | ||
<AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} /> | ||
)); | ||
|
||
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName; |
1 change: 1 addition & 0 deletions
1
packages/webapp-libs/webapp-core/src/components/alertDialog/alertDialogAction/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './alertDialogAction.component'; |
18 changes: 18 additions & 0 deletions
18
.../webapp-core/src/components/alertDialog/alertDialogCancel/alertDialogCancel.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'; | ||
import * as React from 'react'; | ||
|
||
import { cn } from '../../../lib/utils'; | ||
import { buttonVariants } from '../../buttons/button/button.styles'; | ||
|
||
export const AlertDialogCancel = React.forwardRef< | ||
React.ElementRef<typeof AlertDialogPrimitive.Cancel>, | ||
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel> | ||
>(({ className, ...props }, ref) => ( | ||
<AlertDialogPrimitive.Cancel | ||
ref={ref} | ||
className={cn(buttonVariants({ variant: 'outline' }), 'mt-2 sm:mt-0', className)} | ||
{...props} | ||
/> | ||
)); | ||
|
||
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName; |
1 change: 1 addition & 0 deletions
1
packages/webapp-libs/webapp-core/src/components/alertDialog/alertDialogCancel/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './alertDialogCancel.component'; |
Oops, something went wrong.