Files
ESH-Media/src/renderer/components/UpdateNotification.tsx
eshmeshek ecb5e7e49f init: media-center v2
Rewrite of ESH-Media v1 with separated main/renderer/shared architecture
(vite-plugin-electron, React 18, react-router-dom). Includes NeDB storage,
electron-store config, proxy manager with FoxyProxy/uBlock extensions,
custom server-checked updater, NSIS installer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 23:49:43 +03:00

61 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { useState } from 'react';
import { VersionInfo } from '../../shared/types';
import '../styles/UpdateNotification.css';
interface UpdateNotificationProps {
versionInfo: VersionInfo;
onClose: () => void;
}
const UpdateNotification: React.FC<UpdateNotificationProps> = ({
versionInfo,
onClose,
}) => {
const [isDownloading, setIsDownloading] = useState(false);
const handleUpdate = async () => {
setIsDownloading(true);
try {
const installerPath = await window.electronAPI.downloadUpdate(
versionInfo.downloadUrl
);
alert(`Обновление загружено: ${installerPath}\риложение будет закрыто для установки.`);
// App will close automatically after opening installer
} catch (error) {
console.error('Error downloading update:', error);
alert('Ошибка при загрузке обновления');
setIsDownloading(false);
}
};
return (
<div className="update-notification">
<div className="update-content">
<h3>Доступно обновление!</h3>
<p className="version">
Версия <strong>{versionInfo.latestVersion}</strong>
</p>
<div className="changelog">
<h4>Что нового:</h4>
<pre>{versionInfo.changelog}</pre>
</div>
<div className="update-actions">
<button
className="button-primary"
onClick={handleUpdate}
disabled={isDownloading}
>
{isDownloading ? 'Загрузка...' : 'Обновить сейчас'}
</button>
<button className="button-secondary" onClick={onClose}>
Напомнить позже
</button>
</div>
</div>
</div>
);
};
export default UpdateNotification;