feat: adds link to Github repo in main menu

This commit is contained in:
Mark Mankarious
2023-08-28 19:32:51 +01:00
parent a21d01bfe3
commit 109048c8d2
4 changed files with 25 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
import React, { useState, useCallback } from 'react';
import { Menu, MenuItem } from '@mui/material';
import { Menu, MenuItem, Typography } from '@mui/material';
import { Menu as MenuIcon } from '@mui/icons-material';
import { UiElement } from 'src/components/UiElement/UiElement';
import { IconButton } from 'src/components/IconButton/IconButton';
@@ -22,6 +22,10 @@ export const MainMenu = () => {
[setIsMainMenuOpen]
);
const gotoGithub = useCallback(() => {
window.open(REPOSITORY_URL, '_blank');
}, []);
return (
<UiElement>
<IconButton Icon={<MenuIcon />} name="Main menu" onClick={onClick} />
@@ -43,6 +47,11 @@ export const MainMenu = () => {
}}
>
<MenuItem>Export</MenuItem>
<MenuItem onClick={gotoGithub}>
<Typography variant="body2" color="text.secondary">
Isoflow v{PACKAGE_VERSION}
</Typography>
</MenuItem>
</Menu>
</UiElement>
);

3
src/global.d.ts vendored
View File

@@ -1,6 +1,9 @@
import { Size, Coords, SceneInput } from 'src/types';
declare global {
let PACKAGE_VERSION: string;
let REPOSITORY_URL: string;
interface Window {
Isoflow: {
getUnprojectedBounds: () => Size & Coords;

View File

@@ -1,6 +1,7 @@
const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const webpack = require('webpack');
module.exports = {
mode: 'development',
@@ -48,6 +49,10 @@ module.exports = {
plugins: [
new HtmlWebPackPlugin({
template: path.resolve(__dirname, '../src/index.html')
}),
new webpack.DefinePlugin({
PACKAGE_VERSION: JSON.stringify(require("../package.json").version),
REPOSITORY_URL: JSON.stringify(require("../package.json").repository.url),
})
]
};

View File

@@ -1,5 +1,6 @@
const path = require('path');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const webpack = require('webpack');
module.exports = {
mode: 'production',
@@ -48,6 +49,12 @@ module.exports = {
}
]
},
plugins: [
new webpack.DefinePlugin({
PACKAGE_VERSION: JSON.stringify(require("../package.json").version),
REPOSITORY_URL: JSON.stringify(require("../package.json").repository.url),
})
],
resolve: {
extensions: ['.tsx', '.ts', '.js'],
plugins: [new TsconfigPathsPlugin()]