From f1de0dd7632eb29a40ea1f5cf136ab43ee945926 Mon Sep 17 00:00:00 2001 From: Joris Date: Fri, 24 Feb 2017 09:44:16 +0100 Subject: Add search field --- src/main/scala/reading/Books.scala | 2208 -------------------- src/main/scala/reading/Main.scala | 8 +- src/main/scala/reading/component/Index.scala | 24 +- .../scala/reading/component/index/BookDetail.scala | 11 +- src/main/scala/reading/component/index/Books.scala | 11 +- .../reading/component/index/FilterUtils.scala | 39 + .../scala/reading/component/index/Header.scala | 48 +- src/main/scala/reading/component/index/Menu.scala | 160 +- .../reading/component/index/style/BookDetail.scala | 4 + .../reading/component/index/style/Header.scala | 12 + .../scala/reading/component/index/style/Menu.scala | 26 +- src/main/scala/reading/component/style/Index.scala | 18 +- .../scala/reading/component/widget/Cross.scala | 2 +- .../scala/reading/component/widget/Input.scala | 44 + .../scala/reading/component/widget/Modal.scala | 20 +- .../reading/component/widget/style/Input.scala | 16 + .../reading/component/widget/style/Modal.scala | 9 +- src/main/scala/reading/models/Book.scala | 7 +- src/main/scala/reading/models/Books.scala | 2207 +++++++++++++++++++ src/main/scala/reading/models/Filter.scala | 38 +- src/main/scala/reading/models/Search.scala | 16 + src/main/scala/reading/utils/Rx.scala | 91 +- 22 files changed, 2627 insertions(+), 2392 deletions(-) delete mode 100644 src/main/scala/reading/Books.scala create mode 100644 src/main/scala/reading/component/index/FilterUtils.scala create mode 100644 src/main/scala/reading/component/widget/Input.scala create mode 100644 src/main/scala/reading/component/widget/style/Input.scala create mode 100644 src/main/scala/reading/models/Books.scala create mode 100644 src/main/scala/reading/models/Search.scala (limited to 'src') diff --git a/src/main/scala/reading/Books.scala b/src/main/scala/reading/Books.scala deleted file mode 100644 index eb4722a..0000000 --- a/src/main/scala/reading/Books.scala +++ /dev/null @@ -1,2208 +0,0 @@ -package reading - -import reading.models.{ Book, Period, Theme, Genre, Program, Level } -import Period._ -import Theme._ -import Genre._ -import Program._ -import Level._ - -object Books { - def apply(): Seq[Book] = Seq( - Book( - title = "Sweet Sixteen", - author = "Annelise HEURTIER", - year = "2012", - period = Some(Annees50), - genres = Seq(RomanHistorique), - themes = Seq(Ecole, SegregationRaciale), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Le Carnet d’Allie", - author = "Meg CABOT", - year = "2012-2016", - parts = 7, - period = Some(Contemporain), - genres = Seq(JournalIntime), - themes = Seq(Amitie, Famille), - programs = Seq(Autrui), - level = Moyen - ), - - Book( - title = "Une (irrésistible) envie de…", - author = "Meg CABOT", - year = "2007-2014", - parts = 5, - period = Some(Contemporain), - genres = Seq(Policier), - themes = Seq(Americain), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Les filles au chocolat", - author = "Cathy CASSIDY", - year = "2011-2016", - parts = 9, - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Amitie, Famille), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Le Monde de Charlie", - author = "Stephen CHBOSKY", - year = "2012", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Amitie, Conflit), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Je veux vivre", - author = "Jenny DOWNHAM", - year = "2011", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Amour, Adolescence, Maladie), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Nos Étoiles contraires", - author = "John GREEN", - year = "2013", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Amour, Adolescence, Maladie), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Lou !", - author = "Julien NEEL", - year = "2004-2016", - parts = 7, - period = Some(Contemporain), - genres = Seq(BD), - themes = Seq(College, Famille, Amitie), - programs = Seq(Autrui), - level = Facile - ), - - Book( - title = "Trois filles et…", - author = "Jacqueline WILSON", - year = "2000-2003", - parts = 4, - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Amitie, Amour, Famille, Adolescence), - programs = Seq(Autrui), - level = Moyen - ), - - Book( - title = "Kiss", - author = "Jacqueline WILSON", - year = "2009", - period = None, - genres = Seq(Roman), - themes = Seq(Amitie, Famille, Amour), - programs = Seq(Autrui), - level = Moyen - ), - - Book( - title = "Tintin", - author = "HERGE", - year = "20e siècle", - parts = 24, - period = Some(Siecle20), - genres = Seq(BD), - themes = Seq(Aventure, Amitie, College), - programs = Seq(RecitAventure, VoyageEtAventure), - level = Facile - ), - - Book( - title = "Le Royaume de Kensuké", - author = "Michael MORPURGO et François PLACE", - year = "2007", - period = None, - genres = Seq(RomanAventure), - themes = Seq(Aventure, Voyage), - programs = Seq(RecitAventure, VoyageEtAventure), - level = Facile - ), - - Book( - title = "L’Enfant Océan", - author = "J-C MOURLEVAT et Vincent DUTRAIT", - year = "2010", - period = None, - genres = Seq(Roman), - themes = Seq(Aventure, Famille), - programs = Seq(RecitAventure), - level = Facile - ), - - Book( - title = "L’œil du loup", - author = "Daniel PENNAC", - year = "1984", - period = None, - genres = Seq(RomanAventure), - themes = Seq(Nature, Aventure), - programs = Seq(RecitAventure), - level = Facile - ), - - Book( - title = "Les Aventures de Tom Sawyer", - author = "Mark TWAIN", - year = "1876", - period = Some(Siecle19), - genres = Seq(RomanAventure), - themes = Seq(Amitie, Aventure), - programs = Seq(VoyageEtAventure), - level = Moyen - ), - - Book( - title = "Les carnets de Cerise", - author = "Joris CHAMBLAIN et Aurélie NEYRET", - year = "2012-2016", - parts = 4, - period = Some(Contemporain), - genres = Seq(JournalIntime), - themes = Seq(Enquete), - programs = Seq(), - level = Facile - ), - - Book( - title = "Lady Grace", - author = "Patricia FINNEY", - year = "2005-2013", - parts = 12, - period = None, - genres = Seq(JournalIntime, RomanHistorique, Policier), - themes = Seq(), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Le journal intime de Georgia Nicolson", - author = "Louise RENNISON", - year = "2000-2014", - parts = 10, - period = Some(Contemporain), - genres = Seq(JournalIntime), - themes = Seq(Humour, Amitie, Amour, Famille, Adolescence), - programs = Seq(Autrui), - level = Moyen - ), - - Book( - title = "Journal d’une grosse nouille", - author = "RR RUSSELL", - year = "2012-2016", - parts = 10, - period = Some(Contemporain), - genres = Seq(JournalIntime), - themes = Seq(Ecole, Amitie, Amour, Humour), - programs = Seq(TraversSociete), - level = Moyen - ), - - Book( - title = "Les Colombes du Roi Soleil", - author = "Anne-Marie DESPLAT-DUC", - year = "", - period = Some(Louis14), - genres = Seq(RomanHistorique), - themes = Seq(Litterature), - programs = Seq(), - level = Facile - ), - - Book( - title = "À la Poursuite d’Olympe", - author = "Annie JAY", - year = "1995", - period = Some(Louis14), - genres = Seq(RomanHistorique), - themes = Seq(Emancipation), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Cheval de guerre", - author = "Michael MORPURGO", - year = "1986", - period = Some(Siecle20), - genres = Seq(RomanHistorique), - themes = Seq(Animal, Guerre, Amitie), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Soldat Peaceful", - author = "Michael MORPURGO", - year = "2004", - period = Some(Siecle20), - genres = Seq(RomanHistorique), - themes = Seq(Guerre, Famille), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Les Orangers de Versailles", - author = "Annie PIETRI", - year = "2000", - period = Some(Louis14), - genres = Seq(RomanHistorique), - themes = Seq(Enquete, Cour), - programs = Seq(), - level = Moyen - ), - - Book( - title = "L’Espionne du Roi-Soleil", - author = "Annie PIETRI", - year = "2002", - period = Some(Louis14), - genres = Seq(RomanHistorique), - themes = Seq(Famille, Enquete, Cour), - programs = Seq(), - level = Difficile - ), - - Book( - title = "L’Omelette au sucre", - author = "JP ARROU-VIGNOD", - year = "1999", - period = Some(Contemporain), - genres = Seq(Comique), - themes = Seq(Humour, Famille), - programs = Seq(), - level = Facile - ), - - Book( - title = "Matilda", - author = "Roald DAHL", - year = "1988", - period = None, - genres = Seq(Comique), - themes = Seq(Humour, Famille, Ecole), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Le Bon Gros Géant", - author = "Roald DAHL", - year = "1984", - period = None, - genres = Seq(Comique), - themes = Seq(Humour, Amitie, Aventure), - programs = Seq(Monstre, Autrui, Heros), - level = Moyen - ), - - Book( - title = "Fantastique Maître Renard", - author = "Roald DAHL", - year = "1977", - period = None, - genres = Seq(Comique), - themes = Seq(Humour, Famille, Animal), - programs = Seq(Resister), - level = Facile - ), - - Book( - title = "Mortelle Adèle", - author = "Mr TAN", - year = "2013-2016", - parts = 11, - period = Some(Contemporain), - genres = Seq(BD), - themes = Seq(Humour, Amitie, Famille), - programs = Seq(), - level = Facile - ), - - Book( - title = "Les Plus belles histoires du Prince de Motordu", - author = "PEF", - year = "2014", - period = None, - genres = Seq(Comique), - themes = Seq(Famille), - programs = Seq(), - level = Facile - ), - - Book( - title = "Les Dix petits nègres", - author = "Agatha CHRISTIE", - year = "1939", - period = Some(Siecle20), - genres = Seq(Policier), - themes = Seq(Enquete), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Le Crime de l’Orient-Express", - author = "Agatha CHRISTIE", - year = "1934", - period = Some(Siecle20), - genres = Seq(Policier), - themes = Seq(Enquete, Voyage), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Cinq petits cochons", - author = "Agatha CHRISTIE", - year = "1942", - period = Some(Siecle20), - genres = Seq(Policier), - themes = Seq(Famille, Enquete), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Un Cadavre dans la bibliothèque", - author = "Agatha CHRISTIE", - year = "1942", - period = Some(Siecle20), - genres = Seq(Policier), - themes = Seq(Enquete), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Le Meurtre de Roger Ackroyd", - author = "Agatha CHRISTIE", - year = "1926", - period = Some(Siecle20), - genres = Seq(Policier), - themes = Seq(Amour, Enquete), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Le chien des Baskerville", - author = "Arthur CONAN DOYLE", - year = "1902", - period = Some(Siecle20), - genres = Seq(Policier, Fantastique), - themes = Seq(Malediction, Enquete), - programs = Seq(), - level = Moyen - ), - - Book( - title = "EverWorld", - author = "K.A APPLEGATE", - year = "2000-2002", - parts = 4, - period = None, - genres = Seq(Fantasy, SF), - themes = Seq(Amitie, Amour, Aventure), - programs = Seq(), - level = Difficile - ), - - Book( - title = "La Quête d’Ewilan", - author = "Pierre BOTTERO", - year = "2005-2016", - parts = 4, - period = None, - genres = Seq(Fantasy), - themes = Seq(Amitie, Aventure), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Les Mondes d’Ewilan", - author = "Pierre BOTTERO et Jean-Louis THOUARD", - year = "2005-2006", - parts = 3, - period = None, - genres = Seq(Fantasy), - themes = Seq(Aventure), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Ellana", - author = "Pierre BOTTERO", - year = "2006-2010", - parts = 3, - period = None, - genres = Seq(Policier, Fantasy), - themes = Seq(Aventure), - programs = Seq(), - level = Difficile - ), - - Book( - title = "The Mortal instruments", - author = "Cassandra CLARE", - year = "2013-2015", - parts = 6, - period = None, - genres = Seq(Fantastique), - themes = Seq(Aventure, Famille), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Le Monde de Narnia", - author = "C.S LEWIS", - year = "2002-2008", - period = None, - genres = Seq(Fantasy), - themes = Seq(Aventure, Famille), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Eragon", - author = "Christopher PAOLINI", - year = "2003-2006", - period = None, - genres = Seq(Fantasy), - themes = Seq(Amitie, Aventure, Dragon), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Harry POTTER", - author = "J.K ROWLING", - year = "1999-2007", - period = None, - genres = Seq(Fantastique), - themes = Seq(Amitie, Ecole, Aventure, Magie), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Les Royaumes de feu", - author = "T.T SUTHERLAND", - year = "2012-2016", - parts = 5, - period = None, - genres = Seq(Fantastique), - themes = Seq(Aventure, Dragon), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Bilbo Le Hobbit", - author = "J.R.R TOLKIEN", - year = "1937", - period = None, - genres = Seq(Fantasy), - themes = Seq(Aventure), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Le Seigneur des anneaux", - author = "J.R.R TOLKIEN", - year = "1954-1955", - period = None, - genres = Seq(Fantasy), - themes = Seq(Aventure, Combat), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Le Silmarillion", - author = "J.R.R TOLKIEN", - year = "1977", - period = None, - genres = Seq(Fantasy), - themes = Seq(Aventure, Combat), - programs = Seq(), - level = Difficile - ), - - Book( - title = "À la Croisée des mondes", - author = "Philip PULLMAN", - year = "1998-2001", - period = None, - genres = Seq(Fantastique), - themes = Seq(Aventure, Amitie, Enquete, Nature), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Uglies", - author = "Scott WESTERFELD", - year = "2007-2008", - period = None, - genres = Seq(SF, Dystopie), - themes = Seq(Beaute, Laideur, Americain), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Percy JACKSON", - author = "Rick RIORDAN", - year = "2005-2010", - parts = 5, - period = None, - genres = Seq(Fantastique), - themes = Seq(Mythologie, Aventure), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Les Héros de l’Olympe", - author = "Rick RIORDAN", - year = "2010-2014", - period = None, - genres = Seq(Fantastique), - themes = Seq(Amitie, Aventure, Mythologie), - programs = Seq(), - level = Difficile - ), - - Book( - title = "La Rivière à l’envers", - author = "J-C MOURLEVAT", - year = "2000-2002", - parts = 2, - period = None, - genres = Seq(RomanAventure, Merveilleux), - themes = Seq(Amitie), - programs = Seq(), - level = Facile - ), - - Book( - title = "La Guerre des clans", - author = "Erin HUNTER", - year = "2007-2016", - parts = 5, - period = None, - genres = Seq(Fantastique), - themes = Seq(Animal, Nature), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Journal d’un noob", - author = "Cube Kid", - year = "2016-2017", - parts = 4, - period = None, - genres = Seq(Fantastique), - themes = Seq(JeuVideo), - programs = Seq(), - level = Facile - ), - - Book( - title = "Journal d’un dégonflé", - author = "Jeff KINNEY", - year = "2009-2016", - parts = 10, - period = Some(Contemporain), - genres = Seq(JournalIntime), - themes = Seq(Humour, Amitie, Famille, Adolescence), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Frankenstein", - author = "Mary SHELLEY", - year = "1818", - period = None, - genres = Seq(SF), - themes = Seq(Monstrueux), - programs = Seq(Monstre), - level = Moyen - ), - - Book( - title = "Frigiel et Fluffy", - author = "FRIGIEL et Nicolas DIGARD", - year = "2016", - period = None, - genres = Seq(Roman), - themes = Seq(Amitie, Magie, Famille, Aventure), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Cherub", - author = "Robert MUCHAMORE", - year = "2009-2016", - period = None, - genres = Seq(Roman), - themes = Seq(Adolescence, Espionnage, Americain), - programs = Seq(), - level = Moyen - ), - - Book( - title = "DIMILY", - author = "Estelle MASKAME", - year = "2016", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Amour, Famille, Adolescence), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Les Héritiers d’Enkidiev", - author = "Anne ROBILLARD", - year = "2011-2016", - period = None, - genres = Seq(Fantasy), - themes = Seq(Combat), - programs = Seq(), - level = Moyen - ), - - Book( - title = "La Sélection", - author = "Kiera CASS", - year = "2011-2016", - parts = 5, - period = None, - genres = Seq(SF), - themes = Seq(Famille, Amour), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Hunger Games", - author = "Suzanne COLLINS", - year = "2009-2011", - period = None, - genres = Seq(Dystopie, Fantastique), - themes = Seq(Combat), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Le Passeur", - author = "Lois LOWRY", - year = "1996", - period = None, - genres = Seq(Dystopie), - themes = Seq(Initiation), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Cinder", - author = "Marissa MEYER", - year = "2013-2016", - period = None, - genres = Seq(SF), - themes = Seq(Robot, Famille, Aventure), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Les Âmes vagabondes", - author = "Stephenie MEYER", - year = "2010", - period = None, - genres = Seq(Fantasy, SF), - themes = Seq(Adolescence, Aventure), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Divergente", - author = "Veronica ROTH", - year = "2011-2014", - parts = 3, - period = None, - genres = Seq(Fantasy, SF), - themes = Seq(Adolescence, Aventure), - programs = Seq(), - level = Difficile - ), - - Book( - title = "L’Étrange cas du Dr Jekyll et de M. Hyde", - author = "R.L STEVENSON", - year = "1886", - period = None, - genres = Seq(Fantastique), - themes = Seq(Folie), - programs = Seq(Monstre), - level = Facile - ), - - Book( - title = "Persépolis", - author = "Marjane SATRAPI", - year = "2007", - period = Some(Siecle20), - genres = Seq(BD), - themes = Seq(Famille, Amitie), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Le Petit Nicolas", - author = "GOSCINNY et SEMPE", - year = "1973", - period = Some(Siecle20), - genres = Seq(Comique), - themes = Seq(Amitie, Ecole, Famille), - programs = Seq(), - level = Facile - ), - - Book( - title = "Les Sisters", - author = "William CAZENOVE", - year = "2008-2016", - period = Some(Contemporain), - genres = Seq(BD), - themes = Seq(Famille, College), - programs = Seq(), - level = Facile - ), - - Book( - title = "Le Journal d’Aurélie Laflamme", - author = "India DESJARDINS", - year = "2013-2015", - period = Some(Contemporain), - genres = Seq(JournalIntime), - themes = Seq(Famille, Amitie, Amour, Ecole), - programs = Seq(), - level = Moyen - ), - - Book( - title = "L’Ordre Terne", - author = "I.M NANCY", - year = "2015-2016", - parts = 2, - period = None, - genres = Seq(Fantasy), - themes = Seq(Magie), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Tobie Lolness", - author = "Timothée DE FOMBELLE", - year = "2010", - parts = 2, - period = None, - genres = Seq(Roman), - themes = Seq(Famille, Nature, Aventure, Amour), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Question de temps", - author = "E.R LINK", - year = "2016", - period = None, - genres = Seq(Roman), - themes = Seq(Aventure, Pirate, Amour, Amitie), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Maliki", - author = "MALIKI", - year = "2007-2015", - parts = 7, - period = None, - genres = Seq(BD), - themes = Seq(Enfants, Humour, Animal), - programs = Seq(), - level = Facile - ), - - Book( - title = "Gardiens des cités perdues", - author = "Shannon MESSENGER", - year = "2014-2016", - parts = 4, - period = None, - genres = Seq(Fantasy), - themes = Seq(Ecole), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Le Maître des clés", - author = "Benoît GRELAUD", - year = "2012-2014", - parts = 5, - period = None, - genres = Seq(RomanAventure, Fantasy), - themes = Seq(Famille, Nature, Aventure, Poetique), - programs = Seq(RecitAventure), - level = Facile - ), - - Book( - title = "Le Passe-miroir", - author = "Christelle DABOS", - year = "2013-2015", - parts = 2, - period = None, - genres = Seq(Fantastique), - themes = Seq(Complot, Cour, Enquete), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Oniria", - author = "P.F PARRY", - year = "2012-2016", - parts = 4, - period = None, - genres = Seq(Fantastique), - themes = Seq(Famille, Amitie, Aventure), - programs = Seq(), - level = Moyen - ), - - Book( - title = "La Vie compliquée de Léa OLIVIER", - author = "Catherine GIRARD AUDET", - year = "2013-2016", - parts = 9, - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Amitie, Amour, Adolescence), - programs = Seq(), - level = Moyen - ), - - Book( - title = "La Trilogie de Bartiméus", - author = "Jonathan STROUD", - year = "2003-2006", - parts = 3, - period = Some(Siecle19), - genres = Seq(Fantasy), - themes = Seq(Humour, Magie), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Risk", - author = "Fleur FERRIS", - year = "2016", - period = None, - genres = Seq(Roman), - themes = Seq(Amitie, Internet, Enquete), - programs = Seq(), - level = Moyen - ), - - Book( - title = "L’Apprenti d’Araluen", - author = "John FLANAGAN", - year = "2014-2016", - parts = 12, - period = None, - genres = Seq(Fantasy), - themes = Seq(Conflit, Initiation), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Titeuf", - author = "ZEP", - year = "2000-2015", - parts = 14, - period = None, - genres = Seq(BD), - themes = Seq(Amitie, Famille, Ecole), - programs = Seq(), - level = Facile - ), - - Book( - title = "Cabot Caboche", - author = "Daniel PENNAC", - year = "1989", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Amitie, Animal), - programs = Seq(), - level = Facile - ), - - Book( - title = "La Mécanique du cœur", - author = "Mathias MALZIEU", - year = "2009", - period = Some(Siecle19), - genres = Seq(Roman), - themes = Seq(Amour), - programs = Seq(DireAmour), - level = Facile - ), - - Book( - title = "Mathias MALZIEU", - author = "Maintenant qu’il fait tout le temps nuit sur toi", - year = "2006", - period = None, - genres = Seq(Roman), - themes = Seq(Deuil, Famille), - programs = Seq(), - level = Facile - ), - - Book( - title = "Le Plus petit baiser jamais recensé", - author = "Mathias MALZIEU", - year = "2014", - period = None, - genres = Seq(Roman), - themes = Seq(Amour, Enquete), - programs = Seq(), - level = Facile - ), - - Book( - title = "Journal d’un vampire en pyjama", - author = "Mathias MALZIEU", - year = "2016", - period = None, - genres = Seq(JournalIntime), - themes = Seq(Maladie), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Le Donjon de NAHEULBEUK", - author = "John LANG et POINSOT Marion", - year = "2011-2016", - period = None, - genres = Seq(Fantasy, BD), - themes = Seq(Aventure, Humour), - programs = Seq(), - level = Facile - ), - - Book( - title = "Bichon", - author = "David GILSON", - year = "2013-2015", - period = None, - genres = Seq(BD), - themes = Seq(Humour, Ecole, Amitie, Famille, Amour, Homosexualite), - programs = Seq(), - level = Facile - ), - - Book( - title = "Tild : mage à louer", - author = "MAXA’", - year = "2016", - period = None, - genres = Seq(Fantasy, BD), - themes = Seq(Magie), - programs = Seq(), - level = Facile - ), - - Book( - title = "Seuls", - author = "Bruno GAZZOTTI et Fabien VEHLMANN", - year = "2006-2016", - period = None, - genres = Seq(Fantastique, BD), - themes = Seq(Enquete, Aventure, Enfants), - programs = Seq(), - level = Facile - ), - - Book( - title = "Caïus", - author = "Henry WINTERFELD", - year = "2014", - parts = 2, - period = Some(Antiquite), - genres = Seq(Roman), - themes = Seq(Enquete, Enfants), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Cédric", - author = "Raoul CAUVIN et LAUDEC", - year = "1989-2016", - parts = 30, - period = None, - genres = Seq(BD), - themes = Seq(Enfants, Humour, Famille, Amour), - programs = Seq(), - level = Facile - ), - - Book( - title = "Les Inséparables", - author = "Colas GUTMAN", - year = "2007", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Conflit, Enfants, Famille), - programs = Seq(Resister), - level = Facile - ), - - Book( - title = "La Rentrée du Petit Nicolas : les histoires inédites du Petit Nicolas 3", - author = "SEMPE et GOSCINNY", - year = "2008", - period = None, - genres = Seq(Comique), - themes = Seq(Enfants, Amitie, Humour), - programs = Seq(Resister), - level = Facile - ), - - Book( - title = "Un Drôle d’ange gardien", - author = "Denis-Pierre FILIPPI, Sandrine REVEL", - year = "1995-2008", - parts = 7, - period = None, - genres = Seq(BD), - themes = Seq(Enfants, Amour), - programs = Seq(), - level = Facile - ), - - Book( - title = "Histoire du chien qui avait une ombre d’enfant", - author = "Hervé WALBECQ", - year = "2015", - period = None, - genres = Seq(Roman), - themes = Seq(Poetique), - programs = Seq(CreationPoetique), - level = Facile - ), - - Book( - title = "Quand la nuit voit le jour", - author = "Marie-Josée CHRISTIEN", - year = "2015", - period = None, - genres = Seq(Roman), - themes = Seq(Nature, Poetique), - programs = Seq(CreationPoetique), - level = Facile - ), - - Book( - title = "L’Homme à l’oreille coupée", - author = "Jean-Claude MOURLEVAT", - year = "2003", - period = None, - genres = Seq(Roman), - themes = Seq(Aventure, Folie), - programs = Seq(RecitAventure), - level = Facile - ), - - Book( - title = "Les Mauvaises notes", - author = "Claire JULLIARD", - year = "1997", - period = None, - genres = Seq(Roman), - themes = Seq(Adolescence, Aventure, Amitie, Famille, Conflit), - programs = Seq(RecitAventure), - level = Moyen - ), - - Book( - title = "Le Renard de Morlange", - author = "Alain SURGET", - year = "1995", - period = Some(MoyenAge), - genres = Seq(Roman), - themes = Seq(Animal, Metamorphose), - programs = Seq(Monstre), - level = Facile - ), - - Book( - title = "C’était mon oncle !", - author = "Yves GREVET", - year = "2006", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Famille, Exclusion, Poetique), - programs = Seq(Monstre), - level = Facile - ), - - Book( - title = "Un Monde sauvage", - author = "Xavier-Laurent PETIT", - year = "2015", - period = None, - genres = Seq(Roman), - themes = Seq(Nature, Animal, Amitie, Amour, Famille), - programs = Seq(HommeEtNature), - level = Moyen - ), - - Book( - title = "Décollage immédiat", - author = "Fabien CLAVEL", - year = "2012", - period = Some(Contemporain), - genres = Seq(Thriller), - themes = Seq(Adolescence, Aventure, Famille), - programs = Seq(VoyageEtAventure, RecitAventure), - level = Moyen - ), - - Book( - title = "Céleste, ma planète", - author = "Thimothée DE FOMBELLE, Julie RICOSSE", - year = "2009", - period = Some(Futur), - genres = Seq(Roman), - themes = Seq(Ecole, Nature, Amour), - programs = Seq(UniversNouveaux), - level = Facile - ), - - Book( - title = "Bjorn le Morphir", - author = "Thomas LAVACHERY", - year = "2004", - period = Some(MoyenAge), - genres = Seq(BD, Fantasy, RomanAventure), - themes = Seq(Combat, Initiation), - programs = Seq(Heros), - level = Facile - ), - - Book( - title = "Cinq histoires d’amour et de chevalerie", - author = "Isabelle PERIER et NADEL", - year = "2012", - period = Some(MoyenAge), - genres = Seq(), - themes = Seq(Amour, Chevalerie), - programs = Seq(Heros), - level = Moyen - ), - - Book( - title = "Isis, 13 ans, 1,60 m, 82 kilos", - author = "Sophie RIGAL-GOULARD", - year = "2016", - period = Some(Contemporain), - genres = Seq(Epistolaire), - themes = Seq(Harcelement, Laideur, Adolescence, Famille, Ecole), - programs = Seq(Autrui), - level = Facile - ), - - Book( - title = "Ma mère, le crabe et moi", - author = "Anne PERCIN", - year = "2015", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Adolescence, Internet, Famille, Maladie), - programs = Seq(Autrui), - level = Facile - ), - - Book( - title = "Simple", - author = "Marie-Aude MURAIL", - year = "2004", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Handicap, Humour, Famille), - programs = Seq(Autrui), - level = Moyen - ), - - Book( - title = "Le Jour où j’ai rencontré un ange", - author = "Brigitte MINNE", - year = "2007", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Adolescence, Deuil, Handicap), - programs = Seq(Autrui), - level = Facile - ), - - Book( - title = "Délit de fuite", - author = "Christophe LEON", - year = "2011", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Amitie, Famille, Crime), - programs = Seq(Autrui), - level = Facile - ), - - Book( - title = "Espions de famille", - author = "Thierry GAUDIN et Romain RONZEAU", - year = "2012-2017", - parts = 5, - period = Some(Contemporain), - genres = Seq(BD), - themes = Seq(Adolescence, Famille, Espionnage), - programs = Seq(Autrui), - level = Facile - ), - - Book( - title = "Histoire du garçon qui courait après son chien qui courait après sa balle", - author = "Hervé GIRAUD", - year = "2016", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Deuil, Maladie, Animal, Famille), - programs = Seq(Autrui), - level = Facile - ), - - Book( - title = "À Copier 100 fois", - author = "Antoine DOLE", - year = "2013", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Homosexualite, Exclusion, Famille, Ecole), - programs = Seq(Autrui), - level = Facile - ), - - Book( - title = "Après la vague", - author = "Orianne CHARPENTIER", - year = "2014", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Adolescence, Deuil, Famille), - programs = Seq(Autrui), - level = Facile - ), - - Book( - title = "Robin des graffs", - author = "Muriel ZÜRCHER", - year = "2016", - period = Some(Contemporain), - genres = Seq(Policier), - themes = Seq(Marginalite, Amitie), - programs = Seq(Ville), - level = Moyen - ), - - Book( - title = "Maestro !", - author = "Xavier-Laurent PETIT", - year = "2005", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Pauvrete, Famille, Dictature, Enfants, Musique), - programs = Seq(Reel), - level = Moyen - ), - - Book( - title = "Le Horla, d’après l’œuvre de G. de Maupassant", - author = "Guillaume SOREL", - year = "2014", - period = Some(Siecle19), - genres = Seq(BD, Fantastique), - themes = Seq(Folie), - programs = Seq(Reel), - level = Facile - ), - - Book( - title = "Le Passage du diable", - author = "Anne FINE", - year = "2014", - period = Some(Siecle19), - genres = Seq(Fantastique), - themes = Seq(Secret, Folie, Famille, Mensonge), - programs = Seq(Reel), - level = Moyen - ), - - Book( - title = "La Folle rencontre de Flora et Max", - author = "Martin PAGE, Coline PIERRE", - year = "2015", - period = Some(Contemporain), - genres = Seq(Epistolaire), - themes = Seq(Amitie, Apprentissage, Exclusion), - programs = Seq(Valeurs), - level = Facile - ), - - Book( - title = "L’Insigne d’argent", - author = "Korneï TCHOUKOVSKI", - year = "2015", - period = Some(Siecle19), - genres = Seq(Roman), - themes = Seq(Exclusion, Ecole), - programs = Seq(Valeurs), - level = Moyen - ), - - Book( - title = "Mon Cher VOLTAIRE", - author = "Jean RENE", - year = "2015", - period = Some(Lumieres), - genres = Seq(Epistolaire), - themes = Seq(Litterature), - programs = Seq(Valeurs), - level = Facile - ), - - Book( - title = "Maïté Coiffure", - author = "Marie-Aude MURAIL", - year = "2004", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Adolescence, Ecole, Famille, Conflit), - programs = Seq(Valeurs), - level = Moyen - ), - - Book( - title = "Sauveur et fils", - author = "Marie-Aude MURAIL", - year = "2016", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Deuil, Famille, Metissage), - programs = Seq(Valeurs), - level = Moyen - ), - - Book( - title = "Le Singe de Hartlepool", - author = "Jérémie MOREAU, Wilfrid LUPANO", - year = "2014", - period = Some(Siecle19), - genres = Seq(BD), - themes = Seq(Animal, Racisme), - programs = Seq(Valeurs), - level = Facile - ), - - Book( - title = "Refuges", - author = "Annelise HEURTIER", - year = "2015", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Deuil, Migration, Famille, Adolescence), - programs = Seq(Valeurs), - level = Moyen - ), - - Book( - title = "Tout revivre", - author = "Mélody GORNET", - year = "2015", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Adolescence, Famille, Deuil, Ecole), - programs = Seq(Valeurs), - level = Facile - ), - - Book( - title = "Une Preuve d’amour", - author = "Valentine GOBY", - year = "2013", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Amour, Famille, Migration, Amitie, Litterature), - programs = Seq(Valeurs), - level = Facile - ), - - Book( - title = "Mots rumeurs, mots cutter", - author = "Charlotte BOUSQUET, Stéphanie RUBINI", - year = "2014", - period = Some(Contemporain), - genres = Seq(BD), - themes = Seq(Adolescence, Internet, Amitie, Harcelement), - programs = Seq(Autrui, Valeurs), - level = Facile - ), - - Book( - title = "Invisible", - author = "Charlotte BOUSQUET, Stéphanie RUBINI", - year = "2015", - period = Some(Contemporain), - genres = Seq(BD), - themes = Seq(Adolescence, Amour, Suicide, Ecole, Laideur, Discrimination), - programs = Seq(Valeurs), - level = Facile - ), - - Book( - title = "Tabou", - author = "Frank ANDRIAT", - year = "2003", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Adolescence, Suicide, Homosexualite, Ecole, Discrimination), - programs = Seq(Valeurs), - level = Facile - ), - - Book( - title = "Avant l’ouragan", - author = "Jewell PARKER RHODES", - year = "2015", - period = Some(Contemporain), - genres = Seq(Fantastique), - themes = Seq(Adolescence, Deuil), - programs = Seq(Valeurs), - level = Moyen - ), - - Book( - title = "Kodhja", - author = "Thomas SCOTTO, Régis LEJONC", - year = "2015", - period = Some(Contemporain), - genres = Seq(BD), - themes = Seq(Enfants, Initiation), - programs = Seq(SeRaconter), - level = Facile - ), - - Book( - title = "Les Ailes de la Sylphide", - author = "Pascale MARET", - year = "2013", - period = Some(Contemporain), - genres = Seq(Fantastique), - themes = Seq(Adolescence, Viol, Danse), - programs = Seq(SeRaconter), - level = Facile - ), - - Book( - title = "Ajin", - author = "Tsuina MIURA", - year = "2015-2016", - parts = 8, - period = Some(Contemporain), - genres = Seq(Manga, SF), - themes = Seq(Adolescence, Immortalite, Conflit, Mutant), - programs = Seq(Reel), - level = Moyen - ), - - Book( - title = "Dragon Ball", - author = "Akira TORIYAMA", - year = "1993-2000", - parts = 16, - period = None, - genres = Seq(Manga), - themes = Seq(Combat, Conflit, Aventure, Apprentissage, Enfants), - programs = Seq(), - level = Facile - ), - - Book( - title = "Ariol", - author = "Emmanuel GUIBERT", - year = "2011-2015", - parts = 10, - period = None, - genres = Seq(BD), - themes = Seq(Amitie, Famille, Humour, Ecole), - programs = Seq(Resister, Autrui), - level = Facile - ), - - Book( - title = "Chroniques des vampires", - author = "Anne RICE", - year = "2004", - parts = 2, - period = Some(Siecle18), - genres = Seq(Fantastique), - themes = Seq(Vampire, Metamorphose), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Dragon Ball Z", - author = "Akira TORIYAMA", - year = "2008-2016", - parts = 26, - period = None, - genres = Seq(Manga), - themes = Seq(Combat, Conflit, Aventure), - programs = Seq(), - level = Facile - ), - - Book( - title = "Les Enfants de la baleine", - author = "Abi UMEDA", - year = "2016-2017", - parts = 6, - period = None, - genres = Seq(Manga, Fantastique, SF), - themes = Seq(Mutant, Magie, Sentiment, Poetique), - programs = Seq(), - level = Facile - ), - - Book( - title = "Fairy Tail", - author = "Hiro MASHIMA", - year = "2008-2017", - parts = 55, - period = None, - genres = Seq(Manga, Fantastique), - themes = Seq(Magie, Amitie, Humour, Aventure), - programs = Seq(), - level = Facile - ), - - Book( - title = "Le Bazar des mauvais rêves : nouvelles", - author = "Stephen KING", - year = "2016", - parts = 42, - period = None, - genres = Seq(Nouvelle, Fantastique, Thriller), - themes = Seq(Vieillesse), - programs = Seq(SeRaconter), - level = Difficile - ), - - Book( - title = "Le Guide junior", - author = "GOUPIL, DOUYE, et al.", - year = "2005-2016", - parts = 18, - period = None, - genres = Seq(BD), - themes = Seq(Enfants, Humour, Famille), - programs = Seq(Autrui), - level = Facile - ), - - Book( - title = "Le Monde Secret de Sombreterre", - author = "Cassandra O'DONNELL", - year = "2016", - parts = 2, - period = None, - genres = Seq(Fantastique), - themes = Seq(Exclusion, Fantome, Aventure, Amitie, Magie), - programs = Seq(Heros, Autrui, VoyageEtAventure), - level = Facile - ), - - Book( - title = "Malenfer", - author = "Cassandra O'DONNELL", - year = "2014-2015", - parts = 3, - period = None, - genres = Seq(Fantastique), - themes = Seq(Magie, Enfants, Aventure), - programs = Seq(UniversNouveaux), - level = Moyen - ), - - Book( - title = "Le Temps des mitaines", - author = "Loic CLEMENT, Anne MONTEL", - year = "2014-2016", - parts = 2, - period = None, - genres = Seq(BD), - themes = Seq(Enquete, Amitie, Ecole, Famille, Enfants, Humour, Magie), - programs = Seq(UniversNouveaux), - level = Facile - ), - - Book( - title = "Naruto", - author = "Masashi KISHIMOTO", - year = "2002-2016", - parts = 72, - period = None, - genres = Seq(Manga), - themes = Seq(Enfants, Apprentissage, Combat, Aventure), - programs = Seq(UniversNouveaux), - level = Moyen - ), - - Book( - title = "One Piece", - author = "Eiichirô ODA", - year = "2013-2017", - parts = 81, - period = None, - genres = Seq(Manga), - themes = Seq(Pirate, Aventure, Humour, Combat, Apprentissage), - programs = Seq(UniversNouveaux, Heros), - level = Moyen - ), - - Book( - title = "Platinum End", - author = "Tsugumi OHBA", - year = "2016", - parts = 3, - period = None, - genres = Seq(Manga), - themes = Seq(Suicide, Magie, Conflit), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Susan HOPPER", - author = "Anne PLICHOTA, Cendrine WOLF", - year = "2013-2016", - parts = 2, - period = None, - genres = Seq(Fantastique), - themes = Seq(Fantome, Humour, Famille, Malediction), - programs = Seq(), - level = Moyen - ), - - Book( - title = "La Déferlante", - author = "Michael BUCKLEY", - year = "2014-2016", - parts = 2, - period = None, - genres = Seq(SF), - themes = Seq(Conflit, Ecole, Americain, Amitie), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Les Mystères de LARISPEM", - author = "Lucie PIERRAT-PAJOT, Donatien MARY", - year = "2016", - period = Some(Siecle19), - genres = Seq(Uchronie, SF, Dystopie), - themes = Seq(Revolution, Litterature, Complot), - programs = Seq(Ville), - level = Moyen - ), - - Book( - title = "Les Petites reines", - author = "Clémentine BEAUVAIS", - year = "2015", - parts = 2, - period = Some(Contemporain), - genres = Seq(BD), - themes = Seq(Internet, Laideur, Humour, Harcelement, Amitie), - programs = Seq(Autrui, Ville), - level = Moyen - ), - - Book( - title = "Tous les héros s’appellent Phénix", - author = "Nastasia RUGANI", - year = "2014", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Famille, Adolescence, Maltraitance, Manipulation), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Brise glace", - author = "Jean-Philippe BLONDEL", - year = "2011", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Amitie, Deuil, Ecole, Musique, Adolescence), - programs = Seq(Autrui), - level = Facile - ), - - Book( - title = "Terrienne", - author = "JC MOURLEVAT", - year = "2013", - period = Some(Contemporain), - genres = Seq(SF), - themes = Seq(Adolescence, Famille), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Le Temps des miracles", - author = "Anne-Laure BONDOUX", - year = "2009", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Enfants, Migration), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Le Combat d’hiver", - author = "JC MOURLEVAT", - year = "2006", - period = None, - genres = Seq(SF, Dystopie), - themes = Seq(Combat, Dictature, Adolescence, Amitie), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Les Larmes de l’assassin", - author = "Anne-Laure BONDOUX", - year = "2003", - period = None, - genres = Seq(Roman), - themes = Seq(Adolescence, Crime, Amitie, Apprentissage), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Oh, boy !", - author = "Marie-Aude MURAIL", - year = "2000", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Deuil, Maladie, Homosexualite, Famille, Humour), - programs = Seq(Autrui), - level = Moyen - ), - - Book( - title = "Skeleton Creek", - author = "Patrick CARMAN", - year = "2011-2012", - parts = 4, - period = Some(Contemporain), - genres = Seq(Policier, Thriller), - themes = Seq(Enquete, Amitie, Internet, Secret), - programs = Seq(), - level = Facile - ), - - Book( - title = "Le Manoir", - author = "Evelyne BRISOU-PELLEN", - year = "2013-2016", - parts = 8, - period = None, - genres = Seq(Fantastique), - themes = Seq(Enquete, Amitie, Fantome, Maladie), - programs = Seq(), - level = Difficile - ), - - Book( - title = "Le Premier qui pleure a perdu", - author = "Sherman ALEXIE", - year = "2013", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Humour, Discrimination, Ecole, Adolescence, Famille), - programs = Seq(Valeurs, TraversSociete), - level = Moyen - ), - - Book( - title = "Freak City", - author = "Kathrin Schrocke", - year = "2013", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Handicap, Amour, Adolescence), - programs = Seq(Autrui), - level = Moyen - ), - - Book( - title = "Le Journal malgré lui de Henry K. LARSEN", - author = "Susin NIELSEN", - year = "2013", - period = None, - genres = Seq(JournalIntime), - themes = Seq(Ecole, Harcelement, Suicide, Deuil, Famille, Amitie, Adolescence), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Max", - author = "Sarah COHEN-SCALI", - year = "2013", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Dictature, Guerre, Genetique, Nazisme), - programs = Seq(Agir), - level = Difficile - ), - - Book( - title = "Boys don’t cry", - author = "Malorie BLACKMAN", - year = "2011", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Adolescence, Famille, Homosexualite, Apprentissage), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Le Monde dans la main", - author = "Mikaël OLLIVIER", - year = "2011", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Famille, Adolescence, Amour, Apprentissage, Secret), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Là où naissent les nuages", - author = "Annelise HEURTIER", - year = "2015", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Voyage, Famille, Adolescence, Initiation, Maladie, Pauvrete), - programs = Seq(VoyageEtAventure), - level = Moyen - ), - - Book( - title = "Les Mondes de l’Alliance", - author = "David MOITET", - year = "2014-2015", - parts = 3, - period = None, - genres = Seq(SF), - themes = Seq(Famille, Aventure, Adolescence), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Le Suivant sur la liste", - author = "Manon FARGETTON", - year = "2014", - period = None, - genres = Seq(Thriller), - themes = Seq(Genetique, Manipulation, Adolescence), - programs = Seq(), - level = Moyen - ), - - Book( - title = "Le Livre de Perle", - author = "Thimothée de FOMBELLE", - year = "2014", - period = Some(Siecle20), - genres = Seq(Merveilleux), - themes = Seq(Poetique, Magie, Amour), - programs = Seq(VisionsPoetiques), - level = Difficile - ), - - Book( - title = "Ma Raison de vivre", - author = "Rebecca DONOVAN", - year = "2015-2016", - parts = 3, - period = None, - genres = Seq(Roman), - themes = Seq(Adolescence, Amour, Famille, Amitie, Maltraitance), - programs = Seq(), - level = Difficile - ), - Book( - title = "Ma Vie ne sait pas nager", - author = "Elaine TURGEON", - year = "2006", - period = Some(Contemporain), - genres = Seq(Epistolaire), - themes = Seq(Adolescence, Deuil), - programs = Seq(SeRaconter), - level = Facile - ), - - Book( - title = "Moi, René TARDI, prisonnier de guerre au Stalag IIB", - author = "TARDI", - year = "2012-2014", - parts = 2, - period = Some(Siecle20), - genres = Seq(BD), - themes = Seq(Nazisme, Guerre, Antisemitisme, Prison, Maltraitance), - programs = Seq(SeRaconter), - level = Facile - ), - - Book( - title = "Trop tôt", - author = "Jo WITEK", - year = "2015", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Adolescence, Sexualite, Apprentissage, Sentiment), - programs = Seq(SeRaconter), - level = Facile - ), - - Book( - title = "Je suis un phénomène", - author = "Elisabeth ATKINSON", - year = "2010", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Adolescence, Amitie, Famille, Discrimination), - programs = Seq(SeRaconter), - level = Moyen - ), - - Book( - title = "Instinct", - author = "Vincent VILLEMINOT", - year = "2011", - period = Some(Contemporain), - genres = Seq(Fantastique), - themes = Seq(Adolescence, Metamorphose, Famille), - programs = Seq(SeRaconter), - level = Moyen - ), - - Book( - title = "L’Empire des auras", - author = "Nadia COSTE", - year = "2016", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Adolescence, Dictature, Manipulation, SegregationRaciale, Amour), - programs = Seq(TraversSociete), - level = Moyen - ), - - Book( - title = "Quand j’étais soldate", - author = "Valérie ZENATTI", - year = "2002", - period = Some(Contemporain), - genres = Seq(JournalIntime), - themes = Seq(Adolescence, Guerre), - programs = Seq(Agir), - level = Moyen - ), - - Book( - title = "La Colline des potences", - author = "Dorothy M. JOHNSON", - year = "2015", - period = Some(Siecle19), - genres = Seq(Roman), - themes = Seq(Americain), - programs = Seq(Agir), - level = Moyen - ), - - Book( - title = "Qui se souvient de Paula", - author = "Romain SLOCOMBE", - year = "2008", - period = Some(Siecle20), - genres = Seq(Roman), - themes = Seq(Guerre, Nazisme), - programs = Seq(Agir), - level = Moyen - ), - - Book( - title = "La Guerre des mercredis", - author = "Gary D. SCHMIDT", - year = "2016", - period = Some(Contemporain), - genres = Seq(Roman), - themes = Seq(Adolescence, Ecole, Litterature), - programs = Seq(Agir), - level = Moyen - ), - - Book( - title = "La Fée de VERDUN", - author = "Philippe NESSMANN", - year = "2016", - period = Some(Siecle20), - genres = Seq(Roman), - themes = Seq(Guerre, Femme, Art), - programs = Seq(Agir), - level = Facile - ), - - Book( - title = "Voyage à PITCHIPOÏ", - author = "JC MOSCOVICI", - year = "1995", - period = Some(Siecle20), - genres = Seq(Autobiographie), - themes = Seq(Guerre, Nazisme, Antisemitisme, Racisme, Famille), - programs = Seq(Agir), - level = Facile - ), - - Book( - title = "Le Ring de la mort", - author = "Jean-Jacques GREIF", - year = "1998", - period = Some(Siecle20), - genres = Seq(Roman), - themes = Seq(Guerre, Maltraitance, Discrimination, Sport, Antisemitisme, Prison, Nazisme), - programs = Seq(Agir), - level = Moyen - ), - - Book( - title = "Le Garçon en pyjama rayé", - author = "John BOYNE", - year = "2006", - period = Some(Siecle20), - genres = Seq(Roman), - themes = Seq(Guerre, Amitie, Antisemitisme, Nazisme), - programs = Seq(Agir), - level = Moyen - ), - - Book( - title = "Emmett TILL, derniers jours d’une courte vie", - author = "Arnaud FLOC'H", - year = "2015", - period = Some(Siecle20), - genres = Seq(BD), - themes = Seq(Racisme, Discrimination), - programs = Seq(Agir), - level = Facile - ), - - Book( - title = "Le Livre des étoiles", - author = "Erik L’Homme", - year = "2001", - parts = 3, - period = None, - genres = Seq(Fantasy), - themes = Seq(Amitie, Magie, Aventure, Famille), - programs = Seq(Autrui, UniversNouveaux), - level = Moyen - ) - ) -} diff --git a/src/main/scala/reading/Main.scala b/src/main/scala/reading/Main.scala index 6104891..a9fc3e2 100644 --- a/src/main/scala/reading/Main.scala +++ b/src/main/scala/reading/Main.scala @@ -1,13 +1,13 @@ package reading import scala.scalajs.js.JSApp - +import rx._ +import rx.Ctx.Owner.Unsafe._ import org.scalajs.dom - import scalacss.Defaults._ import reading.component.style.{ Global => GlobalStyle } -import reading.utils.RxTag +import reading.utils.RxUtils._ object Main extends JSApp { def main(): Unit = { @@ -16,7 +16,7 @@ object Main extends JSApp { dom.document.head.appendChild(style) val _ = dom.document.body.appendChild { - RxTag { implicit context => + Rx { Route.current() match { case Route.Books(filters) => component.Index(filters) } diff --git a/src/main/scala/reading/component/Index.scala b/src/main/scala/reading/component/Index.scala index 57f5b4b..78890de 100644 --- a/src/main/scala/reading/component/Index.scala +++ b/src/main/scala/reading/component/Index.scala @@ -1,34 +1,30 @@ package reading.component import rx._ -import Ctx.Owner.Unsafe._ - -import scalatags.JsDom.all._ import scalacss.Defaults._ import scalacss.ScalatagsCss._ +import scalatags.JsDom.all._ -import reading.Books -import reading.component.style.{ Index => IndexStyle } import reading.component.index.{ Menu, Header, Books => BooksComponent } -import reading.models.{ Book, Filter } +import reading.component.style.{ Index => IndexStyle } +import reading.models.{ Book, Books, Filter } object Index { - def apply(initialFilters: Seq[Filter]): HtmlTag = { + def apply(initialFilters: Seq[Filter])(implicit ctx: Ctx.Owner): Frag = { val filters: Var[Seq[Filter]] = Var(initialFilters) - val books: Rx[Seq[Book]] = Rx { - if (filters().isEmpty) Books() else Book.filter(Books(), filters()) - } - val count: Rx[Int] = Rx(books().length) + val books: Rx[Seq[Book]] = Rx(Filter.add(Books(), filters())) + val search: Var[String] = Var("") val showFiltersMenu: Var[Boolean] = Var(false) + val searchedBooks: Rx[Seq[Book]] = Rx(Book.filter(books(), search())) div( IndexStyle.render, IndexStyle.page, - Menu(books, filters, showFiltersMenu), + Menu(books, filters, search, showFiltersMenu), div( IndexStyle.main, - Header(filters, showFiltersMenu, count), - BooksComponent(books) + Header(searchedBooks, filters, search, showFiltersMenu), + BooksComponent(searchedBooks) ) ) } diff --git a/src/main/scala/reading/component/index/BookDetail.scala b/src/main/scala/reading/component/index/BookDetail.scala index 7df771b..c42029f 100644 --- a/src/main/scala/reading/component/index/BookDetail.scala +++ b/src/main/scala/reading/component/index/BookDetail.scala @@ -8,7 +8,7 @@ import reading.component.index.style.{ BookDetail => BookStyle } import reading.models.{ Program, Book } object BookDetail { - def apply(book: Book): HtmlTag = + def apply(book: Book): Frag = div( BookStyle.render, BookStyle.detail, @@ -20,6 +20,8 @@ object BookDetail { ), div( + BookStyle.items, + if (book.programs.nonEmpty) { item("classe", book.programs.map(Program.grade(_).prettyPrint).distinct.sorted) }, @@ -33,11 +35,14 @@ object BookDetail { item("genre", book.genres.sorted.map(_.prettyPrint)) }, book.period.map { period => - item("période", Seq(period.prettyPrint)) - } + item("période", period.prettyPrint) + }, + item("niveau", book.level.prettyPrint) ) ) + private def item(key: String, value: String): Frag = item(key, Seq(value)) + private def item(key: String, values: Seq[String]): Frag = div( BookStyle.item, diff --git a/src/main/scala/reading/component/index/Books.scala b/src/main/scala/reading/component/index/Books.scala index 20b308d..c22639f 100644 --- a/src/main/scala/reading/component/index/Books.scala +++ b/src/main/scala/reading/component/index/Books.scala @@ -1,7 +1,6 @@ package reading.component.index import rx._ -import Ctx.Owner.Unsafe._ import scalatags.JsDom.all._ import scalacss.Defaults._ @@ -10,16 +9,16 @@ import scalacss.ScalatagsCss._ import reading.component.index.style.{ Books => BooksStyle } import reading.component.widget.Modal import reading.models.{ Book } -import reading.utils.{ RxTag, RxAttr } +import reading.utils.RxUtils._ object Books { - def apply(books: Rx[Seq[Book]]): Frag = { + def apply(books: Rx[Seq[Book]])(implicit ctx: Ctx.Owner): Frag = { val focus: Var[Option[Book]] = Var(None) div( BooksStyle.render, - RxTag { implicit context => + Rx { div( div( BooksStyle.books, @@ -31,13 +30,13 @@ object Books { BooksStyle.cover, src := s"cover/${book.title}.jpg", alt := s"${book.title}, ${book.author}", - RxAttr(onclick, Rx(() => focus() = Some(book))) + onclick := (() => focus() = Some(book)) ) ) } ), - RxTag { implicit context => + Rx { focus() match { case Some(book) => Modal(onClose = focus() = None)(BookDetail(book)) case None => span("") diff --git a/src/main/scala/reading/component/index/FilterUtils.scala b/src/main/scala/reading/component/index/FilterUtils.scala new file mode 100644 index 0000000..d4b24e4 --- /dev/null +++ b/src/main/scala/reading/component/index/FilterUtils.scala @@ -0,0 +1,39 @@ +package reading.component.index + +import rx._ + +import reading.models._ +import reading.Route + +object FilterUtils { + def remove( + filters: Var[Seq[Filter]], + search: Var[String], + filter: Filter + ): Unit = { + val newFilters = Filter.remove(filters.now, filter) + filters() = newFilters + search() = "" + Route.push(Route.Books(newFilters)) + } + + def removeAll( + filters: Var[Seq[Filter]], + search: Var[String] + ): Unit = { + filters() = Nil + search() = "" + Route.push(Route.Books(Nil)) + } + + def add( + filters: Var[Seq[Filter]], + search: Var[String], + filter: Filter + ): Unit = { + val newFilters = filter +: filters.now + filters() = newFilters + search() = "" + Route.push(Route.Books(newFilters)) + } +} diff --git a/src/main/scala/reading/component/index/Header.scala b/src/main/scala/reading/component/index/Header.scala index cf078ad..50d520e 100644 --- a/src/main/scala/reading/component/index/Header.scala +++ b/src/main/scala/reading/component/index/Header.scala @@ -1,32 +1,39 @@ package reading.component.index import rx._ -import Ctx.Owner.Unsafe._ import scalatags.JsDom.all._ import scalacss.Defaults._ import scalacss.ScalatagsCss._ import reading.component.index.style.{ Header => HeaderStyle } -import reading.component.widget.Cross +import reading.component.widget.{ Cross, Input } import reading.component.style.{ Color => C } -import reading.models.Filter -import reading.Route -import reading.utils.{ RxTag, RxAttr } +import reading.models.{ Book, Filter } +import reading.utils.RxUtils._ object Header { - def apply(filters: Var[Seq[Filter]], showFiltersMenu: Var[Boolean], booksCount: Rx[Int]): Frag = { + def apply( + books: Rx[Seq[Book]], + filters: Var[Seq[Filter]], + search: Var[String], + showFiltersMenu: Var[Boolean] + )( + implicit + ctx: Ctx.Owner + ): Frag = { val filtersCount: Rx[Int] = Rx(filters().length) + val booksCount: Rx[Int] = books.map(_.length) div( HeaderStyle.render, HeaderStyle.header, - RxTag { implicit context => + Rx { div( div( HeaderStyle.showFiltersMenu, - RxAttr(onclick, Rx(() => showFiltersMenu() = true)), + onclick := (() => showFiltersMenu() = true), "Filtrer", if (filtersCount() > 0) span(HeaderStyle.filtersCount, filtersCount()) else span("") ), @@ -39,14 +46,14 @@ object Header { div( HeaderStyle.clear, - RxAttr(onclick, Rx(() => updateFilters(filters, Nil))), + onclick := (() => FilterUtils.removeAll(filters, search)), "Effacer les filtres" ), filters().sortBy(_.name).map { filter => div( HeaderStyle.filter, - RxAttr(onclick, Rx(() => updateFilters(filters, Filter.remove(filters(), filter)))), + onclick := (() => FilterUtils.remove(filters, search, filter)), span(HeaderStyle.name, filter.name.capitalize), Cross(15.px, C.black.value) ) @@ -55,17 +62,16 @@ object Header { ) }, - RxTag { implicit context => - div( - HeaderStyle.booksCount, - span(s"${booksCount()} livre${if (booksCount() > 1) "s" else ""}") - ) - } + div( + HeaderStyle.searchAndCount, + Input(HeaderStyle.search, search, "Rechercher"), + Rx { + div( + HeaderStyle.booksCount, + span(s"${booksCount()} livre${if (booksCount() > 1) "s" else ""}") + ) + } + ) ) } - - private def updateFilters(filters: Var[Seq[Filter]], newFilters: Seq[Filter]): Unit = { - filters() = newFilters - Route.push(Route.Books(newFilters)) - } } diff --git a/src/main/scala/reading/component/index/Menu.scala b/src/main/scala/reading/component/index/Menu.scala index a0aabd1..4c118bd 100644 --- a/src/main/scala/reading/component/index/Menu.scala +++ b/src/main/scala/reading/component/index/Menu.scala @@ -1,7 +1,6 @@ package reading.component.index import rx._ -import Ctx.Owner.Unsafe._ import scalatags.JsDom.all._ import scalacss.Defaults._ @@ -9,45 +8,60 @@ import scalacss.ScalatagsCss._ import reading.component.index.style.{ Menu => MenuStyle } import reading.models._ -import reading.utils.{ RxTag, RxAttr } -import reading.Route +import reading.utils.RxUtils._ object Menu { - def apply(books: Rx[Seq[Book]], filters: Var[Seq[Filter]], showFiltersMenu: Var[Boolean]): Frag = - RxTag { implicit context => + def apply( + books: Rx[Seq[Book]], + filters: Var[Seq[Filter]], + search: Var[String], + showFiltersMenu: Var[Boolean] + )( + implicit + ctx: Ctx.Owner + ): Frag = + div( + MenuStyle.render, + Rx(if (showFiltersMenu()) MenuStyle.show else MenuStyle.empty), + MenuStyle.menu, + + div(MenuStyle.background), + div( - MenuStyle.render, - if (showFiltersMenu()) MenuStyle.show else "", - MenuStyle.menu, + MenuStyle.content, - header(showFiltersMenu, filters().length), + Rx(header(showFiltersMenu, filters().length)), div( MenuStyle.groups, - filters().find(_.kind == FilterKind.Grade) match { - case Some(grade) => { - val programs = Program.values.filter(p => Program.grade(p).toString() == grade.nonFormattedName) - group(books, filters, grade.name, programs.map(Filter.apply(_)), Some(grade)) + Rx { + filters().find(_.kind == FilterKind.Grade) match { + case Some(grade) => + val programs = Program.values.filter(p => Program.grade(p).toString() == grade.nonFormattedName) + group(books, filters, search, grade.name, programs.map(Filter.apply(_)), Some(grade)) + case None => + group(books, filters, search, "Classe", Grade.values.map(Filter.apply(_))) } - case None => group(books, filters, "Classe", Grade.values.map(Filter.apply(_))) }, - filters().find(_.kind == FilterKind.GroupedTheme) match { - case Some(groupedTheme) => { - val themes = Theme.values.filter(t => Theme.groupedTheme(t).toString() == groupedTheme.nonFormattedName) - group(books, filters, groupedTheme.name, themes.map(Filter.apply(_)), Some(groupedTheme)) + Rx { + filters().find(_.kind == FilterKind.GroupedTheme) match { + case Some(groupedTheme) => + val themes = Theme.values.filter(t => Theme.groupedTheme(t).toString() == groupedTheme.nonFormattedName) + group(books, filters, search, groupedTheme.name, themes.map(Filter.apply(_)), Some(groupedTheme)) + case None => + group(books, filters, search, "Theme", GroupedTheme.values.map(Filter.apply(_))) } - case None => group(books, filters, "Theme", GroupedTheme.values.map(Filter.apply(_))) }, - group(books, filters, "Genre", Genre.values.sorted.map(Filter.apply(_))), - group(books, filters, "Niveau", Level.values.map(Filter.apply(_))), - group(books, filters, "Période", Period.values.map(Filter.apply(_))) + group(books, filters, search, "Genre", Genre.values.sorted.map(Filter.apply(_))), + group(books, filters, search, "Niveau", Level.values.map(Filter.apply(_))), + group(books, filters, search, "Période", Period.values.map(Filter.apply(_))) ), - footer(Rx(books().length), filters, showFiltersMenu) + footer(books, filters, search, showFiltersMenu) ) - } + ) - def header(showFiltersMenu: Var[Boolean], count: Int): HtmlTag = + def header(showFiltersMenu: Var[Boolean], count: Int): Frag = div( MenuStyle.header, "Filtrer", @@ -57,78 +71,84 @@ object Menu { def group( books: Rx[Seq[Book]], filters: Var[Seq[Filter]], + search: Var[String], name: String, groupFilters: Seq[Filter], parentFilter: Option[Filter] = None )( implicit - context: Ctx.Data + ctx: Ctx.Owner ): Frag = { val filtersWithCount = Rx { groupFilters - .map(filter => (filter, Book.filter(books(), Seq(filter)).length)) + .map(filter => (filter, Filter.add(books(), filter).length)) .filter(_._2 > 0) } - if (filtersWithCount().isEmpty) - span("") - else - div( - MenuStyle.filterGroup, + Rx { + if (filtersWithCount().isEmpty) + span("") + else div( - MenuStyle.filterTitle, - parentFilter.map { filter => - RxAttr(onclick, Rx(() => updateFilters(filters, Filter.remove(filters(), filter)))) - }.getOrElse(""), - if (parentFilter.isDefined) MenuStyle.activeFilter else "", - name, - RxTag { implicit context => - val count = filters().filter(f => groupFilters.exists(Filter.equals(f, _))).length - if (count > 0) span(MenuStyle.filterTitleCount, count) else span("") - } - ), - div( - filtersWithCount().map { - case (filter, count) => { - val isActive = Filter.contains(filters(), filter) + div( + MenuStyle.filterTitle, + parentFilter.map { filter => + onclick := (() => FilterUtils.remove(filters, search, filter)) + }.getOrElse(""), + if (parentFilter.isDefined) MenuStyle.activeFilter else "", + name, + Rx { + val count = filters().filter(f => groupFilters.exists(f == _)).length + if (count > 0) span(MenuStyle.filterTitleCount, count) else span("") + } + ), + div( + filtersWithCount().map { + case (filter, count) => { + val isActive = Filter.contains(filters(), filter) - button( - MenuStyle.filter, - if (isActive) MenuStyle.activeFilter else "", - RxAttr(onclick, Rx(() => updateFilters( - filters, - if (isActive) Filter.remove(filters(), filter) else filter +: filters() - ))), - span( - span(filter.name.capitalize), - span(MenuStyle.filterCount, count) + button( + MenuStyle.filter, + if (isActive) MenuStyle.activeFilter else "", + onclick := (() => + if (isActive) + FilterUtils.remove(filters, search, filter) + else + FilterUtils.add(filters, search, filter)), + span( + span(filter.name.capitalize), + span(MenuStyle.filterCount, count) + ) ) - ) + } } - } + ) ) - ) - } - - private def updateFilters(filters: Var[Seq[Filter]], newFilters: Seq[Filter]): Unit = { - filters() = newFilters - Route.push(Route.Books(newFilters)) + } } - def footer(bookCount: Rx[Int], filters: Var[Seq[Filter]], showFiltersMenu: Var[Boolean]): HtmlTag = + def footer( + books: Rx[Seq[Book]], + filters: Var[Seq[Filter]], + search: Var[String], + showFiltersMenu: Var[Boolean] + )( + implicit + ctx: Ctx.Owner + ): Frag = div( MenuStyle.footer, div( MenuStyle.clear, - RxAttr(onclick, Rx(() => filters() = Nil)), + onclick := (() => FilterUtils.removeAll(filters, search)), "Effacer" ), div( MenuStyle.returnToBooks, - RxAttr(onclick, Rx(() => showFiltersMenu() = false)), + onclick := (() => showFiltersMenu() = false), "Afficher", - RxTag { implicit context => - span(MenuStyle.bookCount, bookCount()) + Rx { + span(MenuStyle.bookCount, books().length) } ) ) diff --git a/src/main/scala/reading/component/index/style/BookDetail.scala b/src/main/scala/reading/component/index/style/BookDetail.scala index e8f970e..f432fda 100644 --- a/src/main/scala/reading/component/index/style/BookDetail.scala +++ b/src/main/scala/reading/component/index/style/BookDetail.scala @@ -18,6 +18,10 @@ object BookDetail extends StyleSheet.Inline { marginBottom(30.px) ) + val items = style( + marginBottom(25.px) + ) + val item = style( lineHeight(25.px), margin(0.px, 15.px, 15.px), diff --git a/src/main/scala/reading/component/index/style/Header.scala b/src/main/scala/reading/component/index/style/Header.scala index 2260c91..2eb6eb2 100644 --- a/src/main/scala/reading/component/index/style/Header.scala +++ b/src/main/scala/reading/component/index/style/Header.scala @@ -66,6 +66,18 @@ object Header extends StyleSheet.Inline { height(15.px) ) + val searchAndCount = style( + display.flex, + flexWrap.wrap, + alignItems.center, + Media.mobile(justifyContent.center) + ) + + val search = style( + Media.mobile(display.none), + Media.desktop(marginRight(30.px)) + ) + val booksCount = style( fontSize(20.px), color(C.gray.value), diff --git a/src/main/scala/reading/component/index/style/Menu.scala b/src/main/scala/reading/component/index/style/Menu.scala index 12b0646..dd74039 100644 --- a/src/main/scala/reading/component/index/style/Menu.scala +++ b/src/main/scala/reading/component/index/style/Menu.scala @@ -10,9 +10,27 @@ object Menu extends StyleSheet.Inline { val menu = style( Media.mobile(display.none), - color(C.white.value), + Media.desktop( + color(C.white.value), + position.relative, + width(280.px) + ) + ) + + val background = style( + Media.desktop( + position.fixed, + width(280.px), + height(100.%%), + backgroundColor(C.englishWalnut.value), + boxShadow := "4px 0px 6px -1px rgba(0, 0, 0, 0.2)" + ) + ) + + val content = style( position.relative, - width(280.px) + width(100.%%), + height(100.%%) ) val header = style( @@ -50,6 +68,8 @@ object Menu extends StyleSheet.Inline { ) ) + val empty = style() + val groups = style( Media.mobile( height :=! "calc(100% - 120px)", @@ -57,8 +77,6 @@ object Menu extends StyleSheet.Inline { ) ) - val filterGroup = style() - val filterTitle = style( Commons.filter(), minHeight(50.px), diff --git a/src/main/scala/reading/component/style/Index.scala b/src/main/scala/reading/component/style/Index.scala index 99e4746..e02ebd9 100644 --- a/src/main/scala/reading/component/style/Index.scala +++ b/src/main/scala/reading/component/style/Index.scala @@ -3,7 +3,6 @@ package reading.component.style import scalacss.Defaults._ import reading.Media -import reading.component.style.{ Color => C } object Index extends StyleSheet.Inline { import dsl._ @@ -11,22 +10,11 @@ object Index extends StyleSheet.Inline { val page = style( display.flex, overflowY.scroll, - height(100.%%), - - Media.desktop( - &.before( - content := "\"\"", - display.block, - position.fixed, - width(280.px), - height(100.%%), - backgroundColor(C.englishWalnut.value), - boxShadow := "4px 0px 6px -1px rgba(0, 0, 0, 0.2)" - ) - ) + height(100.%%) ) val main = style( - width(100.%%) + Media.desktop(width :=! "calc(100% - 280px)"), + Media.mobile(width(100.%%)) ) } diff --git a/src/main/scala/reading/component/widget/Cross.scala b/src/main/scala/reading/component/widget/Cross.scala index c9e3054..40087a1 100644 --- a/src/main/scala/reading/component/widget/Cross.scala +++ b/src/main/scala/reading/component/widget/Cross.scala @@ -8,7 +8,7 @@ import scalacss.internal.ValueT, ValueT.Color import reading.component.widget.style.{ Cross => CrossStyle } object Cross { - def apply(size: String, color: ValueT[Color]): HtmlTag = + def apply(size: String, color: ValueT[Color]): Frag = div( CrossStyle.render, CrossStyle.cross, diff --git a/src/main/scala/reading/component/widget/Input.scala b/src/main/scala/reading/component/widget/Input.scala new file mode 100644 index 0000000..7dac47a --- /dev/null +++ b/src/main/scala/reading/component/widget/Input.scala @@ -0,0 +1,44 @@ +package reading.component.widget + +import scalatags.JsDom.all._ + +import org.scalajs.dom.KeyboardEvent +import org.scalajs.dom.html.Input + +import scalacss.Defaults._ +import scalacss.ScalatagsCss._ + +import rx._ + +import reading.component.widget.style.{ Input => InputStyle } + +object Input { + def apply( + style: StyleA, + query: Var[String], + label: String = "", + onEnter: => Unit = () + )( + implicit + ctx: Ctx.Owner + ): Frag = { + val inputBox = input( + InputStyle.render, + InputStyle.input, + style, + placeholder := label, + onkeyup := { (e: KeyboardEvent) => + val input = e.target.asInstanceOf[Input] + query() = input.value + input.value = input.value + if (e.keyCode == 13) onEnter + } + ).render + + query.trigger { + inputBox.value = query.now + } + + inputBox + } +} diff --git a/src/main/scala/reading/component/widget/Modal.scala b/src/main/scala/reading/component/widget/Modal.scala index 81d0c78..db1f7e6 100644 --- a/src/main/scala/reading/component/widget/Modal.scala +++ b/src/main/scala/reading/component/widget/Modal.scala @@ -3,29 +3,27 @@ package reading.component.widget import scala.util.Random import org.scalajs.dom.raw.HTMLElement -import rx._ -import rx.Ctx.Owner.Unsafe._ import scalacss.Defaults._ import scalacss.ScalatagsCss._ import scalatags.JsDom.all._ import reading.component.widget.style.{ Modal => ModalStyle } -import reading.utils.{ RxAttr } object Modal { - def apply(onClose: => Unit)(content: HtmlTag): HtmlTag = { + def apply(onClose: => Unit)(content: Frag): Frag = { val modalId = s"modal${Random.nextInt}" Animate( id = modalId, duration = 250, transition = Transition.easeOut, - animate = (progress, element) => { - element.style.opacity = s"$progress" - element.childNodes(2) match { - case e: HTMLElement => e.style.transform = s"scale(${0.85 + 0.15 * progress})" + animate = + (progress, element) => { + element.style.opacity = s"$progress" + element.childNodes(2) match { + case e: HTMLElement => e.style.transform = s"scale(${0.85 + 0.15 * progress})" + } } - } ) div( @@ -35,7 +33,7 @@ object Modal { div( ModalStyle.curtain, - RxAttr(onclick, Rx(() => close(modalId, onClose))) + onclick := (() => close(modalId, onClose)) ), div( @@ -43,7 +41,7 @@ object Modal { content, button( ModalStyle.close, - RxAttr(onclick, Rx(() => close(modalId, onClose))), + onclick := (() => close(modalId, onClose)), "Fermer" ) ) diff --git a/src/main/scala/reading/component/widget/style/Input.scala b/src/main/scala/reading/component/widget/style/Input.scala new file mode 100644 index 0000000..967393b --- /dev/null +++ b/src/main/scala/reading/component/widget/style/Input.scala @@ -0,0 +1,16 @@ +package reading.component.widget.style + +import scalacss.Defaults._ + +import reading.component.style.{ Color => C } + +object Input extends StyleSheet.Inline { + import dsl._ + + val input = style( + border(1.px, solid, C.mickado.value), + borderRadius(2.px), + padding(10.px), + &.hover(borderColor(C.gray.value)) + ) +} diff --git a/src/main/scala/reading/component/widget/style/Modal.scala b/src/main/scala/reading/component/widget/style/Modal.scala index 1872344..faf325d 100644 --- a/src/main/scala/reading/component/widget/style/Modal.scala +++ b/src/main/scala/reading/component/widget/style/Modal.scala @@ -55,8 +55,11 @@ object Modal extends StyleSheet.Inline { ) val close = style( - Button.simple, - marginTop(20.px), - marginBottom(30.px) + Media.desktop(display.none), + Media.mobile( + Button.simple, + marginTop(20.px), + marginBottom(30.px) + ) ) } diff --git a/src/main/scala/reading/models/Book.scala b/src/main/scala/reading/models/Book.scala index 7d72f23..6f4d8dd 100644 --- a/src/main/scala/reading/models/Book.scala +++ b/src/main/scala/reading/models/Book.scala @@ -16,6 +16,9 @@ case class Book( } object Book { - def filter(books: Seq[Book], filters: Seq[Filter]): Seq[Book] = - books.filter(b => filters.forall(_.filter(b))) + def filter(books: Seq[Book], search: String = ""): Seq[Book] = + books.filter { book => + (Search(book.title, search) + || Search(book.author, search)) + } } diff --git a/src/main/scala/reading/models/Books.scala b/src/main/scala/reading/models/Books.scala new file mode 100644 index 0000000..43ed2b8 --- /dev/null +++ b/src/main/scala/reading/models/Books.scala @@ -0,0 +1,2207 @@ +package reading.models + +import Period._ +import Theme._ +import Genre._ +import Program._ +import Level._ + +object Books { + def apply(): Seq[Book] = Seq( + Book( + title = "Sweet Sixteen", + author = "Annelise HEURTIER", + year = "2012", + period = Some(Annees50), + genres = Seq(RomanHistorique), + themes = Seq(Ecole, SegregationRaciale), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Le Carnet d’Allie", + author = "Meg CABOT", + year = "2012-2016", + parts = 7, + period = Some(Contemporain), + genres = Seq(JournalIntime), + themes = Seq(Amitie, Famille), + programs = Seq(Autrui), + level = Moyen + ), + + Book( + title = "Une (irrésistible) envie de…", + author = "Meg CABOT", + year = "2007-2014", + parts = 5, + period = Some(Contemporain), + genres = Seq(Policier), + themes = Seq(Americain), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Les filles au chocolat", + author = "Cathy CASSIDY", + year = "2011-2016", + parts = 9, + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Amitie, Famille), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Le Monde de Charlie", + author = "Stephen CHBOSKY", + year = "2012", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Amitie, Conflit), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Je veux vivre", + author = "Jenny DOWNHAM", + year = "2011", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Amour, Adolescence, Maladie), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Nos Étoiles contraires", + author = "John GREEN", + year = "2013", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Amour, Adolescence, Maladie), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Lou !", + author = "Julien NEEL", + year = "2004-2016", + parts = 7, + period = Some(Contemporain), + genres = Seq(BD), + themes = Seq(College, Famille, Amitie), + programs = Seq(Autrui), + level = Facile + ), + + Book( + title = "Trois filles et…", + author = "Jacqueline WILSON", + year = "2000-2003", + parts = 4, + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Amitie, Amour, Famille, Adolescence), + programs = Seq(Autrui), + level = Moyen + ), + + Book( + title = "Kiss", + author = "Jacqueline WILSON", + year = "2009", + period = None, + genres = Seq(Roman), + themes = Seq(Amitie, Famille, Amour), + programs = Seq(Autrui), + level = Moyen + ), + + Book( + title = "Tintin", + author = "HERGE", + year = "20e siècle", + parts = 24, + period = Some(Siecle20), + genres = Seq(BD), + themes = Seq(Aventure, Amitie, College), + programs = Seq(RecitAventure, VoyageEtAventure), + level = Facile + ), + + Book( + title = "Le Royaume de Kensuké", + author = "Michael MORPURGO et François PLACE", + year = "2007", + period = None, + genres = Seq(RomanAventure), + themes = Seq(Aventure, Voyage), + programs = Seq(RecitAventure, VoyageEtAventure), + level = Facile + ), + + Book( + title = "L’Enfant Océan", + author = "J-C MOURLEVAT et Vincent DUTRAIT", + year = "2010", + period = None, + genres = Seq(Roman), + themes = Seq(Aventure, Famille), + programs = Seq(RecitAventure), + level = Facile + ), + + Book( + title = "L’œil du loup", + author = "Daniel PENNAC", + year = "1984", + period = None, + genres = Seq(RomanAventure), + themes = Seq(Nature, Aventure), + programs = Seq(RecitAventure), + level = Facile + ), + + Book( + title = "Les Aventures de Tom Sawyer", + author = "Mark TWAIN", + year = "1876", + period = Some(Siecle19), + genres = Seq(RomanAventure), + themes = Seq(Amitie, Aventure), + programs = Seq(VoyageEtAventure), + level = Moyen + ), + + Book( + title = "Les carnets de Cerise", + author = "Joris CHAMBLAIN et Aurélie NEYRET", + year = "2012-2016", + parts = 4, + period = Some(Contemporain), + genres = Seq(JournalIntime), + themes = Seq(Enquete), + programs = Seq(), + level = Facile + ), + + Book( + title = "Lady Grace", + author = "Patricia FINNEY", + year = "2005-2013", + parts = 12, + period = None, + genres = Seq(JournalIntime, RomanHistorique, Policier), + themes = Seq(), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Le journal intime de Georgia Nicolson", + author = "Louise RENNISON", + year = "2000-2014", + parts = 10, + period = Some(Contemporain), + genres = Seq(JournalIntime), + themes = Seq(Humour, Amitie, Amour, Famille, Adolescence), + programs = Seq(Autrui), + level = Moyen + ), + + Book( + title = "Journal d’une grosse nouille", + author = "RR RUSSELL", + year = "2012-2016", + parts = 10, + period = Some(Contemporain), + genres = Seq(JournalIntime), + themes = Seq(Ecole, Amitie, Amour, Humour), + programs = Seq(TraversSociete), + level = Moyen + ), + + Book( + title = "Les Colombes du Roi Soleil", + author = "Anne-Marie DESPLAT-DUC", + year = "", + period = Some(Louis14), + genres = Seq(RomanHistorique), + themes = Seq(Litterature), + programs = Seq(), + level = Facile + ), + + Book( + title = "À la Poursuite d’Olympe", + author = "Annie JAY", + year = "1995", + period = Some(Louis14), + genres = Seq(RomanHistorique), + themes = Seq(Emancipation), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Cheval de guerre", + author = "Michael MORPURGO", + year = "1986", + period = Some(Siecle20), + genres = Seq(RomanHistorique), + themes = Seq(Animal, Guerre, Amitie), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Soldat Peaceful", + author = "Michael MORPURGO", + year = "2004", + period = Some(Siecle20), + genres = Seq(RomanHistorique), + themes = Seq(Guerre, Famille), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Les Orangers de Versailles", + author = "Annie PIETRI", + year = "2000", + period = Some(Louis14), + genres = Seq(RomanHistorique), + themes = Seq(Enquete, Cour), + programs = Seq(), + level = Moyen + ), + + Book( + title = "L’Espionne du Roi-Soleil", + author = "Annie PIETRI", + year = "2002", + period = Some(Louis14), + genres = Seq(RomanHistorique), + themes = Seq(Famille, Enquete, Cour), + programs = Seq(), + level = Difficile + ), + + Book( + title = "L’Omelette au sucre", + author = "JP ARROU-VIGNOD", + year = "1999", + period = Some(Contemporain), + genres = Seq(Comique), + themes = Seq(Humour, Famille), + programs = Seq(), + level = Facile + ), + + Book( + title = "Matilda", + author = "Roald DAHL", + year = "1988", + period = None, + genres = Seq(Comique), + themes = Seq(Humour, Famille, Ecole), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Le Bon Gros Géant", + author = "Roald DAHL", + year = "1984", + period = None, + genres = Seq(Comique), + themes = Seq(Humour, Amitie, Aventure), + programs = Seq(Monstre, Autrui, Heros), + level = Moyen + ), + + Book( + title = "Fantastique Maître Renard", + author = "Roald DAHL", + year = "1977", + period = None, + genres = Seq(Comique), + themes = Seq(Humour, Famille, Animal), + programs = Seq(Resister), + level = Facile + ), + + Book( + title = "Mortelle Adèle", + author = "Mr TAN", + year = "2013-2016", + parts = 11, + period = Some(Contemporain), + genres = Seq(BD), + themes = Seq(Humour, Amitie, Famille), + programs = Seq(), + level = Facile + ), + + Book( + title = "Les Plus belles histoires du Prince de Motordu", + author = "PEF", + year = "2014", + period = None, + genres = Seq(Comique), + themes = Seq(Famille), + programs = Seq(), + level = Facile + ), + + Book( + title = "Les Dix petits nègres", + author = "Agatha CHRISTIE", + year = "1939", + period = Some(Siecle20), + genres = Seq(Policier), + themes = Seq(Enquete), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Le Crime de l’Orient-Express", + author = "Agatha CHRISTIE", + year = "1934", + period = Some(Siecle20), + genres = Seq(Policier), + themes = Seq(Enquete, Voyage), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Cinq petits cochons", + author = "Agatha CHRISTIE", + year = "1942", + period = Some(Siecle20), + genres = Seq(Policier), + themes = Seq(Famille, Enquete), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Un Cadavre dans la bibliothèque", + author = "Agatha CHRISTIE", + year = "1942", + period = Some(Siecle20), + genres = Seq(Policier), + themes = Seq(Enquete), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Le Meurtre de Roger Ackroyd", + author = "Agatha CHRISTIE", + year = "1926", + period = Some(Siecle20), + genres = Seq(Policier), + themes = Seq(Amour, Enquete), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Le chien des Baskerville", + author = "Arthur CONAN DOYLE", + year = "1902", + period = Some(Siecle20), + genres = Seq(Policier, Fantastique), + themes = Seq(Malediction, Enquete), + programs = Seq(), + level = Moyen + ), + + Book( + title = "EverWorld", + author = "K.A APPLEGATE", + year = "2000-2002", + parts = 4, + period = None, + genres = Seq(Fantasy, SF), + themes = Seq(Amitie, Amour, Aventure), + programs = Seq(), + level = Difficile + ), + + Book( + title = "La Quête d’Ewilan", + author = "Pierre BOTTERO", + year = "2005-2016", + parts = 4, + period = None, + genres = Seq(Fantasy), + themes = Seq(Amitie, Aventure), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Les Mondes d’Ewilan", + author = "Pierre BOTTERO et Jean-Louis THOUARD", + year = "2005-2006", + parts = 3, + period = None, + genres = Seq(Fantasy), + themes = Seq(Aventure), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Ellana", + author = "Pierre BOTTERO", + year = "2006-2010", + parts = 3, + period = None, + genres = Seq(Policier, Fantasy), + themes = Seq(Aventure), + programs = Seq(), + level = Difficile + ), + + Book( + title = "The Mortal instruments", + author = "Cassandra CLARE", + year = "2013-2015", + parts = 6, + period = None, + genres = Seq(Fantastique), + themes = Seq(Aventure, Famille), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Le Monde de Narnia", + author = "C.S LEWIS", + year = "2002-2008", + period = None, + genres = Seq(Fantasy), + themes = Seq(Aventure, Famille), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Eragon", + author = "Christopher PAOLINI", + year = "2003-2006", + period = None, + genres = Seq(Fantasy), + themes = Seq(Amitie, Aventure, Dragon), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Harry POTTER", + author = "J.K ROWLING", + year = "1999-2007", + period = None, + genres = Seq(Fantastique), + themes = Seq(Amitie, Ecole, Aventure, Magie), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Les Royaumes de feu", + author = "T.T SUTHERLAND", + year = "2012-2016", + parts = 5, + period = None, + genres = Seq(Fantastique), + themes = Seq(Aventure, Dragon), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Bilbo Le Hobbit", + author = "J.R.R TOLKIEN", + year = "1937", + period = None, + genres = Seq(Fantasy), + themes = Seq(Aventure), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Le Seigneur des anneaux", + author = "J.R.R TOLKIEN", + year = "1954-1955", + period = None, + genres = Seq(Fantasy), + themes = Seq(Aventure, Combat), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Le Silmarillion", + author = "J.R.R TOLKIEN", + year = "1977", + period = None, + genres = Seq(Fantasy), + themes = Seq(Aventure, Combat), + programs = Seq(), + level = Difficile + ), + + Book( + title = "À la Croisée des mondes", + author = "Philip PULLMAN", + year = "1998-2001", + period = None, + genres = Seq(Fantastique), + themes = Seq(Aventure, Amitie, Enquete, Nature), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Uglies", + author = "Scott WESTERFELD", + year = "2007-2008", + period = None, + genres = Seq(SF, Dystopie), + themes = Seq(Beaute, Laideur, Americain), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Percy JACKSON", + author = "Rick RIORDAN", + year = "2005-2010", + parts = 5, + period = None, + genres = Seq(Fantastique), + themes = Seq(Mythologie, Aventure), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Les Héros de l’Olympe", + author = "Rick RIORDAN", + year = "2010-2014", + period = None, + genres = Seq(Fantastique), + themes = Seq(Amitie, Aventure, Mythologie), + programs = Seq(), + level = Difficile + ), + + Book( + title = "La Rivière à l’envers", + author = "J-C MOURLEVAT", + year = "2000-2002", + parts = 2, + period = None, + genres = Seq(RomanAventure, Merveilleux), + themes = Seq(Amitie), + programs = Seq(), + level = Facile + ), + + Book( + title = "La Guerre des clans", + author = "Erin HUNTER", + year = "2007-2016", + parts = 5, + period = None, + genres = Seq(Fantastique), + themes = Seq(Animal, Nature), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Journal d’un noob", + author = "Cube Kid", + year = "2016-2017", + parts = 4, + period = None, + genres = Seq(Fantastique), + themes = Seq(JeuVideo), + programs = Seq(), + level = Facile + ), + + Book( + title = "Journal d’un dégonflé", + author = "Jeff KINNEY", + year = "2009-2016", + parts = 10, + period = Some(Contemporain), + genres = Seq(JournalIntime), + themes = Seq(Humour, Amitie, Famille, Adolescence), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Frankenstein", + author = "Mary SHELLEY", + year = "1818", + period = None, + genres = Seq(SF), + themes = Seq(Monstrueux), + programs = Seq(Monstre), + level = Moyen + ), + + Book( + title = "Frigiel et Fluffy", + author = "FRIGIEL et Nicolas DIGARD", + year = "2016", + period = None, + genres = Seq(Roman), + themes = Seq(Amitie, Magie, Famille, Aventure), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Cherub", + author = "Robert MUCHAMORE", + year = "2009-2016", + period = None, + genres = Seq(Roman), + themes = Seq(Adolescence, Espionnage, Americain), + programs = Seq(), + level = Moyen + ), + + Book( + title = "DIMILY", + author = "Estelle MASKAME", + year = "2016", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Amour, Famille, Adolescence), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Les Héritiers d’Enkidiev", + author = "Anne ROBILLARD", + year = "2011-2016", + period = None, + genres = Seq(Fantasy), + themes = Seq(Combat), + programs = Seq(), + level = Moyen + ), + + Book( + title = "La Sélection", + author = "Kiera CASS", + year = "2011-2016", + parts = 5, + period = None, + genres = Seq(SF), + themes = Seq(Famille, Amour), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Hunger Games", + author = "Suzanne COLLINS", + year = "2009-2011", + period = None, + genres = Seq(Dystopie, Fantastique), + themes = Seq(Combat), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Le Passeur", + author = "Lois LOWRY", + year = "1996", + period = None, + genres = Seq(Dystopie), + themes = Seq(Initiation), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Cinder", + author = "Marissa MEYER", + year = "2013-2016", + period = None, + genres = Seq(SF), + themes = Seq(Robot, Famille, Aventure), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Les Âmes vagabondes", + author = "Stephenie MEYER", + year = "2010", + period = None, + genres = Seq(Fantasy, SF), + themes = Seq(Adolescence, Aventure), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Divergente", + author = "Veronica ROTH", + year = "2011-2014", + parts = 3, + period = None, + genres = Seq(Fantasy, SF), + themes = Seq(Adolescence, Aventure), + programs = Seq(), + level = Difficile + ), + + Book( + title = "L’Étrange cas du Dr Jekyll et de M. Hyde", + author = "R.L STEVENSON", + year = "1886", + period = None, + genres = Seq(Fantastique), + themes = Seq(Folie), + programs = Seq(Monstre), + level = Facile + ), + + Book( + title = "Persépolis", + author = "Marjane SATRAPI", + year = "2007", + period = Some(Siecle20), + genres = Seq(BD), + themes = Seq(Famille, Amitie), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Le Petit Nicolas", + author = "GOSCINNY et SEMPE", + year = "1973", + period = Some(Siecle20), + genres = Seq(Comique), + themes = Seq(Amitie, Ecole, Famille), + programs = Seq(), + level = Facile + ), + + Book( + title = "Les Sisters", + author = "William CAZENOVE", + year = "2008-2016", + period = Some(Contemporain), + genres = Seq(BD), + themes = Seq(Famille, College), + programs = Seq(), + level = Facile + ), + + Book( + title = "Le Journal d’Aurélie Laflamme", + author = "India DESJARDINS", + year = "2013-2015", + period = Some(Contemporain), + genres = Seq(JournalIntime), + themes = Seq(Famille, Amitie, Amour, Ecole), + programs = Seq(), + level = Moyen + ), + + Book( + title = "L’Ordre Terne", + author = "I.M NANCY", + year = "2015-2016", + parts = 2, + period = None, + genres = Seq(Fantasy), + themes = Seq(Magie), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Tobie Lolness", + author = "Timothée DE FOMBELLE", + year = "2010", + parts = 2, + period = None, + genres = Seq(Roman), + themes = Seq(Famille, Nature, Aventure, Amour), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Question de temps", + author = "E.R LINK", + year = "2016", + period = None, + genres = Seq(Roman), + themes = Seq(Aventure, Pirate, Amour, Amitie), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Maliki", + author = "MALIKI", + year = "2007-2015", + parts = 7, + period = None, + genres = Seq(BD), + themes = Seq(Enfants, Humour, Animal), + programs = Seq(), + level = Facile + ), + + Book( + title = "Gardiens des cités perdues", + author = "Shannon MESSENGER", + year = "2014-2016", + parts = 4, + period = None, + genres = Seq(Fantasy), + themes = Seq(Ecole), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Le Maître des clés", + author = "Benoît GRELAUD", + year = "2012-2014", + parts = 5, + period = None, + genres = Seq(RomanAventure, Fantasy), + themes = Seq(Famille, Nature, Aventure, Poetique), + programs = Seq(RecitAventure), + level = Facile + ), + + Book( + title = "Le Passe-miroir", + author = "Christelle DABOS", + year = "2013-2015", + parts = 2, + period = None, + genres = Seq(Fantastique), + themes = Seq(Complot, Cour, Enquete), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Oniria", + author = "P.F PARRY", + year = "2012-2016", + parts = 4, + period = None, + genres = Seq(Fantastique), + themes = Seq(Famille, Amitie, Aventure), + programs = Seq(), + level = Moyen + ), + + Book( + title = "La Vie compliquée de Léa OLIVIER", + author = "Catherine GIRARD AUDET", + year = "2013-2016", + parts = 9, + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Amitie, Amour, Adolescence), + programs = Seq(), + level = Moyen + ), + + Book( + title = "La Trilogie de Bartiméus", + author = "Jonathan STROUD", + year = "2003-2006", + parts = 3, + period = Some(Siecle19), + genres = Seq(Fantasy), + themes = Seq(Humour, Magie), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Risk", + author = "Fleur FERRIS", + year = "2016", + period = None, + genres = Seq(Roman), + themes = Seq(Amitie, Internet, Enquete), + programs = Seq(), + level = Moyen + ), + + Book( + title = "L’Apprenti d’Araluen", + author = "John FLANAGAN", + year = "2014-2016", + parts = 12, + period = None, + genres = Seq(Fantasy), + themes = Seq(Conflit, Initiation), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Titeuf", + author = "ZEP", + year = "2000-2015", + parts = 14, + period = None, + genres = Seq(BD), + themes = Seq(Amitie, Famille, Ecole), + programs = Seq(), + level = Facile + ), + + Book( + title = "Cabot Caboche", + author = "Daniel PENNAC", + year = "1989", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Amitie, Animal), + programs = Seq(), + level = Facile + ), + + Book( + title = "La Mécanique du cœur", + author = "Mathias MALZIEU", + year = "2009", + period = Some(Siecle19), + genres = Seq(Roman), + themes = Seq(Amour), + programs = Seq(DireAmour), + level = Facile + ), + + Book( + title = "Mathias MALZIEU", + author = "Maintenant qu’il fait tout le temps nuit sur toi", + year = "2006", + period = None, + genres = Seq(Roman), + themes = Seq(Deuil, Famille), + programs = Seq(), + level = Facile + ), + + Book( + title = "Le Plus petit baiser jamais recensé", + author = "Mathias MALZIEU", + year = "2014", + period = None, + genres = Seq(Roman), + themes = Seq(Amour, Enquete), + programs = Seq(), + level = Facile + ), + + Book( + title = "Journal d’un vampire en pyjama", + author = "Mathias MALZIEU", + year = "2016", + period = None, + genres = Seq(JournalIntime), + themes = Seq(Maladie), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Le Donjon de NAHEULBEUK", + author = "John LANG et POINSOT Marion", + year = "2011-2016", + period = None, + genres = Seq(Fantasy, BD), + themes = Seq(Aventure, Humour), + programs = Seq(), + level = Facile + ), + + Book( + title = "Bichon", + author = "David GILSON", + year = "2013-2015", + period = None, + genres = Seq(BD), + themes = Seq(Humour, Ecole, Amitie, Famille, Amour, Homosexualite), + programs = Seq(), + level = Facile + ), + + Book( + title = "Tild : mage à louer", + author = "MAXA’", + year = "2016", + period = None, + genres = Seq(Fantasy, BD), + themes = Seq(Magie), + programs = Seq(), + level = Facile + ), + + Book( + title = "Seuls", + author = "Bruno GAZZOTTI et Fabien VEHLMANN", + year = "2006-2016", + period = None, + genres = Seq(Fantastique, BD), + themes = Seq(Enquete, Aventure, Enfants), + programs = Seq(), + level = Facile + ), + + Book( + title = "L’affaire Caïus", + author = "Henry WINTERFELD", + year = "2014", + parts = 2, + period = Some(Antiquite), + genres = Seq(Roman), + themes = Seq(Enquete, Enfants), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Cédric", + author = "Raoul CAUVIN et LAUDEC", + year = "1989-2016", + parts = 30, + period = None, + genres = Seq(BD), + themes = Seq(Enfants, Humour, Famille, Amour), + programs = Seq(), + level = Facile + ), + + Book( + title = "Les Inséparables", + author = "Colas GUTMAN", + year = "2007", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Conflit, Enfants, Famille), + programs = Seq(Resister), + level = Facile + ), + + Book( + title = "La Rentrée du Petit Nicolas : les histoires inédites du Petit Nicolas 3", + author = "SEMPE et GOSCINNY", + year = "2008", + period = None, + genres = Seq(Comique), + themes = Seq(Enfants, Amitie, Humour), + programs = Seq(Resister), + level = Facile + ), + + Book( + title = "Un Drôle d’ange gardien", + author = "Denis-Pierre FILIPPI, Sandrine REVEL", + year = "1995-2008", + parts = 7, + period = None, + genres = Seq(BD), + themes = Seq(Enfants, Amour), + programs = Seq(), + level = Facile + ), + + Book( + title = "Histoire du chien qui avait une ombre d’enfant", + author = "Hervé WALBECQ", + year = "2015", + period = None, + genres = Seq(Roman), + themes = Seq(Poetique), + programs = Seq(CreationPoetique), + level = Facile + ), + + Book( + title = "Quand la nuit voit le jour", + author = "Marie-Josée CHRISTIEN", + year = "2015", + period = None, + genres = Seq(Roman), + themes = Seq(Nature, Poetique), + programs = Seq(CreationPoetique), + level = Facile + ), + + Book( + title = "L’Homme à l’oreille coupée", + author = "Jean-Claude MOURLEVAT", + year = "2003", + period = None, + genres = Seq(Roman), + themes = Seq(Aventure, Folie), + programs = Seq(RecitAventure), + level = Facile + ), + + Book( + title = "Les Mauvaises notes", + author = "Claire JULLIARD", + year = "1997", + period = None, + genres = Seq(Roman), + themes = Seq(Adolescence, Aventure, Amitie, Famille, Conflit), + programs = Seq(RecitAventure), + level = Moyen + ), + + Book( + title = "Le Renard de Morlange", + author = "Alain SURGET", + year = "1995", + period = Some(MoyenAge), + genres = Seq(Roman), + themes = Seq(Animal, Metamorphose), + programs = Seq(Monstre), + level = Facile + ), + + Book( + title = "C’était mon oncle !", + author = "Yves GREVET", + year = "2006", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Famille, Exclusion, Poetique), + programs = Seq(Monstre), + level = Facile + ), + + Book( + title = "Un Monde sauvage", + author = "Xavier-Laurent PETIT", + year = "2015", + period = None, + genres = Seq(Roman), + themes = Seq(Nature, Animal, Amitie, Amour, Famille), + programs = Seq(HommeEtNature), + level = Moyen + ), + + Book( + title = "Décollage immédiat", + author = "Fabien CLAVEL", + year = "2012", + period = Some(Contemporain), + genres = Seq(Thriller), + themes = Seq(Adolescence, Aventure, Famille), + programs = Seq(VoyageEtAventure, RecitAventure), + level = Moyen + ), + + Book( + title = "Céleste, ma planète", + author = "Thimothée DE FOMBELLE, Julie RICOSSE", + year = "2009", + period = Some(Futur), + genres = Seq(Roman), + themes = Seq(Ecole, Nature, Amour), + programs = Seq(UniversNouveaux), + level = Facile + ), + + Book( + title = "Bjorn le Morphir", + author = "Thomas LAVACHERY", + year = "2004", + period = Some(MoyenAge), + genres = Seq(BD, Fantasy, RomanAventure), + themes = Seq(Combat, Initiation), + programs = Seq(Heros), + level = Facile + ), + + Book( + title = "Cinq histoires d’amour et de chevalerie", + author = "Isabelle PERIER et NADEL", + year = "2012", + period = Some(MoyenAge), + genres = Seq(), + themes = Seq(Amour, Chevalerie), + programs = Seq(Heros), + level = Moyen + ), + + Book( + title = "Isis, 13 ans, 1,60 m, 82 kilos", + author = "Sophie RIGAL-GOULARD", + year = "2016", + period = Some(Contemporain), + genres = Seq(Epistolaire), + themes = Seq(Harcelement, Laideur, Adolescence, Famille, Ecole), + programs = Seq(Autrui), + level = Facile + ), + + Book( + title = "Ma mère, le crabe et moi", + author = "Anne PERCIN", + year = "2015", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Adolescence, Internet, Famille, Maladie), + programs = Seq(Autrui), + level = Facile + ), + + Book( + title = "Simple", + author = "Marie-Aude MURAIL", + year = "2004", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Handicap, Humour, Famille), + programs = Seq(Autrui), + level = Moyen + ), + + Book( + title = "Le Jour où j’ai rencontré un ange", + author = "Brigitte MINNE", + year = "2007", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Adolescence, Deuil, Handicap), + programs = Seq(Autrui), + level = Facile + ), + + Book( + title = "Délit de fuite", + author = "Christophe LEON", + year = "2011", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Amitie, Famille, Crime), + programs = Seq(Autrui), + level = Facile + ), + + Book( + title = "Espions de famille", + author = "Thierry GAUDIN et Romain RONZEAU", + year = "2012-2017", + parts = 5, + period = Some(Contemporain), + genres = Seq(BD), + themes = Seq(Adolescence, Famille, Espionnage), + programs = Seq(Autrui), + level = Facile + ), + + Book( + title = "Histoire du garçon qui courait après son chien qui courait après sa balle", + author = "Hervé GIRAUD", + year = "2016", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Deuil, Maladie, Animal, Famille), + programs = Seq(Autrui), + level = Facile + ), + + Book( + title = "À Copier 100 fois", + author = "Antoine DOLE", + year = "2013", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Homosexualite, Exclusion, Famille, Ecole), + programs = Seq(Autrui), + level = Facile + ), + + Book( + title = "Après la vague", + author = "Orianne CHARPENTIER", + year = "2014", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Adolescence, Deuil, Famille), + programs = Seq(Autrui), + level = Facile + ), + + Book( + title = "Robin des graffs", + author = "Muriel ZÜRCHER", + year = "2016", + period = Some(Contemporain), + genres = Seq(Policier), + themes = Seq(Marginalite, Amitie), + programs = Seq(Ville), + level = Moyen + ), + + Book( + title = "Maestro !", + author = "Xavier-Laurent PETIT", + year = "2005", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Pauvrete, Famille, Dictature, Enfants, Musique), + programs = Seq(Reel), + level = Moyen + ), + + Book( + title = "Le Horla, d’après l’œuvre de G. de Maupassant", + author = "Guillaume SOREL", + year = "2014", + period = Some(Siecle19), + genres = Seq(BD, Fantastique), + themes = Seq(Folie), + programs = Seq(Reel), + level = Facile + ), + + Book( + title = "Le Passage du diable", + author = "Anne FINE", + year = "2014", + period = Some(Siecle19), + genres = Seq(Fantastique), + themes = Seq(Secret, Folie, Famille, Mensonge), + programs = Seq(Reel), + level = Moyen + ), + + Book( + title = "La Folle rencontre de Flora et Max", + author = "Martin PAGE, Coline PIERRE", + year = "2015", + period = Some(Contemporain), + genres = Seq(Epistolaire), + themes = Seq(Amitie, Apprentissage, Exclusion), + programs = Seq(Valeurs), + level = Facile + ), + + Book( + title = "L’Insigne d’argent", + author = "Korneï TCHOUKOVSKI", + year = "2015", + period = Some(Siecle19), + genres = Seq(Roman), + themes = Seq(Exclusion, Ecole), + programs = Seq(Valeurs), + level = Moyen + ), + + Book( + title = "Mon Cher VOLTAIRE", + author = "Jean RENE", + year = "2015", + period = Some(Lumieres), + genres = Seq(Epistolaire), + themes = Seq(Litterature), + programs = Seq(Valeurs), + level = Facile + ), + + Book( + title = "Maïté Coiffure", + author = "Marie-Aude MURAIL", + year = "2004", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Adolescence, Ecole, Famille, Conflit), + programs = Seq(Valeurs), + level = Moyen + ), + + Book( + title = "Sauveur et fils", + author = "Marie-Aude MURAIL", + year = "2016", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Deuil, Famille, Metissage), + programs = Seq(Valeurs), + level = Moyen + ), + + Book( + title = "Le Singe de Hartlepool", + author = "Jérémie MOREAU, Wilfrid LUPANO", + year = "2014", + period = Some(Siecle19), + genres = Seq(BD), + themes = Seq(Animal, Racisme), + programs = Seq(Valeurs), + level = Facile + ), + + Book( + title = "Refuges", + author = "Annelise HEURTIER", + year = "2015", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Deuil, Migration, Famille, Adolescence), + programs = Seq(Valeurs), + level = Moyen + ), + + Book( + title = "Tout revivre", + author = "Mélody GORNET", + year = "2015", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Adolescence, Famille, Deuil, Ecole), + programs = Seq(Valeurs), + level = Facile + ), + + Book( + title = "Une Preuve d’amour", + author = "Valentine GOBY", + year = "2013", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Amour, Famille, Migration, Amitie, Litterature), + programs = Seq(Valeurs), + level = Facile + ), + + Book( + title = "Mots rumeurs, mots cutter", + author = "Charlotte BOUSQUET, Stéphanie RUBINI", + year = "2014", + period = Some(Contemporain), + genres = Seq(BD), + themes = Seq(Adolescence, Internet, Amitie, Harcelement), + programs = Seq(Autrui, Valeurs), + level = Facile + ), + + Book( + title = "Invisible", + author = "Charlotte BOUSQUET, Stéphanie RUBINI", + year = "2015", + period = Some(Contemporain), + genres = Seq(BD), + themes = Seq(Adolescence, Amour, Suicide, Ecole, Laideur, Discrimination), + programs = Seq(Valeurs), + level = Facile + ), + + Book( + title = "Tabou", + author = "Frank ANDRIAT", + year = "2003", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Adolescence, Suicide, Homosexualite, Ecole, Discrimination), + programs = Seq(Valeurs), + level = Facile + ), + + Book( + title = "Avant l’ouragan", + author = "Jewell PARKER RHODES", + year = "2015", + period = Some(Contemporain), + genres = Seq(Fantastique), + themes = Seq(Adolescence, Deuil), + programs = Seq(Valeurs), + level = Moyen + ), + + Book( + title = "Kodhja", + author = "Thomas SCOTTO, Régis LEJONC", + year = "2015", + period = Some(Contemporain), + genres = Seq(BD), + themes = Seq(Enfants, Initiation), + programs = Seq(SeRaconter), + level = Facile + ), + + Book( + title = "Les Ailes de la Sylphide", + author = "Pascale MARET", + year = "2013", + period = Some(Contemporain), + genres = Seq(Fantastique), + themes = Seq(Adolescence, Viol, Danse), + programs = Seq(SeRaconter), + level = Facile + ), + + Book( + title = "Ajin", + author = "Tsuina MIURA", + year = "2015-2016", + parts = 8, + period = Some(Contemporain), + genres = Seq(Manga, SF), + themes = Seq(Adolescence, Immortalite, Conflit, Mutant), + programs = Seq(Reel), + level = Moyen + ), + + Book( + title = "Dragon Ball", + author = "Akira TORIYAMA", + year = "1993-2000", + parts = 16, + period = None, + genres = Seq(Manga), + themes = Seq(Combat, Conflit, Aventure, Apprentissage, Enfants), + programs = Seq(), + level = Facile + ), + + Book( + title = "Ariol", + author = "Emmanuel GUIBERT", + year = "2011-2015", + parts = 10, + period = None, + genres = Seq(BD), + themes = Seq(Amitie, Famille, Humour, Ecole), + programs = Seq(Resister, Autrui), + level = Facile + ), + + Book( + title = "Chroniques des vampires", + author = "Anne RICE", + year = "2004", + parts = 2, + period = Some(Siecle18), + genres = Seq(Fantastique), + themes = Seq(Vampire, Metamorphose), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Dragon Ball Z", + author = "Akira TORIYAMA", + year = "2008-2016", + parts = 26, + period = None, + genres = Seq(Manga), + themes = Seq(Combat, Conflit, Aventure), + programs = Seq(), + level = Facile + ), + + Book( + title = "Les Enfants de la baleine", + author = "Abi UMEDA", + year = "2016-2017", + parts = 6, + period = None, + genres = Seq(Manga, Fantastique, SF), + themes = Seq(Mutant, Magie, Sentiment, Poetique), + programs = Seq(), + level = Facile + ), + + Book( + title = "Fairy Tail", + author = "Hiro MASHIMA", + year = "2008-2017", + parts = 55, + period = None, + genres = Seq(Manga, Fantastique), + themes = Seq(Magie, Amitie, Humour, Aventure), + programs = Seq(), + level = Facile + ), + + Book( + title = "Le Bazar des mauvais rêves : nouvelles", + author = "Stephen KING", + year = "2016", + parts = 42, + period = None, + genres = Seq(Nouvelle, Fantastique, Thriller), + themes = Seq(Vieillesse), + programs = Seq(SeRaconter), + level = Difficile + ), + + Book( + title = "Le Guide junior", + author = "GOUPIL, DOUYE, et al.", + year = "2005-2016", + parts = 18, + period = None, + genres = Seq(BD), + themes = Seq(Enfants, Humour, Famille), + programs = Seq(Autrui), + level = Facile + ), + + Book( + title = "Le Monde Secret de Sombreterre", + author = "Cassandra O'DONNELL", + year = "2016", + parts = 2, + period = None, + genres = Seq(Fantastique), + themes = Seq(Exclusion, Fantome, Aventure, Amitie, Magie), + programs = Seq(Heros, Autrui, VoyageEtAventure), + level = Facile + ), + + Book( + title = "Malenfer", + author = "Cassandra O'DONNELL", + year = "2014-2015", + parts = 3, + period = None, + genres = Seq(Fantastique), + themes = Seq(Magie, Enfants, Aventure), + programs = Seq(UniversNouveaux), + level = Moyen + ), + + Book( + title = "Le Temps des mitaines", + author = "Loic CLEMENT, Anne MONTEL", + year = "2014-2016", + parts = 2, + period = None, + genres = Seq(BD), + themes = Seq(Enquete, Amitie, Ecole, Famille, Enfants, Humour, Magie), + programs = Seq(UniversNouveaux), + level = Facile + ), + + Book( + title = "Naruto", + author = "Masashi KISHIMOTO", + year = "2002-2016", + parts = 72, + period = None, + genres = Seq(Manga), + themes = Seq(Enfants, Apprentissage, Combat, Aventure), + programs = Seq(UniversNouveaux), + level = Moyen + ), + + Book( + title = "One Piece", + author = "Eiichirô ODA", + year = "2013-2017", + parts = 81, + period = None, + genres = Seq(Manga), + themes = Seq(Pirate, Aventure, Humour, Combat, Apprentissage), + programs = Seq(UniversNouveaux, Heros), + level = Moyen + ), + + Book( + title = "Platinum End", + author = "Tsugumi OHBA", + year = "2016", + parts = 3, + period = None, + genres = Seq(Manga), + themes = Seq(Suicide, Magie, Conflit), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Susan HOPPER", + author = "Anne PLICHOTA, Cendrine WOLF", + year = "2013-2016", + parts = 2, + period = None, + genres = Seq(Fantastique), + themes = Seq(Fantome, Humour, Famille, Malediction), + programs = Seq(), + level = Moyen + ), + + Book( + title = "La Déferlante", + author = "Michael BUCKLEY", + year = "2014-2016", + parts = 2, + period = None, + genres = Seq(SF), + themes = Seq(Conflit, Ecole, Americain, Amitie), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Les Mystères de LARISPEM", + author = "Lucie PIERRAT-PAJOT, Donatien MARY", + year = "2016", + period = Some(Siecle19), + genres = Seq(Uchronie, SF, Dystopie), + themes = Seq(Revolution, Litterature, Complot), + programs = Seq(Ville), + level = Moyen + ), + + Book( + title = "Les Petites reines", + author = "Clémentine BEAUVAIS", + year = "2015", + parts = 2, + period = Some(Contemporain), + genres = Seq(BD), + themes = Seq(Internet, Laideur, Humour, Harcelement, Amitie), + programs = Seq(Autrui, Ville), + level = Moyen + ), + + Book( + title = "Tous les héros s’appellent Phénix", + author = "Nastasia RUGANI", + year = "2014", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Famille, Adolescence, Maltraitance, Manipulation), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Brise glace", + author = "Jean-Philippe BLONDEL", + year = "2011", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Amitie, Deuil, Ecole, Musique, Adolescence), + programs = Seq(Autrui), + level = Facile + ), + + Book( + title = "Terrienne", + author = "JC MOURLEVAT", + year = "2013", + period = Some(Contemporain), + genres = Seq(SF), + themes = Seq(Adolescence, Famille), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Le Temps des miracles", + author = "Anne-Laure BONDOUX", + year = "2009", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Enfants, Migration), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Le Combat d’hiver", + author = "JC MOURLEVAT", + year = "2006", + period = None, + genres = Seq(SF, Dystopie), + themes = Seq(Combat, Dictature, Adolescence, Amitie), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Les Larmes de l’assassin", + author = "Anne-Laure BONDOUX", + year = "2003", + period = None, + genres = Seq(Roman), + themes = Seq(Adolescence, Crime, Amitie, Apprentissage), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Oh, boy !", + author = "Marie-Aude MURAIL", + year = "2000", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Deuil, Maladie, Homosexualite, Famille, Humour), + programs = Seq(Autrui), + level = Moyen + ), + + Book( + title = "Skeleton Creek", + author = "Patrick CARMAN", + year = "2011-2012", + parts = 4, + period = Some(Contemporain), + genres = Seq(Policier, Thriller), + themes = Seq(Enquete, Amitie, Internet, Secret), + programs = Seq(), + level = Facile + ), + + Book( + title = "Le Manoir", + author = "Evelyne BRISOU-PELLEN", + year = "2013-2016", + parts = 8, + period = None, + genres = Seq(Fantastique), + themes = Seq(Enquete, Amitie, Fantome, Maladie), + programs = Seq(), + level = Difficile + ), + + Book( + title = "Le Premier qui pleure a perdu", + author = "Sherman ALEXIE", + year = "2013", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Humour, Discrimination, Ecole, Adolescence, Famille), + programs = Seq(Valeurs, TraversSociete), + level = Moyen + ), + + Book( + title = "Freak City", + author = "Kathrin Schrocke", + year = "2013", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Handicap, Amour, Adolescence), + programs = Seq(Autrui), + level = Moyen + ), + + Book( + title = "Le Journal malgré lui de Henry K. LARSEN", + author = "Susin NIELSEN", + year = "2013", + period = None, + genres = Seq(JournalIntime), + themes = Seq(Ecole, Harcelement, Suicide, Deuil, Famille, Amitie, Adolescence), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Max", + author = "Sarah COHEN-SCALI", + year = "2013", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Dictature, Guerre, Genetique, Nazisme), + programs = Seq(Agir), + level = Difficile + ), + + Book( + title = "Boys don’t cry", + author = "Malorie BLACKMAN", + year = "2011", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Adolescence, Famille, Homosexualite, Apprentissage), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Le Monde dans la main", + author = "Mikaël OLLIVIER", + year = "2011", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Famille, Adolescence, Amour, Apprentissage, Secret), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Là où naissent les nuages", + author = "Annelise HEURTIER", + year = "2015", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Voyage, Famille, Adolescence, Initiation, Maladie, Pauvrete), + programs = Seq(VoyageEtAventure), + level = Moyen + ), + + Book( + title = "Les Mondes de l’Alliance", + author = "David MOITET", + year = "2014-2015", + parts = 3, + period = None, + genres = Seq(SF), + themes = Seq(Famille, Aventure, Adolescence), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Le Suivant sur la liste", + author = "Manon FARGETTON", + year = "2014", + period = None, + genres = Seq(Thriller), + themes = Seq(Genetique, Manipulation, Adolescence), + programs = Seq(), + level = Moyen + ), + + Book( + title = "Le Livre de Perle", + author = "Thimothée de FOMBELLE", + year = "2014", + period = Some(Siecle20), + genres = Seq(Merveilleux), + themes = Seq(Poetique, Magie, Amour), + programs = Seq(VisionsPoetiques), + level = Difficile + ), + + Book( + title = "Ma Raison de vivre", + author = "Rebecca DONOVAN", + year = "2015-2016", + parts = 3, + period = None, + genres = Seq(Roman), + themes = Seq(Adolescence, Amour, Famille, Amitie, Maltraitance), + programs = Seq(), + level = Difficile + ), + Book( + title = "Ma Vie ne sait pas nager", + author = "Elaine TURGEON", + year = "2006", + period = Some(Contemporain), + genres = Seq(Epistolaire), + themes = Seq(Adolescence, Deuil), + programs = Seq(SeRaconter), + level = Facile + ), + + Book( + title = "Moi, René TARDI, prisonnier de guerre au Stalag IIB", + author = "TARDI", + year = "2012-2014", + parts = 2, + period = Some(Siecle20), + genres = Seq(BD), + themes = Seq(Nazisme, Guerre, Antisemitisme, Prison, Maltraitance), + programs = Seq(SeRaconter), + level = Facile + ), + + Book( + title = "Trop tôt", + author = "Jo WITEK", + year = "2015", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Adolescence, Sexualite, Apprentissage, Sentiment), + programs = Seq(SeRaconter), + level = Facile + ), + + Book( + title = "Je suis un phénomène", + author = "Elisabeth ATKINSON", + year = "2010", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Adolescence, Amitie, Famille, Discrimination), + programs = Seq(SeRaconter), + level = Moyen + ), + + Book( + title = "Instinct", + author = "Vincent VILLEMINOT", + year = "2011", + period = Some(Contemporain), + genres = Seq(Fantastique), + themes = Seq(Adolescence, Metamorphose, Famille), + programs = Seq(SeRaconter), + level = Moyen + ), + + Book( + title = "L’Empire des auras", + author = "Nadia COSTE", + year = "2016", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Adolescence, Dictature, Manipulation, SegregationRaciale, Amour), + programs = Seq(TraversSociete), + level = Moyen + ), + + Book( + title = "Quand j’étais soldate", + author = "Valérie ZENATTI", + year = "2002", + period = Some(Contemporain), + genres = Seq(JournalIntime), + themes = Seq(Adolescence, Guerre), + programs = Seq(Agir), + level = Moyen + ), + + Book( + title = "La Colline des potences", + author = "Dorothy M. JOHNSON", + year = "2015", + period = Some(Siecle19), + genres = Seq(Roman), + themes = Seq(Americain), + programs = Seq(Agir), + level = Moyen + ), + + Book( + title = "Qui se souvient de Paula", + author = "Romain SLOCOMBE", + year = "2008", + period = Some(Siecle20), + genres = Seq(Roman), + themes = Seq(Guerre, Nazisme), + programs = Seq(Agir), + level = Moyen + ), + + Book( + title = "La Guerre des mercredis", + author = "Gary D. SCHMIDT", + year = "2016", + period = Some(Contemporain), + genres = Seq(Roman), + themes = Seq(Adolescence, Ecole, Litterature), + programs = Seq(Agir), + level = Moyen + ), + + Book( + title = "La Fée de VERDUN", + author = "Philippe NESSMANN", + year = "2016", + period = Some(Siecle20), + genres = Seq(Roman), + themes = Seq(Guerre, Femme, Art), + programs = Seq(Agir), + level = Facile + ), + + Book( + title = "Voyage à PITCHIPOÏ", + author = "JC MOSCOVICI", + year = "1995", + period = Some(Siecle20), + genres = Seq(Autobiographie), + themes = Seq(Guerre, Nazisme, Antisemitisme, Racisme, Famille), + programs = Seq(Agir), + level = Facile + ), + + Book( + title = "Le Ring de la mort", + author = "Jean-Jacques GREIF", + year = "1998", + period = Some(Siecle20), + genres = Seq(Roman), + themes = Seq(Guerre, Maltraitance, Discrimination, Sport, Antisemitisme, Prison, Nazisme), + programs = Seq(Agir), + level = Moyen + ), + + Book( + title = "Le Garçon en pyjama rayé", + author = "John BOYNE", + year = "2006", + period = Some(Siecle20), + genres = Seq(Roman), + themes = Seq(Guerre, Amitie, Antisemitisme, Nazisme), + programs = Seq(Agir), + level = Moyen + ), + + Book( + title = "Emmett TILL, derniers jours d’une courte vie", + author = "Arnaud FLOC'H", + year = "2015", + period = Some(Siecle20), + genres = Seq(BD), + themes = Seq(Racisme, Discrimination), + programs = Seq(Agir), + level = Facile + ), + + Book( + title = "Le Livre des étoiles", + author = "Erik L’Homme", + year = "2001", + parts = 3, + period = None, + genres = Seq(Fantasy), + themes = Seq(Amitie, Magie, Aventure, Famille), + programs = Seq(Autrui, UniversNouveaux), + level = Moyen + ) + ) +} diff --git a/src/main/scala/reading/models/Filter.scala b/src/main/scala/reading/models/Filter.scala index d14ca63..7ec6340 100644 --- a/src/main/scala/reading/models/Filter.scala +++ b/src/main/scala/reading/models/Filter.scala @@ -5,6 +5,16 @@ trait Filter { def kind: FilterKind def nonFormattedName: String def name: String + + override def equals(that: Any): Boolean = + that match { + case that: Filter => + this.kind == that.kind && this.name == that.name + case _ => + false + } + + override def hashCode: Int = this.kind.hashCode + this.nonFormattedName.hashCode } object Filter { @@ -23,15 +33,33 @@ object Filter { } def contains(filters: Seq[Filter], filter: Filter): Boolean = - filters.find(equals(_, filter)).nonEmpty - - def equals(f1: Filter, f2: Filter): Boolean = - f1.kind == f2.kind && f1.name == f2.name + filters.find(_ == filter).nonEmpty def remove(fs: Seq[Filter], rf: Filter): Seq[Filter] = fs.filterNot { f => - (equals(f, rf) + (f == rf || rf.kind == FilterKind.Grade && f.kind == FilterKind.Program || rf.kind == FilterKind.GroupedTheme && f.kind == FilterKind.Theme) } + + val onBooks: Map[Filter, Seq[Book]] = + Seq( + Grade.values.map(Filter.apply(_)), + Program.values.map(Filter.apply(_)), + Theme.values.map(Filter.apply(_)), + GroupedTheme.values.map(Filter.apply(_)), + Genre.values.map(Filter.apply(_)), + Level.values.map(Filter.apply(_)), + Period.values.map(Filter.apply(_)) + ) + .flatten + .map(f => (f, Books().filter(f.filter))) + .toMap + + def add(books: Seq[Book], filters: Seq[Filter]): Seq[Book] = + filters.foldLeft(books)(add) + + def add(books: Seq[Book], filter: Filter): Seq[Book] = + books.intersect(onBooks.getOrElse(filter, Nil)) + } diff --git a/src/main/scala/reading/models/Search.scala b/src/main/scala/reading/models/Search.scala new file mode 100644 index 0000000..5ef97c1 --- /dev/null +++ b/src/main/scala/reading/models/Search.scala @@ -0,0 +1,16 @@ +package reading.models + +object Search { + def apply(text: String, search: String): Boolean = + format(text).contains(format(search)) + + private def format(str: String): String = + str + .toLowerCase + .replace('’', '\'') + .replaceAll("[èéêë]", "e") + .replaceAll("[ûù]", "u") + .replaceAll("[ïî]", "i") + .replaceAll("[àâ]", "a") + .replaceAll("ô", "o") +} diff --git a/src/main/scala/reading/utils/Rx.scala b/src/main/scala/reading/utils/Rx.scala index 76d05eb..a5b56ee 100644 --- a/src/main/scala/reading/utils/Rx.scala +++ b/src/main/scala/reading/utils/Rx.scala @@ -1,44 +1,85 @@ package reading.utils +import java.util.concurrent.atomic.AtomicReference + +import scala.annotation.tailrec +import scala.language.implicitConversions import scala.util.{ Failure, Success } import org.scalajs.dom.Element - -import scalatags.JsDom.all._ import rx._ +import scalacss.Defaults.StyleA +import scalatags.JsDom.all._ -import Ctx.Owner.Unsafe._ +object RxUtils { -object RxTag { - def apply(r: Ctx.Data => HtmlTag): HtmlTag = - rxMod(Rx(r(implicitly[Ctx.Data]))) + implicit def rxFrag[T](n: Rx[T])(implicit f: T => Frag, ctx: Ctx.Owner): Frag = { - private def rxMod(r: Rx[HtmlTag]): HtmlTag = { - def rSafe = r.toTry match { - case Success(v) => v.render - case Failure(e) => span(e.toString, backgroundColor := "red").render + @tailrec def clearChildren(node: org.scalajs.dom.Node): Unit = { + if (node.firstChild != null) { + node.removeChild(node.firstChild) + clearChildren(node) + } } - var last = rSafe - r.trigger { - val newLast = rSafe - Option(last.parentElement).foreach { - _.replaceChild(newLast, last) + + def fSafe: Frag = n match { + case r: Rx.Dynamic[T] => r.toTry match { + case Success(v) => v.render + case Failure(e) => span(e.getMessage, backgroundColor := "red").render } + case v: Var[T] => v.now.render + } + + var last = fSafe.render + + val container = span(last).render + + n.triggerLater { + val newLast = fSafe.render + //Rx[Seq[T]] can generate multiple children per propagate, so use clearChildren instead of replaceChild + clearChildren(container) + container.appendChild(newLast) last = newLast } - span( - bindNode(last) - ) + bindNode(container) } -} -object RxAttr { - def apply[Builder, T: AttrValue](attr: scalatags.generic.Attr, v: Rx[T]) = { - val attrValue = new AttrValue[Rx[T]] { - def apply(t: Element, a: Attr, r: Rx[T]): Unit = { - val _ = r.trigger { implicitly[AttrValue[T]].apply(t, a, r.now) } + implicit def RxAttrValue[T: AttrValue](implicit ctx: Ctx.Owner) = new AttrValue[Rx.Dynamic[T]] { + def apply(t: Element, a: Attr, r: Rx.Dynamic[T]): Unit = { + r.trigger { implicitly[AttrValue[T]].apply(t, a, r.now) } + () + } + } + + implicit def RxStyleValue[T: StyleValue](implicit ctx: Ctx.Owner) = new StyleValue[Rx.Dynamic[T]] { + def apply(t: Element, s: Style, r: Rx.Dynamic[T]): Unit = { + r.trigger { implicitly[StyleValue[T]].apply(t, s, r.now) } + () + } + } + + implicit class bindRxStyle(rx: Rx[StyleA])(implicit ctx: Ctx.Owner) extends Modifier { + def applyTo(container: Element) = { + val atomicReference = new AtomicReference(rx.now) + applyStyle(container, atomicReference.get()) + rx.triggerLater { + val current = rx.now + val previous = atomicReference.getAndSet(current) + removeStyle(container, previous) + applyStyle(container, current) + () } + () } - scalatags.generic.AttrPair(attr, v, attrValue) + + private def removeStyle(container: Element, style: StyleA): Unit = + style.classNameIterator.foreach { className => + container.classList.remove(className.value) + } + + private def applyStyle(container: Element, style: StyleA): Unit = + style.classNameIterator.foreach { className => + container.classList.add(className.value) + } } } -- cgit v1.2.3