Ajout police Sawaasdee, rename js to src

This commit is contained in:
wpetit 2015-10-16 15:12:49 +02:00
parent 39399a5c08
commit 2d8f9bd903
40 changed files with 97 additions and 34 deletions

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; box-sizing: border-box;
} }
@ -5,7 +12,7 @@
html, body { html, body {
padding: 0; padding: 0;
margin: 0; margin: 0;
font-family: 'Droid Sans', 'Ubuntu Sans', sans-serif; font-family: 'sawasdeeregular';
background-size: contain; background-size: contain;
background-position: center; background-position: center;
background-color: rgb(34, 107, 160); background-color: rgb(34, 107, 160);
@ -15,11 +22,21 @@ html, body {
overflow-x: hidden; overflow-x: hidden;
} }
/* Common */
.alert.alert-default { .alert.alert-default {
border-radius: 4px; border-radius: 4px;
border: 1px solid #ddd; 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 { .full-width {
width: 100%; width: 100%;
} }
@ -28,14 +45,17 @@ html, body {
.launcher { .launcher {
display: flex; display: flex;
width: 100%;
height: 100%;
flex-direction: column; flex-direction: column;
background: url('../img/background.png'); background: url('../img/background.png');
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
background-position: center center; background-position: center center;
transition: background-image 250ms ease-in-out; transition: background-image 250ms ease-in-out;
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
} }
.launcher .main { .launcher .main {
@ -48,7 +68,7 @@ html, body {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
display: flex; display: flex;
width: 50px; width: 60px;
} }
.launcher .nav a.goback { .launcher .nav a.goback {
@ -56,6 +76,7 @@ html, body {
color: white; color: white;
font-size: 60px; font-size: 60px;
text-shadow: 1px 1px #444; text-shadow: 1px 1px #444;
font-family: sans-serif;
} }
.launcher .nav a.goback:hover { .launcher .nav a.goback:hover {
@ -79,7 +100,7 @@ html, body {
.launcher ul.apps-list { .launcher ul.apps-list {
margin: 0; margin: 0;
padding: 0; padding: 0 20%;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
list-style: none; list-style: none;
@ -91,7 +112,7 @@ html, body {
} }
.launcher .nav ~ ul.apps-list { .launcher .nav ~ ul.apps-list {
margin-left: -50px; margin-left: -60px;
} }
.launcher li.app-item { .launcher li.app-item {
@ -127,8 +148,9 @@ html, body {
} }
.launcher li.app-item > .app-icon { .launcher li.app-item > .app-icon {
width: 70%; width: 90px;
height: auto; height: 90px;
margin: auto;
} }
.launcher li.app-item > .app-label { .launcher li.app-item > .app-label {
@ -237,7 +259,7 @@ html, body {
.edit .desktop-app > .app-icon { .edit .desktop-app > .app-icon {
height: 20px; height: 20px;
width: auto; width: 20px;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
margin-right: 10px; margin-right: 10px;
@ -268,7 +290,10 @@ html, body {
.edit .profile-tree .tree-item .app-icon { .edit .profile-tree .tree-item .app-icon {
height: 25px; height: 25px;
width: 25px;
margin-right: 5px; margin-right: 5px;
display: inline-block;
vertical-align: middle;
} }
.edit .app-item-edit { .edit .app-item-edit {

Binary file not shown.

View File

@ -2,7 +2,6 @@
<head> <head>
<title>Lanceur - Pitaya</title> <title>Lanceur - Pitaya</title>
<link rel="stylesheet" href="css/style.css" /> <link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
</head> </head>
<body> <body>
@ -20,12 +19,11 @@
if(isDev) { if(isDev) {
// Auto transform JSX // Auto transform JSX
require('node-jsx').install({extension: '.js'}); 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> </script>
</body> </body>

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 BrowserWindow = require('browser-window'); // Module to create native browser window.
var Menu = require('menu'); var Menu = require('menu');
var isDev = process.env.NODE_ENV === 'development'; 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; var mainWindow = null;
@ -14,7 +14,7 @@ app.on('window-all-closed', function() {
app.on('ready', function() { app.on('ready', function() {
// Create the browser window. // Create the browser window.
var electronScreen = require('screen'); var electronScreen = require('screen');
var size = electronScreen.getPrimaryDisplay().workAreaSize; var size = electronScreen.getPrimaryDisplay().size;
var asDesktop = process.env.PITAYA_AS_DESKTOP == 1; var asDesktop = process.env.PITAYA_AS_DESKTOP == 1;
@ -29,7 +29,7 @@ app.on('ready', function() {
y: asDesktop ? 0 : undefined, y: asDesktop ? 0 : undefined,
}); });
if(process.env.NODE_ENV === 'development') { if(isDev) {
mainWindow.openDevTools(); mainWindow.openDevTools();
} }

View File

@ -13,9 +13,9 @@
"scripts": { "scripts": {
"test": "./node_modules/.bin/nodeunit test", "test": "./node_modules/.bin/nodeunit test",
"start": "./node_modules/.bin/electron .", "start": "./node_modules/.bin/electron .",
"compile": "./node_modules/.bin/jsx -x js js js-compiled", "compile": "./node_modules/.bin/jsx -x js src dist",
"clean": "rm -rf js-compiled/* build/*", "clean": "rm -rf dist/* 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", "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" "build": "npm run clean && npm run compile && npm run package"
}, },
"dependencies": { "dependencies": {

View File

@ -41,8 +41,12 @@ module.exports = React.createClass({
var icon = this.state.icon; var icon = this.state.icon;
var style = {
backgroundImage: 'url('+icon+')'
};
return ( return (
<img src={icon} className="app-icon" /> <div className="app-icon" style={style}></div>
); );
}, },
@ -60,6 +64,13 @@ module.exports = React.createClass({
} }
return iconPath; return iconPath;
}) })
.then(function(iconPath) {
return Util.System.exists(iconPath)
.then(function(exists) {
return exists ? iconPath : DEFAULT_ICON;
})
;
})
.then(function(iconPath) { .then(function(iconPath) {
self.setState({ icon: iconPath }); self.setState({ icon: iconPath });
}) })

View File

@ -21,6 +21,7 @@ var EditView = React.createClass({
return ( return (
<div className="edit"> <div className="edit">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css" />
<div className="menu-bar"> <div className="menu-bar">
<div className="left"> <div className="left">
<ProfileMenu /> <ProfileMenu />
@ -76,6 +77,16 @@ var EditView = React.createClass({
handleItemChange: function(item, key, value) { handleItemChange: function(item, key, value) {
this.props.dispatch(actions.edit.updateProfileItem(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));
} }
}); });

View File

@ -1,5 +1,6 @@
var Util = require('../../util'); var Util = require('../../util');
var path = require('path'); var path = require('path');
var _ = require('lodash');
// Action types // Action types
var LOAD_DESKTOP_APPS = exports.LOAD_PROFILE = 'LOAD_DESKTOP_APPS'; 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 }); 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() { .then(function() {
dispatch({ type: SAVE_PROFILE_SUCCESS, profile: profile, path: destPath }); dispatch({ type: SAVE_PROFILE_SUCCESS, profile: profile, path: destPath });
}) })

View File

@ -4,33 +4,40 @@ var tree = require('../../util/tree');
module.exports = function(oldProfile, action) { module.exports = function(oldProfile, action) {
var newProfile = oldProfile || { items: [] };
switch(action.type) { switch(action.type) {
case actions.common.LOAD_PROFILE_SUCCESS: case actions.common.LOAD_PROFILE_SUCCESS:
var newProfile = _.cloneDeep(action.profile); newProfile = _.cloneDeep(action.profile);
tree.walk(newProfile, ensureItemKey); break;
return newProfile;
case actions.edit.MOVE_PROFILE_ITEM: 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: case actions.edit.REMOVE_PROFILE_ITEM:
return removeProfileItem(oldProfile, action.removedItem); newProfile = removeProfileItem(oldProfile, action.removedItem);
break;
case actions.edit.ADD_PROFILE_ITEM: 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: 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: case actions.edit.SELECT_PROFILE_ITEM:
return selectProfileItem(oldProfile, action.item); newProfile = selectProfileItem(oldProfile, action.item);
break;
default:
return oldProfile || null;
} }
if(newProfile) tree.walk(newProfile, ensureItemKey);
return newProfile;
}; };
function selectProfileItem(oldProfile, item) { function selectProfileItem(oldProfile, item) {

View File

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