Skip to content

Commit

Permalink
feat(wallpaper): Add transition for wallpaper
Browse files Browse the repository at this point in the history
  • Loading branch information
FranklinWaller committed Mar 20, 2020
1 parent 69b15bf commit 3e26bc1
Show file tree
Hide file tree
Showing 21 changed files with 312 additions and 272 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
"dependencies": {
"@material-ui/core": "^4.9.5",
"@material-ui/icons": "^4.9.1",
"@wasmer/io-devices": "^0.10.1",
"@wasmer/wasm-terminal": "^0.10.1",
"@wasmer/wasm-transformer": "^0.10.1",
"@wasmer/io-devices": "^0.10.1",
"@wasmer/wasmfs": "^0.10.1",
"comlink": "^4.2.0",
"classnames": "^2.2.6",
"comlink": "^4.2.0",
"connected-react-router": "^6.6.1",
"ethers": "^4.0.45",
"inherits": "^2.0.4",
Expand Down Expand Up @@ -74,6 +74,7 @@
"devDependencies": {
"@types/classnames": "^2.2.10",
"@types/jszip": "^3.1.7",
"@types/material-ui": "^0.21.7",
"@types/react": "^16.9.23",
"@types/react-dom": "^16.9.5",
"@types/react-loadable": "^5.5.3",
Expand Down
27 changes: 27 additions & 0 deletions src/img/PlayOSLogoSide_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/js/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default class App {

constructor(id: string = 'app') {
this.domId = id;
console.log('[] id -> ', id);
}

run() {
Expand Down
1 change: 0 additions & 1 deletion src/js/apps/Explorer/components/File/File.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import Dirent from 'memfs/lib/Dirent';
import InsertDriveFileOutlinedIcon from '@material-ui/icons/InsertDriveFileOutlined';
import WebIcon from '@material-ui/icons/Web';
import getFileExtension from '../../../../services/micro/getFileExtension';
Expand Down
5 changes: 3 additions & 2 deletions src/js/apps/Explorer/components/Folder/Folder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ interface Props {
}

export default function Folder(props: Props) {
const { folder } = props;
const [icon, setIcon] = React.useState('');
const [name, setName] = React.useState(props.folder.name);
const [name, setName] = React.useState(folder.name);

React.useEffect(() => {
async function processFile() {
Expand All @@ -34,7 +35,7 @@ export default function Folder(props: Props) {
// const info = await getWappInformation(file);

if (wappInfo !== null) {
const newFolderName = folderName.replace('.' + WAPP_EXTENSION, '');
const newFolderName = folderName.replace(`.${WAPP_EXTENSION}`, '');

setIcon(wappInfo.icon);
setName(newFolderName);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.wrapper {
position: absolute;
top: 0;
width: 100%;
height: 100%;
}


.defaultBackground {
position: absolute;
top: 0;
z-index: 1;

width: 100%;
height: 100%;

background-image: var(--default-background);
background-repeat: no-repeat;
background-size: cover;
background-position: center;

opacity: 1;

transition: opacity 2s ease-in-out;
}

.backgroundSet {
opacity: 0;
}

.background {
position: absolute;
top: 0;
z-index: 0;

width: 100%;
height: 100%;

background-repeat: no-repeat;
background-size: cover;
background-position: center;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import classnames from 'classnames';
import styles from './BackgroundWallpaper.module.scss';

interface Props {
src?: string;
}

export default function BackgroundWallpaper(props: Props) {
const { src } = props;
const backgroundImage = src ? `url(${src})` : undefined;

const defaultBackgroundClassName = classnames(styles.defaultBackground, {
[styles.backgroundSet]: !!backgroundImage,
});

return (
<div className={styles.wrapper}>
<div className={defaultBackgroundClassName} />
<div className={styles.background} style={{ backgroundImage }} />
</div>
);
}
1 change: 1 addition & 0 deletions src/js/components/atoms/BackgroundWallpaper/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './BackgroundWallpaper';
2 changes: 1 addition & 1 deletion src/js/components/molecules/Header/Header.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

position: fixed;
top: 0;
z-index: 3;
z-index: 20;

// border-bottom: 2px solid rgba(86, 86, 86, 0.63);

Expand Down
79 changes: 0 additions & 79 deletions src/js/layout/DefaultLayout.jsx

This file was deleted.

19 changes: 14 additions & 5 deletions src/js/layout/DefaultLayout.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
position: fixed;
width: 100%;
height: 100%;
z-index: 10;

&Background {
position: absolute;
top: 0;
background-color: #252525;
// background-color: #252525;
background-image: linear-gradient(45deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%);
// background: linear-gradient(45deg, #FF512F 0%, #DD2476 100%);
background-repeat: no-repeat;
background-size: cover;
background-position: center;
Expand All @@ -16,7 +19,7 @@
position: fixed;

&Default {
background-image: url('/res/img/background.jpg');
// background-image: url('/res/img/background.jpg');
}
}

Expand All @@ -29,6 +32,7 @@
top: -100px;
bottom: 0;
margin: auto;
z-index: 15;

&Paper {
padding: 20px;
Expand All @@ -38,12 +42,16 @@
display: block;

&Logo {
text-align: center;
color: black;
font-size: 40px;
-webkit-font-smoothing: antialiased;
letter-spacing: 0;
display: block;
display: flex;
justify-content: center;
margin-bottom: 30px;

img {
width: 180px;
}
}

&-Description {
Expand All @@ -65,6 +73,7 @@

.childrenWrapper {
position: absolute;
z-index: 10;
width: 100%;
height: 100%;
}
73 changes: 73 additions & 0 deletions src/js/layout/DefaultLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import React from 'react';
import { connect } from 'react-redux';
import { Route } from 'react-router';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import Paper from 'material-ui/Paper';
import classnames from 'classnames';
import styles from './DefaultLayout.module.scss';
import logo from '../../img/PlayOSLogoSide_white.svg';
import ChoosePage from '../pages/ChoosePage';
import LoginPage from '../pages/LoginPage';
import RegisterPage from '../pages/RegisterPage';
import HomePage from '../pages/HomePage/HomePage';
import BackgroundWallpaper from '../components/atoms/BackgroundWallpaper';

function getRoutes() {
return (
<>
<Route path="/os/choose" component={ChoosePage} />
<Route path="/os/login" component={LoginPage} />
<Route path="/os/register" component={RegisterPage} />
<Route path="/os/home" component={HomePage} />
</>
);
}

interface Props {
user: any;
currentPathName: string;
}

function DefaultLayout(props: Props) {
const { user, currentPathName } = props;
const { wallpaper } = user.info;

return (
<MuiThemeProvider>
<div className={styles.defaultLayout}>
<BackgroundWallpaper src={wallpaper} />

{currentPathName !== '/os/home'
&& (
<section className={styles.defaultLayoutPanel}>
<div className={styles.defaultLayoutPanelMessage}>
<span className={styles.defaultLayoutPanelMessageLogo}>
<img src={logo} alt="Logo" />
</span>
</div>
<Paper zDepth={5} className={styles.defaultLayoutPanelPaper}>
<div className={styles.defaultLayoutPanelContent}>
{getRoutes()}
</div>
</Paper>
</section>
)}

{currentPathName === '/os/home'
&& (
<div className={styles.childrenWrapper}>
{getRoutes()}
</div>
)}
</div>
</MuiThemeProvider>
);
}

const mapStateToProps = (store: any) => ({
SnackBarMessageStore: store.SnackBarMessageStore,
user: store.UserInfoStore,
currentPathName: store.router.location ? store.router.location.pathname : '',
});

export default connect(mapStateToProps)(DefaultLayout);
2 changes: 1 addition & 1 deletion src/js/pages/HomePage/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class HomePage extends React.Component<Props, State> {
await bootSystem(keys);

if (!this.props.user.info.fullName && keys) {
this.props.dispatch(loadUserInfo());
this.props.dispatch(loadUserInfo(keys));
this.props.dispatch(loadApps());
}
}
Expand Down
Loading

0 comments on commit 3e26bc1

Please sign in to comment.