mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-26 03:00:56 +02:00
convert unclickable inside the react tree
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import React from "react";
|
||||
import { use } from "../ui/Context";
|
||||
import { Exploit } from "./Exploit";
|
||||
|
||||
export function Unclickable(): React.ReactElement {
|
||||
const player = use.Player();
|
||||
|
||||
function unclickable(event: React.MouseEvent<HTMLDivElement>): void {
|
||||
if (!event.target || !(event.target instanceof Element)) return;
|
||||
const display = window.getComputedStyle(event.target as Element).display;
|
||||
const visibility = window.getComputedStyle(event.target as Element).visibility;
|
||||
if (display === "none" && visibility === "hidden" && event.isTrusted) player.giveExploit(Exploit.Unclickable);
|
||||
}
|
||||
|
||||
return (
|
||||
<div id="unclickable" onClick={unclickable} style={{ display: "none", visibility: "hidden" }}>
|
||||
Click on this to upgrade your Source-File -1!
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user