1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-16 04:15:56 +00:00

Removing unneeded code

This commit is contained in:
Scott Tolksdorf
2016-05-10 21:45:58 -04:00
parent c07c9911ec
commit c9bfd08bb3
10 changed files with 10 additions and 594 deletions

View File

@@ -1,29 +0,0 @@
var React = require('react');
var _ = require('lodash');
var cx = require('classnames');
//var Icon = require('naturalcrit/icon.svg.jsx');
//var Logo = require('naturalcrit/logo/logo.jsx');
//var HomebrewIcon = require('naturalcrit/homebrewIcon.svg.jsx');
//var CombatIcon = require('naturalcrit/combatIcon.svg.jsx');
var Home = React.createClass({
navigate : function(){
},
render : function(){
return(
<div className='home'>
</div>
);
}
});
module.exports = Home;

View File

@@ -1,178 +0,0 @@
@import 'naturalcrit/styles/reset.less';
//@import 'naturalcrit/styles/elements.less';
@import 'naturalcrit/styles/animations.less';
@import 'naturalcrit/styles/colors.less';
@import 'naturalcrit/styles/tooltip.less';
html,body, #reactContainer{
min-height: 100vh;
height: 100vh;
margin: 0;
font-family : 'Open Sans', sans-serif;
}
.home{
height : 100vh;
background-color : white;
.top{
.fadeInTop(1s);
.delay(0.5);
margin-bottom : 100px;
padding-top : 100px;
text-align : center;
.logo{
font-size : 4em;
color : black;
svg{
fill : black;
}
}
p{
margin-top : 10px;
font-size : 1.3em;
font-style : italic;
color : @grey;
}
}
.tools{
width : 100%;
text-align : center;
.toolContainer{
.sequentialDelay(0.5s, 1s);
.fadeInDown(1s);
.keep();
display : inline-block;
cursor : pointer;
opacity : 0;
text-align : center;
border-right : 1px solid #333;
&:last-child{
border : none;
}
.content{
.addSketch(360px);
.animateAll(0.5s);
position : relative;
width : 500px;
padding : 40px;
&:hover{
svg, h2{
.transform(scale(1.3));
}
}
h2{
.animateAll(0.5s);
font-family : 'CodeBold';
font-size : 2em;
}
p{
max-width : 300px;
margin : 20px auto;
line-height : 1.5em;
}
svg{
.animateAll(0.5s);
height : 10em;
}
}
//Proejct specific styles
&.homebrew{
.content:hover{
background-color : fade(@teal, 20%);
}
}
&.combat{
.content:hover{
background-color : fade(@red, 20%);
}
}
//Under Construction styles
&.underConstruction{
cursor : initial;
.content{
&:hover{
svg, h2{
.transform(scale(1.0));
}
}
svg, h2{
opacity : 0.3;
}
&:after{
.animateAll();
content : "Under Construction";
position : absolute;
display : block;
top : 120px;
left : 0px;
width : 100%;
padding : 10px 0px;
//opacity : 0;
background-color : fade(@grey, 50%);
font-size : 2em;
font-weight : 800;
text-align : center;
text-transform : uppercase;
}
&:before{
content : "";
position : absolute;
display : block;
top : 130px;
right : 30px;
height : 50px;
width : 40px;
//opacity : 0;
background-image : url('/assets/naturalCrit/home/bulldozer.png');
background-repeat : no-repeat;
background-size : contain;
animation-iteration-count : infinite;
}
}
}
}
}
}
.addSketch(@length, @color : black){
path, line, polyline, circle, rect, polygon {
.sketch(@length, @color, 4s);
stroke-dasharray : @length;
stroke-dashoffset : 0px;
stroke : @color;
stroke-width : 0.5px;
fill : @color;
//.animateAll(3s);
}
}
.sketch(@length, @color : black, @duration : 3s, @easing : @defaultEasing){
.createAnimation(sketch, @duration, @easing);
.sketchKeyFrames(){
0% { stroke-dashoffset : @length; fill: transparent;}
50% { stroke-dashoffset : @length; fill: transparent;}
80% { stroke-dashoffset : 0px; fill: transparent;}
100% { stroke-dashoffset : 0px; fill:@color;}
}
@-webkit-keyframes sketch {.sketchKeyFrames();}
@-moz-keyframes sketch {.sketchKeyFrames();}
@-ms-keyframes sketch {.sketchKeyFrames();}
@-o-keyframes sketch {.sketchKeyFrames();}
@keyframes sketch {.sketchKeyFrames();}
}
/*
.sketch(@length, @color : black, @duration : 3s, @easing : @defaultEasing){
.createAnimation(bounce, @duration, @easing);
.sketchKeyFrames(){
0% { stroke-dashoffset : 0px; fill:@color;}
15% { stroke-dashoffset : 0px; fill : transparent}
50% { stroke-dashoffset : @length; fill: transparent}
85% { stroke-dashoffset : 0px; fill:transparent;}
100% { stroke-dashoffset : 0px; fill:@color;}
}
@-webkit-keyframes bounce {.sketchKeyFrames();}
@-moz-keyframes bounce {.sketchKeyFrames();}
@-ms-keyframes bounce {.sketchKeyFrames();}
@-o-keyframes bounce {.sketchKeyFrames();}
@keyframes bounce {.sketchKeyFrames();}
}
*/

View File

@@ -21,20 +21,16 @@ var BrewRenderer = React.createClass({
totalPages : 0,
height : 0,
componentDidMount: function() {
this.setState({
height : this.refs.main.parentNode.clientHeight
});
},
handleScroll : function(e){
this.setState({
viewablePageNumber : Math.floor(e.target.scrollTop / PAGE_HEIGHT)
});
},
//Implement later
scrollToPage : function(pageNumber){
},

View File

@@ -6,7 +6,7 @@ var Nav = require('naturalcrit/nav/nav.jsx');
const MAX_TITLE_LENGTH = 50;
var RedditShare = React.createClass({
var EditTitle = React.createClass({
getDefaultProps: function() {
return {
title : '',
@@ -30,4 +30,4 @@ var RedditShare = React.createClass({
});
module.exports = RedditShare;
module.exports = EditTitle;

View File

@@ -19,11 +19,7 @@ var Navbar = React.createClass({
<Nav.item>v1.5.0</Nav.item>
</Nav.section>
{this.props.children}
{this.props.children}
</Nav.base>
}
});

View File

@@ -1,53 +0,0 @@
var React = require('react');
var _ = require('lodash');
var cx = require('classnames');
var Markdown = require('marked');
var PAGE_HEIGHT = 1056 + 30;
var PageContainer = React.createClass({
getDefaultProps: function() {
return {
text : ""
};
},
getInitialState: function() {
return {
viewablePageIndex: 0
};
},
handleScroll : function(e){
this.setState({
viewablePageIndex : Math.floor(e.target.scrollTop / PAGE_HEIGHT)
});
},
renderDummyPage : function(key){
return <div className='phb' key={key}>
<i className='fa fa-spinner fa-spin' />
</div>
},
renderPages : function(){
var currentIndex = this.state.viewablePageIndex;
return _.map(this.props.text.split('\\page'), (pageText, index) => {
if(currentIndex - 1 == index || currentIndex == index || currentIndex + 1 == index){
return <div className='phb' dangerouslySetInnerHTML={{__html:Markdown(pageText)}} key={index} />
}else{
return this.renderDummyPage(index);
}
})
},
render : function(){
return <div className="pageContainer" onScroll={this.handleScroll}>
<div className='pages'>
{this.renderPages()}
</div>
</div>;
}
});
module.exports = PageContainer;

View File

@@ -1,14 +0,0 @@
@import (less) './client/homebrew/phbStyle/phb.style.less';
.pageContainer{
background-color : @steel;
.pages{
padding : 30px 0px;
&>.phb{
margin-right : auto;
margin-bottom : 30px;
margin-left : auto;
box-shadow : 1px 4px 14px #000;
}
}
}

View File

@@ -1,173 +0,0 @@
var React = require('react');
var _ = require('lodash');
var cx = require('classnames');
var Moment = require('moment');
var request = require('superagent')
var Logo = require('naturalcrit/logo/logo.jsx');
var replaceAll = function(str, find, replace) {
return str.replace(new RegExp(find, 'g'), replace);
}
var Statusbar = React.createClass({
getDefaultProps: function() {
return {
editId: null,
sourceText : null,
shareId : null,
printId : null,
isPending : false,
lastUpdated : null,
info : null,
views : 0
};
},
componentDidMount: function() {
//Updates the last updated text every 10 seconds
if(this.props.lastUpdated){
this.refreshTimer = setInterval(()=>{
this.forceUpdate();
}, 10000)
}
},
componentWillUnmount: function() {
clearInterval(this.refreshTimer);
},
deleteBrew : function(){
if(!confirm("are you sure you want to delete this brew?")) return;
if(!confirm("are you REALLY sure? You will not be able to recover it")) return;
request.get('/homebrew/api/remove/' + this.props.editId)
.send()
.end(function(err, res){
window.location.href = '/homebrew';
});
},
openSourceWindow : function(){
var sourceWindow = window.open();
var content = replaceAll(this.props.sourceText, '<', '&lt;');
content = replaceAll(content, '>', '&gt;');
sourceWindow.document.write('<code><pre>' + content + '</pre></code>');
},
renderInfo : function(){
if(!this.props.lastUpdated) return null;
return [
<div className='views' key='views'>
Views: {this.props.views}
</div>,
<div className='lastUpdated' key='lastUpdated'>
Last updated: {Moment(this.props.lastUpdated).fromNow()}
</div>
];
},
renderChromeTip : function(){
if(typeof window !== 'undefined' && window.chrome) return;
return <div
className='chromeField'
data-tooltip="If you are noticing rendering issues, try using Chrome instead.">
<i className='fa fa-exclamation-triangle' />
Optimized for Chrome
</div>
},
renderSourceButton : function(){
if(!this.props.sourceText) return null;
return <a className='sourceField' onClick={this.openSourceWindow}>
View Source <i className='fa fa-code' />
</a>
},
renderNewButton : function(){
if(this.props.editId || this.props.shareId) return null;
return <a className='newButton' target='_blank' href='/homebrew/new'>
New Brew <i className='fa fa-external-link' />
</a>
},
renderChangelogButton : function(){
if(this.props.editId || this.props.shareId) return null;
return <a className='changelogButton' target='_blank' href='/homebrew/changelog'>
Changelog <i className='fa fa-file-text-o' />
</a>
},
renderShare : function(){
if(!this.props.shareId) return null;
return <a className='shareField' key='share' href={'/homebrew/share/' + this.props.shareId} target="_blank">
Share Link <i className='fa fa-external-link' />
</a>
},
renderPrintButton : function(){
if(!this.props.printId) return null;
return <a className='printField' key='print' href={'/homebrew/print/' + this.props.printId} target="_blank">
Print View <i className='fa fa-print' />
</a>
},
renderDeleteButton : function(){
if(!this.props.editId) return null;
return <div className='deleteButton' onClick={this.deleteBrew}>
Delete <i className='fa fa-trash' />
</div>
},
renderStatus : function(){
if(!this.props.editId) return null;
var text = 'Saved.'
if(this.props.isPending){
text = 'Saving...'
}
return <div className='savingStatus'>
{text}
</div>
},
render : function(){
return <div className='statusbar'>
<Logo
hoverSlide={true}
/>
<div className='left'>
<a href='/homebrew' className='toolName'>
The Home<small>Brewery</small>
</a>
</div>
<div className='controls right'>
{this.renderChromeTip()}
{this.renderChangelogButton()}
{this.renderStatus()}
{this.renderInfo()}
{this.renderSourceButton()}
{this.renderDeleteButton()}
{this.renderPrintButton()}
{this.renderShare()}
{this.renderNewButton()}
</div>
</div>
}
});
module.exports = Statusbar;

View File

@@ -1,135 +0,0 @@
.statusbar{
position : fixed;
z-index : 1000;
height : 25px;
width : 100%;
background-color : black;
font-size : 24px;
color : white;
line-height : 1.0em;
border-bottom : 1px solid @grey;
.logo{
display : inline-block;
vertical-align : middle;
margin-top : -5px;
margin-right : 20px;
svg{
margin-top : -6px;
}
}
.left{
display : inline-block;
vertical-align : top;
}
.right{
float : right;
}
.toolName{
display : block;
vertical-align : middle;
font-family : CodeBold;
font-size : 16px;
color : white;
line-height : 30px;
text-decoration : none;
small{
font-family : CodeBold;
}
}
.controls{
font-size : 12px;
>*{
display : inline-block;
height : 100%;
padding : 0px 10px;
border-left : 1px solid @grey;
}
.savingStatus{
width : 56px;
color : @grey;
text-align : center;
}
.newButton{
.animate(background-color);
color : white;
text-decoration : none;
&:hover{
background-color : fade(@green, 70%);
}
}
.chromeField{
background-color: @orange;
color : white;
text-decoration : none;
i{
margin-right: 10px;
}
}
.changelogButton{
.animate(background-color);
color : white;
text-decoration : none;
&:hover{
background-color : fade(@purple, 70%);
}
}
.deleteButton{
.animate(background-color);
color : white;
text-decoration : none;
cursor: pointer;
&:hover{
background-color : fade(@red, 70%);
}
}
.shareField{
.animate(background-color);
cursor : pointer;
color : white;
text-decoration : none;
&:hover{
background-color : fade(@teal, 70%);
}
span{
margin-right : 5px;
}
input{
width : 100px;
font-size : 12px;
}
}
.printField{
.animate(background-color);
cursor : pointer;
color : white;
text-decoration : none;
&:hover{
background-color : fade(@orange, 70%);
}
span{
margin-right : 5px;
}
input{
width : 100px;
font-size : 12px;
}
}
.sourceField{
.animate(background-color);
cursor : pointer;
color : white;
text-decoration : none;
&:hover{
background-color : fade(@teal, 70%);
}
span{
margin-right : 5px;
}
input{
width : 100px;
font-size : 12px;
}
}
}
}

View File

@@ -5,12 +5,13 @@ var cx = require('classnames');
var SplitPane = React.createClass({
getDefaultProps: function() {
return {
storageKey : 'naturalcrit-pane-split',
onDragFinish : function(){} //fires when dragging
};
},
getInitialState: function() {
return {
storageKey : 'naturalcrit-pane-split',
size : null,
isDragging : false
};
@@ -69,6 +70,11 @@ var SplitPane = React.createClass({
}
});
var Pane = React.createClass({
getDefaultProps: function() {
return {