diff --git a/app.js b/app.js index ebf113c..027a3e1 100644 --- a/app.js +++ b/app.js @@ -63,7 +63,11 @@ app.get('/', function(req, res) { {artist: "Hozier", album: "self-titled album", url: '/google/album/Bd3mxcy3otokg4yc45qktq7l35q'}, {artist: "Daft Punk", album: "Discovery", url: '/google/album/B4t6yqqvhnb2hy4st4uisjrcsrm'} ]; - res.render('index', { page: "home", samples: samples, error: req.flash('search-error') }); + + // shitty sort until I add more metadata on cached items + req.db.matches.find().sort({$natural:-1}).limit(4).toArray().then(function(docs){ + res.render('index', { page: "home", samples: samples, recent: docs, error: req.flash('search-error') }); + }); }); app.post('/search', search); diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css index d7c3a3c..92fc6af 100644 --- a/public/stylesheets/style.css +++ b/public/stylesheets/style.css @@ -88,7 +88,7 @@ h3 { } .share-form { - margin-top: 30vh; + margin-top: 25vh; margin-bottom: 20px; text-align: center; } @@ -105,7 +105,11 @@ h3 { } .blurb { - margin-bottom: 100px; + margin-bottom: 50px; +} + +.recent { + margin-bottom: 30px; } .service { diff --git a/views/index.ejs b/views/index.ejs index 2774735..0e281dc 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -24,8 +24,19 @@

Make sharing from music services better. We match album and track links from Rdio, Spotify, Deezer, Beats Music, Google Music and iTunes and give you back a link with all of them.

- <% var sample = samples[Math.floor(Math.random() * samples.length)] %> -

Here's an example with <%= sample.artist %>'s <%= sample.album %>.

+
+ + +
+
+ <% if (recent.length) { %>

Recently Shared

<% } %> +
+ <% for (var i=0;i < recent.length;i++) { var item = recent[i].items[0]; %> + <% if((i+1)%2 == 0) { %>
<% } %> + <% } %> +