feat: back-to-search button, retry site search, update checker, nsis installer
This commit is contained in:
@@ -17,6 +17,8 @@ const HomePage: React.FC = () => {
|
||||
const [activeApp, setActiveApp] = useState<string>('home')
|
||||
const [appCardList, setAppCardList] = useState<AppEntry[]>([])
|
||||
const [movieQuery, setMovieQuery] = useState<string | null>(null)
|
||||
const [movieSearchKey, setMovieSearchKey] = useState(0)
|
||||
const [openedFromSearch, setOpenedFromSearch] = useState(false)
|
||||
const [bookmarks, setBookmarks] = useState<Bookmark[]>([])
|
||||
const configRef = useRef<any>({})
|
||||
|
||||
@@ -46,14 +48,22 @@ const HomePage: React.FC = () => {
|
||||
const handleMovieSearch = (query: string) => {
|
||||
window.electron?.hideView()
|
||||
setMovieQuery(query)
|
||||
setMovieSearchKey(k => k + 1)
|
||||
setOpenedFromSearch(false)
|
||||
setActiveApp('movie-search')
|
||||
}
|
||||
|
||||
const handleMovieSearchOpen = (name: string, url: string) => {
|
||||
window.electron?.createView(name, url, '', 1.0, resolveUseProxy(url))
|
||||
setOpenedFromSearch(true)
|
||||
setActiveApp(name)
|
||||
}
|
||||
|
||||
const handleBackToSearch = () => {
|
||||
window.electron?.hideView()
|
||||
setActiveApp('movie-search')
|
||||
}
|
||||
|
||||
const handleBookmarkAdd = (title: string, url: string, poster: string, source: string) => {
|
||||
const updated = [...bookmarks, { title, url, poster, source }]
|
||||
setBookmarks(updated)
|
||||
@@ -89,12 +99,14 @@ const HomePage: React.FC = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header activeApp={activeApp} setActiveApp={setActiveApp} onAppsChange={setAppCardList} onMovieSearch={handleMovieSearch} onBookmark={handleBookmarkAdd} onBookmarkRemove={handleBookmarkRemove} bookmarks={bookmarks} />
|
||||
<Header activeApp={activeApp} setActiveApp={setActiveApp} onAppsChange={setAppCardList} onMovieSearch={handleMovieSearch} onBookmark={handleBookmarkAdd} onBookmarkRemove={handleBookmarkRemove} bookmarks={bookmarks} openedFromSearch={openedFromSearch} onBackToSearch={handleBackToSearch} />
|
||||
<Sidebar openedApps={sidebarApps} activeApp={activeApp} setActiveApp={setActiveApp} />
|
||||
{activeApp === 'movie-search'
|
||||
? <MovieSearch initialQuery={movieQuery ?? ''} onOpenUrl={handleMovieSearchOpen} onBookmark={handleBookmarkAdd} />
|
||||
: <AppList apps={appCardList} bookmarks={bookmarks} onBookmarkOpen={handleBookmarkOpen} onBookmarkRemove={handleBookmarkRemove} />
|
||||
}
|
||||
<div style={{ display: activeApp === 'movie-search' ? undefined : 'none' }}>
|
||||
<MovieSearch key={movieSearchKey} initialQuery={movieQuery ?? ''} onOpenUrl={handleMovieSearchOpen} onBookmark={handleBookmarkAdd} />
|
||||
</div>
|
||||
{activeApp !== 'movie-search' && (
|
||||
<AppList apps={appCardList} bookmarks={bookmarks} onBookmarkOpen={handleBookmarkOpen} onBookmarkRemove={handleBookmarkRemove} />
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user