refactor: ui

This commit is contained in:
cha0s 2021-07-12 14:05:09 -05:00
parent 4c92d0821e
commit d792b50070
17 changed files with 129 additions and 14 deletions

View File

@ -8,3 +8,6 @@
- Layer flood fill - Layer flood fill
- Layer mute/solo - Layer mute/solo
- Tile stamp creation/application - Tile stamp creation/application
- Void 'holes' in generated sed worlds
- Fall in to 'deeper' void
- Basically endgame

View File

@ -0,0 +1,24 @@
.project {
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
}
.floater {
flex-grow: 1;
position: relative;
}
.resource {
background-position: center;
background-repeat: no-repeat;
background-size: contain;
height: 100%;
transform: scale(2, 2);
width: 100%;
}
.room {
background-image: url('./map.png');
}

View File

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -1,9 +1,9 @@
import {PropTypes, React} from '@latus/react'; import {PropTypes, React} from '@latus/react';
const SidebarActions = ({ const OrganizationActions = ({
collapseAll, collapseAll,
}) => ( }) => (
<div className="sidebar-actions"> <div className="organization-actions">
<button <button
className="button new-file" className="button new-file"
label="New resource" label="New resource"
@ -26,12 +26,12 @@ const SidebarActions = ({
</div> </div>
); );
SidebarActions.defaultProps = {}; OrganizationActions.defaultProps = {};
SidebarActions.propTypes = { OrganizationActions.propTypes = {
collapseAll: PropTypes.func.isRequired, collapseAll: PropTypes.func.isRequired,
}; };
SidebarActions.displayName = 'SidebarActions'; OrganizationActions.displayName = 'OrganizationActions';
export default SidebarActions; export default OrganizationActions;

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 312 B

After

Width:  |  Height:  |  Size: 312 B

View File

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

View File

Before

Width:  |  Height:  |  Size: 832 B

After

Width:  |  Height:  |  Size: 832 B

View File

Before

Width:  |  Height:  |  Size: 429 B

After

Width:  |  Height:  |  Size: 429 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -13,10 +13,10 @@ import {
import {createNextState} from '@latus/redux'; import {createNextState} from '@latus/redux';
import 'swipe-touch-events'; import 'swipe-touch-events';
import SidebarActions from './actions'; import OrganizationActions from './actions';
import './index.scss'; import './index.scss';
const Sidebar = ({ const Organization = ({
className, className,
label, label,
resourcePaths, resourcePaths,
@ -60,7 +60,7 @@ const Sidebar = ({
}; };
const path = join('/project', uuid); const path = join('/project', uuid);
return ( return (
<div className={classnames('sidebar', className)}> <div className={classnames('organization', className)}>
<Tree <Tree
// active={({value}) => location.pathname === join('/project', value)} // active={({value}) => location.pathname === join('/project', value)}
activate={({value, nodes}) => { activate={({value, nodes}) => {
@ -99,7 +99,7 @@ const Sidebar = ({
{!nodes && <div className={`icon ${displayName}`} />} {!nodes && <div className={`icon ${displayName}`} />}
<span className="text">{label}</span> <span className="text">{label}</span>
{value === uuid && ( {value === uuid && (
<SidebarActions <OrganizationActions
collapseAll={(event) => { collapseAll={(event) => {
event.stopPropagation(); event.stopPropagation();
setCollapsed({}); setCollapsed({});
@ -115,17 +115,17 @@ const Sidebar = ({
); );
}; };
Sidebar.defaultProps = { Organization.defaultProps = {
className: '', className: '',
}; };
Sidebar.propTypes = { Organization.propTypes = {
className: PropTypes.string.isRequired, className: PropTypes.string.isRequired,
label: PropTypes.string.isRequired, label: PropTypes.string.isRequired,
resourcePaths: PropTypes.arrayOf(PropTypes.any).isRequired, resourcePaths: PropTypes.arrayOf(PropTypes.any).isRequired,
uuid: PropTypes.string.isRequired, uuid: PropTypes.string.isRequired,
}; };
Sidebar.displayName = 'Sidebar'; Organization.displayName = 'Organization';
export default Sidebar; export default Organization;

View File

@ -0,0 +1,88 @@
.organization {
background-color: #222;
height: 100%;
overflow-x: hidden;
overflow-y: auto;
transition: 0.2s left;
width: 100%;
> .tree > .node > .item .label > .text {
flex-grow: 1;
overflow: hidden;
text-overflow: ellipsis;
}
.label.inline {
justify-content: flex-start;
> div:first-child.icon {
background-size: cover;
flex-grow: unset;
margin-right: 0.125em;
width: 1em;
height: 1em;
&.AudioComponent {
background-image: url('./img/sound.png');
}
&.Binary {
background-image: url('./img/question.png');
}
&.EntityComponent {
background-image: url('./img/joystick.png');
}
&.ImageComponent {
background-image: url('./img/image.png');
}
&.RoomComponent {
background-image: url('./img/map.png');
}
&.ScriptComponent {
background-image: url('./img/script.png');
}
&.SoundComponent {
background-image: url('./img/music.png');
}
&.TextComponent {
background-image: url('./img/note.png');
}
}
}
.node {
&.parent > .item .label:before {
color: #999;
content: "\25BE";
margin-right: 0.25em;
}
&.collapsed {
&.parent > .item .label:before {
color: #999;
content: "\25B8";
}
}
}
}
.organization-actions {
display: none;
line-height: 0;
min-width: 4em;
.organization:hover & {
display: block;
}
button {
background-color: transparent;
background-size: cover;
background-repeat: no-repeat;
border: none;
margin: 0;
margin-right: 0.25em;
width: 1em;
height: 1em;
&.collapse-all {
background-image: url('./img/collapse-all.svg');
}
&.new-file {
background-image: url('./img/new-file.svg');
}
&.new-folder {
background-image: url('./img/new-folder.svg');
}
}
}