diff --git a/src/main/index.ts b/src/main/index.ts index c238341..3c9e2b4 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -63,6 +63,10 @@ app.whenReady().then(() => { return result.filePaths[0] }) + ipcMain.handle('beep', () => { + shell.beep() + }) + initTasks() initLibrary() initInstaller() diff --git a/src/main/library.ts b/src/main/library.ts index e78a971..acbe9b7 100644 --- a/src/main/library.ts +++ b/src/main/library.ts @@ -1,4 +1,4 @@ -import { ipcMain, app } from 'electron' +import { ipcMain, app, shell } from 'electron' import { MaProduct, MaRelease } from 'solar-js-sdk' import { join } from 'path' import * as fs from 'fs' @@ -46,6 +46,7 @@ export function initLibrary(): void { ipcMain.handle('uninstall-app', (_, id: string) => uninstallApp(id)) ipcMain.handle('launch-app', (_, id: string) => launchApp(id)) + ipcMain.handle('open-path-app', (_, id: string) => openPathApp(id)) } export function getAppLibrary(): LocalAppRecord[] { @@ -105,3 +106,10 @@ export function launchApp(id: string): void { console.error(err) } } + +export function openPathApp(id: string): void { + const app = getAppLibrary().filter((ele) => ele.id === id)[0] + if (!app) return + + shell.openPath(app.basePath) +} diff --git a/src/renderer/src/pages/library/Details.tsx b/src/renderer/src/pages/library/Details.tsx index 293ff5f..abffd2c 100644 --- a/src/renderer/src/pages/library/Details.tsx +++ b/src/renderer/src/pages/library/Details.tsx @@ -1,5 +1,16 @@ import { LocalAppRecord } from '@main/library' -import { Avatar, Box, Button, Container, Divider, Grid2 as Grid, IconButton, Stack, Typography } from '@mui/material' +import { + Avatar, + Box, + Button, + Container, + Divider, + Grid2 as Grid, + IconButton, + Link, + Stack, + Typography, +} from '@mui/material' import { useEffect, useMemo, useState } from 'react' import { useNavigate, useParams } from 'react-router' import { getAttachmentUrl } from 'solar-js-sdk' @@ -60,6 +71,10 @@ export default function LibraryDetails(): JSX.Element { setBusy(false) } + async function openInstalledPath() { + await window.electron.ipcRenderer.invoke('open-path-app', app?.id) + } + return ( <> {product?.previews && ( @@ -130,7 +145,7 @@ export default function LibraryDetails(): JSX.Element { - + @@ -140,6 +155,37 @@ export default function LibraryDetails(): JSX.Element { + + + + Store page + + openInstalledPath()} + > + Open installed path + + + + + + Version {app?.release.version} + + + #{app?.id} + +