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