diff --git a/.env b/.env index b07abe7..20f5eba 100644 --- a/.env +++ b/.env @@ -1,2 +1,4 @@ +VITE_API_BASE_URL=https://int.ipsupply.com.au VITE_PUSHER_APP_KEY=4e7f3ed7c83244388ecc -VITE_PUSHER_CHANNEL=my-channel \ No newline at end of file +VITE_PUSHER_CHANNEL=my-channel +VITE_API_AUTH_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2ludC5pcHN1cHBseS5jb20uYXUvYXBpL2xvZ2luIiwiaWF0IjoxNzQ2NTIwNTg2LCJleHAiOjMyNjAyNDg1ODYsIm5iZiI6MTc0NjUyMDU4NiwianRpIjoicVdhSHBvSXVxSW9HNGlTSSIsInN1YiI6MSwicHJ2IjoiYzhlZTFmYzg5ZTc3NWVjNGM3Mzg2NjdlNWJlMTdhNTkwYjZkNDBmYyJ9.IEnKSIaIijwHOgXYZ-7B29eaSYaK8m0RT8eOrfglqxU \ No newline at end of file diff --git a/.gitignore b/.gitignore index de478a6..f26f4e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ node_modules dist out +.env .DS_Store .eslintcache *.log* diff --git a/README.md b/README.md index 1e0e713..9cf1125 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# electron-app +# new-item-app An Electron application with React and TypeScript diff --git a/build/icon.ico b/build/icon.ico index 72c391e..3512400 100644 Binary files a/build/icon.ico and b/build/icon.ico differ diff --git a/build/icon.png b/build/icon.png index cf9e8b2..1b910c8 100644 Binary files a/build/icon.png and b/build/icon.png differ diff --git a/dev-app-update.yml b/dev-app-update.yml index 0a21494..6efb160 100644 --- a/dev-app-update.yml +++ b/dev-app-update.yml @@ -1,3 +1,3 @@ provider: generic url: https://example.com/auto-updates -updaterCacheDirName: electron-app-updater +updaterCacheDirName: new-item-app-updater diff --git a/electron-builder.yml b/electron-builder.yml index c5618b1..f051116 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -1,5 +1,5 @@ appId: com.electron.app -productName: electron-app +productName: New Item directories: buildResources: build files: @@ -12,7 +12,7 @@ files: asarUnpack: - resources/** win: - executableName: electron-app + executableName: New-item nsis: artifactName: ${name}-${version}-setup.${ext} shortcutName: ${productName} diff --git a/package-lock.json b/package-lock.json index c8c3d4e..8d7a9a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,24 +1,21 @@ { - "name": "electron-app", + "name": "new-item-app", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "electron-app", + "name": "new-item-app", "version": "1.0.0", "hasInstallScript": true, "dependencies": { "@electron-toolkit/preload": "^3.0.1", "@electron-toolkit/utils": "^4.0.0", "@mantine/core": "^8.0.0", - "@mantine/dates": "^8.0.0", - "@mantine/form": "^8.0.0", "@mantine/hooks": "^8.0.0", "@mantine/notifications": "^8.0.0", "@mantine/vanilla-extract": "^8.0.0", "axios": "^1.9.0", - "dayjs": "^1.11.13", "electron-updater": "^6.3.9", "moment": "^2.30.1", "pusher-js": "^8.4.0" @@ -1806,35 +1803,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@mantine/dates": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@mantine/dates/-/dates-8.0.0.tgz", - "integrity": "sha512-LQuDk8/tmFgZnqAGCuM+addTLHF/0lcyxYJgZbuQu1S+7WrbR58g04KzdQNg25UOBDydInRJIWAtiN/7fJFGmg==", - "license": "MIT", - "dependencies": { - "clsx": "^2.1.1" - }, - "peerDependencies": { - "@mantine/core": "8.0.0", - "@mantine/hooks": "8.0.0", - "dayjs": ">=1.0.0", - "react": "^18.x || ^19.x", - "react-dom": "^18.x || ^19.x" - } - }, - "node_modules/@mantine/form": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@mantine/form/-/form-8.0.0.tgz", - "integrity": "sha512-ErbbEFMEiRsK2Rn0jmFE5ohNJXHSMSbuJsL2vDUVsbIaXo6svw6ockw1WWGdiU8oEGqxM6Pd618yI9cJWNHF3g==", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "klona": "^2.0.6" - }, - "peerDependencies": { - "react": "^18.x || ^19.x" - } - }, "node_modules/@mantine/hooks": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-8.0.0.tgz", @@ -4276,12 +4244,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/dayjs": { - "version": "1.11.13", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", - "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==", - "license": "MIT" - }, "node_modules/debug": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", @@ -5698,6 +5660,7 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, "license": "MIT" }, "node_modules/fast-diff": { @@ -7407,15 +7370,6 @@ "json-buffer": "3.0.1" } }, - "node_modules/klona": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/klona/-/klona-2.0.6.tgz", - "integrity": "sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA==", - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, "node_modules/lazy-val": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/lazy-val/-/lazy-val-1.0.5.tgz", diff --git a/package.json b/package.json index 4f718ae..cb4d2cc 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "electron-app", + "name": "new-item-app", "version": "1.0.0", "description": "An Electron application with React and TypeScript", "main": "./out/main/index.js", @@ -24,13 +24,10 @@ "@electron-toolkit/preload": "^3.0.1", "@electron-toolkit/utils": "^4.0.0", "@mantine/core": "^8.0.0", - "@mantine/dates": "^8.0.0", - "@mantine/form": "^8.0.0", "@mantine/hooks": "^8.0.0", "@mantine/notifications": "^8.0.0", "@mantine/vanilla-extract": "^8.0.0", "axios": "^1.9.0", - "dayjs": "^1.11.13", "electron-updater": "^6.3.9", "moment": "^2.30.1", "pusher-js": "^8.4.0" diff --git a/resources/icon.png b/resources/icon.png index cf9e8b2..1b910c8 100644 Binary files a/resources/icon.png and b/resources/icon.png differ diff --git a/src/main/index.ts b/src/main/index.ts index 98f2895..2a78249 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -1,4 +1,4 @@ -import { app, shell, BrowserWindow, ipcMain, screen } from 'electron' +import { app, shell, BrowserWindow, ipcMain, screen, globalShortcut } from 'electron' import { join } from 'path' import { electronApp, optimizer, is } from '@electron-toolkit/utils' import icon from '../../resources/icon.png?asset' @@ -35,8 +35,29 @@ function createWindow(): void { mainWindow.setAlwaysOnTop(true, 'normal') // Right-click to Inspect Element - mainWindow.webContents.on('context-menu', (_, params) => { - mainWindow?.webContents.inspectElement(params.x, params.y) + // mainWindow.webContents.on('context-menu', (_, params) => { + // mainWindow?.webContents.inspectElement(params.x, params.y) + // }) + + // Inspect element with shortcut + mainWindow.webContents.once('did-finish-load', () => { + const shortcut = 'Control+Shift+C' + + mainWindow.on('focus', () => { + globalShortcut.register(shortcut, () => { + const pos = screen.getCursorScreenPoint() + mainWindow.webContents.inspectElement(pos.x, pos.y) + mainWindow.webContents.focus() // optional: refocus back + }) + }) + + mainWindow.on('blur', () => { + globalShortcut.unregister(shortcut) + }) + + mainWindow.on('closed', () => { + globalShortcut.unregister(shortcut) + }) }) // HMR for renderer base on electron-vite cli. diff --git a/src/renderer/index.html b/src/renderer/index.html index e633e53..1b0cc0a 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -2,7 +2,7 @@ - Electron + New Item