You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-11-23 22:05:15 +02:00
Чек открытия сообщения на странице скачивания
This commit is contained in:
42
docs/docusaurus/src/pages/download.js
vendored
42
docs/docusaurus/src/pages/download.js
vendored
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
import Layout from '@theme/Layout';
|
import Layout from '@theme/Layout';
|
||||||
import Link from '@docusaurus/Link';
|
import Link from '@docusaurus/Link';
|
||||||
import Heading from '@theme/Heading';
|
import Heading from '@theme/Heading';
|
||||||
@@ -8,9 +8,7 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
|
|||||||
const DownloadPage = () => {
|
const DownloadPage = () => {
|
||||||
const [showThankYou, setShowThankYou] = useState(false);
|
const [showThankYou, setShowThankYou] = useState(false);
|
||||||
const [isModalVisible, setIsModalVisible] = useState(false);
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
||||||
|
const thankYouClosed = useRef(false); // флаг: пользователь закрыл окно
|
||||||
const githubLogo = useBaseUrl('/img/github-logo.svg');
|
|
||||||
const boostyLogo = useBaseUrl('/img/boosty-logo.svg');
|
|
||||||
|
|
||||||
const downloadItems = [
|
const downloadItems = [
|
||||||
{
|
{
|
||||||
@@ -94,24 +92,39 @@ const DownloadPage = () => {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const handleDownload = (filename) => {
|
const triggerDownload = (filename) => {
|
||||||
const cleanFilename = filename.trim();
|
const cleanFilename = filename.trim();
|
||||||
const url = `https://github.com/Bayselonarrend/OpenIntegrations/releases/latest/download/${cleanFilename}`;
|
const url = `https://github.com/Bayselonarrend/OpenIntegrations/releases/latest/download/${cleanFilename}`;
|
||||||
|
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.setAttribute('target', '_self');
|
link.setAttribute('target', '_self');
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDownload = (filename) => {
|
||||||
|
if (thankYouClosed.current) {
|
||||||
|
// Просто скачиваем без модалки
|
||||||
|
triggerDownload(filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
triggerDownload(filename);
|
||||||
|
|
||||||
setShowThankYou(true);
|
setShowThankYou(true);
|
||||||
// Через кадр — включаем видимость → запускается transition
|
// Задержка перед анимацией (чтобы пользователь успел увидеть начало скачивания)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setIsModalVisible(true);
|
setIsModalVisible(true);
|
||||||
}, 600);
|
}, 600);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCloseThankYou = () => {
|
||||||
|
setShowThankYou(false);
|
||||||
|
setIsModalVisible(false);
|
||||||
|
thankYouClosed.current = true; // запоминаем выбор на время сессии
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout title="Скачать" description="Скачайте последнюю версию OpenIntegrations">
|
<Layout title="Скачать" description="Скачайте последнюю версию OpenIntegrations">
|
||||||
<main className="container margin-vert--lg">
|
<main className="container margin-vert--lg">
|
||||||
@@ -180,10 +193,7 @@ const DownloadPage = () => {
|
|||||||
{showThankYou && (
|
{showThankYou && (
|
||||||
<div
|
<div
|
||||||
className={`${styles.modalOverlay} ${isModalVisible ? styles.modalOverlayVisible : ''}`}
|
className={`${styles.modalOverlay} ${isModalVisible ? styles.modalOverlayVisible : ''}`}
|
||||||
onClick={() => {
|
onClick={handleCloseThankYou}
|
||||||
setShowThankYou(false);
|
|
||||||
setIsModalVisible(false);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<div className={styles.modalContent} onClick={(e) => e.stopPropagation()}>
|
<div className={styles.modalContent} onClick={(e) => e.stopPropagation()}>
|
||||||
<div className={styles.modalScrollable}>
|
<div className={styles.modalScrollable}>
|
||||||
@@ -239,7 +249,7 @@ const DownloadPage = () => {
|
|||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
<p>
|
<p>
|
||||||
Пожертвования на Boosty — единственный источника дохода проекта. Такой вид монетизации позволяет нам развивать проект дальше, при этом не пряча функционал за платными версиями и не засоряя документацию рекламными блоками
|
Пожертвования на Boosty — единственный источник дохода проекта. Такой вид монетизации позволяет нам развивать проект дальше, при этом не пряча функционал за платными версиями и не засоряя документацию рекламными блоками.
|
||||||
</p>
|
</p>
|
||||||
<Link
|
<Link
|
||||||
className={styles.supportButton}
|
className={styles.supportButton}
|
||||||
@@ -253,13 +263,7 @@ const DownloadPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button className={styles.closeButton} onClick={handleCloseThankYou}>
|
||||||
className={styles.closeButton}
|
|
||||||
onClick={() => {
|
|
||||||
setShowThankYou(false);
|
|
||||||
setIsModalVisible(false);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Нет, спасибо
|
Нет, спасибо
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user