Skip to content

Commit

Permalink
Получение версии приложения из пакета (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
chekoopa authored Dec 13, 2023
1 parent e431e98 commit df5763e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ app.whenReady().then(() => {
return FLASHER_LOCAL_PORT;
});

ipcMain.handle('appVersion', app.getVersion);

ipcMain.handle('getAllTemplates', getAllTemplates);

ipcMain.handle('getTemplateData', (_, type: string, name: string) => getTemplate(type, name));

// Горячие клавиши для режима разрабочика:
Expand Down
16 changes: 13 additions & 3 deletions src/renderer/src/components/AboutTheProgramModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect, useState } from 'react';

import { Modal } from './Modal/Modal';

Expand All @@ -11,12 +11,22 @@ export const AboutTheProgramModal: React.FC<AboutTheProgramModalProps> = ({
onClose,
...props
}) => {
const [appVersion, setAppVersion] = useState<string>('0.0.0');
const releaseName = 'Abyssinian';
const releaseDate = '1 декабря 2023 года';

useEffect(() => {
window.electron.ipcRenderer.invoke('appVersion').then((version) => {
setAppVersion(version);
});
}, []);

return (
<Modal {...props} onRequestClose={onClose} title="О программе">
<div>
<b>Версия:</b> 0.1.0 «Abyssinian»
<b>Версия:</b> {appVersion} «{releaseName}»
<br />
<b>Дата релиза:</b> 1 декабря 2023 года
<b>Дата релиза:</b> {releaseDate}
<br />
<b>Ссылка на проект:</b>{' '}
<a
Expand Down

0 comments on commit df5763e

Please sign in to comment.