feat: test for mac
This commit is contained in:
@@ -3,7 +3,8 @@ import { Sidebar } from '@renderer/components/ui/sidebar'
|
||||
import { Toaster } from '@renderer/components/ui/sonner'
|
||||
import { TitleBar } from '@renderer/components/ui/title-bar'
|
||||
import { ThemeProvider } from 'next-themes'
|
||||
import { useState } from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { ipcServices } from './lib/ipc'
|
||||
import { About } from './pages/About'
|
||||
import { Home } from './pages/Home'
|
||||
import { Settings } from './pages/Settings'
|
||||
@@ -13,6 +14,22 @@ type Page = 'home' | 'settings' | 'about' | 'sites'
|
||||
|
||||
function AppContent() {
|
||||
const [currentPage, setCurrentPage] = useState<Page>('home')
|
||||
const [platform, setPlatform] = useState<string>('')
|
||||
|
||||
useEffect(() => {
|
||||
// Get platform info to determine if we should show title bar
|
||||
const getPlatform = async () => {
|
||||
try {
|
||||
const platformInfo = await ipcServices.app.getPlatform()
|
||||
setPlatform(platformInfo)
|
||||
} catch (error) {
|
||||
console.error('Failed to get platform info:', error)
|
||||
// Default to showing title bar if platform detection fails
|
||||
setPlatform('unknown')
|
||||
}
|
||||
}
|
||||
getPlatform()
|
||||
}, [])
|
||||
|
||||
const renderPage = () => {
|
||||
switch (currentPage) {
|
||||
@@ -36,8 +53,8 @@ function AppContent() {
|
||||
|
||||
{/* Main Content */}
|
||||
<main className="flex flex-col flex-1 min-h-0 overflow-hidden bg-background">
|
||||
{/* Custom Title Bar */}
|
||||
<TitleBar />
|
||||
{/* Custom Title Bar - Hide on macOS */}
|
||||
{platform !== 'darwin' && <TitleBar />}
|
||||
|
||||
<ScrollArea
|
||||
className="flex-1 w-full overflow-y-auto overflow-x-hidden"
|
||||
|
||||
@@ -20,7 +20,9 @@ import { settingsAtom } from '../../store/settings'
|
||||
const generateFilePath = (downloadPath: string, title: string, format: string): string => {
|
||||
const fileName = `${title}.${format}`
|
||||
// Use proper path joining for cross-platform compatibility
|
||||
return `${downloadPath}/${fileName}`.replace(/\//g, '\\')
|
||||
// Handle both forward and backward slashes for cross-platform compatibility
|
||||
const normalizedDownloadPath = downloadPath.replace(/\\/g, '/')
|
||||
return `${normalizedDownloadPath}/${fileName}`
|
||||
}
|
||||
|
||||
interface DownloadItemProps {
|
||||
|
||||
Reference in New Issue
Block a user