From db16d5d051276254ef46a8daa793ce09edec46e7 Mon Sep 17 00:00:00 2001 From: Nexmoe <16796652+nexmoe@users.noreply.github.com> Date: Fri, 19 Dec 2025 20:41:58 +0800 Subject: [PATCH] Remove supported sites page (#40) * Remove supported sites page * Remove supported sites page component --- src/renderer/src/App.tsx | 22 ++-- src/renderer/src/components/ui/sidebar.tsx | 28 +++-- src/renderer/src/pages/SupportedSites.tsx | 117 --------------------- 3 files changed, 34 insertions(+), 133 deletions(-) delete mode 100644 src/renderer/src/pages/SupportedSites.tsx diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 2520ac2..1344185 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -14,18 +14,16 @@ import { About } from './pages/About' import { Home } from './pages/Home' import { Settings } from './pages/Settings' import { Subscriptions } from './pages/Subscriptions' -import { SupportedSites } from './pages/SupportedSites' import { loadSettingsAtom, settingsAtom } from './store/settings' import { loadSubscriptionsAtom, setSubscriptionsAtom } from './store/subscriptions' -type Page = 'home' | 'subscriptions' | 'settings' | 'about' | 'sites' +type Page = 'home' | 'subscriptions' | 'settings' | 'about' const pageToPath: Record = { home: '/', subscriptions: '/subscriptions', settings: '/settings', - about: '/about', - sites: '/sites' + about: '/about' } const normalizePathname = (pathname: string): string => { @@ -42,8 +40,6 @@ const pathToPage = (pathname: string): Page => { return 'settings' case '/about': return 'about' - case '/sites': - return 'sites' default: return 'home' } @@ -61,6 +57,7 @@ function AppContent() { const navigate = useNavigate() const location = useLocation() const currentPage = pathToPage(location.pathname) + const supportedSitesUrl = 'https://vidbee.org/supported-sites/' const handlePageChange = (page: Page) => { const targetPath = pageToPath[page] ?? '/' @@ -69,6 +66,10 @@ function AppContent() { } } + const handleOpenSupportedSites = () => { + window.open(supportedSitesUrl, '_blank') + } + useEffect(() => { loadSettings() }, [loadSettings]) @@ -227,7 +228,11 @@ function AppContent() { return (
{/* Sidebar Navigation */} - + {/* Main Content */}
@@ -244,7 +249,7 @@ function AppContent() { path="/" element={ handlePageChange('sites')} + onOpenSupportedSites={handleOpenSupportedSites} onOpenSettings={() => handlePageChange('settings')} /> } @@ -252,7 +257,6 @@ function AppContent() { } /> } /> } /> - } /> } />
diff --git a/src/renderer/src/components/ui/sidebar.tsx b/src/renderer/src/components/ui/sidebar.tsx index bf249d2..b202e9e 100644 --- a/src/renderer/src/components/ui/sidebar.tsx +++ b/src/renderer/src/components/ui/sidebar.tsx @@ -24,9 +24,20 @@ import MingcuteRssLine from '~icons/mingcute/rss-line' import MingcuteSettingsFill from '~icons/mingcute/settings-3-fill' import MingcuteSettingsLine from '~icons/mingcute/settings-3-line' -type Page = 'home' | 'subscriptions' | 'settings' | 'about' | 'sites' +type Page = 'home' | 'subscriptions' | 'settings' | 'about' +type NavigationTarget = Page | 'supported-sites' interface NavigationItem { + id: NavigationTarget + icon: { + active: React.ComponentType<{ className?: string }> + inactive: React.ComponentType<{ className?: string }> + } + label: string + onClick?: () => void +} + +interface PageNavigationItem { id: Page icon: { active: React.ComponentType<{ className?: string }> @@ -38,9 +49,10 @@ interface NavigationItem { interface SidebarProps { currentPage: Page onPageChange: (page: Page) => void + onOpenSupportedSites: () => void } -export function Sidebar({ currentPage, onPageChange }: SidebarProps) { +export function Sidebar({ currentPage, onPageChange, onOpenSupportedSites }: SidebarProps) { const { t, i18n } = useTranslation() const saveSetting = useSetAtom(saveSettingAtom) @@ -64,16 +76,17 @@ export function Sidebar({ currentPage, onPageChange }: SidebarProps) { label: t('menu.rss') }, { - id: 'sites', + id: 'supported-sites', icon: { active: MingcuteCheckCircleFill, inactive: MingcuteCheckCircleLine }, - label: t('menu.supportedSites') + label: t('menu.supportedSites'), + onClick: onOpenSupportedSites } ] - const bottomNavigationItems: NavigationItem[] = [ + const bottomNavigationItems: PageNavigationItem[] = [ { id: 'settings', icon: { @@ -107,15 +120,16 @@ export function Sidebar({ currentPage, onPageChange }: SidebarProps) { } const renderNavigationItem = (item: NavigationItem, showLabel = true) => { - const isActive = currentPage === item.id + const isActive = item.id !== 'supported-sites' && currentPage === item.id const IconComponent = isActive ? item.icon.active : item.icon.inactive + const handleClick = item.onClick ?? (() => onPageChange(item.id as Page)) return (
- - -
- ) -}