mirror of https://github.com/msgbyte/tailchat
feat: add plugin com.msgbyte.env.electron
parent
148f446eb6
commit
eb83f784a1
@ -0,0 +1,11 @@
|
||||
{
|
||||
"label": "Electron Support",
|
||||
"label.zh-CN": "Electron 支持",
|
||||
"name": "com.msgbyte.env.electron",
|
||||
"url": "/plugins/com.msgbyte.env.electron/index.js",
|
||||
"version": "0.0.0",
|
||||
"author": "moonrailgun",
|
||||
"description": "Add support for Electron environment in Tailchat",
|
||||
"description.zh-CN": "在 Tailchat 添加对 Electron 环境的支持",
|
||||
"requireRestart": true
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "@plugins/com.msgbyte.env.electron",
|
||||
"main": "src/index.tsx",
|
||||
"version": "0.0.0",
|
||||
"description": "Add support for Electron environment in Tailchat",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"sync:declaration": "tailchat declaration github"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@types/styled-components": "^5.1.26",
|
||||
"react": "18.2.0",
|
||||
"styled-components": "^5.3.6"
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
import React from 'react';
|
||||
import { Translate } from './translate';
|
||||
|
||||
interface WindowElectronDeviceInfo {
|
||||
version: string;
|
||||
}
|
||||
|
||||
export const DeviceInfoPanel: React.FC = React.memo(() => {
|
||||
const deviceInfo: WindowElectronDeviceInfo =
|
||||
(window as any).__electronDeviceInfo ?? {};
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
{Translate.clientVersion}: {deviceInfo.version}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
DeviceInfoPanel.displayName = 'DeviceInfoPanel';
|
@ -0,0 +1,15 @@
|
||||
import { regCustomPanel } from '@capital/common';
|
||||
import { DeviceInfoPanel } from './DeviceInfoPanel';
|
||||
import { Translate } from './translate';
|
||||
|
||||
const PLUGIN_NAME = 'Electron Support';
|
||||
|
||||
console.log(`Plugin ${PLUGIN_NAME} is loaded`);
|
||||
|
||||
regCustomPanel({
|
||||
position: 'setting',
|
||||
icon: '',
|
||||
name: 'com.msgbyte.env.electron/deviceInfoPanel',
|
||||
label: Translate.deviceInfo,
|
||||
render: DeviceInfoPanel,
|
||||
});
|
@ -0,0 +1,12 @@
|
||||
import { localTrans } from '@capital/common';
|
||||
|
||||
export const Translate = {
|
||||
deviceInfo: localTrans({
|
||||
'zh-CN': '设备信息',
|
||||
'en-US': 'Device Info',
|
||||
}),
|
||||
clientVersion: localTrans({
|
||||
'zh-CN': '客户端版本号',
|
||||
'en-US': 'Client Version',
|
||||
}),
|
||||
};
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"esModuleInterop": true,
|
||||
"jsx": "react",
|
||||
"importsNotUsedAsValues": "error"
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
declare module '@capital/common';
|
||||
declare module '@capital/component';
|
Loading…
Reference in New Issue