Commit a642ccae by asranov0003

feat: add terms and privacy

parent c43f1e34
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { BiArrowBack } from "react-icons/bi";
import { Link } from "react-router-dom";
const Privacy: React.FC = () => {
const { i18n } = useTranslation();
const [html, setHtml] = useState<string>("");
useEffect(() => {
const loadPrivacy = async () => {
try {
const response = await fetch(`/texts/privacy/${i18n.language}.html`);
const text = await response.text();
setHtml(text);
} catch (err) {
console.error("Failed to load privacy:", err);
}
};
loadPrivacy();
}, [i18n.language]);
return (
<div className="wrapper">
<Link
to={"/auth/register"}
style={{
textDecoration: "none",
cursor: "pointer",
fontSize: "1.5rem",
color: "#000000",
}}
>
<BiArrowBack />
</Link>
<div
dangerouslySetInnerHTML={{ __html: html }}
style={{
wordWrap: "break-word",
boxSizing: "border-box",
}}
/>
</div>
);
};
export default Privacy;
export { default } from "./Privacy";
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { BiArrowBack } from "react-icons/bi";
import { Link } from "react-router-dom";
const Terms: React.FC = () => {
const { i18n } = useTranslation();
const [html, setHtml] = useState<string>("");
useEffect(() => {
const loadTerms = async () => {
try {
const response = await fetch(`/texts/terms/${i18n.language}.html`);
const text = await response.text();
setHtml(text);
} catch (err) {
console.error("Failed to load terms:", err);
}
};
loadTerms();
}, [i18n.language]);
return (
<div className="wrapper">
<Link
to={"/auth/register"}
style={{
textDecoration: "none",
cursor: "pointer",
fontSize: "1.5rem",
color: "#000000",
}}
>
<BiArrowBack />
</Link>
<div
dangerouslySetInnerHTML={{ __html: html }}
style={{
wordWrap: "break-word",
boxSizing: "border-box",
}}
/>
</div>
);
};
export default Terms;
export { default } from "./Terms";
......@@ -26,6 +26,8 @@ import Permissions from "../pages/Permissions";
import Recording from "../pages/Recording";
import BlockApps from "../pages/BlockApps";
import UsageLimits from "../pages/UsageLimits";
import Terms from "../pages/Auth/Terms";
import Privacy from "../pages/Auth/Privacy";
const Router: React.FC = () => {
const isAuthenticated = !!localStorage.getItem(`token-${TG_USER_ID}`);
......@@ -47,6 +49,14 @@ const Router: React.FC = () => {
path: "/auth/recover",
element: <Recover />,
},
{
path: "/auth/terms",
element: <Terms />,
},
{
path: "/auth/privacy",
element: <Privacy />,
},
],
},
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment