feat: back-to-search button, retry site search, update checker, nsis installer

This commit is contained in:
2026-03-14 14:25:52 +03:00
parent 14da54f204
commit 6c314b614d
6 changed files with 150 additions and 11 deletions

View File

@@ -10,9 +10,11 @@ interface HeaderProps {
onBookmark: (title: string, url: string, poster: string, source: string) => void
onBookmarkRemove: (index: number) => void
bookmarks: import('./Settings').Bookmark[]
openedFromSearch?: boolean
onBackToSearch?: () => void
}
const Header: React.FC<HeaderProps> = ({ activeApp, setActiveApp, onAppsChange, onMovieSearch, onBookmark, onBookmarkRemove, bookmarks }) => {
const Header: React.FC<HeaderProps> = ({ activeApp, setActiveApp, onAppsChange, onMovieSearch, onBookmark, onBookmarkRemove, bookmarks, openedFromSearch, onBackToSearch }) => {
const [isCollapsed, setIsCollapsed] = useState(false)
const [isHovered, setIsHovered] = useState(false)
const [leftDisabled, setLeftDisabled] = useState(true)
@@ -106,6 +108,15 @@ const Header: React.FC<HeaderProps> = ({ activeApp, setActiveApp, onAppsChange,
const showSearchIcon = activeApp === 'home' || activeApp === 'movie-search'
const [isKiosk, setIsKiosk] = useState(true)
const [updateInfo, setUpdateInfo] = useState<{ version: string; url: string } | null>(null)
useEffect(() => {
if (!window.electron) return
const off = window.electron.on('update-available', (info: { version: string; url: string }) => {
setUpdateInfo(info)
})
return off
}, [])
useEffect(() => {
window.electron?.isKiosk().then(k => setIsKiosk(k))
@@ -185,6 +196,14 @@ const Header: React.FC<HeaderProps> = ({ activeApp, setActiveApp, onAppsChange,
</div>
<div className="header-center">
{appOpen && openedFromSearch && onBackToSearch && (
<button className="header-btn nav-btn" onClick={onBackToSearch} title="Вернуться к результатам поиска">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#e53935" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
<polyline points="15 18 9 12 15 6" />
</svg>
<span style={{ fontSize: '12px', color: '#e53935', marginLeft: 2 }}>Поиск</span>
</button>
)}
{appOpen && (
<>
<button
@@ -262,6 +281,16 @@ const Header: React.FC<HeaderProps> = ({ activeApp, setActiveApp, onAppsChange,
)}
</div>
{updateInfo && (
<div className="update-banner">
<span>Доступна версия {updateInfo.version}</span>
<a href={updateInfo.url} target="_blank" rel="noreferrer" className="update-banner-btn" onClick={() => window.electron?.createView('Обновление', updateInfo.url, '', 1.0, false)}>
Скачать
</a>
<button className="update-banner-close" onClick={() => setUpdateInfo(null)}></button>
</div>
)}
{showSettings && (
<Settings onClose={closeSettings} onAppsChange={onAppsChange} />
)}