Compare commits

...

3 Commits

Author SHA1 Message Date
Red Adaya cdeef49ec1 fix tabs freeze on touchpad scroll 2023-12-24 15:31:48 +08:00
Red Adaya 7e128c791b only pop modal when purging is successful 2023-12-23 11:34:56 +08:00
Red Adaya 09c4a42557 immediately hide modal when deleting workspace 2023-12-22 07:06:10 +08:00
3 changed files with 15 additions and 7 deletions
+5 -2
View File
@@ -440,7 +440,7 @@ class SessionSettingsModal extends React.Component<{}, {}> {
return; return;
} }
let prtn = GlobalCommandRunner.sessionPurge(this.sessionId); let prtn = GlobalCommandRunner.sessionPurge(this.sessionId);
commandRtnHandler(prtn, this.errorMessage); commandRtnHandler(prtn, this.errorMessage, () => GlobalModel.modalsModel.popModal());
}); });
} }
@@ -783,7 +783,10 @@ class ClientSettingsModal extends React.Component<{}, {}> {
<div className="settings-field"> <div className="settings-field">
<div className="settings-label">Check for Updates</div> <div className="settings-label">Check for Updates</div>
<div className="settings-input"> <div className="settings-input">
<Toggle checked={!cdata.clientopts.noreleasecheck} onChange={this.handleChangeReleaseCheck} /> <Toggle
checked={!cdata.clientopts.noreleasecheck}
onChange={this.handleChangeReleaseCheck}
/>
</div> </div>
</div> </div>
<div className="settings-field"> <div className="settings-field">
+6 -4
View File
@@ -17,6 +17,7 @@ import { ReactComponent as ActionsIcon } from "../../assets/icons/tab/actions.sv
import { ReactComponent as AddIcon } from "../../assets/icons/add.svg"; import { ReactComponent as AddIcon } from "../../assets/icons/add.svg";
import * as constants from "../../appconst"; import * as constants from "../../appconst";
import { Reorder } from "framer-motion"; import { Reorder } from "framer-motion";
import { debounce } from "throttle-debounce";
import { MagicLayout } from "../../magiclayout"; import { MagicLayout } from "../../magiclayout";
import "../workspace.less"; import "../workspace.less";
@@ -86,11 +87,11 @@ class ScreenTabs extends React.Component<{ session: Session }, { showingScreens:
// Add the current deltaY to the history // Add the current deltaY to the history
this.deltaYHistory.push(Math.abs(event.deltaY)); this.deltaYHistory.push(Math.abs(event.deltaY));
if (this.deltaYHistory.length > 5) { if (this.deltaYHistory.length > 2) {
this.deltaYHistory.shift(); // Keep only the last 5 entries this.deltaYHistory.shift(); // Keep only the last 2 entries
} }
// Check if any of the last 5 deltaY values are greater than a threshold // Check if any of the last 2 deltaY values are greater than a threshold
let isMouseWheel = this.deltaYHistory.some((deltaY) => deltaY > 0); let isMouseWheel = this.deltaYHistory.some((deltaY) => deltaY > 0);
if (isMouseWheel) { if (isMouseWheel) {
@@ -108,7 +109,8 @@ class ScreenTabs extends React.Component<{ session: Session }, { showingScreens:
// Add the wheel event listener to the tabsRef // Add the wheel event listener to the tabsRef
if (this.tabsRef.current) { if (this.tabsRef.current) {
this.tabsRef.current.addEventListener("wheel", this.handleWheel, { passive: false }); let handleWheel = debounce(200, this.handleWheel);
this.tabsRef.current.addEventListener("wheel", handleWheel, { passive: false });
} }
} }
+4 -1
View File
@@ -390,9 +390,12 @@ function getColorRGB(colorInput) {
return computedColorStyle; return computedColorStyle;
} }
function commandRtnHandler(prtn: Promise<CommandRtnType>, errorMessage: OV<string>) { function commandRtnHandler(prtn: Promise<CommandRtnType>, errorMessage: OV<string>, onSuccess?: () => void) {
prtn.then((crtn) => { prtn.then((crtn) => {
if (crtn.success) { if (crtn.success) {
if (onSuccess) {
onSuccess();
}
return; return;
} }
mobx.action(() => { mobx.action(() => {