Setup CI tests (#100)

* use @xarc/xrun to streamline tasks in an imperative manner

* add lint-staged/husky for git hook tasks

* run prettier across all files

* fixing tests

* add ci test workflow

* add a ci workflow

* remove precommit in favor of husky

* add .prettierrc.js

* reformat with prettier
This commit is contained in:
Vu Nguyen
2021-01-13 23:05:05 -06:00
committed by GitHub
parent 649c64cf1d
commit 9ef655ac3b
117 changed files with 9484 additions and 4342 deletions

View File

@@ -2,106 +2,111 @@
var React = require('react');
var reactCreateClass = require('create-react-class');
var MainList = reactCreateClass({
_openOptionsPage: function() {
if (browser.runtime.openOptionsPage) {
// New way to open options pages, if supported (Chrome 42+).
browser.runtime.openOptionsPage();
} else {
// Reasonable fallback.
window.open(browser.runtime.getURL('options.html'));
}
},
render: function() {
var that = this;
var loginLogoutButton = function() {
if (that.props.loggedIn === true) {
return (
<div>
<a href="#" className="list-group-item" onClick={that.props.logoutUser}>
<i className="fa fa-fw fa-sign-out"></i>
Logout
</a>
</div>
);
}
return (
<a target="_blank" href="https://wakatime.com/login" className="list-group-item">
<i className="fa fa-fw fa-sign-in"></i>
Login
</a>
);
};
// If logging is enabled, display that info to user
var loggingStatus = function() {
if(that.props.loggingEnabled === true && that.props.loggedIn === true)
{
return (
<div className="row">
<div className="col-xs-12">
<p>
<a href="#" onClick={that.props.disableLogging} className="btn btn-danger btn-block">Disable logging</a>
</p>
</div>
</div>
);
}
else if(that.props.loggingEnabled === false && that.props.loggedIn === true)
{
return (
<div className="row">
<div className="col-xs-12">
<p>
<a href="#" onClick={that.props.enableLogging} className="btn btn-success btn-block">Enable logging</a>
</p>
</div>
</div>
);
}
};
var totalTimeLoggedToday = function() {
if (that.props.loggedIn === true) {
return (
<div className="row">
<div className="col-xs-12">
<blockquote>
<p>{that.props.totalTimeLoggedToday}</p>
<small><cite>TOTAL TIME LOGGED TODAY</cite></small>
</blockquote>
</div>
</div>
);
}
};
return (
<div>
{totalTimeLoggedToday()}
{loggingStatus()}
<div className="list-group">
<a href="#" className="list-group-item" onClick={this._openOptionsPage}>
<i className="fa fa-fw fa-cogs"></i>
Options
</a>
{loginLogoutButton()}
</div>
</div>
);
_openOptionsPage: function () {
if (browser.runtime.openOptionsPage) {
// New way to open options pages, if supported (Chrome 42+).
browser.runtime.openOptionsPage();
} else {
// Reasonable fallback.
window.open(browser.runtime.getURL('options.html'));
}
},
render: function () {
var that = this;
var loginLogoutButton = function () {
if (that.props.loggedIn === true) {
return (
<div>
<a href="#" className="list-group-item" onClick={that.props.logoutUser}>
<i className="fa fa-fw fa-sign-out"></i>
Logout
</a>
</div>
);
}
return (
<a target="_blank" href="https://wakatime.com/login" className="list-group-item">
<i className="fa fa-fw fa-sign-in"></i>
Login
</a>
);
};
// If logging is enabled, display that info to user
var loggingStatus = function () {
if (that.props.loggingEnabled === true && that.props.loggedIn === true) {
return (
<div className="row">
<div className="col-xs-12">
<p>
<a
href="#"
onClick={that.props.disableLogging}
className="btn btn-danger btn-block"
>
Disable logging
</a>
</p>
</div>
</div>
);
} else if (that.props.loggingEnabled === false && that.props.loggedIn === true) {
return (
<div className="row">
<div className="col-xs-12">
<p>
<a
href="#"
onClick={that.props.enableLogging}
className="btn btn-success btn-block"
>
Enable logging
</a>
</p>
</div>
</div>
);
}
};
var totalTimeLoggedToday = function () {
if (that.props.loggedIn === true) {
return (
<div className="row">
<div className="col-xs-12">
<blockquote>
<p>{that.props.totalTimeLoggedToday}</p>
<small>
<cite>TOTAL TIME LOGGED TODAY</cite>
</small>
</blockquote>
</div>
</div>
);
}
};
return (
<div>
{totalTimeLoggedToday()}
{loggingStatus()}
<div className="list-group">
<a href="#" className="list-group-item" onClick={this._openOptionsPage}>
<i className="fa fa-fw fa-cogs"></i>
Options
</a>
{loginLogoutButton()}
</div>
</div>
);
},
});
module.exports = MainList;