diff --git a/public/android-chrome-192x192.png b/public/android-chrome-192x192.png new file mode 100644 index 0000000..9a025ef Binary files /dev/null and b/public/android-chrome-192x192.png differ diff --git a/public/android-chrome-512x512.png b/public/android-chrome-512x512.png new file mode 100644 index 0000000..34378d1 Binary files /dev/null and b/public/android-chrome-512x512.png differ diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png new file mode 100644 index 0000000..130e1f3 Binary files /dev/null and b/public/apple-touch-icon.png differ diff --git a/public/browserconfig.xml b/public/browserconfig.xml new file mode 100644 index 0000000..b3930d0 --- /dev/null +++ b/public/browserconfig.xml @@ -0,0 +1,9 @@ + + + + + + #da532c + + + diff --git a/public/favicon-16x16.png b/public/favicon-16x16.png new file mode 100644 index 0000000..433377b Binary files /dev/null and b/public/favicon-16x16.png differ diff --git a/public/favicon-32x32.png b/public/favicon-32x32.png new file mode 100644 index 0000000..f6901f5 Binary files /dev/null and b/public/favicon-32x32.png differ diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..b7fcc82 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/favicon.png b/public/favicon.png deleted file mode 100644 index a06747b..0000000 Binary files a/public/favicon.png and /dev/null differ diff --git a/public/header.jpg b/public/header.jpg new file mode 100644 index 0000000..42f79ab Binary files /dev/null and b/public/header.jpg differ diff --git a/public/logo.png b/public/logo.png new file mode 100644 index 0000000..116d933 Binary files /dev/null and b/public/logo.png differ diff --git a/public/logo.svg b/public/logo.svg new file mode 100644 index 0000000..7ceed9f --- /dev/null +++ b/public/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/mstile-144x144.png b/public/mstile-144x144.png new file mode 100644 index 0000000..ed6068d Binary files /dev/null and b/public/mstile-144x144.png differ diff --git a/public/mstile-150x150.png b/public/mstile-150x150.png new file mode 100644 index 0000000..e4a5dfe Binary files /dev/null and b/public/mstile-150x150.png differ diff --git a/public/mstile-310x150.png b/public/mstile-310x150.png new file mode 100644 index 0000000..ed34b0c Binary files /dev/null and b/public/mstile-310x150.png differ diff --git a/public/mstile-310x310.png b/public/mstile-310x310.png new file mode 100644 index 0000000..5e7f65c Binary files /dev/null and b/public/mstile-310x310.png differ diff --git a/public/mstile-70x70.png b/public/mstile-70x70.png new file mode 100644 index 0000000..a1d31cb Binary files /dev/null and b/public/mstile-70x70.png differ diff --git a/public/safari-pinned-tab.svg b/public/safari-pinned-tab.svg new file mode 100644 index 0000000..2498ec0 --- /dev/null +++ b/public/safari-pinned-tab.svg @@ -0,0 +1,27 @@ + + + + +Created by potrace 1.14, written by Peter Selinger 2001-2017 + + + + + diff --git a/public/site.webmanifest b/public/site.webmanifest new file mode 100644 index 0000000..b20abb7 --- /dev/null +++ b/public/site.webmanifest @@ -0,0 +1,19 @@ +{ + "name": "", + "short_name": "", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} diff --git a/sass/home.scss b/sass/home.scss new file mode 100644 index 0000000..f1a4b96 --- /dev/null +++ b/sass/home.scss @@ -0,0 +1,17 @@ +.header { + height: 30vh; + background-image: url('/header.jpg'); + background-size: cover; + margin-bottom: 3.25rem; +} + +html, +body { + min-height: 100vh; + display: flex; + flex-direction: column; +} + +body > footer { + margin-top: auto; +} diff --git a/sass/index.scss b/sass/index.scss index d157cd1..d4603c9 100644 --- a/sass/index.scss +++ b/sass/index.scss @@ -1,3 +1,4 @@ @use './bulma.scss'; @use './toast.scss'; -@use './pagination.scss'; \ No newline at end of file +@use './pagination.scss'; +@use './home.scss'; \ No newline at end of file diff --git a/src/middleware/Albums.js b/src/middleware/Albums.js index 44856c9..877b433 100644 --- a/src/middleware/Albums.js +++ b/src/middleware/Albums.js @@ -83,18 +83,18 @@ class Albums extends Pages { return album.save(); } - static async getMyArtists(req) { + static async getAllDistincts(field, user) { const artists = await AlbumsModel.find( { - user: req.user._id, + user, }, [], { sort: { - artists_sort: 1, + [field]: 1, }, } - ).distinct("artists_sort"); + ).distinct(field); return artists; } @@ -106,6 +106,7 @@ class Albums extends Pages { sort = "artists_sort", order = "asc", artists_sort, + format, } = this.req.query; const skip = (page - 1) * limit; @@ -115,6 +116,9 @@ class Albums extends Pages { if (artists_sort) { where.artists_sort = artists_sort; } + if (format) { + where["formats.name"] = format; + } const count = await AlbumsModel.count({ user: this.req.user._id, @@ -143,9 +147,17 @@ class Albums extends Pages { } async loadMyCollection() { - const artists = await Albums.getMyArtists(this.req); + const artists = await Albums.getAllDistincts( + "artists_sort", + this.req.user._id + ); + const formats = await Albums.getAllDistincts( + "formats.name", + this.req.user._id + ); this.setPageContent("artists", artists); + this.setPageContent("formats", formats); } } diff --git a/src/routes/index.js b/src/routes/index.js index bd15630..8a47e02 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -11,11 +11,18 @@ import render from "../libs/format"; // eslint-disable-next-line new-cap const router = express.Router(); -router - .route("/") - .get(ensureLoggedIn("/connexion"), (req, res) => - res.redirect("/ma-collection") - ); +router.route("/").get((req, res, next) => { + if (req.user) { + return res.redirect("/ma-collection"); + } + try { + const page = new Pages(req, "home"); + + return render(res, page); + } catch (err) { + return next(err); + } +}); router .route("/connexion") diff --git a/views/index.ejs b/views/index.ejs index 7ccad87..a556a56 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -5,7 +5,14 @@ <% if (page.title) { %><%= page.title %> <% } else { %> DarKou - Ma CDThèque <% } %> - + + + + + + + + { - // (document.querySelectorAll('.notification .delete') || []).forEach(($delete) => { - // const $notification = $delete.parentNode; - - // $delete.addEventListener('click', () => { - // $notification.parentNode.removeChild($notification); - // }); - // }); - // });