feat(FN-1074): add desktop tray and application menu
- Add dedicated desktop tray and menu modules, including platform-aware menu templates and tray status/visibility controls - Integrate tray setup, app menu initialization, and tray status exports into the Electron main process bootstrap - Add tray icon assets plus an icon generation script and update desktop package dependencies/lockfile - Expand desktop test coverage with new menu/tray test suites and main process integration assertions - Update desktop README with tray and application menu usage/documentation
This commit is contained in:
34
packages/desktop/scripts/generate-icons.ts
Normal file
34
packages/desktop/scripts/generate-icons.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { mkdir, readFile } from "node:fs/promises";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import sharp from "sharp";
|
||||
|
||||
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
||||
const packageDir = resolve(scriptDir, "..");
|
||||
const repoRoot = resolve(packageDir, "../..");
|
||||
|
||||
const sourceSvgPath = resolve(repoRoot, "packages/dashboard/app/public/logo.svg");
|
||||
const outputDir = resolve(packageDir, "src/icons");
|
||||
|
||||
const iconSizes = [16, 32, 48] as const;
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const sourceSvg = await readFile(sourceSvgPath, "utf8");
|
||||
const tintedSvg = sourceSvg.replaceAll("currentColor", "#333333");
|
||||
|
||||
await mkdir(outputDir, { recursive: true });
|
||||
|
||||
await Promise.all(
|
||||
iconSizes.map(async (size) => {
|
||||
const outputPath = resolve(outputDir, `tray-${size}.png`);
|
||||
await sharp(Buffer.from(tintedSvg), { density: 1024 })
|
||||
.resize(size, size, { fit: "contain" })
|
||||
.png({ compressionLevel: 9 })
|
||||
.toFile(outputPath);
|
||||
}),
|
||||
);
|
||||
|
||||
console.log(`Generated ${iconSizes.length} tray icons in ${outputDir}`);
|
||||
}
|
||||
|
||||
void main();
|
||||
Reference in New Issue
Block a user