Fix/scope hotkeys (#581)
* WIP * asd * Fix * Fix lint * Removed console log * asd * Removed isDefined * Fix/debounce company card onchange (#580) * Add internal state and debounce for editable text card * Use debounce for date fields too * Update refetch * Nit * Removed comments * Ménage --------- Co-authored-by: Emilien Chauvet <emilien.chauvet.enpc@gmail.com>
This commit is contained in:
@ -11,7 +11,6 @@ import { useOnboardingStatus } from '@/auth/hooks/useOnboardingStatus';
|
||||
import { currentUserState } from '@/auth/states/currentUserState';
|
||||
import { isMockModeState } from '@/auth/states/isMockModeState';
|
||||
import { OnboardingStatus } from '@/auth/utils/getOnboardingStatus';
|
||||
import { useHotkeysScopeOnMountOnly } from '@/hotkeys/hooks/useHotkeysScopeOnMountOnly';
|
||||
import { useScopedHotkeys } from '@/hotkeys/hooks/useScopedHotkeys';
|
||||
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
||||
import { NameFields } from '@/settings/profile/components/NameFields';
|
||||
@ -39,10 +38,6 @@ const StyledButtonContainer = styled.div`
|
||||
`;
|
||||
|
||||
export function CreateProfile() {
|
||||
useHotkeysScopeOnMountOnly({
|
||||
scope: InternalHotkeysScope.CreateProfile,
|
||||
customScopes: { 'command-menu': false, goto: false },
|
||||
});
|
||||
const navigate = useNavigate();
|
||||
const [, setMockMode] = useRecoilState(isMockModeState);
|
||||
const onboardingStatus = useOnboardingStatus();
|
||||
|
||||
@ -9,7 +9,6 @@ import { Title } from '@/auth/components/ui/Title';
|
||||
import { useOnboardingStatus } from '@/auth/hooks/useOnboardingStatus';
|
||||
import { isMockModeState } from '@/auth/states/isMockModeState';
|
||||
import { OnboardingStatus } from '@/auth/utils/getOnboardingStatus';
|
||||
import { useHotkeysScopeOnMountOnly } from '@/hotkeys/hooks/useHotkeysScopeOnMountOnly';
|
||||
import { useScopedHotkeys } from '@/hotkeys/hooks/useScopedHotkeys';
|
||||
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
||||
import { WorkspaceLogoUploader } from '@/settings/workspace/components/WorkspaceLogoUploader';
|
||||
@ -37,10 +36,6 @@ const StyledButtonContainer = styled.div`
|
||||
`;
|
||||
|
||||
export function CreateWorkspace() {
|
||||
useHotkeysScopeOnMountOnly({
|
||||
scope: InternalHotkeysScope.CreateWokspace,
|
||||
customScopes: { 'command-menu': false, goto: false },
|
||||
});
|
||||
const [, setMockMode] = useRecoilState(isMockModeState);
|
||||
const navigate = useNavigate();
|
||||
const onboardingStatus = useOnboardingStatus();
|
||||
|
||||
@ -13,7 +13,6 @@ import { authFlowUserEmailState } from '@/auth/states/authFlowUserEmailState';
|
||||
import { isMockModeState } from '@/auth/states/isMockModeState';
|
||||
import { authProvidersState } from '@/client-config/states/authProvidersState';
|
||||
import { isDemoModeState } from '@/client-config/states/isDemoModeState';
|
||||
import { useHotkeysScopeOnMountOnly } from '@/hotkeys/hooks/useHotkeysScopeOnMountOnly';
|
||||
import { useScopedHotkeys } from '@/hotkeys/hooks/useScopedHotkeys';
|
||||
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
||||
import { MainButton } from '@/ui/components/buttons/MainButton';
|
||||
@ -33,10 +32,6 @@ const StyledFooterNote = styled(FooterNote)`
|
||||
`;
|
||||
|
||||
export function Index() {
|
||||
useHotkeysScopeOnMountOnly({
|
||||
scope: InternalHotkeysScope.AuthIndex,
|
||||
customScopes: { 'command-menu': false, goto: false },
|
||||
});
|
||||
const navigate = useNavigate();
|
||||
const theme = useTheme();
|
||||
const [, setMockMode] = useRecoilState(isMockModeState);
|
||||
|
||||
@ -11,7 +11,6 @@ import { useAuth } from '@/auth/hooks/useAuth';
|
||||
import { authFlowUserEmailState } from '@/auth/states/authFlowUserEmailState';
|
||||
import { isMockModeState } from '@/auth/states/isMockModeState';
|
||||
import { isDemoModeState } from '@/client-config/states/isDemoModeState';
|
||||
import { useHotkeysScopeOnMountOnly } from '@/hotkeys/hooks/useHotkeysScopeOnMountOnly';
|
||||
import { useScopedHotkeys } from '@/hotkeys/hooks/useScopedHotkeys';
|
||||
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
||||
import { MainButton } from '@/ui/components/buttons/MainButton';
|
||||
@ -51,10 +50,6 @@ const StyledErrorContainer = styled.div`
|
||||
`;
|
||||
|
||||
export function PasswordLogin() {
|
||||
useHotkeysScopeOnMountOnly({
|
||||
scope: InternalHotkeysScope.PasswordLogin,
|
||||
customScopes: { 'command-menu': false, goto: false },
|
||||
});
|
||||
const navigate = useNavigate();
|
||||
const [isDemoMode] = useRecoilState(isDemoModeState);
|
||||
|
||||
|
||||
@ -4,8 +4,6 @@ import styled from '@emotion/styled';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { GET_COMPANIES } from '@/companies/services';
|
||||
import { useHotkeysScopeOnMountOnly } from '@/hotkeys/hooks/useHotkeysScopeOnMountOnly';
|
||||
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
||||
import { RecoilScope } from '@/recoil-scope/components/RecoilScope';
|
||||
import { EntityTableActionBar } from '@/ui/components/table/action-bar/EntityTableActionBar';
|
||||
import { IconBuildingSkyscraper } from '@/ui/icons/index';
|
||||
@ -26,11 +24,6 @@ const StyledTableContainer = styled.div`
|
||||
`;
|
||||
|
||||
export function Companies() {
|
||||
useHotkeysScopeOnMountOnly({
|
||||
scope: InternalHotkeysScope.Table,
|
||||
customScopes: { 'command-menu': true, goto: true },
|
||||
});
|
||||
|
||||
const [insertCompany] = useInsertCompanyMutation();
|
||||
|
||||
async function handleAddButtonClick() {
|
||||
|
||||
@ -3,8 +3,6 @@ import { useTheme } from '@emotion/react';
|
||||
|
||||
import { Timeline } from '@/comments/components/timeline/Timeline';
|
||||
import { useCompanyQuery } from '@/companies/services';
|
||||
import { useHotkeysScopeOnMountOnly } from '@/hotkeys/hooks/useHotkeysScopeOnMountOnly';
|
||||
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
||||
import { RawLink } from '@/ui/components/links/RawLink';
|
||||
import { PropertyBox } from '@/ui/components/property-box/PropertyBox';
|
||||
import { PropertyBoxItem } from '@/ui/components/property-box/PropertyBoxItem';
|
||||
@ -19,11 +17,6 @@ import { CommentableType } from '~/generated/graphql';
|
||||
export function CompanyShow() {
|
||||
const companyId = useParams().companyId ?? '';
|
||||
|
||||
useHotkeysScopeOnMountOnly({
|
||||
scope: InternalHotkeysScope.ShowPage,
|
||||
customScopes: { 'command-menu': true, goto: true },
|
||||
});
|
||||
|
||||
const { data } = useCompanyQuery(companyId);
|
||||
const company = data?.findUniqueCompany;
|
||||
|
||||
|
||||
@ -3,8 +3,6 @@ import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { useHotkeysScopeOnMountOnly } from '@/hotkeys/hooks/useHotkeysScopeOnMountOnly';
|
||||
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
||||
import { GET_PEOPLE } from '@/people/services';
|
||||
import { RecoilScope } from '@/recoil-scope/components/RecoilScope';
|
||||
import { EntityTableActionBar } from '@/ui/components/table/action-bar/EntityTableActionBar';
|
||||
@ -24,11 +22,6 @@ const StyledPeopleContainer = styled.div`
|
||||
`;
|
||||
|
||||
export function People() {
|
||||
useHotkeysScopeOnMountOnly({
|
||||
scope: InternalHotkeysScope.Table,
|
||||
customScopes: { 'command-menu': true, goto: true },
|
||||
});
|
||||
|
||||
const [insertPersonMutation] = useInsertPersonMutation();
|
||||
|
||||
async function handleAddButtonClick() {
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { useHotkeysScopeOnMountOnly } from '@/hotkeys/hooks/useHotkeysScopeOnMountOnly';
|
||||
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
||||
import { EmailField } from '@/settings/profile/components/EmailField';
|
||||
import { NameFields } from '@/settings/profile/components/NameFields';
|
||||
import { ProfilePictureUploader } from '@/settings/profile/components/ProfilePictureUploader';
|
||||
@ -27,11 +25,6 @@ const StyledSectionContainer = styled.div`
|
||||
`;
|
||||
|
||||
export function SettingsProfile() {
|
||||
useHotkeysScopeOnMountOnly({
|
||||
scope: InternalHotkeysScope.Settings,
|
||||
customScopes: { 'command-menu': true, goto: false },
|
||||
});
|
||||
|
||||
return (
|
||||
<NoTopBarContainer>
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user