// Copyright 2024, Command Line Inc. // SPDX-License-Identifier: Apache-2.0 import Logo from "@/app/asset/logo.svg"; import { Button } from "@/app/element/button"; import { Toggle } from "@/app/element/toggle"; import * as services from "@/store/services"; import { OverlayScrollbarsComponent } from "overlayscrollbars-react"; import { useEffect, useRef, useState } from "react"; import { FlexiModal } from "./modal"; import { QuickTips } from "@/app/element/quicktips"; import { atoms } from "@/app/store/global"; import { modalsModel } from "@/app/store/modalmodel"; import { RpcApi } from "@/app/store/wshclientapi"; import { WindowRpcClient } from "@/app/store/wshrpcutil"; import { atom, PrimitiveAtom, useAtom, useAtomValue, useSetAtom } from "jotai"; import "./tos.less"; const pageNumAtom: PrimitiveAtom = atom(1); const ModalPage1 = () => { const settings = useAtomValue(atoms.settingsAtom); const clientData = useAtomValue(atoms.client); const [tosOpen, setTosOpen] = useAtom(modalsModel.tosOpen); const [telemetryEnabled, setTelemetryEnabled] = useState(!!settings["telemetry:enabled"]); const setPageNum = useSetAtom(pageNumAtom); const acceptTos = () => { if (!clientData.tosagreed) { services.ClientService.AgreeTos(); } setPageNum(2); }; const setTelemetry = (value: boolean) => { RpcApi.SetConfigCommand(WindowRpcClient, { "telemetry:enabled": value }) .then(() => { setTelemetryEnabled(value); }) .catch((error) => { console.error("failed to set telemetry:", error); }); }; const label = telemetryEnabled ? "Telemetry Enabled" : "Telemetry Disabled"; return ( <>
Welcome to Wave Terminal
Support us on GitHub
We're open source and committed to providing a free terminal for individual users. Please show your support by giving us a star on{" "} Github (wavetermdev/waveterm)
Join our Community
Get help, submit feature requests, report bugs, or just chat with fellow terminal enthusiasts.
Join the Wave Discord Channel
Telemetry
We collect minimal anonymous{" "} telemetry data {" "} to help us understand how people are using Wave ( Privacy Policy ).
); }; const ModalPage2 = () => { const [tosOpen, setTosOpen] = useAtom(modalsModel.tosOpen); const handleGetStarted = () => { setTosOpen(false); }; return ( <>
Icons and Keybindings
); }; const TosModal = () => { const modalRef = useRef(null); const [pageNum, setPageNum] = useAtom(pageNumAtom); const clientData = useAtomValue(atoms.client); const updateModalHeight = () => { const windowHeight = window.innerHeight; if (modalRef.current) { const modalHeight = modalRef.current.offsetHeight; const maxHeight = windowHeight * 0.9; if (maxHeight < modalHeight) { modalRef.current.style.height = `${maxHeight}px`; } else { modalRef.current.style.height = "auto"; } } }; useEffect(() => { // on unmount, always reset pagenum if (clientData.tosagreed) { setPageNum(2); } return () => { setPageNum(1); }; }, []); useEffect(() => { updateModalHeight(); // Run on initial render window.addEventListener("resize", updateModalHeight); // Run on window resize return () => { window.removeEventListener("resize", updateModalHeight); }; }, []); return ( {pageNum === 1 ? : } ); }; TosModal.displayName = "TosModal"; export { TosModal };