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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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