Skip to content

Commit

Permalink
AI Assistant: Remove dead Breve code (#39089)
Browse files Browse the repository at this point in the history
* remove old files and use typescript on all files

* changelog
  • Loading branch information
dhasilva authored Aug 28, 2024
1 parent 40cedaa commit 78448a0
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 1,286 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

AI Assistant: Remove dead Breve code
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ import features from './features';
import calculateFleschKincaid from './utils/FleschKincaidUtils';
import { getPostText } from './utils/getPostText';
import './breve.scss';
/**
* Types
*/
import type { BreveSelect } from './types';

export const useInit = init => {
const [ initialized, setInitialized ] = useState( false );
Expand All @@ -34,13 +38,13 @@ export const useInit = init => {
};

const Controls = ( { blocks, disabledFeatures } ) => {
const [ gradeLevel, setGradeLevel ] = useState( null );
const [ gradeLevel, setGradeLevel ] = useState< string | null >( null );
const { toggleFeature, toggleProofread, setPopoverHover, setHighlightHover, setPopoverAnchor } =
useDispatch( 'jetpack/ai-breve' );
const { tracks } = useAnalytics();

const isProofreadEnabled = useSelect(
select => select( 'jetpack/ai-breve' ).isProofreadEnabled(),
select => ( select( 'jetpack/ai-breve' ) as BreveSelect ).isProofreadEnabled(),
[]
);

Expand All @@ -64,7 +68,7 @@ const Controls = ( { blocks, disabledFeatures } ) => {
const debouncedGradeLevelUpdate = useDebounce( updateGradeLevel, 250 );

const handleToggleFeature = useCallback(
feature => checked => {
( feature: string ) => ( checked: boolean ) => {
tracks.recordEvent( 'jetpack_ai_breve_feature_toggle', { type: feature, on: checked } );
toggleFeature( feature, checked );
},
Expand Down
Loading

0 comments on commit 78448a0

Please sign in to comment.