Skip to content

Commit

Permalink
Updates network background property and home figures for light/dark t…
Browse files Browse the repository at this point in the history
…hemes -- #290
  • Loading branch information
chrtannus committed May 28, 2024
1 parent 25192b6 commit fad3a7f
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 32 deletions.
Binary file modified public/images/demo_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/hero-figure-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/hero-figure-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/home-figure.png
Binary file not shown.
2 changes: 0 additions & 2 deletions src/client/components/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export const BOTTOM_DRAWER_HEIGHT = 48;
/** Whether the bottom drawer must be open (expanded) by default */
export const BOTTOM_DRAWER_OPEN = true;

export const NETWORK_BACKGROUND = '#ffffff';

/**
* The minimum width the header toolbar must have to show its buttons.
* If the toolbar gets smaller than this, the buttons must be moved to
Expand Down
4 changes: 3 additions & 1 deletion src/client/components/home/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,10 @@ const useFigureStyles = makeStyles(theme => ({

function Figure() {
const classes = useFigureStyles();
const theme = useTheme();
const img = theme?.palette?.type === 'dark' ? 'hero-figure-dark.png' : 'hero-figure-light.png';

return <img src="/images/home-figure.png" alt="figure" className={classes.figure} />;
return <img src={`/images/${img}`} alt="figure" className={classes.figure} />;
}

//==[ LogoBar ]=======================================================================================================
Expand Down
4 changes: 2 additions & 2 deletions src/client/components/home/recent-networks-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import _ from 'lodash';
import clsx from 'clsx';

import { NETWORK_BACKGROUND } from '../defaults';
import { networkURL } from '../util';
import { RecentNetworksController } from '../recent-networks-controller';

Expand Down Expand Up @@ -91,6 +90,7 @@ const useStyles = theme => ({
objectFit: 'contain',
border: `1px solid ${theme.palette.divider}`,
borderRadius: 4,
backgroundColor: theme.palette.background.network,
[theme.breakpoints.down('xs')]: {
width: 148,
height: 128,
Expand Down Expand Up @@ -427,7 +427,7 @@ export class RecentNetworksList extends Component {
<Grid container direction="column" alignItems="stretch" justifyContent="center">
<Grid item>
{ enabled ? (
<img src={imgSrc} className={classes.thumbnail} style={{ background: NETWORK_BACKGROUND }} />
<img src={imgSrc} className={classes.thumbnail} />
) : (
<Skeleton variant="rect" className={classes.thumbnail} />
)}
Expand Down
1 change: 1 addition & 0 deletions src/client/components/home/upload-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ UploadPanel.propTypes = {

const useDemoPanelStyles = makeStyles((theme) => ({
thumbnail: {
backgroundColor: theme.palette.background.network,
border: `4px solid ${theme.palette.divider}`,
borderRadius: '8px',
width: '100%',
Expand Down
1 change: 1 addition & 0 deletions src/client/components/network-editor/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const useHeaderStyles = makeStyles((theme) => ({
appBar: {
minHeight: HEADER_HEIGHT,
backgroundColor: theme.palette.background.header,
borderBottom: `1px solid ${theme.palette.divider}`,
transition: theme.transitions.create(['margin', 'width'], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen,
Expand Down
27 changes: 2 additions & 25 deletions src/client/components/network-editor/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import Mousetrap from 'mousetrap';

import { makeStyles, useTheme } from '@material-ui/core/styles';

import { DEFAULT_PADDING, HEADER_HEIGHT, LEFT_DRAWER_WIDTH, BOTTOM_DRAWER_HEIGHT, NETWORK_BACKGROUND, bottomDrawerHeight } from '../defaults';
import { EventEmitterProxy } from '../../../model/event-emitter-proxy';
import { DEFAULT_PADDING, HEADER_HEIGHT, LEFT_DRAWER_WIDTH, BOTTOM_DRAWER_HEIGHT, bottomDrawerHeight } from '../defaults';
import { NetworkEditorController } from './controller';
import { Header } from './header';
import LeftDrawer from './left-drawer';
Expand Down Expand Up @@ -45,7 +44,7 @@ const useStyles = makeStyles((theme) => ({
right: 0,
top: 0,
bottom: 0,
background: NETWORK_BACKGROUND,
background: theme.palette.background.network,
},
cy: {
position: 'absolute',
Expand Down Expand Up @@ -87,27 +86,6 @@ const useStyles = makeStyles((theme) => ({
}));


const NetworkBackground = ({ controller }) => {
const [ bgColor, setBgColor ] = useState(NETWORK_BACKGROUND);

const busProxy = new EventEmitterProxy(controller.bus);

useEffect(() => {
busProxy.on('setNetworkBackgroundColor', (color) => setBgColor(color));

return function cleanup() {
busProxy.removeAllListeners();
};
}, []);

return (
<div style={{ position: 'absolute', zIndex: -1, width: '100%', height: '100%', backgroundColor: bgColor }} />
);
};
NetworkBackground.propTypes = {
controller: PropTypes.instanceOf(NetworkEditorController).isRequired,
};

const useRestoreConfirmDialogStyles = makeStyles((theme) => ({
root: {
// Disable Text Selection:
Expand Down Expand Up @@ -430,7 +408,6 @@ const Main = ({
style={shiftYCy ? {height: `calc(100% - ${bottomDrawerHeight(theme)}px)`,} : {}}
>
<div id="cy" className={classes.cy} style={{ zIndex: 1, width: '100%', height: '100%' }} />
<NetworkBackground controller={controller} />
</div>
<RightDrawer
open={openRightDrawer}
Expand Down
2 changes: 0 additions & 2 deletions src/client/components/recent-networks-controller.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import EventEmitter from 'eventemitter3';
import LocalForage from 'localforage';
import { NETWORK_BACKGROUND } from './defaults';


const MAX_ITEMS = 20;
Expand Down Expand Up @@ -127,7 +126,6 @@ const NETWORK_THUMBNAIL_HEIGHT = 344;
maxWidth: NETWORK_THUMBNAIL_WIDTH,
maxHeight: NETWORK_THUMBNAIL_HEIGHT,
full: true,
bg: NETWORK_BACKGROUND,
});

return {
Expand Down
2 changes: 2 additions & 0 deletions src/client/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const lightTheme = createTheme({
field: '#ffffff',
header: '#e6eaed',
accent: '#f6faf5',
network: '#ffffff',
},
action: {
hover: 'rgba(31, 120, 180, 0.1)',
Expand Down Expand Up @@ -120,6 +121,7 @@ export const darkTheme = createTheme({
field: '#464646',
header: '#242424',
accent: 'rgba(45, 52, 43, 0.25)',
network: '#121212',
},
action: {
hover: 'rgba(167, 193, 222, 0.1)',
Expand Down

0 comments on commit fad3a7f

Please sign in to comment.