Skip to content

Commit

Permalink
feat: ui updates (#343)
Browse files Browse the repository at this point in the history
Description
---
I added the new colours and fonts from the updated brand guidelines.
Made changes to the settings tabs and split the mining settings into 2
sections, so it's a bit easier to use.
Temporarily removed buttons that don't work yet.
Added the mining addresses back into the boxes on the homepage.

Motivation and Context
---
There are new brand colours & fonts.
Various other ui improvements.

How Has This Been Tested?
---
Manually
  • Loading branch information
NovaT82 authored May 31, 2024
1 parent 3bd3f4c commit f2a1a0c
Show file tree
Hide file tree
Showing 64 changed files with 939 additions and 494 deletions.
103 changes: 103 additions & 0 deletions ui/frontend/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 ui/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"dependencies": {
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.15.18",
"@mui/material": "^5.15.13",
"@react-spring/web": "^9.7.3",
"@tauri-apps/api": "^1",
"material-icons": "^1.13.12",
"notistack": "^3.0.1",
Expand All @@ -25,6 +27,7 @@
},
"devDependencies": {
"@tauri-apps/cli": "^1",
"@types/node": "^20.12.12",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.2.1",
Expand Down
23 changes: 23 additions & 0 deletions ui/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useEffect } from 'react';
import { emit, listen } from '@tauri-apps/api/event';
import MainLayout from './MainLayout';
import useAppStateStore from './store/appStateStore';
import useConfigStore from './store/configStore';
import MainTabs from './containers/Dashboard/DashboardContainer/MainTabs';
import SettingsDialog from './containers/SettingsContainer/SettingsDialog';
import DockerWarning from './containers/DockerWarning/DockerWarning';
Expand All @@ -30,7 +31,10 @@ function App() {
setMergeTime,
mergeTimerOn,
openSchedule,
startBaseNode,
startMining,
} = useAppStateStore();
const { startupConfig } = useConfigStore();

// async function connect() {
// // Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
Expand Down Expand Up @@ -350,6 +354,25 @@ function App() {
setNetwork(appState?.config?.settings?.saved_settings?.tari_network || '');
}, [appState?.config?.settings?.saved_settings?.tari_network]);

// settings that should run on first startup
useEffect(() => {
if (startupConfig.shaMine) {
setTimeout(() => {
startMining('Sha');
}, 2000);
}
if (startupConfig.mergeMine) {
setTimeout(() => {
startMining('Merge');
}, 2000);
}
if (startupConfig.baseNode) {
setTimeout(() => {
startBaseNode();
}, 2000);
}
}, []);

console.log(appState);

useEffect(() => {
Expand Down
14 changes: 10 additions & 4 deletions ui/frontend/src/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const StyledMaterialDesignContent = styled(MaterialDesignContent)(
backgroundColor:
theme.palette.mode === 'light'
? theme.palette.background.paper
: '#262626',
: 'rgba(255,255,255,0.04)',
color: theme.palette.text.primary,
boxShadow: 'none',
maxWidth: '200px',
Expand Down Expand Up @@ -105,7 +105,13 @@ export default function MainLayout({
'normal'
);
const [drawerWidth, setDrawerWidth] = useState(window.innerWidth * 0.5);
const { setOpenSettings, setTariAddress, appState } = useAppStateStore();
const { setOpenSettings, setTariAddress, appState } = useAppStateStore(
(state) => ({
setOpenSettings: state.setOpenSettings,
setTariAddress: state.setTariAddress,
appState: state.appState,
})
);
const { themeMode } = useThemeStore();
const headerHeight = 64;

Expand Down Expand Up @@ -199,7 +205,7 @@ export default function MainLayout({
<ThemeProvider theme={theme}>
<Button
onClick={handleOpenSettings}
size="small"
size="medium"
startIcon={<SvgSetting />}
style={{
color: open ? '#fff' : 'inherit',
Expand Down Expand Up @@ -306,7 +312,7 @@ export default function MainLayout({
<Button
onClick={handleFullScreenToggle}
startIcon={<SvgMonitor />}
style={typography.microMedium}
style={typography.smallMedium}
color="inherit"
>
{contentWidth === 'fullScreen'
Expand Down
6 changes: 6 additions & 0 deletions ui/frontend/src/components/StyledComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ export const StyledIconButton = styled(IconButton)(({ theme }) => ({
boxShadow: 'none',
}));

export const IconButtonNoPadding = styled(IconButton)(({ theme }) => ({
color: theme.palette.text.secondary,
boxShadow: 'none',
padding: 0,
}));

export const AccordionIconButton = styled(IconButton)(({ theme }) => ({
backgroundColor: theme.palette.divider,
color: theme.palette.primary.main,
Expand Down
2 changes: 1 addition & 1 deletion ui/frontend/src/components/SubHeading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const HeadingContainer = styled('div')({

const Heading = styled(Typography)(({ theme }) => ({
marginRight: theme.spacing(2),
color: `${theme.palette.primary.main} !important`,
color: `${theme.palette.secondary.main} !important`,
}));

const Line = styled('hr')(({ theme }) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import { TextButton } from '../../components/StyledComponents';
import { SettingsTabs } from '../../store/types';

function BaseNodeFooter() {
const { openSettingsFunc } = useAppStateStore();
const { openSettingsFunc } = useAppStateStore((state) => ({
openSettingsFunc: state.openSettingsFunc,
}));
return (
<FooterBox>
<InfoBox>
Expand Down
16 changes: 8 additions & 8 deletions ui/frontend/src/containers/BaseNodeContainer/BaseNodeWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ import {
StatusChip,
TransparentButton,
} from '../../components/StyledComponents';
import {
BaseNodeBox,
ContentBox,
DefaultBox,
CircularProgressLight,
} from './styles';
import { BaseNodeBox, ContentBox, DefaultBox } from './styles';
import { useEffect, useState } from 'react';

type Status = 'inactive' | 'pending' | 'active';

function BaseNodeWidget() {
const { appState, containers, startBaseNode, stopBaseNode, network } =
useAppStateStore();
useAppStateStore((state) => ({
appState: state.appState,
containers: state.containers,
startBaseNode: state.startBaseNode,
stopBaseNode: state.stopBaseNode,
network: state.network,
}));
const [baseNodeStatus, setBaseNodeStatus] = useState<Status>('inactive');

function start() {
Expand Down Expand Up @@ -135,7 +136,6 @@ function BaseNodeWidget() {
<ContentBox>
<BaseNodeTitle />
<BaseNodeNetwork />
<CircularProgressLight />
</ContentBox>
<ContentBox>
<TransparentButton onClick={stop}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ function a11yProps(index: number) {
export default function MainTabs() {
const [value, setValue] = useState(0);
const theme = useTheme();
const { containers, network } = useAppStateStore();
const { containers, network } = useAppStateStore((state) => ({
containers: state.containers,
network: state.network,
}));

const handleChange = (_event: React.SyntheticEvent, newValue: number) => {
setValue(newValue);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import { Typography, Divider, Box } from '@mui/material';
import { styled } from '@mui/material/styles';
import useAppStateStore from '../../../../store/appStateStore';
import typography from '../../../../styles/styles/typography';

const CustomGrid = styled(Box)(({ theme }) => ({
display: 'grid',
gridTemplateColumns: '1fr 1fr 100px',
gridGap: theme.spacing(1),
gridGap: theme.spacing(2),
width: '100%',
}));

const CustomGridContainer = styled(Box)(({ theme }) => ({
display: 'flex',
width: '100%',
flexDirection: 'column',
gap: theme.spacing(1),
gap: theme.spacing(2),
}));

function Containers() {
const { containers } = useAppStateStore();
const containers = useAppStateStore((state) => state.containers);
const items = [
{
container: 'Tor',
Expand Down Expand Up @@ -66,9 +67,15 @@ function Containers() {
<>
<Divider />
<CustomGrid>
<Typography variant="h6">{item.container}</Typography>
<Typography variant="body2">{item.status}</Typography>
<Typography variant="body2">{item.cpu}</Typography>
<Typography variant="h6" sx={typography.smallHeavy}>
{item.container}
</Typography>
<Typography variant="body2" sx={typography.smallMedium}>
{item.status}
</Typography>
<Typography variant="body2" sx={typography.smallMedium}>
{item.cpu}
</Typography>
</CustomGrid>
</>
);
Expand All @@ -77,9 +84,15 @@ function Containers() {
return (
<CustomGridContainer>
<CustomGrid>
<Typography variant="h5">Container</Typography>
<Typography variant="h5">Status</Typography>
<Typography variant="h5">CPU</Typography>
<Typography variant="h5" sx={typography.defaultHeavy}>
Container
</Typography>
<Typography variant="h5" sx={typography.defaultHeavy}>
Status
</Typography>
<Typography variant="h5" sx={typography.defaultHeavy}>
CPU
</Typography>
</CustomGrid>
{renderItems}
</CustomGridContainer>
Expand Down
Loading

0 comments on commit f2a1a0c

Please sign in to comment.