From 040bcf49b7f38d0fc14229f3cf60deb8dd2ab6b4 Mon Sep 17 00:00:00 2001 From: Sylvie Crowe <107814465+oneirocosm@users.noreply.github.com> Date: Tue, 17 Sep 2024 14:29:44 -0700 Subject: [PATCH] Remove Tips Modal (#393) This tips modal wasn't discovered often enough in tests, so we are removing it. --- frontend/app/modals/modalregistry.tsx | 2 - frontend/app/modals/tipsmodal.less | 47 ---------------- frontend/app/modals/tipsmodal.tsx | 71 ------------------------- frontend/app/view/preview/preview.tsx | 28 ---------- frontend/types/gotypes.d.ts | 2 - pkg/wconfig/defaultconfig/settings.json | 3 +- pkg/wconfig/metaconsts.go | 3 -- pkg/wconfig/settingsconfig.go | 3 -- 8 files changed, 1 insertion(+), 158 deletions(-) delete mode 100644 frontend/app/modals/tipsmodal.less delete mode 100644 frontend/app/modals/tipsmodal.tsx diff --git a/frontend/app/modals/modalregistry.tsx b/frontend/app/modals/modalregistry.tsx index cde96919f..f77d790f2 100644 --- a/frontend/app/modals/modalregistry.tsx +++ b/frontend/app/modals/modalregistry.tsx @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import { AboutModal } from "./about"; -import { TipsModal } from "./tipsmodal"; import { TosModal } from "./tos"; import { UserInputModal } from "./userinputmodal"; @@ -10,7 +9,6 @@ const modalRegistry: { [key: string]: React.ComponentType } = { [TosModal.displayName || "TosModal"]: TosModal, [UserInputModal.displayName || "UserInputModal"]: UserInputModal, [AboutModal.displayName || "AboutModal"]: AboutModal, - [TipsModal.displayName || "TipsModal"]: TipsModal, }; export const getModalComponent = (key: string): React.ComponentType | undefined => { diff --git a/frontend/app/modals/tipsmodal.less b/frontend/app/modals/tipsmodal.less deleted file mode 100644 index 885ffc39f..000000000 --- a/frontend/app/modals/tipsmodal.less +++ /dev/null @@ -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); - } - } -} diff --git a/frontend/app/modals/tipsmodal.tsx b/frontend/app/modals/tipsmodal.tsx deleted file mode 100644 index c6287dd0c..000000000 --- a/frontend/app/modals/tipsmodal.tsx +++ /dev/null @@ -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 ; - } - return {tipsContent.querytext}; - }, [tipsContent.markdown, tipsContent.querytext]); - - const inputBox = useMemo(() => { - if (tipsContent.responsetype === "confirm") { - return <>; - } - return ( - 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 ( - handleClose()} onCancel={() => handleClose()} onClose={() => handleClose()}> -
{tipsContent.title}
-
- {queryText} - {inputBox} -
-
- ); -}; - -TipsModal.displayName = "TipsModal"; - -export { TipsModal }; diff --git a/frontend/app/view/preview/preview.tsx b/frontend/app/view/preview/preview.tsx index 9a01a47ef..ca9fbb0db 100644 --- a/frontend/app/view/preview/preview.tsx +++ b/frontend/app/view/preview/preview.tsx @@ -9,7 +9,6 @@ import { WindowRpcClient } from "@/app/store/wshrpcutil"; import { Markdown } from "@/element/markdown"; import { NodeModel } from "@/layout/index"; import { atoms, createBlock, getConnStatusAtom, globalStore, refocusNode } from "@/store/global"; -import { modalsModel } from "@/store/modalmodel"; import * as services from "@/store/services"; import * as WOS from "@/store/wos"; import { getWebServerEndpoint } from "@/util/endpoints"; @@ -353,34 +352,7 @@ export class PreviewModel implements ViewModel { if (mimeType == "directory") { const showHiddenFiles = get(this.showHiddenFiles); 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 [ - ...tipIcon, { elemtype: "iconbutton", icon: showHiddenFiles ? "eye" : "eye-slash", diff --git a/frontend/types/gotypes.d.ts b/frontend/types/gotypes.d.ts index 4eafb43a4..935bb24d6 100644 --- a/frontend/types/gotypes.d.ts +++ b/frontend/types/gotypes.d.ts @@ -422,8 +422,6 @@ declare global { "window:tilegapsize"?: number; "telemetry:*"?: boolean; "telemetry:enabled"?: boolean; - "tips:*"?: boolean; - "tips:show"?: boolean; }; // waveobj.StickerClickOptsType diff --git a/pkg/wconfig/defaultconfig/settings.json b/pkg/wconfig/defaultconfig/settings.json index c65a140eb..fcb805cb1 100644 --- a/pkg/wconfig/defaultconfig/settings.json +++ b/pkg/wconfig/defaultconfig/settings.json @@ -7,6 +7,5 @@ "autoupdate:intervalms": 3600000, "editor:minimapenabled": true, "window:tilegapsize": 3, - "telemetry:enabled": true, - "tips:show": true + "telemetry:enabled": true } diff --git a/pkg/wconfig/metaconsts.go b/pkg/wconfig/metaconsts.go index ea4c5908f..b01dbcd2a 100644 --- a/pkg/wconfig/metaconsts.go +++ b/pkg/wconfig/metaconsts.go @@ -47,8 +47,5 @@ const ( ConfigKey_TelemetryClear = "telemetry:*" ConfigKey_TelemetryEnabled = "telemetry:enabled" - - ConfigKey_TipsClear = "tips:*" - ConfigKey_TipsShow = "tips:show" ) diff --git a/pkg/wconfig/settingsconfig.go b/pkg/wconfig/settingsconfig.go index f3de678a6..8a68b591d 100644 --- a/pkg/wconfig/settingsconfig.go +++ b/pkg/wconfig/settingsconfig.go @@ -79,9 +79,6 @@ type SettingsType struct { TelemetryClear bool `json:"telemetry:*,omitempty"` TelemetryEnabled bool `json:"telemetry:enabled,omitempty"` - - TipsClear bool `json:"tips:*,omitempty"` - TipsShow bool `json:"tips:show,omitempty"` } type ConfigError struct {