Skip to content

Commit 6f43bab

Browse files
committed
feat: fix cross-platform logo loading and update build configuration
- Fix logo not displaying on Windows/Linux by using ES module import - Update build config for separate x64/arm64 installers - Add cross-platform asset handling notes to workflows - Update landing page with glassmorphism buttons - Simplify README badges - Add release/ to gitignore (packages uploaded via GitHub Releases)
1 parent 1f3f7bf commit 6f43bab

5 files changed

Lines changed: 93 additions & 34 deletions

File tree

.agent/workflows/build_linux.md

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,47 @@
22
description: Build Linux Packages (x64 + ARM64)
33
---
44

5-
This workflow builds Linux packages (AppImage and deb) for both x64 and ARM64 architectures.
5+
# Build Linux AppImages
66

7-
# Prerequisites
7+
Build separate Linux AppImage packages for x64 and ARM64 architectures.
88

9-
Ensure the icon is present:
10-
- `build/icon.png`
9+
## Prerequisites
10+
- Node.js installed
11+
- Dependencies installed (`npm install`)
12+
- Icon file at `build/icon.png` (copy from `public/icon/DMG_Icon_1024x1024.png` if missing)
1113

12-
# Build Command
14+
## Output
15+
All artifacts output to `release/` directory:
16+
- `GlotShot-{version}-x86_64.AppImage` - Linux x64 AppImage
17+
- `GlotShot-{version}-arm64.AppImage` - Linux ARM64 AppImage
1318

14-
Run the following command to build Linux packages.
19+
## Build Command
1520

1621
// turbo
17-
npm run build && npx electron-builder --linux --x64 --arm64 && mkdir -p release && mv dist/*.AppImage dist/*.deb dist/*.snap release/ 2>/dev/null || true
22+
```bash
23+
npm run electron:build -- --linux
24+
```
25+
26+
## Notes
27+
- **DO NOT** build `.deb` packages on macOS (requires `fpm` and `dpkg`)
28+
- Each architecture gets its own separate AppImage
29+
- Files are named with architecture suffix automatically via `artifactName` in `package.json`
30+
- `x86_64` is the standard Linux naming for x64 architecture
31+
32+
## Cross-Platform Asset Handling
33+
34+
> **IMPORTANT**: When loading images/assets in React components, always use ES module imports instead of absolute paths.
35+
36+
**WRONG** (only works on macOS):
37+
```jsx
38+
<img src="/icon/logo.png" />
39+
```
40+
41+
**CORRECT** (works on all platforms):
42+
```jsx
43+
import logo from '../../public/icon/logo.png';
44+
// ...
45+
<img src={logo} />
46+
```
47+
48+
Vite bundles imported assets into `dist/assets/`, ensuring cross-platform compatibility.

.agent/workflows/build_windows.md

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,47 @@
22
description: Build Windows Installers (x64 + ARM64)
33
---
44

5-
This workflow builds Windows installers for both x64 and ARM64 architectures.
5+
# Build Windows Installers
66

7-
# Prerequisites
7+
Build separate Windows NSIS installers for x64 and ARM64 architectures.
88

9-
Ensure the icon is present:
10-
- `build/icon.png` (will be auto-converted to .ico by electron-builder)
9+
## Prerequisites
10+
- Node.js installed
11+
- Dependencies installed (`npm install`)
12+
- Icon file at `build/icon.png` (copy from `public/icon/DMG_Icon_1024x1024.png` if missing)
1113

12-
**Note:** Building Windows installers from macOS may require Wine. For production builds, consider using GitHub Actions or a Windows environment.
14+
## Output
15+
All artifacts output to `release/` directory:
16+
- `GlotShot-{version}-x64.exe` - Windows x64 installer
17+
- `GlotShot-{version}-arm64.exe` - Windows ARM64 installer
1318

14-
# Build Command
15-
16-
Run the following command to build Windows installers.
19+
## Build Command
1720

1821
// turbo
19-
npm run build && npx electron-builder --win --x64 --arm64 && mkdir -p release && mv dist/*.exe dist/*.blockmap release/ 2>/dev/null || true
22+
```bash
23+
npm run electron:build -- --win
24+
```
25+
26+
## Notes
27+
- **DO NOT** use combined architecture builds (multiple archs in one target)
28+
- **DO NOT** build portable versions
29+
- Each architecture gets its own separate installer
30+
- Files are named with architecture suffix automatically via `artifactName` in `package.json`
31+
32+
## Cross-Platform Asset Handling
33+
34+
> **IMPORTANT**: When loading images/assets in React components, always use ES module imports instead of absolute paths.
35+
36+
**WRONG** (only works on macOS):
37+
```jsx
38+
<img src="/icon/logo.png" />
39+
```
40+
41+
**CORRECT** (works on all platforms):
42+
```jsx
43+
import logo from '../../public/icon/logo.png';
44+
// ...
45+
<img src={logo} />
46+
```
47+
48+
Vite bundles imported assets into `dist/assets/`, ensuring cross-platform compatibility.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ node_modules
1111
dist
1212
dist-ssr
1313
build
14-
release/
14+
release
1515
*.local
1616

1717
# Editor directories and files

package.json

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,42 +59,40 @@
5959
"target": [
6060
{
6161
"target": "nsis",
62-
"arch": [
63-
"x64",
64-
"arm64"
65-
]
62+
"arch": "x64"
6663
},
6764
{
68-
"target": "portable",
69-
"arch": [
70-
"x64",
71-
"arm64"
72-
]
65+
"target": "nsis",
66+
"arch": "arm64"
7367
}
7468
],
75-
"icon": "build/icon.png"
69+
"icon": "build/icon.png",
70+
"artifactName": "${productName}-${version}-${arch}.${ext}"
7671
},
7772
"linux": {
7873
"target": [
7974
{
8075
"target": "AppImage",
81-
"arch": [
82-
"x64",
83-
"arm64"
84-
]
76+
"arch": "x64"
77+
},
78+
{
79+
"target": "AppImage",
80+
"arch": "arm64"
8581
}
8682
],
8783
"icon": "build/icon.png",
8884
"category": "Graphics",
89-
"maintainer": "Maohuhu <huyuanbo412004038@gmail.com>"
85+
"maintainer": "Maohuhu <huyuanbo412004038@gmail.com>",
86+
"artifactName": "${productName}-${version}-${arch}.${ext}"
9087
},
9188
"files": [
9289
"dist/**/*",
9390
"electron/**/*",
9491
"public/**/*"
9592
],
9693
"directories": {
97-
"buildResources": "assets"
94+
"buildResources": "assets",
95+
"output": "release"
9896
}
9997
},
10098
"devDependencies": {

src/components/SettingsModal.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useState, useEffect } from 'react';
22
import { X, LayoutGrid, Monitor, Palette, Keyboard, Settings, Info, Image as ImageIcon, Layers, Github, ExternalLink, Star } from 'lucide-react';
33
import './SettingsModal.css';
44
import { useTranslation, SUPPORTED_UI_LANGUAGES } from '../locales/i18n';
5+
import appLogo from '../../public/icon/DMG_Icon_1024x1024.png';
56

67
const SettingsModal = ({ isOpen, onClose, initialTab = 'start', appMode, setAppMode, globalSettings, setGlobalSettings, theme, setTheme, glassEffect, setGlassEffect }) => {
78
const [activeTab, setActiveTab] = useState(initialTab);
@@ -223,7 +224,7 @@ const SettingsModal = ({ isOpen, onClose, initialTab = 'start', appMode, setAppM
223224
<div className="about-hero">
224225
<div className="about-logo-large">
225226
<img
226-
src="/icon/DMG_Icon_1024x1024.png"
227+
src={appLogo}
227228
alt="GlotShot"
228229
className="w-full h-full object-cover rounded-[22%]"
229230
style={{ boxShadow: '0 0 20px rgba(0,0,0,0.2)' }}

0 commit comments

Comments
 (0)