Skip to content

Commit

Permalink
Update var name
Browse files Browse the repository at this point in the history
  • Loading branch information
dkmyta committed Dec 21, 2024
1 parent c5499d8 commit f38a689
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ import { ThreatsModalContext } from '.';
/**
* ThreatActions component
*
* @param {object} props - The props.
* @param {Threat[]} props.selectedThreats - The selected threats.
* @param {boolean} props.canReturnToBulk - Whether the user can return to the bulk view.
* @param {Function} props.viewBulkThreats - The function to view all threats.
* @param {object} props - The props.
* @param {Threat[]} props.selectedThreats - The selected threats.
* @param {boolean} props.canReturnToBulkThreats - Whether the user can return to the bulk view.
* @param {Function} props.viewBulkThreats - The function to view all threats.
*
* @return {JSX.Element | null} The rendered action buttons or null if no actions are available.
*/
const ThreatActions = ( {
selectedThreats,
canReturnToBulk,
canReturnToBulkThreats,
viewBulkThreats,
}: {
selectedThreats: Threat[];
canReturnToBulk: boolean;
canReturnToBulkThreats: boolean;
viewBulkThreats: () => void;
} ): JSX.Element => {
const {
Expand Down Expand Up @@ -77,7 +77,7 @@ const ThreatActions = ( {

const renderIndividualActions = () => (
<>
{ canReturnToBulk && (
{ canReturnToBulkThreats && (
<Button className={ styles[ 'view-bulk' ] } onClick={ viewBulkThreats }>
{ sprintf(
// translators: %d is the number of threats.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const ThreatFixConfirmation = () => {
const { currentThreats, threatsList, setThreatsList, isBulk, handleUpgradeClick } =
useContext( ThreatsModalContext );

const [ canReturnToBulk, setCanReturnToBulk ] = useState( false );
const [ canReturnToBulkThreats, setcanReturnToBulkThreats ] = useState( false );
const [ selectedThreats, setSelectedThreats ] = useState( threatsList );

const handleToggleThreat = useCallback( ( threat: Threat, isChecked: boolean ) => {
Expand Down Expand Up @@ -55,14 +55,14 @@ const ThreatFixConfirmation = () => {
const viewBulkThreats = useCallback( () => {
setThreatsList( currentThreats );
setSelectedThreats( currentThreats );
setCanReturnToBulk( false );
setcanReturnToBulkThreats( false );
}, [ currentThreats, setThreatsList, setSelectedThreats ] );

const viewIndividualThreat = useCallback(
( threat: Threat ) => {
setThreatsList( [ threat ] );
setSelectedThreats( [ threat ] );
setCanReturnToBulk( true );
setcanReturnToBulkThreats( true );
},
[ setThreatsList, setSelectedThreats ]
);
Expand Down Expand Up @@ -163,7 +163,7 @@ const ThreatFixConfirmation = () => {
) }
<ThreatActions
selectedThreats={ selectedThreats }
canReturnToBulk={ canReturnToBulk }
canReturnToBulkThreats={ canReturnToBulkThreats }
viewBulkThreats={ viewBulkThreats }
/>
</div>
Expand Down

0 comments on commit f38a689

Please sign in to comment.