mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 21:53:50 +01:00
BUGFIX: script tab reordering (#563)
This commit is contained in:
parent
99954ebd1e
commit
dd9849f53d
@ -6,6 +6,7 @@ import CloseIcon from "@mui/icons-material/Close";
|
|||||||
import SearchIcon from "@mui/icons-material/Search";
|
import SearchIcon from "@mui/icons-material/Search";
|
||||||
import SyncIcon from "@mui/icons-material/Sync";
|
import SyncIcon from "@mui/icons-material/Sync";
|
||||||
|
|
||||||
|
import { useRerender } from "../../ui/React/hooks";
|
||||||
import { Settings } from "../../Settings/Settings";
|
import { Settings } from "../../Settings/Settings";
|
||||||
|
|
||||||
import { dirty, reorder } from "./utils";
|
import { dirty, reorder } from "./utils";
|
||||||
@ -27,11 +28,13 @@ interface IProps {
|
|||||||
export function Tabs({ scripts, currentScript, onTabClick, onTabClose, onTabUpdate }: IProps) {
|
export function Tabs({ scripts, currentScript, onTabClick, onTabClose, onTabUpdate }: IProps) {
|
||||||
const [filter, setFilter] = useState("");
|
const [filter, setFilter] = useState("");
|
||||||
const [searchExpanded, setSearchExpanded] = useState(false);
|
const [searchExpanded, setSearchExpanded] = useState(false);
|
||||||
|
const rerender = useRerender();
|
||||||
|
|
||||||
function onDragEnd(result: any): void {
|
function onDragEnd(result: any): void {
|
||||||
// Dropped outside of the list
|
// Dropped outside of the list
|
||||||
if (!result.destination) return;
|
if (!result.destination) return;
|
||||||
reorder(scripts, result.source.index, result.destination.index);
|
reorder(scripts, result.source.index, result.destination.index);
|
||||||
|
rerender();
|
||||||
}
|
}
|
||||||
|
|
||||||
const filteredOpenScripts = Object.values(scripts).filter(
|
const filteredOpenScripts = Object.values(scripts).filter(
|
||||||
|
Loading…
Reference in New Issue
Block a user