Browse Source

Ajout police Sawaasdee, rename js to src

feature/remote-launch
William Petit 3 years ago
parent
commit
2d8f9bd903

+ 34
- 9
css/style.css View File

@@ -1,3 +1,10 @@
1
+@font-face {
2
+  font-family: 'sawasdeeregular';
3
+  src: url('../fonts/sawasdee-webfont.woff2') format('woff2');
4
+  font-weight: normal;
5
+  font-style: normal;
6
+}
7
+
1 8
 * {
2 9
   box-sizing: border-box;
3 10
 }
@@ -5,7 +12,7 @@
5 12
 html, body {
6 13
   padding: 0;
7 14
   margin: 0;
8
-  font-family: 'Droid Sans', 'Ubuntu Sans', sans-serif;
15
+  font-family: 'sawasdeeregular';
9 16
   background-size: contain;
10 17
   background-position: center;
11 18
   background-color: rgb(34, 107, 160);
@@ -15,11 +22,21 @@ html, body {
15 22
   overflow-x: hidden;
16 23
 }
17 24
 
25
+
26
+/* Common */
27
+
18 28
 .alert.alert-default {
19 29
   border-radius: 4px;
20 30
   border: 1px solid #ddd;
21 31
 }
22 32
 
33
+.app-icon {
34
+  background-position: center center;
35
+  background-size: contain;
36
+  background-repeat: no-repeat;
37
+  transition: background-image 250ms ease-in-out;
38
+}
39
+
23 40
 .full-width {
24 41
   width: 100%;
25 42
 }
@@ -28,14 +45,17 @@ html, body {
28 45
 
29 46
 .launcher {
30 47
   display: flex;
31
-  width: 100%;
32
-  height: 100%;
33 48
   flex-direction: column;
34 49
   background: url('../img/background.png');
35 50
   background-repeat: no-repeat;
36 51
   background-size: cover;
37 52
   background-position: center center;
38 53
   transition: background-image 250ms ease-in-out;
54
+  position: absolute;
55
+  left: 0;
56
+  right: 0;
57
+  bottom: 0;
58
+  top: 0;
39 59
 }
40 60
 
41 61
 .launcher .main {
@@ -48,7 +68,7 @@ html, body {
48 68
   justify-content: center;
49 69
   align-items: center;
50 70
   display: flex;
51
-  width: 50px;
71
+  width: 60px;
52 72
 }
53 73
 
54 74
 .launcher .nav a.goback {
@@ -56,6 +76,7 @@ html, body {
56 76
   color: white;
57 77
   font-size: 60px;
58 78
   text-shadow: 1px 1px #444;
79
+  font-family: sans-serif;
59 80
 }
60 81
 
61 82
 .launcher .nav a.goback:hover {
@@ -79,7 +100,7 @@ html, body {
79 100
 
80 101
 .launcher ul.apps-list {
81 102
   margin: 0;
82
-  padding: 0;
103
+  padding: 0 20%;
83 104
   display: flex;
84 105
   flex-direction: row;
85 106
   list-style: none;
@@ -91,7 +112,7 @@ html, body {
91 112
 }
92 113
 
93 114
 .launcher .nav ~ ul.apps-list {
94
-  margin-left: -50px;
115
+  margin-left: -60px;
95 116
 }
96 117
 
97 118
 .launcher li.app-item {
@@ -127,8 +148,9 @@ html, body {
127 148
 }
128 149
 
129 150
 .launcher li.app-item > .app-icon {
130
-  width: 70%;
131
-  height: auto;
151
+  width: 90px;
152
+  height: 90px;
153
+  margin: auto;
132 154
 }
133 155
 
134 156
 .launcher li.app-item > .app-label {
@@ -237,7 +259,7 @@ html, body {
237 259
 
238 260
 .edit .desktop-app > .app-icon {
239 261
   height: 20px;
240
-  width: auto;
262
+  width: 20px;
241 263
   display: inline-block;
242 264
   vertical-align: middle;
243 265
   margin-right: 10px;
@@ -268,7 +290,10 @@ html, body {
268 290
 
269 291
 .edit .profile-tree .tree-item .app-icon {
270 292
   height: 25px;
293
+  width: 25px;
271 294
   margin-right: 5px;
295
+  display: inline-block;
296
+  vertical-align: middle;
272 297
 }
273 298
 
274 299
 .edit .app-item-edit {

BIN
fonts/sawasdee-webfont.woff2 View File


+ 3
- 5
index.html View File

@@ -2,7 +2,6 @@
2 2
   <head>
3 3
     <title>Lanceur - Pitaya</title>
4 4
     <link rel="stylesheet" href="css/style.css" />
5
-    <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
6 5
   </head>
7 6
   <body>
8 7
 
@@ -20,12 +19,11 @@
20 19
       if(isDev) {
21 20
         // Auto transform JSX
22 21
         require('node-jsx').install({extension: '.js'});
23
-        // Launch application
24
-        require('./js/app.js');
25
-      } else {
26
-        require('./js-compiled/app.js');
27 22
       }
28 23
 
24
+      // Launch app
25
+      require('./'+(isDev ? 'src' : 'dist')+'/app.js');
26
+
29 27
     </script>
30 28
 
31 29
   </body>

+ 3
- 3
main.js View File

@@ -2,7 +2,7 @@ var app = require('app');  // Module to control application life.
2 2
 var BrowserWindow = require('browser-window');  // Module to create native browser window.
3 3
 var Menu = require('menu');
4 4
 var isDev = process.env.NODE_ENV === 'development';
5
-var constants = require('./'+(isDev ? 'js': 'js-compiled')+'/util/const');
5
+var constants = require('./'+(isDev ? 'src': 'dist')+'/util/const');
6 6
 
7 7
 var mainWindow = null;
8 8
 
@@ -14,7 +14,7 @@ app.on('window-all-closed', function() {
14 14
 app.on('ready', function() {
15 15
   // Create the browser window.
16 16
   var electronScreen = require('screen');
17
-  var size = electronScreen.getPrimaryDisplay().workAreaSize;
17
+  var size = electronScreen.getPrimaryDisplay().size;
18 18
 
19 19
   var asDesktop = process.env.PITAYA_AS_DESKTOP == 1;
20 20
 
@@ -29,7 +29,7 @@ app.on('ready', function() {
29 29
     y: asDesktop ? 0 : undefined,
30 30
   });
31 31
 
32
-  if(process.env.NODE_ENV === 'development') {
32
+  if(isDev) {
33 33
     mainWindow.openDevTools();
34 34
   }
35 35
 

+ 3
- 3
package.json View File

@@ -13,9 +13,9 @@
13 13
   "scripts": {
14 14
     "test": "./node_modules/.bin/nodeunit test",
15 15
     "start": "./node_modules/.bin/electron .",
16
-    "compile": "./node_modules/.bin/jsx -x js js js-compiled",
17
-    "clean": "rm -rf js-compiled/* build/*",
18
-    "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",
16
+    "compile": "./node_modules/.bin/jsx -x js src dist",
17
+    "clean": "rm -rf dist/* build/*",
18
+    "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",
19 19
     "build": "npm run clean && npm run compile && npm run package"
20 20
   },
21 21
   "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({
41 41
 
42 42
     var icon = this.state.icon;
43 43
 
44
+    var style = {
45
+      backgroundImage: 'url('+icon+')'
46
+    };
47
+
44 48
     return (
45
-      <img src={icon} className="app-icon" />
49
+      <div className="app-icon" style={style}></div>
46 50
     );
47 51
 
48 52
   },
@@ -61,6 +65,13 @@ module.exports = React.createClass({
61 65
         return iconPath;
62 66
       })
63 67
       .then(function(iconPath) {
68
+        return Util.System.exists(iconPath)
69
+          .then(function(exists) {
70
+            return exists ? iconPath : DEFAULT_ICON;
71
+          })
72
+        ;
73
+      })
74
+      .then(function(iconPath) {
64 75
         self.setState({ icon: iconPath });
65 76
       })
66 77
     ;

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({
21 21
 
22 22
     return (
23 23
       <div className="edit">
24
+        <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css" />
24 25
         <div className="menu-bar">
25 26
           <div className="left">
26 27
             <ProfileMenu />
@@ -76,6 +77,16 @@ var EditView = React.createClass({
76 77
 
77 78
   handleItemChange: function(item, key, value) {
78 79
     this.props.dispatch(actions.edit.updateProfileItem(item, key, value));
80
+  },
81
+
82
+  handleAddNewNode: function() {
83
+    var newItem = {
84
+      label: 'Nouveau noeud',
85
+      icon: '',
86
+      exec: '',
87
+      background: ''
88
+    };
89
+    this.props.dispatch(actions.edit.addProfileItem(newItem, this.props.profile));
79 90
   }
80 91
 
81 92
 });

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 @@
1 1
 var Util = require('../../util');
2 2
 var path = require('path');
3
+var _ = require('lodash');
3 4
 
4 5
 // Action types
5 6
 var LOAD_DESKTOP_APPS = exports.LOAD_PROFILE = 'LOAD_DESKTOP_APPS';
@@ -45,7 +46,14 @@ exports.saveProfile = function(destPath, profile) {
45 46
 
46 47
     dispatch({ type: SAVE_PROFILE, profile: profile, path: destPath });
47 48
 
48
-    return Util.System.saveJSON(destPath, profile)
49
+    var cleanedProfile = _.cloneDeep(profile);
50
+
51
+    Util.Tree.walk(cleanedProfile, function(item) {
52
+      delete item.selected;
53
+      delete item._key;
54
+    });
55
+
56
+    return Util.System.saveJSON(destPath, cleanedProfile)
49 57
       .then(function() {
50 58
         dispatch({ type: SAVE_PROFILE_SUCCESS, profile: profile, path: destPath });
51 59
       })

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');
4 4
 
5 5
 module.exports = function(oldProfile, action) {
6 6
 
7
+  var newProfile = oldProfile || { items: [] };
8
+
7 9
   switch(action.type) {
8 10
 
9 11
     case actions.common.LOAD_PROFILE_SUCCESS:
10
-      var newProfile = _.cloneDeep(action.profile);
11
-      tree.walk(newProfile, ensureItemKey);
12
-      return newProfile;
12
+      newProfile = _.cloneDeep(action.profile);
13
+      break;
13 14
 
14 15
     case actions.edit.MOVE_PROFILE_ITEM:
15
-      return moveProfileItem(oldProfile, action.movedItem, action.targetItem);
16
+      newProfile = moveProfileItem(oldProfile, action.movedItem, action.targetItem);
17
+      break;
16 18
 
17 19
     case actions.edit.REMOVE_PROFILE_ITEM:
18
-      return removeProfileItem(oldProfile, action.removedItem);
20
+      newProfile = removeProfileItem(oldProfile, action.removedItem);
21
+      break;
19 22
 
20 23
     case actions.edit.ADD_PROFILE_ITEM:
21
-      return addProfileItem(oldProfile, action.newItem, action.targetItem);
24
+      newProfile = addProfileItem(oldProfile, action.newItem, action.targetItem);
25
+      break;
22 26
 
23 27
     case actions.edit.UPDATE_PROFILE_ITEM:
24
-      return updateProfileItem(oldProfile, action.item, action.key, action.value);
28
+      newProfile = updateProfileItem(oldProfile, action.item, action.key, action.value);
29
+      break;
25 30
 
26 31
     case actions.edit.SELECT_PROFILE_ITEM:
27
-      return selectProfileItem(oldProfile, action.item);
28
-
29
-    default:
30
-      return oldProfile || null;
32
+      newProfile = selectProfileItem(oldProfile, action.item);
33
+      break;
31 34
 
32 35
   }
33 36
 
37
+  if(newProfile) tree.walk(newProfile, ensureItemKey);
38
+
39
+  return newProfile;
40
+
34 41
 };
35 42
 
36 43
 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) {
46 46
   if(!Array.isArray(baseDirs)) {
47 47
     baseDirs = [baseDirs];
48 48
   }
49
-  
49
+
50 50
   return promises.seq(baseDirs, function(baseDir) {
51 51
       return System.findFiles('**/*.desktop', {cwd: baseDir, realpath: true});
52 52
     })

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

@@ -2,3 +2,6 @@ exports.System = require('./system');
2 2
 exports.DesktopApps = require('./desktop-apps');
3 3
 exports.Cache = require('./cache');
4 4
 exports.Debug = require('./debug');
5
+exports.Tree = require('./tree');
6
+exports.Const = require('./const');
7
+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