add furture auto open #4
			
				
			
		
		
		
	| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    "name": "new-item-app",
 | 
					    "name": "new-item-app",
 | 
				
			||||||
    "version": "1.0.0",
 | 
					    "version": "1.0.3",
 | 
				
			||||||
    "description": "An Electron application with React and TypeScript",
 | 
					    "description": "An Electron application with React and TypeScript",
 | 
				
			||||||
    "main": "./out/main/index.js",
 | 
					    "main": "./out/main/index.js",
 | 
				
			||||||
    "author": "example.com",
 | 
					    "author": "example.com",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,8 @@ import icon from '../../resources/icon.png?asset'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let mainWindow: null | BrowserWindow = null
 | 
					let mainWindow: null | BrowserWindow = null
 | 
				
			||||||
let isQuiting = false
 | 
					let isQuiting = false
 | 
				
			||||||
 | 
					const startupFlagFile = path.join(app.getPath('userData'), 'startup-set.flag')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function createWindow(): void {
 | 
					function createWindow(): void {
 | 
				
			||||||
    // Get Screen width, height
 | 
					    // Get Screen width, height
 | 
				
			||||||
    const { width, height } = screen.getPrimaryDisplay().workAreaSize
 | 
					    const { width, height } = screen.getPrimaryDisplay().workAreaSize
 | 
				
			||||||
| 
						 | 
					@ -39,10 +41,7 @@ function createWindow(): void {
 | 
				
			||||||
    // Make the window always on top
 | 
					    // Make the window always on top
 | 
				
			||||||
    mainWindow.setAlwaysOnTop(true, 'normal')
 | 
					    mainWindow.setAlwaysOnTop(true, 'normal')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Right-click to Inspect Element
 | 
					    // mainWindow.webContents.openDevTools()
 | 
				
			||||||
    // mainWindow.webContents.on('context-menu', (_, params) => {
 | 
					 | 
				
			||||||
    //     mainWindow?.webContents.inspectElement(params.x, params.y)
 | 
					 | 
				
			||||||
    // })
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Inspect element with shortcut
 | 
					    // Inspect element with shortcut
 | 
				
			||||||
    mainWindow.webContents.once('did-finish-load', () => {
 | 
					    mainWindow.webContents.once('did-finish-load', () => {
 | 
				
			||||||
| 
						 | 
					@ -113,6 +112,16 @@ function createTray() {
 | 
				
			||||||
// initialization and is ready to create browser windows.
 | 
					// initialization and is ready to create browser windows.
 | 
				
			||||||
// Some APIs can only be used after this event occurs.
 | 
					// Some APIs can only be used after this event occurs.
 | 
				
			||||||
app.whenReady().then(() => {
 | 
					app.whenReady().then(() => {
 | 
				
			||||||
 | 
					    if (!fs.existsSync(startupFlagFile)) {
 | 
				
			||||||
 | 
					        app.setLoginItemSettings({
 | 
				
			||||||
 | 
					            openAtLogin: true,
 | 
				
			||||||
 | 
					            path: process.execPath,
 | 
				
			||||||
 | 
					            args: []
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        fs.writeFileSync(startupFlagFile, 'ok')
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Set app user model id for windows
 | 
					    // Set app user model id for windows
 | 
				
			||||||
    electronApp.setAppUserModelId('com.electron')
 | 
					    electronApp.setAppUserModelId('com.electron')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -156,6 +156,12 @@ function App(): React.JSX.Element {
 | 
				
			||||||
                                </Box>
 | 
					                                </Box>
 | 
				
			||||||
                            ) : (
 | 
					                            ) : (
 | 
				
			||||||
                                newItems?.map((item: Product) => {
 | 
					                                newItems?.map((item: Product) => {
 | 
				
			||||||
 | 
					                                    console.log({
 | 
				
			||||||
 | 
					                                        hotItem,
 | 
				
			||||||
 | 
					                                        item,
 | 
				
			||||||
 | 
					                                        is_host: isHotItem(item)
 | 
				
			||||||
 | 
					                                    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                    return (
 | 
					                                    return (
 | 
				
			||||||
                                        <CardItem
 | 
					                                        <CardItem
 | 
				
			||||||
                                            key={item?.id}
 | 
					                                            key={item?.id}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue