mirror of
https://github.com/BorysLevytskyi/BitwiseCmd.git
synced 2025-12-18 10:52:17 +01:00
Support of about command
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import HelpResult from './models/HelpResult';
|
import HelpResult from './models/HelpResult';
|
||||||
|
import AboutResult from './models/AboutResult';
|
||||||
import UnknownCommandResult from './models/UnknownCommandResult';
|
import UnknownCommandResult from './models/UnknownCommandResult';
|
||||||
import ExpressionResult from './models/ExpressionResult';
|
import ExpressionResult from './models/ExpressionResult';
|
||||||
import * as expression from './expression';
|
import * as expression from './expression';
|
||||||
@@ -18,7 +19,7 @@ export default {
|
|||||||
|
|
||||||
cmd.commands({
|
cmd.commands({
|
||||||
'help': function(c) {
|
'help': function(c) {
|
||||||
// var helpResult = document.querySelector('.result .helpResultTpl');
|
// TODO: var helpResult = document.querySelector('.result .helpResultTpl');
|
||||||
// if(helpResult != null) {
|
// if(helpResult != null) {
|
||||||
// moveResultUp(helpResult);
|
// moveResultUp(helpResult);
|
||||||
// return;
|
// return;
|
||||||
@@ -38,13 +39,14 @@ export default {
|
|||||||
'light': function () {
|
'light': function () {
|
||||||
appState.setUiTheme('light');
|
appState.setUiTheme('light');
|
||||||
},
|
},
|
||||||
'about': function() {
|
'about': function(c) {
|
||||||
var aboutResult = document.querySelector('.result .aboutTpl');
|
//
|
||||||
if(aboutResult != null) {
|
// TODO: var aboutResult = document.querySelector('.result .aboutTpl');
|
||||||
moveResultUp(aboutResult);
|
// if(aboutResult != null) {
|
||||||
return;
|
// moveResultUp(aboutResult);
|
||||||
}
|
// return;
|
||||||
return new app.models.ViewResult('aboutTpl');
|
// }
|
||||||
|
appState.addCommandResult(new AboutResult(c.input));
|
||||||
},
|
},
|
||||||
'-debug': function() {
|
'-debug': function() {
|
||||||
app.debugMode = true;
|
app.debugMode = true;
|
||||||
|
|||||||
11
src/app/components/results/AboutResultView.jsx
Normal file
11
src/app/components/results/AboutResultView.jsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
export default class AboutResultView extends React.Component {
|
||||||
|
render() {
|
||||||
|
return <div className="aboutTpl">
|
||||||
|
<p> Created by <a href="http://boryslevytskyi.github.io/">Borys Levytskyi</a></p>
|
||||||
|
<p>If you have an idea, suggestion or you've spotted a bug here, please send it to <a href="mailto:bitwisecmd@gmail.com?subject=Feedback">bitwisecmd@gmail.com</a> or tweet on <a href="http://twitter.com/BitwiseCmd">@BitwiseCmd</a>. Your feedback is greatly appreciated.</p>
|
||||||
|
<p><a href="https://github.com/BorisLevitskiy/BitwiseCmd">Project on <strong>GitHub</strong></a></p>
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,8 +3,6 @@ import * as expression from '../../expression';
|
|||||||
import formatter from '../../formatter';
|
import formatter from '../../formatter';
|
||||||
import BinaryStringView from './BinaryStringView';
|
import BinaryStringView from './BinaryStringView';
|
||||||
|
|
||||||
console.log('BinaryStringView', BinaryStringView);
|
|
||||||
|
|
||||||
export default class BitwiseOperationEpxressionView extends React.Component {
|
export default class BitwiseOperationEpxressionView extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
var rows = this.getRows();
|
var rows = this.getRows();
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import HelpResult from '../../models/HelpResult';
|
import HelpResult from '../../models/HelpResult';
|
||||||
|
import AboutResult from '../../models/AboutResult';
|
||||||
import UnknownCommandResult from '../../models/UnknownCommandResult';
|
import UnknownCommandResult from '../../models/UnknownCommandResult';
|
||||||
import HelpResultView from './HelpResultView';
|
import HelpResultView from './HelpResultView';
|
||||||
|
import AboutResultView from './AboutResultView';
|
||||||
import ExpressionResult from '../../models/ExpressionResult';
|
import ExpressionResult from '../../models/ExpressionResult';
|
||||||
import ExpressionResultView from './ExpressionResultView';
|
import ExpressionResultView from './ExpressionResultView';
|
||||||
|
|
||||||
@@ -24,16 +26,20 @@ export default class DisplayResult extends React.Component {
|
|||||||
return <div className="error">Sorry, i don't know what <strong>{this.props.input}</strong> is :(</div>
|
return <div className="error">Sorry, i don't know what <strong>{this.props.input}</strong> is :(</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
findResultComponent(result, key) {
|
findResultComponent(result) {
|
||||||
if(result instanceof HelpResult) {
|
if(result instanceof HelpResult) {
|
||||||
return <HelpResultView key={key} content={result} />
|
return <HelpResultView content={result} />
|
||||||
|
}
|
||||||
|
|
||||||
|
if(result instanceof AboutResult) {
|
||||||
|
return <AboutResultView />
|
||||||
}
|
}
|
||||||
|
|
||||||
if(result instanceof ExpressionResult) {
|
if(result instanceof ExpressionResult) {
|
||||||
return <ExpressionResultView key={key} result={result} />
|
return <ExpressionResultView result={result} />
|
||||||
}
|
}
|
||||||
|
|
||||||
console.warn('Unknow result', result);
|
console.warn('Unknown result:', result);
|
||||||
return <span>Unknown result {typeof result}</span>
|
return <span>Unknown result: {typeof result}</span>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
7
src/app/models/AboutResult.js
Normal file
7
src/app/models/AboutResult.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import CommandResult from './CommandResult';
|
||||||
|
|
||||||
|
export default class AboutResult extends CommandResult {
|
||||||
|
constructor(input) {
|
||||||
|
super(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,6 @@ export default class CommandResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
encodeHash (string) {
|
encodeHash (string) {
|
||||||
return encodeURI(string.trim().replace(/\s/g,','));
|
return encodeURI(string.trim().replace(/\s/g,','));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user