Skip to content

Commit

Permalink
Display completition year in description
Browse files Browse the repository at this point in the history
  • Loading branch information
fawind committed Dec 7, 2016
1 parent eb962a7 commit 5b2ee96
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion chrome/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"main": "index.html",
"scripts": {
"start": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline -d",
"start": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js --port 9090 --inline -d",
"lint": "./node_modules/eslint/bin/eslint.js src",
"build": "./node_modules/webpack/bin/webpack.js --config ./webpack.build.config.js -p",
"clean": "rm -rf ./dist",
Expand Down
4 changes: 2 additions & 2 deletions chrome/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<div class="clock"></div>

<div class="widget" id="info" style="visibility: hidden">
<h2><a id="title">Title</a></h2>
<h3 id="artist">Artist</h3>
<h2><a id="title"></a></h2>
<h3 id="description"></h3>
</div>

<div class="widget" id="actions" style="visibility: hidden">
Expand Down
11 changes: 9 additions & 2 deletions chrome/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const bgElement = $('.bg');
const clockElement = $('.clock');
const widgetElement = $('.widget');
const titleElement = $('#title');
const artistElement = $('#artist');
const descriptionElement = $('#description');
const skipElement = $('#skip');


Expand Down Expand Up @@ -50,7 +50,14 @@ class NewTab {
static _setBackground(image) {
bgElement.css('background-image', `url(${image.dataUri})`);
titleElement.text(image.title).attr('href', image.image);
artistElement.text(image.artistName);
descriptionElement.text(NewTab._getDescription(image));
}

static _getDescription(image) {
if (!image.completitionYear || image.completitionYear === '-1') {
return image.artistName;
}
return `${image.artistName}, ${image.completitionYear}`;
}
}

Expand Down
3 changes: 1 addition & 2 deletions chrome/src/js/imageProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export default class ImageProvider {
if (!ImageStore.hasCurrentImage() || ImageStore.currentImageIsExpired()) {
await ImageProvider._updateCurrentImage();
}
const image = ImageStore.getCurrentImage();
return image;
return ImageStore.getCurrentImage();
} catch (error) {
ImageProvider._handleError(error);
throw error;
Expand Down
2 changes: 1 addition & 1 deletion chrome/src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Picasso - New Tab Page",
"description": "Art masterpieces in your browser tabs.",
"version": "0.0.2",
"version": "0.0.4",
"incognito": "split",
"permissions": [
"http://picasso-tab.appspot.com/*",
Expand Down

0 comments on commit 5b2ee96

Please sign in to comment.