diff --git a/contextAPI.js b/contextAPI.js index 1b09d85..839f707 100644 --- a/contextAPI.js +++ b/contextAPI.js @@ -16,5 +16,6 @@ contextBridge.exposeInMainWorld("api", { removeOnFileOpenListener : callback => ipcRenderer.off("Ation::openFile", callback), - clearCache : () => webFrame.clearCache() + clearCache : () => webFrame.clearCache(), + appVersion : async () => await ipcRenderer.invoke("Ation::appVersion") }); \ No newline at end of file diff --git a/src/Ation.js b/src/Ation.js index 8a4d989..abdffc5 100644 --- a/src/Ation.js +++ b/src/Ation.js @@ -1,9 +1,10 @@ "use strict"; -const {app, protocol, dialog} = require("electron"); -const path = require("path"); -const fs = require("fs/promises"); -const fsn = require("fs"); +const {app, protocol, dialog, ipcMain} = require("electron"); +const path = require("path"); +const fs = require("fs/promises"); +const fsn = require("fs"); +const AppInfo = require("../package.json"); const WindowManager = require("./WindowManager"); const MainMenu = require("./MainMenu"); const {parser} = require("./Parser"); @@ -28,6 +29,8 @@ class Ation { this.fileToOpen = path; }); + ipcMain.handle("Ation::appVersion", () => AppInfo.version); + app.whenReady().then(async () => { if (this.fileToOpen) this.openFile(this.fileToOpen); diff --git a/src/ui/src/assets/css/_toolbar.scss b/src/ui/src/assets/css/_toolbar.scss index 8caedf0..ef0a65a 100644 --- a/src/ui/src/assets/css/_toolbar.scss +++ b/src/ui/src/assets/css/_toolbar.scss @@ -1,4 +1,5 @@ .toolbar { + position: relative; -webkit-app-region: drag; display: flex; align-items: center; @@ -29,4 +30,11 @@ width: auto; margin: 0 2rem; } + + small { + position: absolute; + right: 1rem; + opacity: 0.3; + font-size: 0.5rem; + } } \ No newline at end of file diff --git a/src/ui/src/components/Ation.js b/src/ui/src/components/Ation.js index 33f2056..fd928c0 100644 --- a/src/ui/src/components/Ation.js +++ b/src/ui/src/components/Ation.js @@ -17,6 +17,7 @@ const Ation = () => { const [slide, setSlide] = useState(0); const [basePath, setBasePath] = useState(""); const [showTips, setShowTips] = useState(false); + const [version, setVersion] = useState("0.0.0"); useEffect(() => { window.api.onFileOpen(presentation => { @@ -29,6 +30,7 @@ const Ation = () => { setBasePath(newBasePath); setDeck(slideDeck); }); + (async set => set(await window.api.appVersion()))(setVersion); }, [basePath, slide]); const openFile = () => { @@ -42,7 +44,7 @@ const Ation = () => { : (
- +
diff --git a/src/ui/src/components/Toolbar.js b/src/ui/src/components/Toolbar.js index 1ee8616..3f32638 100644 --- a/src/ui/src/components/Toolbar.js +++ b/src/ui/src/components/Toolbar.js @@ -7,7 +7,7 @@ import Mode from "../models/Mode"; import {ReactComponent as Logo} from "../assets/images/logo_ation.svg"; -const Toolbar = ({openFile, setShowTips}) => { +const Toolbar = ({openFile, setShowTips, version}) => { const {setMode, setSlide} = useContext(SlideContext); const present = () => { @@ -22,6 +22,7 @@ const Toolbar = ({openFile, setShowTips}) => { + v{version} ); };