2024-07-30 20:44:19 +02:00
|
|
|
// Copyright 2024, Command Line Inc.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
import Logo from "@/app/asset/logo.svg";
|
|
|
|
import { Button } from "@/app/element/button";
|
2024-08-27 03:03:32 +02:00
|
|
|
import { Toggle } from "@/app/element/toggle";
|
2024-07-30 20:44:19 +02:00
|
|
|
import * as services from "@/store/services";
|
2024-09-13 08:10:18 +02:00
|
|
|
import { OverlayScrollbarsComponent } from "overlayscrollbars-react";
|
|
|
|
import { useEffect, useRef, useState } from "react";
|
2024-07-30 20:44:19 +02:00
|
|
|
import { FlexiModal } from "./modal";
|
|
|
|
|
2024-09-16 20:59:39 +02:00
|
|
|
import { RpcApi } from "@/app/store/wshclientapi";
|
|
|
|
import { WindowRpcClient } from "@/app/store/wshrpcutil";
|
2024-07-30 20:44:19 +02:00
|
|
|
import "./tos.less";
|
|
|
|
|
|
|
|
const TosModal = () => {
|
2024-09-11 18:26:43 +02:00
|
|
|
const [telemetryEnabled, setTelemetryEnabled] = useState<boolean>(true);
|
2024-09-13 08:10:18 +02:00
|
|
|
const modalRef = useRef<HTMLDivElement | null>(null);
|
|
|
|
|
|
|
|
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(() => {
|
|
|
|
updateModalHeight(); // Run on initial render
|
|
|
|
|
|
|
|
window.addEventListener("resize", updateModalHeight); // Run on window resize
|
|
|
|
return () => {
|
|
|
|
window.removeEventListener("resize", updateModalHeight);
|
|
|
|
};
|
|
|
|
}, []);
|
2024-09-11 18:26:43 +02:00
|
|
|
|
2024-07-30 20:44:19 +02:00
|
|
|
const acceptTos = () => {
|
|
|
|
services.ClientService.AgreeTos();
|
|
|
|
};
|
|
|
|
|
2024-09-13 08:10:18 +02:00
|
|
|
const setTelemetry = (value: boolean) => {
|
2024-09-16 20:59:39 +02:00
|
|
|
RpcApi.SetConfigCommand(WindowRpcClient, { "telemetry:enabled": value })
|
2024-09-11 18:26:43 +02:00
|
|
|
.then(() => {
|
|
|
|
setTelemetryEnabled(value);
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.error("failed to set telemetry:", error);
|
|
|
|
});
|
2024-09-13 08:10:18 +02:00
|
|
|
};
|
2024-09-03 05:21:35 +02:00
|
|
|
|
2024-09-11 18:26:43 +02:00
|
|
|
useEffect(() => {
|
|
|
|
services.FileService.GetFullConfig()
|
|
|
|
.then((data) => {
|
|
|
|
if ("telemetry:enabled" in data.settings) {
|
|
|
|
setTelemetryEnabled(true);
|
|
|
|
} else {
|
|
|
|
setTelemetryEnabled(false);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.error("failed to get config:", error);
|
|
|
|
});
|
|
|
|
}, []);
|
|
|
|
|
2024-09-13 08:10:18 +02:00
|
|
|
const label = telemetryEnabled ? "Telemetry Enabled" : "Telemetry Disabled";
|
2024-09-11 18:26:43 +02:00
|
|
|
|
2024-07-30 20:44:19 +02:00
|
|
|
return (
|
2024-09-13 08:10:18 +02:00
|
|
|
<FlexiModal className="tos-modal" ref={modalRef}>
|
|
|
|
<OverlayScrollbarsComponent className="modal-inner" options={{ scrollbars: { autoHide: "leave" } }}>
|
2024-07-30 20:44:19 +02:00
|
|
|
<header className="modal-header tos-header unselectable">
|
|
|
|
<div className="logo">
|
|
|
|
<Logo />
|
|
|
|
</div>
|
2024-09-13 08:10:18 +02:00
|
|
|
<div className="modal-title">Welcome to Wave Terminal</div>
|
2024-07-30 20:44:19 +02:00
|
|
|
</header>
|
|
|
|
<div className="modal-content tos-content unselectable">
|
|
|
|
<div className="content-section">
|
|
|
|
<div className="icon-wrapper">
|
|
|
|
<a target="_blank" href="https://github.com/wavetermdev/waveterm" rel={"noopener"}>
|
|
|
|
<i className="icon fa-brands fa-github"></i>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div className="content-section-inner">
|
|
|
|
<div className="content-section-title">Support us on GitHub</div>
|
|
|
|
<div className="content-section-text">
|
|
|
|
We're <i>open source</i> and committed to providing a free terminal for individual
|
|
|
|
users. Please show your support by giving us a star on{" "}
|
|
|
|
<a target="_blank" href="https://github.com/wavetermdev/waveterm" rel={"noopener"}>
|
|
|
|
Github (wavetermdev/waveterm)
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="content-section">
|
|
|
|
<div className="icon-wrapper">
|
2024-09-13 08:10:18 +02:00
|
|
|
<a target="_blank" href="https://discord.gg/XfvZ334gwU" rel={"noopener"}>
|
2024-07-30 20:44:19 +02:00
|
|
|
<i className="icon fa-solid fa-people-group"></i>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div className="content-section-inner">
|
|
|
|
<div className="content-section-title">Join our Community</div>
|
|
|
|
<div className="content-section-text">
|
|
|
|
Get help, submit feature requests, report bugs, or just chat with fellow terminal
|
|
|
|
enthusiasts.
|
|
|
|
<br />
|
|
|
|
<a target="_blank" href="https://discord.gg/XfvZ334gwU" rel={"noopener"}>
|
|
|
|
Join the Wave Discord Channel
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="content-section">
|
|
|
|
<div className="icon-wrapper">
|
|
|
|
<i className="icon fa-solid fa-chart-line"></i>
|
|
|
|
</div>
|
|
|
|
<div className="content-section-inner">
|
|
|
|
<div className="content-section-title">Telemetry</div>
|
|
|
|
<div className="content-section-text">
|
2024-09-13 08:10:18 +02:00
|
|
|
We collect minimal anonymous{" "}
|
2024-07-30 20:44:19 +02:00
|
|
|
<a
|
|
|
|
target="_blank"
|
|
|
|
href="https://docs.waveterm.dev/reference/telemetry"
|
|
|
|
rel={"noopener"}
|
|
|
|
>
|
2024-09-13 08:10:18 +02:00
|
|
|
telemetry data
|
|
|
|
</a>{" "}
|
|
|
|
to help us understand how people are using Wave (
|
|
|
|
<a
|
|
|
|
className="plain-link"
|
|
|
|
target="_blank"
|
|
|
|
href="https://waveterm.dev/privacy"
|
|
|
|
rel="noopener"
|
|
|
|
>
|
|
|
|
Privacy Policy
|
2024-07-30 20:44:19 +02:00
|
|
|
</a>
|
2024-09-13 08:10:18 +02:00
|
|
|
).
|
2024-07-30 20:44:19 +02:00
|
|
|
</div>
|
2024-09-11 18:26:43 +02:00
|
|
|
<Toggle checked={telemetryEnabled} onChange={setTelemetry} label={label} />
|
2024-07-30 20:44:19 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<footer className="unselectable">
|
|
|
|
<div className="button-wrapper">
|
2024-09-13 02:49:57 +02:00
|
|
|
<Button className="font-weight-600" onClick={acceptTos}>
|
|
|
|
Get Started
|
|
|
|
</Button>
|
2024-07-30 20:44:19 +02:00
|
|
|
</div>
|
|
|
|
</footer>
|
2024-09-13 08:10:18 +02:00
|
|
|
</OverlayScrollbarsComponent>
|
2024-07-30 20:44:19 +02:00
|
|
|
</FlexiModal>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
TosModal.displayName = "TosModal";
|
|
|
|
|
|
|
|
export { TosModal };
|