Browse Source

Ajout police Sawaasdee, rename js to src

upgrade-electron
wpetit 4 years ago
parent
commit
2d8f9bd903
40 changed files with 97 additions and 34 deletions
  1. +34
    -9
      css/style.css
  2. BIN
      fonts/sawasdee-webfont.woff2
  3. +3
    -5
      index.html
  4. +3
    -3
      main.js
  5. +3
    -3
      package.json
  6. +0
    -0
      src/app.js
  7. +12
    -1
      src/components/common/app-icon.js
  8. +0
    -0
      src/components/edit/desktop-app-item.js
  9. +0
    -0
      src/components/edit/desktop-app-list.js
  10. +11
    -0
      src/components/edit/edit-view.js
  11. +0
    -0
      src/components/edit/icon-theme-selector.js
  12. +0
    -0
      src/components/edit/item-form.js
  13. +0
    -0
      src/components/edit/profile-menu.js
  14. +0
    -0
      src/components/edit/profile-tree.js
  15. +0
    -0
      src/components/edit/tree-item.js
  16. +0
    -0
      src/components/launcher/app-item.js
  17. +0
    -0
      src/components/launcher/app-list.js
  18. +0
    -0
      src/components/launcher/category-header.js
  19. +0
    -0
      src/components/launcher/launcher-view.js
  20. +0
    -0
      src/components/launcher/nav.js
  21. +0
    -0
      src/components/mixins/animate.js
  22. +0
    -0
      src/components/mixins/lazy-load.js
  23. +0
    -0
      src/store/actions/common.js
  24. +9
    -1
      src/store/actions/edit.js
  25. +0
    -0
      src/store/actions/index.js
  26. +0
    -0
      src/store/actions/launcher.js
  27. +0
    -0
      src/store/index.js
  28. +0
    -0
      src/store/middlewares/logger.js
  29. +0
    -0
      src/store/reducers/desktop-apps.js
  30. +0
    -0
      src/store/reducers/index.js
  31. +18
    -11
      src/store/reducers/profile.js
  32. +0
    -0
      src/store/reducers/theme.js
  33. +0
    -0
      src/util/cache.js
  34. +0
    -0
      src/util/const.js
  35. +0
    -0
      src/util/debug.js
  36. +1
    -1
      src/util/desktop-apps.js
  37. +3
    -0
      src/util/index.js
  38. +0
    -0
      src/util/promises.js
  39. +0
    -0
      src/util/system.js
  40. +0
    -0
      src/util/tree.js

+ 34
- 9
css/style.css View File

@@ -1,3 +1,10 @@
@font-face {
font-family: 'sawasdeeregular';
src: url('../fonts/sawasdee-webfont.woff2') format('woff2');
font-weight: normal;
font-style: normal;
}

* {
box-sizing: border-box;
}
@@ -5,7 +12,7 @@
html, body {
padding: 0;
margin: 0;
font-family: 'Droid Sans', 'Ubuntu Sans', sans-serif;
font-family: 'sawasdeeregular';
background-size: contain;
background-position: center;
background-color: rgb(34, 107, 160);
@@ -15,11 +22,21 @@ html, body {
overflow-x: hidden;
}


/* Common */

.alert.alert-default {
border-radius: 4px;
border: 1px solid #ddd;
}

.app-icon {
background-position: center center;
background-size: contain;
background-repeat: no-repeat;
transition: background-image 250ms ease-in-out;
}

.full-width {
width: 100%;
}
@@ -28,14 +45,17 @@ html, body {

.launcher {
display: flex;
width: 100%;
height: 100%;
flex-direction: column;
background: url('../img/background.png');
background-repeat: no-repeat;
background-size: cover;
background-position: center center;
transition: background-image 250ms ease-in-out;
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
}

.launcher .main {
@@ -48,7 +68,7 @@ html, body {
justify-content: center;
align-items: center;
display: flex;
width: 50px;
width: 60px;
}

.launcher .nav a.goback {
@@ -56,6 +76,7 @@ html, body {
color: white;
font-size: 60px;
text-shadow: 1px 1px #444;
font-family: sans-serif;
}

.launcher .nav a.goback:hover {
@@ -79,7 +100,7 @@ html, body {

.launcher ul.apps-list {
margin: 0;
padding: 0;
padding: 0 20%;
display: flex;
flex-direction: row;
list-style: none;
@@ -91,7 +112,7 @@ html, body {
}

.launcher .nav ~ ul.apps-list {
margin-left: -50px;
margin-left: -60px;
}

.launcher li.app-item {
@@ -127,8 +148,9 @@ html, body {
}

.launcher li.app-item > .app-icon {
width: 70%;
height: auto;
width: 90px;
height: 90px;
margin: auto;
}

.launcher li.app-item > .app-label {
@@ -237,7 +259,7 @@ html, body {

.edit .desktop-app > .app-icon {
height: 20px;
width: auto;
width: 20px;
display: inline-block;
vertical-align: middle;
margin-right: 10px;
@@ -268,7 +290,10 @@ html, body {

.edit .profile-tree .tree-item .app-icon {
height: 25px;
width: 25px;
margin-right: 5px;
display: inline-block;
vertical-align: middle;
}

.edit .app-item-edit {

BIN
fonts/sawasdee-webfont.woff2 View File


+ 3
- 5
index.html View File

@@ -2,7 +2,6 @@
<head>
<title>Lanceur - Pitaya</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
</head>
<body>

@@ -20,12 +19,11 @@
if(isDev) {
// Auto transform JSX
require('node-jsx').install({extension: '.js'});
// Launch application
require('./js/app.js');
} else {
require('./js-compiled/app.js');
}

// Launch app
require('./'+(isDev ? 'src' : 'dist')+'/app.js');

</script>

</body>

+ 3
- 3
main.js View File

@@ -2,7 +2,7 @@ var app = require('app'); // Module to control application life.
var BrowserWindow = require('browser-window'); // Module to create native browser window.
var Menu = require('menu');
var isDev = process.env.NODE_ENV === 'development';
var constants = require('./'+(isDev ? 'js': 'js-compiled')+'/util/const');
var constants = require('./'+(isDev ? 'src': 'dist')+'/util/const');

var mainWindow = null;

@@ -14,7 +14,7 @@ app.on('window-all-closed', function() {
app.on('ready', function() {
// Create the browser window.
var electronScreen = require('screen');
var size = electronScreen.getPrimaryDisplay().workAreaSize;
var size = electronScreen.getPrimaryDisplay().size;

var asDesktop = process.env.PITAYA_AS_DESKTOP == 1;

@@ -29,7 +29,7 @@ app.on('ready', function() {
y: asDesktop ? 0 : undefined,
});

if(process.env.NODE_ENV === 'development') {
if(isDev) {
mainWindow.openDevTools();
}


+ 3
- 3
package.json View File

@@ -13,9 +13,9 @@
"scripts": {
"test": "./node_modules/.bin/nodeunit test",
"start": "./node_modules/.bin/electron .",
"compile": "./node_modules/.bin/jsx -x js js js-compiled",
"clean": "rm -rf js-compiled/* build/*",
"package": "./node_modules/.bin/electron-packager ./ pitaya --prune --ignore=js/ --platform=linux --arch=ia32 --version=0.33.6 --out=build --overwrite --app-version 0.0.0",
"compile": "./node_modules/.bin/jsx -x js src dist",
"clean": "rm -rf dist/* build/*",
"package": "./node_modules/.bin/electron-packager ./ pitaya --prune --ignore=res/ --platform=linux --arch=ia32,x64 --version=0.33.6 --out=build --overwrite --app-version 0.0.0",
"build": "npm run clean && npm run compile && npm run package"
},
"dependencies": {

js/app.js → src/app.js View File


js/components/common/app-icon.js → src/components/common/app-icon.js View File

@@ -41,8 +41,12 @@ module.exports = React.createClass({

var icon = this.state.icon;

var style = {
backgroundImage: 'url('+icon+')'
};

return (
<img src={icon} className="app-icon" />
<div className="app-icon" style={style}></div>
);

},
@@ -61,6 +65,13 @@ module.exports = React.createClass({
return iconPath;
})
.then(function(iconPath) {
return Util.System.exists(iconPath)
.then(function(exists) {
return exists ? iconPath : DEFAULT_ICON;
})
;
})
.then(function(iconPath) {
self.setState({ icon: iconPath });
})
;

js/components/edit/desktop-app-item.js → src/components/edit/desktop-app-item.js View File


js/components/edit/desktop-app-list.js → src/components/edit/desktop-app-list.js View File


js/components/edit/edit-view.js → src/components/edit/edit-view.js View File

@@ -21,6 +21,7 @@ var EditView = React.createClass({

return (
<div className="edit">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css" />
<div className="menu-bar">
<div className="left">
<ProfileMenu />
@@ -76,6 +77,16 @@ var EditView = React.createClass({

handleItemChange: function(item, key, value) {
this.props.dispatch(actions.edit.updateProfileItem(item, key, value));
},

handleAddNewNode: function() {
var newItem = {
label: 'Nouveau noeud',
icon: '',
exec: '',
background: ''
};
this.props.dispatch(actions.edit.addProfileItem(newItem, this.props.profile));
}

});

js/components/edit/icon-theme-selector.js → src/components/edit/icon-theme-selector.js View File


js/components/edit/item-form.js → src/components/edit/item-form.js View File


js/components/edit/profile-menu.js → src/components/edit/profile-menu.js View File


js/components/edit/profile-tree.js → src/components/edit/profile-tree.js View File


js/components/edit/tree-item.js → src/components/edit/tree-item.js View File


js/components/launcher/app-item.js → src/components/launcher/app-item.js View File


js/components/launcher/app-list.js → src/components/launcher/app-list.js View File


js/components/launcher/category-header.js → src/components/launcher/category-header.js View File


js/components/launcher/launcher-view.js → src/components/launcher/launcher-view.js View File


js/components/launcher/nav.js → src/components/launcher/nav.js View File


js/components/mixins/animate.js → src/components/mixins/animate.js View File


js/components/mixins/lazy-load.js → src/components/mixins/lazy-load.js View File


js/store/actions/common.js → src/store/actions/common.js View File


js/store/actions/edit.js → src/store/actions/edit.js View File

@@ -1,5 +1,6 @@
var Util = require('../../util');
var path = require('path');
var _ = require('lodash');

// Action types
var LOAD_DESKTOP_APPS = exports.LOAD_PROFILE = 'LOAD_DESKTOP_APPS';
@@ -45,7 +46,14 @@ exports.saveProfile = function(destPath, profile) {

dispatch({ type: SAVE_PROFILE, profile: profile, path: destPath });

return Util.System.saveJSON(destPath, profile)
var cleanedProfile = _.cloneDeep(profile);

Util.Tree.walk(cleanedProfile, function(item) {
delete item.selected;
delete item._key;
});

return Util.System.saveJSON(destPath, cleanedProfile)
.then(function() {
dispatch({ type: SAVE_PROFILE_SUCCESS, profile: profile, path: destPath });
})

js/store/actions/index.js → src/store/actions/index.js View File


js/store/actions/launcher.js → src/store/actions/launcher.js View File


js/store/index.js → src/store/index.js View File


js/store/middlewares/logger.js → src/store/middlewares/logger.js View File


js/store/reducers/desktop-apps.js → src/store/reducers/desktop-apps.js View File


js/store/reducers/index.js → src/store/reducers/index.js View File


js/store/reducers/profile.js → src/store/reducers/profile.js View File

@@ -4,33 +4,40 @@ var tree = require('../../util/tree');

module.exports = function(oldProfile, action) {

var newProfile = oldProfile || { items: [] };

switch(action.type) {

case actions.common.LOAD_PROFILE_SUCCESS:
var newProfile = _.cloneDeep(action.profile);
tree.walk(newProfile, ensureItemKey);
return newProfile;
newProfile = _.cloneDeep(action.profile);
break;

case actions.edit.MOVE_PROFILE_ITEM:
return moveProfileItem(oldProfile, action.movedItem, action.targetItem);
newProfile = moveProfileItem(oldProfile, action.movedItem, action.targetItem);
break;

case actions.edit.REMOVE_PROFILE_ITEM:
return removeProfileItem(oldProfile, action.removedItem);
newProfile = removeProfileItem(oldProfile, action.removedItem);
break;

case actions.edit.ADD_PROFILE_ITEM:
return addProfileItem(oldProfile, action.newItem, action.targetItem);
newProfile = addProfileItem(oldProfile, action.newItem, action.targetItem);
break;

case actions.edit.UPDATE_PROFILE_ITEM:
return updateProfileItem(oldProfile, action.item, action.key, action.value);
newProfile = updateProfileItem(oldProfile, action.item, action.key, action.value);
break;

case actions.edit.SELECT_PROFILE_ITEM:
return selectProfileItem(oldProfile, action.item);

default:
return oldProfile || null;
newProfile = selectProfileItem(oldProfile, action.item);
break;

}

if(newProfile) tree.walk(newProfile, ensureItemKey);

return newProfile;

};

function selectProfileItem(oldProfile, item) {

js/store/reducers/theme.js → src/store/reducers/theme.js View File


js/util/cache.js → src/util/cache.js View File


js/util/const.js → src/util/const.js View File


js/util/debug.js → src/util/debug.js View File


js/util/desktop-apps.js → src/util/desktop-apps.js View File

@@ -46,7 +46,7 @@ exports.findAllDesktopFiles = function(baseDirs) {
if(!Array.isArray(baseDirs)) {
baseDirs = [baseDirs];
}
return promises.seq(baseDirs, function(baseDir) {
return System.findFiles('**/*.desktop', {cwd: baseDir, realpath: true});
})

js/util/index.js → src/util/index.js View File

@@ -2,3 +2,6 @@ exports.System = require('./system');
exports.DesktopApps = require('./desktop-apps');
exports.Cache = require('./cache');
exports.Debug = require('./debug');
exports.Tree = require('./tree');
exports.Const = require('./const');
exports.Promises = require('./promises');

js/util/promises.js → src/util/promises.js View File


js/util/system.js → src/util/system.js View File


js/util/tree.js → src/util/tree.js View File


Loading…
Cancel
Save