diff --git a/bun.lockb b/bun.lockb index 3457188..dd4e005 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/electron-builder.yml b/electron-builder.yml index 8d6b97e..ebca10f 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -1,5 +1,5 @@ -appId: com.electron.app -productName: matrix-terminal +appId: dev.solsynth.matrix +productName: MatrixTerminal directories: buildResources: build files: @@ -12,7 +12,7 @@ files: asarUnpack: - resources/** win: - executableName: matrix-terminal + executableName: MatrixTerminal nsis: artifactName: ${name}-${version}-setup.${ext} shortcutName: ${productName} @@ -33,7 +33,7 @@ linux: - AppImage - snap - deb - maintainer: electronjs.org + maintainer: solsynth.dev category: Utility appImage: artifactName: ${name}-${version}.${ext} diff --git a/electron.vite.config.ts b/electron.vite.config.ts index 5b54e20..c257d1d 100644 --- a/electron.vite.config.ts +++ b/electron.vite.config.ts @@ -4,17 +4,17 @@ import react from '@vitejs/plugin-react' export default defineConfig({ main: { - plugins: [externalizeDepsPlugin()] + plugins: [externalizeDepsPlugin()], }, preload: { - plugins: [externalizeDepsPlugin()] + plugins: [externalizeDepsPlugin()], }, renderer: { resolve: { alias: { - '@renderer': resolve('src/renderer/src') - } + '@renderer': resolve('src/renderer/src'), + }, }, - plugins: [react()] - } + plugins: [react()], + }, }) diff --git a/package.json b/package.json index c966236..4a4cc50 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,9 @@ "@fontsource/roboto": "^5.1.1", "@mui/icons-material": "^6.3.1", "@mui/material": "^6.3.1", - "electron-updater": "^6.3.9" + "electron-updater": "^6.3.9", + "react-router": "^7.1.1", + "solar-js-sdk": "^0.1.2" }, "devDependencies": { "@electron-toolkit/eslint-config-prettier": "^2.0.0", diff --git a/src/main/index.ts b/src/main/index.ts index 4f9a334..7922e22 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -12,14 +12,16 @@ function createWindow(): void { minHeight: 640, show: false, autoHideMenuBar: true, + title: 'MatrixTerminal', ...(process.platform === 'linux' ? { icon } : {}), webPreferences: { preload: join(__dirname, '../preload/index.js'), - sandbox: false - } + sandbox: false, + }, }) mainWindow.on('ready-to-show', () => { + mainWindow.title = 'MatrixTerminal' mainWindow.show() }) @@ -42,7 +44,7 @@ function createWindow(): void { // Some APIs can only be used after this event occurs. app.whenReady().then(() => { // Set app user model id for windows - electronApp.setAppUserModelId('com.electron') + electronApp.setAppUserModelId('dev.solsynth.matrix') // Default open or close DevTools by F12 in development // and ignore CommandOrControl + R in production. diff --git a/src/renderer/index.html b/src/renderer/index.html index e198e05..11e1a41 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -2,11 +2,11 @@ - Electron + MatrixTerminal diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index d0df63b..3102b98 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -1,8 +1,20 @@ import { CssBaseline, ThemeProvider, createTheme } from '@mui/material' +import { BrowserRouter, Route, Routes } from 'react-router' +import { MaAppBar } from '@renderer/components/MaAppBar' +import Landing from '@renderer/pages/Landing' + +import { useUserStore } from 'solar-js-sdk' +import { useEffect } from 'react' function App(): JSX.Element { // const ipcHandle = (): void => window.electron.ipcRenderer.send('ping') + const userStore = useUserStore() + + useEffect(() => { + userStore.fetchUser() + }, []) + const appTheme = createTheme({ cssVariables: true, colorSchemes: { @@ -21,8 +33,15 @@ function App(): JSX.Element { return ( - - Hello, World! + + + + + + + } /> + + ) } diff --git a/src/renderer/src/components/MaAppBar.tsx b/src/renderer/src/components/MaAppBar.tsx new file mode 100644 index 0000000..e0707f9 --- /dev/null +++ b/src/renderer/src/components/MaAppBar.tsx @@ -0,0 +1,56 @@ +import { + AppBar, + Toolbar, + IconButton, + Typography, + Drawer, + List, + ListItem, + ListItemButton, + ListItemIcon, + ListItemText, +} from '@mui/material' +import { useState } from 'react' + +import GamepadIcon from '@mui/icons-material/Gamepad' + +export function MaAppBar(): JSX.Element { + const [open, setOpen] = useState(false) + + return ( + <> + setOpen(false)} sx={{ width: '320px' }}> + + {['Inbox', 'Starred', 'Send email', 'Drafts'].map((text) => ( + + + + + + + + + ))} + + + + + + setOpen(true)} + > + + + + Matrix + + + + + ) +} diff --git a/src/renderer/src/main.tsx b/src/renderer/src/main.tsx index 3884e9f..744a889 100644 --- a/src/renderer/src/main.tsx +++ b/src/renderer/src/main.tsx @@ -8,5 +8,5 @@ import App from './App' ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( - + , ) diff --git a/src/renderer/src/pages/Landing.tsx b/src/renderer/src/pages/Landing.tsx new file mode 100644 index 0000000..358a6dc --- /dev/null +++ b/src/renderer/src/pages/Landing.tsx @@ -0,0 +1,81 @@ +import { + Box, + Container, + Typography, + Grid2 as Grid, + Card, + CardContent, + CardMedia, + CardActionArea, + Avatar, +} from '@mui/material' +import { useEffect, useState } from 'react' +import { MaProduct, getAttachmentUrl, sni } from 'solar-js-sdk' + +export default function Landing(): JSX.Element { + const [products, setProducts] = useState([]) + + async function fetchProducts(): Promise { + const { data: resp } = await sni.get<{ data: MaProduct[] }>('/cgi/ma/products', { + params: { + take: 10, + }, + }) + setProducts(resp.data) + } + + useEffect(() => { + fetchProducts() + }, []) + + return ( + + + + Matrix Marketplace + + + + + {products.map((p) => ( + + + + {p.previews && ( + + )} + + {p.icon && ( + + )} + + {p.name} + + + {p.description} + + + + + + ))} + + + ) +} diff --git a/tailwind.config.js b/tailwind.config.js index fc6a6cd..ab20e63 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -6,4 +6,3 @@ module.exports = { }, plugins: [], } -