Remove Tips Modal (#393)

This tips modal wasn't discovered often enough in tests, so we are
removing it.
This commit is contained in:
Sylvie Crowe 2024-09-17 14:29:44 -07:00 committed by GitHub
parent 525271ee27
commit 040bcf49b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 1 additions and 158 deletions

View File

@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import { AboutModal } from "./about"; import { AboutModal } from "./about";
import { TipsModal } from "./tipsmodal";
import { TosModal } from "./tos"; import { TosModal } from "./tos";
import { UserInputModal } from "./userinputmodal"; import { UserInputModal } from "./userinputmodal";
@ -10,7 +9,6 @@ const modalRegistry: { [key: string]: React.ComponentType<any> } = {
[TosModal.displayName || "TosModal"]: TosModal, [TosModal.displayName || "TosModal"]: TosModal,
[UserInputModal.displayName || "UserInputModal"]: UserInputModal, [UserInputModal.displayName || "UserInputModal"]: UserInputModal,
[AboutModal.displayName || "AboutModal"]: AboutModal, [AboutModal.displayName || "AboutModal"]: AboutModal,
[TipsModal.displayName || "TipsModal"]: TipsModal,
}; };
export const getModalComponent = (key: string): React.ComponentType<any> | undefined => { export const getModalComponent = (key: string): React.ComponentType<any> | undefined => {

View File

@ -1,47 +0,0 @@
// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
.tips-header {
font-weight: bold;
color: var(--main-text-color);
padding-bottom: 10px;
}
.tips-body {
display: flex;
flex-direction: column;
justify-content: space-between;
gap: 1rem;
margin: 0 1rem 1rem 1rem;
font: var(--fixed-font);
color: var(--main-text-color);
.tips-markdown {
color: inherit;
height: 300px;
width: 500px;
}
.tips-text {
}
.tips-inputbox {
resize: none;
background-color: var(--panel-bg-color);
border-radius: 6px;
margin: 0;
border: var(--border-color);
padding: 5px 0 5px 16px;
min-height: 30px;
color: inherit;
&:hover {
cursor: text;
}
&:focus {
outline-color: var(--accent-color);
}
}
}

View File

@ -1,71 +0,0 @@
// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
import { Modal } from "@/app/modals/modal";
import { Markdown } from "@/element/markdown";
import { modalsModel } from "@/store/modalmodel";
import * as keyutil from "@/util/keyutil";
import { useCallback, useMemo, useRef, useState } from "react";
import "./tipsmodal.less";
const TipsModal = (tipsContent: UserInputRequest) => {
const [responseText, setResponseText] = useState("");
const checkboxStatus = useRef(false);
const handleClose = useCallback(() => {
modalsModel.popModal();
}, []);
const handleKeyDown = useCallback(
(waveEvent: WaveKeyboardEvent): boolean => {
if (keyutil.checkKeyPressed(waveEvent, "Escape")) {
handleClose();
return;
}
if (keyutil.checkKeyPressed(waveEvent, "Enter")) {
handleClose();
return true;
}
},
[handleClose]
);
const queryText = useMemo(() => {
if (tipsContent.markdown) {
return <Markdown text={tipsContent.querytext} className="tips-markdown" />;
}
return <span className="tips-text">{tipsContent.querytext}</span>;
}, [tipsContent.markdown, tipsContent.querytext]);
const inputBox = useMemo(() => {
if (tipsContent.responsetype === "confirm") {
return <></>;
}
return (
<input
type={tipsContent.publictext ? "text" : "password"}
onChange={(e) => setResponseText(e.target.value)}
value={responseText}
maxLength={400}
className="tips-inputbox"
autoFocus={true}
onKeyDown={(e) => keyutil.keydownWrapper(handleKeyDown)(e)}
/>
);
}, [tipsContent.responsetype, tipsContent.publictext, responseText, handleKeyDown, setResponseText]);
return (
<Modal onOk={() => handleClose()} onCancel={() => handleClose()} onClose={() => handleClose()}>
<div className="tips-header">{tipsContent.title}</div>
<div className="tips-body">
{queryText}
{inputBox}
</div>
</Modal>
);
};
TipsModal.displayName = "TipsModal";
export { TipsModal };

View File

@ -9,7 +9,6 @@ import { WindowRpcClient } from "@/app/store/wshrpcutil";
import { Markdown } from "@/element/markdown"; import { Markdown } from "@/element/markdown";
import { NodeModel } from "@/layout/index"; import { NodeModel } from "@/layout/index";
import { atoms, createBlock, getConnStatusAtom, globalStore, refocusNode } from "@/store/global"; import { atoms, createBlock, getConnStatusAtom, globalStore, refocusNode } from "@/store/global";
import { modalsModel } from "@/store/modalmodel";
import * as services from "@/store/services"; import * as services from "@/store/services";
import * as WOS from "@/store/wos"; import * as WOS from "@/store/wos";
import { getWebServerEndpoint } from "@/util/endpoints"; import { getWebServerEndpoint } from "@/util/endpoints";
@ -353,34 +352,7 @@ export class PreviewModel implements ViewModel {
if (mimeType == "directory") { if (mimeType == "directory") {
const showHiddenFiles = get(this.showHiddenFiles); const showHiddenFiles = get(this.showHiddenFiles);
const settings = get(atoms.settingsAtom); const settings = get(atoms.settingsAtom);
let tipIcon: IconButtonDecl[];
if (settings["tips:show"]) {
tipIcon = [
{
elemtype: "iconbutton",
icon: "lightbulb",
iconColor: "var(--warning-color)",
className: "bulb",
click: () => {
const tips: UserInputRequest = {
requestid: "",
querytext: previewTipText,
responsetype: "confirm",
title: "Preview Tips",
markdown: true,
timeoutms: 0,
checkboxmsg: "",
publictext: true,
};
modalsModel.pushModal("TipsModal", tips);
},
},
];
} else {
tipIcon = [];
}
return [ return [
...tipIcon,
{ {
elemtype: "iconbutton", elemtype: "iconbutton",
icon: showHiddenFiles ? "eye" : "eye-slash", icon: showHiddenFiles ? "eye" : "eye-slash",

View File

@ -422,8 +422,6 @@ declare global {
"window:tilegapsize"?: number; "window:tilegapsize"?: number;
"telemetry:*"?: boolean; "telemetry:*"?: boolean;
"telemetry:enabled"?: boolean; "telemetry:enabled"?: boolean;
"tips:*"?: boolean;
"tips:show"?: boolean;
}; };
// waveobj.StickerClickOptsType // waveobj.StickerClickOptsType

View File

@ -7,6 +7,5 @@
"autoupdate:intervalms": 3600000, "autoupdate:intervalms": 3600000,
"editor:minimapenabled": true, "editor:minimapenabled": true,
"window:tilegapsize": 3, "window:tilegapsize": 3,
"telemetry:enabled": true, "telemetry:enabled": true
"tips:show": true
} }

View File

@ -47,8 +47,5 @@ const (
ConfigKey_TelemetryClear = "telemetry:*" ConfigKey_TelemetryClear = "telemetry:*"
ConfigKey_TelemetryEnabled = "telemetry:enabled" ConfigKey_TelemetryEnabled = "telemetry:enabled"
ConfigKey_TipsClear = "tips:*"
ConfigKey_TipsShow = "tips:show"
) )

View File

@ -79,9 +79,6 @@ type SettingsType struct {
TelemetryClear bool `json:"telemetry:*,omitempty"` TelemetryClear bool `json:"telemetry:*,omitempty"`
TelemetryEnabled bool `json:"telemetry:enabled,omitempty"` TelemetryEnabled bool `json:"telemetry:enabled,omitempty"`
TipsClear bool `json:"tips:*,omitempty"`
TipsShow bool `json:"tips:show,omitempty"`
} }
type ConfigError struct { type ConfigError struct {