Fix/relation picker (#546)
* FIx pickers * Fix * Fix lint --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -2,6 +2,8 @@ import { useCallback, useState } from 'react';
|
|||||||
import { useRecoilState } from 'recoil';
|
import { useRecoilState } from 'recoil';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
|
||||||
|
import { useHotkeysScopeOnBooleanState } from '@/hotkeys/hooks/useHotkeysScopeOnBooleanState';
|
||||||
|
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
||||||
import { RecoilScope } from '@/recoil-scope/components/RecoilScope';
|
import { RecoilScope } from '@/recoil-scope/components/RecoilScope';
|
||||||
import { Column } from '@/ui/board/components/Board';
|
import { Column } from '@/ui/board/components/Board';
|
||||||
import { NewButton as UINewButton } from '@/ui/board/components/NewButton';
|
import { NewButton as UINewButton } from '@/ui/board/components/NewButton';
|
||||||
@ -71,6 +73,12 @@ export function NewButton({ pipelineId, columnId }: OwnProps) {
|
|||||||
const onNewClick = useCallback(() => {
|
const onNewClick = useCallback(() => {
|
||||||
setIsCreatingCard(true);
|
setIsCreatingCard(true);
|
||||||
}, [setIsCreatingCard]);
|
}, [setIsCreatingCard]);
|
||||||
|
|
||||||
|
useHotkeysScopeOnBooleanState(
|
||||||
|
{ scope: InternalHotkeysScope.RelationPicker },
|
||||||
|
isCreatingCard,
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isCreatingCard && (
|
{isCreatingCard && (
|
||||||
|
|||||||
@ -60,9 +60,10 @@ export function useEntitySelectScroll<
|
|||||||
] as HTMLElement;
|
] as HTMLElement;
|
||||||
|
|
||||||
if (currentHoveredRef) {
|
if (currentHoveredRef) {
|
||||||
|
console.log({ currentHoveredRef, containerRef });
|
||||||
scrollIntoView(currentHoveredRef, {
|
scrollIntoView(currentHoveredRef, {
|
||||||
align: {
|
align: {
|
||||||
top: 0.275,
|
top: 0.15,
|
||||||
},
|
},
|
||||||
isScrollable: (target) => {
|
isScrollable: (target) => {
|
||||||
return target === containerRef.current;
|
return target === containerRef.current;
|
||||||
|
|||||||
@ -80,6 +80,11 @@ export function FilterDropdownButton() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useHotkeysScopeOnBooleanState(
|
||||||
|
{ scope: InternalHotkeysScope.RelationPicker },
|
||||||
|
tableFilterDefinitionUsedInDropdown?.type === 'entity',
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownButton
|
<DropdownButton
|
||||||
label="Filter"
|
label="Filter"
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { useRecoilState } from 'recoil';
|
import { useRecoilState } from 'recoil';
|
||||||
|
|
||||||
import { useHotkeysScopeOnBooleanState } from '@/hotkeys/hooks/useHotkeysScopeOnBooleanState';
|
|
||||||
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
|
||||||
import { isDefined } from '@/utils/type-guards/isDefined';
|
import { isDefined } from '@/utils/type-guards/isDefined';
|
||||||
|
|
||||||
import { Panel } from '../../Panel';
|
import { Panel } from '../../Panel';
|
||||||
@ -21,11 +19,6 @@ export function RightDrawer() {
|
|||||||
const [isRightDrawerOpen] = useRecoilState(isRightDrawerOpenState);
|
const [isRightDrawerOpen] = useRecoilState(isRightDrawerOpenState);
|
||||||
const [rightDrawerPage] = useRecoilState(rightDrawerPageState);
|
const [rightDrawerPage] = useRecoilState(rightDrawerPageState);
|
||||||
|
|
||||||
useHotkeysScopeOnBooleanState(
|
|
||||||
{ scope: InternalHotkeysScope.RightDrawer },
|
|
||||||
isRightDrawerOpen,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!isRightDrawerOpen || !isDefined(rightDrawerPage)) {
|
if (!isRightDrawerOpen || !isDefined(rightDrawerPage)) {
|
||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,12 @@
|
|||||||
|
import { useRecoilValue } from 'recoil';
|
||||||
|
|
||||||
import { useCurrentHotkeysScope } from '@/hotkeys/hooks/useCurrentHotkeysScope';
|
import { useCurrentHotkeysScope } from '@/hotkeys/hooks/useCurrentHotkeysScope';
|
||||||
import { useResetHotkeysScopeStack } from '@/hotkeys/hooks/useResetHotkeysScopeStack';
|
import { useResetHotkeysScopeStack } from '@/hotkeys/hooks/useResetHotkeysScopeStack';
|
||||||
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
||||||
|
|
||||||
|
import { isSoftFocusActiveState } from '../states/isSoftFocusActiveState';
|
||||||
|
import { isSomeInputInEditModeState } from '../states/isSomeInputInEditModeState';
|
||||||
|
|
||||||
import { useCloseCurrentCellInEditMode } from './useClearCellInEditMode';
|
import { useCloseCurrentCellInEditMode } from './useClearCellInEditMode';
|
||||||
import { useDisableSoftFocus } from './useDisableSoftFocus';
|
import { useDisableSoftFocus } from './useDisableSoftFocus';
|
||||||
|
|
||||||
@ -12,7 +17,15 @@ export function useLeaveTableFocus() {
|
|||||||
const disableSoftFocus = useDisableSoftFocus();
|
const disableSoftFocus = useDisableSoftFocus();
|
||||||
const closeCurrentCellInEditMode = useCloseCurrentCellInEditMode();
|
const closeCurrentCellInEditMode = useCloseCurrentCellInEditMode();
|
||||||
|
|
||||||
|
const isSoftFocusActive = useRecoilValue(isSoftFocusActiveState);
|
||||||
|
const isSomeInputInEditMode = useRecoilValue(isSomeInputInEditModeState);
|
||||||
|
|
||||||
return async function leaveTableFocus() {
|
return async function leaveTableFocus() {
|
||||||
|
// TODO: replace with scope ancestor ?
|
||||||
|
if (!isSoftFocusActive && !isSomeInputInEditMode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (currentHotkeysScope?.scope === InternalHotkeysScope.Table) {
|
if (currentHotkeysScope?.scope === InternalHotkeysScope.Table) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ArgsType, Field } from '@nestjs/graphql';
|
import { ArgsType, Field } from '@nestjs/graphql';
|
||||||
import { IsEmail, IsNotEmpty, IsString, MinLength } from 'class-validator';
|
import { IsEmail, IsNotEmpty, IsString } from 'class-validator';
|
||||||
|
|
||||||
@ArgsType()
|
@ArgsType()
|
||||||
export class ChallengeInput {
|
export class ChallengeInput {
|
||||||
|
|||||||
Reference in New Issue
Block a user