Fix hotkeys blocking comments (#487)

* Fix hotkeys blocking comments

* Fix tests
This commit is contained in:
Charles Bochet
2023-07-01 02:09:49 +03:00
committed by GitHub
parent f08ff68530
commit 8684a8d517
16 changed files with 54 additions and 29 deletions

View File

@ -1,6 +1,8 @@
import { useEffect } from 'react';
import styled from '@emotion/styled';
import { useRecoilState } from 'recoil';
import { captureHotkeyTypeInFocusState } from '@/hotkeys/states/captureHotkeyTypeInFocusState';
import { isDefined } from '@/utils/type-guards/isDefined';
import { Panel } from '../../Panel';
@ -16,9 +18,14 @@ const StyledRightDrawer = styled.div`
`;
export function RightDrawer() {
const [, setCaptureHotkeyTypeInFocus] = useRecoilState(
captureHotkeyTypeInFocusState,
);
const [isRightDrawerOpen] = useRecoilState(isRightDrawerOpenState);
const [rightDrawerPage] = useRecoilState(rightDrawerPageState);
useEffect(() => {
setCaptureHotkeyTypeInFocus(isRightDrawerOpen);
}, [isRightDrawerOpen, setCaptureHotkeyTypeInFocus]);
if (!isRightDrawerOpen || !isDefined(rightDrawerPage)) {
return <></>;
}

View File

@ -1,5 +1,7 @@
import type { Meta, StoryObj } from '@storybook/react';
import { AuthModal } from '@/auth/components/ui/Modal';
import { AuthLayout } from '@/ui/layout/AuthLayout';
import { graphqlMocks } from '~/testing/graphqlMocks';
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
@ -15,7 +17,14 @@ export default meta;
export type Story = StoryObj<typeof Index>;
export const Default: Story = {
render: getRenderWrapperForPage(<Index />, '/auth'),
render: getRenderWrapperForPage(
<AuthLayout>
<AuthModal>
<Index />
</AuthModal>
</AuthLayout>,
'/auth',
),
parameters: {
msw: graphqlMocks,
},

View File

@ -1,5 +1,7 @@
import type { Meta, StoryObj } from '@storybook/react';
import { AuthModal } from '@/auth/components/ui/Modal';
import { AuthLayout } from '@/ui/layout/AuthLayout';
import { graphqlMocks } from '~/testing/graphqlMocks';
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
@ -15,7 +17,14 @@ export default meta;
export type Story = StoryObj<typeof PasswordLogin>;
export const Default: Story = {
render: getRenderWrapperForPage(<PasswordLogin />, '/auth/password-login'),
render: getRenderWrapperForPage(
<AuthLayout>
<AuthModal>
<PasswordLogin />
</AuthModal>
</AuthLayout>,
'/auth/password-login',
),
parameters: {
msw: graphqlMocks,
},

View File

@ -20,11 +20,11 @@ export class PersonCreateManyCompanyInput {
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
@Validator.IsString()
email!: string;
@Field(() => String, {nullable:false})
@Validator.IsPhoneNumber()
@Validator.IsString()
phone!: string;
@Field(() => String, {nullable:false})

View File

@ -20,11 +20,11 @@ export class PersonCreateManyWorkspaceInput {
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
@Validator.IsString()
email!: string;
@Field(() => String, {nullable:false})
@Validator.IsPhoneNumber()
@Validator.IsString()
phone!: string;
@Field(() => String, {nullable:false})

View File

@ -20,11 +20,11 @@ export class PersonCreateManyInput {
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
@Validator.IsString()
email!: string;
@Field(() => String, {nullable:false})
@Validator.IsPhoneNumber()
@Validator.IsString()
phone!: string;
@Field(() => String, {nullable:false})

View File

@ -21,11 +21,11 @@ export class PersonCreateWithoutCompanyInput {
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
@Validator.IsString()
email!: string;
@Field(() => String, {nullable:false})
@Validator.IsPhoneNumber()
@Validator.IsString()
phone!: string;
@Field(() => String, {nullable:false})

View File

@ -21,11 +21,11 @@ export class PersonCreateWithoutWorkspaceInput {
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
@Validator.IsString()
email!: string;
@Field(() => String, {nullable:false})
@Validator.IsPhoneNumber()
@Validator.IsString()
phone!: string;
@Field(() => String, {nullable:false})

View File

@ -22,11 +22,11 @@ export class PersonCreateInput {
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
@Validator.IsString()
email!: string;
@Field(() => String, {nullable:false})
@Validator.IsPhoneNumber()
@Validator.IsString()
phone!: string;
@Field(() => String, {nullable:false})

View File

@ -23,11 +23,11 @@ export class PersonGroupBy {
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
@Validator.IsString()
email!: string;
@Field(() => String, {nullable:false})
@Validator.IsPhoneNumber()
@Validator.IsString()
phone!: string;
@Field(() => String, {nullable:false})

View File

@ -20,11 +20,11 @@ export class PersonMaxAggregate {
lastName?: string;
@Field(() => String, {nullable:true})
@Validator.IsEmail()
@Validator.IsString()
email?: string;
@Field(() => String, {nullable:true})
@Validator.IsPhoneNumber()
@Validator.IsString()
phone?: string;
@Field(() => String, {nullable:true})

View File

@ -20,11 +20,11 @@ export class PersonMinAggregate {
lastName?: string;
@Field(() => String, {nullable:true})
@Validator.IsEmail()
@Validator.IsString()
email?: string;
@Field(() => String, {nullable:true})
@Validator.IsPhoneNumber()
@Validator.IsString()
phone?: string;
@Field(() => String, {nullable:true})

View File

@ -20,11 +20,11 @@ export class PersonUncheckedCreateWithoutCompanyInput {
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
@Validator.IsString()
email!: string;
@Field(() => String, {nullable:false})
@Validator.IsPhoneNumber()
@Validator.IsString()
phone!: string;
@Field(() => String, {nullable:false})

View File

@ -20,11 +20,11 @@ export class PersonUncheckedCreateWithoutWorkspaceInput {
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
@Validator.IsString()
email!: string;
@Field(() => String, {nullable:false})
@Validator.IsPhoneNumber()
@Validator.IsString()
phone!: string;
@Field(() => String, {nullable:false})

View File

@ -20,11 +20,11 @@ export class PersonUncheckedCreateInput {
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
@Validator.IsString()
email!: string;
@Field(() => String, {nullable:false})
@Validator.IsPhoneNumber()
@Validator.IsString()
phone!: string;
@Field(() => String, {nullable:false})

View File

@ -275,9 +275,9 @@ model Person {
firstName String
/// @Validator.IsString()
lastName String
/// @Validator.IsEmail()
/// @Validator.IsString()
email String
/// @Validator.IsPhoneNumber()
/// @Validator.IsString()
phone String
/// @Validator.IsString()
city String