diff --git a/README.md b/README.md index 24b2aff..967271c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Chie -An extensible desktop app for large language models like ChatGPT and New Bing. +An extensible desktop app for large language models like ChatGPT and Bing Chat. It works on macOS, Linux and Windows, and uses native UI on each platform. * [Introduce the Chie app (with screenshots)](https://chie.app/posts/introduce-the-chie-app/) diff --git a/assets/build/icon_dev.icns b/assets/build/icon-dev.icns similarity index 100% rename from assets/build/icon_dev.icns rename to assets/build/icon-dev.icns diff --git a/assets/build/icon_dev.ico b/assets/build/icon-dev.ico similarity index 100% rename from assets/build/icon_dev.ico rename to assets/build/icon-dev.ico diff --git a/assets/build/icon.png b/assets/build/icon.png deleted file mode 100644 index 3d81764..0000000 Binary files a/assets/build/icon.png and /dev/null differ diff --git a/assets/build/icon_dev.png b/assets/build/icon_dev.png deleted file mode 100644 index 2155064..0000000 Binary files a/assets/build/icon_dev.png and /dev/null differ diff --git a/assets/icons/icon-dev@2x.png b/assets/icons/icon-dev@2x.png new file mode 100644 index 0000000..4fe48f3 Binary files /dev/null and b/assets/icons/icon-dev@2x.png differ diff --git a/assets/icons/icon@2x.png b/assets/icons/icon@2x.png new file mode 100644 index 0000000..9f44dd0 Binary files /dev/null and b/assets/icons/icon@2x.png differ diff --git a/package.json b/package.json index 43fecc5..2904318 100644 --- a/package.json +++ b/package.json @@ -9,15 +9,15 @@ "build": { "appId": "org.chie.chie", "productName": "Chie", - "copyright": "Copyright © 2023 Cheng Zhao", + "copyright": "Copyright © 2023 Cheng. All rights reserved.", "unpackDir": "assets/icons", "ignore": [ "assets/build" ], "entitlements": "assets/build/entitlements.plist", "icons": { - "mac": "assets/build/icon_dev.icns", - "win": "assets/build/icon_dev.ico" + "mac": "assets/build/icon-dev.icns", + "win": "assets/build/icon-dev.ico" } }, "scripts": { diff --git a/src/gui-main.ts b/src/gui-main.ts index bc5d6f2..c76752b 100644 --- a/src/gui-main.ts +++ b/src/gui-main.ts @@ -2,6 +2,7 @@ import gui from 'gui'; +import AboutWindow from './view/about-window'; import ChatService from './model/chat-service'; import ChatView from './view/chat-view'; import DashboardWindow from './view/dashboard-window'; @@ -93,6 +94,7 @@ function guiMain() { config.initFromFileSync(); // Register named windows. + windowManager.registerNamedWindow('about', AboutWindow); windowManager.registerNamedWindow('dashboard', DashboardWindow); windowManager.registerNamedWindow('settings', SettingsWindow); windowManager.registerNamedWindow('newAssistant', NewAssistantWindow); diff --git a/src/view/about-window.ts b/src/view/about-window.ts new file mode 100644 index 0000000..dbceb0b --- /dev/null +++ b/src/view/about-window.ts @@ -0,0 +1,44 @@ +import fs from 'node:fs'; +import gui from 'gui'; +import path from 'node:path'; + +import BaseWindow from '../view/base-window'; +import basicStyle from '../view/basic-style'; + +export default class AboutWindow extends BaseWindow { + constructor() { + super(); + + const packageJson = require('../../package.json'); + let iconPath = path.join(__dirname, '../../assets/icons/icon'); + if (packageJson.version.endsWith('-dev')) + iconPath += '-dev'; + const icon = gui.Image.createFromPath(fs.realpathSync(iconPath + '@2x.png')); + + const imageView = gui.GifPlayer.create(); + imageView.setImage(icon); + this.contentView.addChildView(imageView); + const title = gui.Label.create(packageJson.build.productName); + title.setFont(gui.Font.default().derive(1, 'bold', 'normal')); + this.contentView.addChildView(title); + const smallFont = gui.Font.default().derive(-3, 'normal', 'normal'); + const version = gui.Label.create(`Version ${packageJson.version}`); + version.setFont(smallFont); + this.contentView.addChildView(version); + const copyright = gui.Label.create(packageJson.build.copyright); + copyright.setFont(smallFont); + this.contentView.addChildView(copyright); + + this.contentView.setStyle({ + alignItems: 'center', + padding: basicStyle.padding, + gap: basicStyle.padding / 2, + }); + this.resizeToFitContentView(); + this.window.setResizable(false); + } + + saveState() { + return null; // do not remember state + } +} diff --git a/src/view/app-menu-bar.ts b/src/view/app-menu-bar.ts index 6072149..35dd85e 100644 --- a/src/view/app-menu-bar.ts +++ b/src/view/app-menu-bar.ts @@ -4,12 +4,20 @@ import BaseMenuBar from './base-menu-bar'; export default class AppMenuBar extends BaseMenuBar { constructor() { + const name = require('../../package.json').build.productName; + const template = [ // The main menu. { - label: require('../../package.json').build.productName, + label: name, submenu: [ - { role: 'about' }, + { + label: `About ${name}`, + onClick: () => { + const windowManager = require('../controller/window-manager').default; + windowManager.showNamedWindow('about')} + , + }, { type: 'separator' }, { role: 'hide' }, { role: 'hide-others' },