1088f7bbab
## Summary
This PR adds the `lingui/no-unlocalized-strings` ESLint rule to detect
untranslated strings and fixes translation issues across multiple
components.
## Changes
### ESLint Configuration (`eslint.config.react.mjs`)
- Added comprehensive `ignore` patterns for non-translatable strings
(CSS values, HTML attributes, technical identifiers)
- Added `ignoreNames` for props that don't need translation (className,
data-*, aria-*, etc.)
- Added `ignoreFunctions` for console methods, URL APIs, and other
non-user-facing functions
- Disabled rule for debug files, storybook, and test files
### Components Fixed (~19 files)
- Object record components (field inputs, pickers, merge dialogs)
- Settings components (accounts, admin panel)
- Serverless function components
- Record table and title cell components
## Status
🚧 **Work in Progress** - ~124 files remaining to fix
This PR is being submitted as draft to allow progressive fixing of
remaining translation issues.
## Testing
- Run `npx eslint "src/**/*.tsx"` in `packages/twenty-front` to check
remaining issues
85 lines
3.0 KiB
TypeScript
85 lines
3.0 KiB
TypeScript
import { useRecoilCallback } from 'recoil';
|
|
|
|
import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchState';
|
|
|
|
import { COMMAND_MENU_SEARCH_INPUT_FOCUS_ID } from '@/command-menu/constants/CommandMenuSearchInputFocusId';
|
|
import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId';
|
|
import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu';
|
|
import { isCommandMenuClosingState } from '@/command-menu/states/isCommandMenuClosingState';
|
|
import { CommandMenuPages } from '@/command-menu/types/CommandMenuPages';
|
|
import { useCloseAnyOpenDropdown } from '@/ui/layout/dropdown/hooks/useCloseAnyOpenDropdown';
|
|
import { emitSidePanelOpenEvent } from '@/ui/layout/right-drawer/utils/emitSidePanelOpenEvent';
|
|
import { isDragSelectionStartEnabledState } from '@/ui/utilities/drag-select/states/internal/isDragSelectionStartEnabledState';
|
|
import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById';
|
|
import { t } from '@lingui/core/macro';
|
|
import { useCallback } from 'react';
|
|
import { IconDotsVertical } from 'twenty-ui/display';
|
|
import { isCommandMenuOpenedState } from '../states/isCommandMenuOpenedState';
|
|
|
|
export const useCommandMenu = () => {
|
|
const { navigateCommandMenu } = useNavigateCommandMenu();
|
|
const { closeAnyOpenDropdown } = useCloseAnyOpenDropdown();
|
|
|
|
const { removeFocusItemFromFocusStackById } =
|
|
useRemoveFocusItemFromFocusStackById();
|
|
|
|
const closeCommandMenu = useRecoilCallback(
|
|
({ set, snapshot }) =>
|
|
() => {
|
|
const isCommandMenuOpened = snapshot
|
|
.getLoadable(isCommandMenuOpenedState)
|
|
.getValue();
|
|
|
|
if (isCommandMenuOpened) {
|
|
set(isCommandMenuOpenedState, false);
|
|
set(isCommandMenuClosingState, true);
|
|
set(isDragSelectionStartEnabledState, true);
|
|
closeAnyOpenDropdown();
|
|
removeFocusItemFromFocusStackById({
|
|
focusId: COMMAND_MENU_SEARCH_INPUT_FOCUS_ID,
|
|
});
|
|
removeFocusItemFromFocusStackById({
|
|
focusId: SIDE_PANEL_FOCUS_ID,
|
|
});
|
|
}
|
|
},
|
|
[closeAnyOpenDropdown, removeFocusItemFromFocusStackById],
|
|
);
|
|
|
|
const openCommandMenu = useCallback(() => {
|
|
emitSidePanelOpenEvent();
|
|
closeAnyOpenDropdown();
|
|
navigateCommandMenu({
|
|
page: CommandMenuPages.Root,
|
|
pageTitle: t`Command Menu`,
|
|
pageIcon: IconDotsVertical,
|
|
resetNavigationStack: true,
|
|
});
|
|
}, [closeAnyOpenDropdown, navigateCommandMenu]);
|
|
|
|
const toggleCommandMenu = useRecoilCallback(
|
|
({ snapshot, set }) =>
|
|
async () => {
|
|
const isCommandMenuOpened = snapshot
|
|
.getLoadable(isCommandMenuOpenedState)
|
|
.getValue();
|
|
|
|
set(commandMenuSearchState, '');
|
|
|
|
if (isCommandMenuOpened) {
|
|
closeCommandMenu();
|
|
} else {
|
|
openCommandMenu();
|
|
}
|
|
},
|
|
[closeCommandMenu, openCommandMenu],
|
|
);
|
|
|
|
return {
|
|
openCommandMenu,
|
|
closeCommandMenu,
|
|
navigateCommandMenu,
|
|
toggleCommandMenu,
|
|
};
|
|
};
|