aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/resources/cover/Le Joueur.jpgbin0 -> 30079 bytes
-rw-r--r--src/main/resources/cover/Le Petit Prince.jpgbin0 -> 164020 bytes
-rw-r--r--src/main/resources/cover/Les Dix petits nègres.jpgbin0 -> 47023 bytes
-rw-r--r--src/main/resources/cover/Les Frères Karamazov.jpgbin0 -> 32461 bytes
-rw-r--r--src/main/resources/cover/Voyage au bout de la nuit.jpgbin0 -> 41775 bytes
-rw-r--r--src/main/scala/reading/component/index/Books.scala21
-rw-r--r--src/main/scala/reading/component/index/FiltersMenu.scala8
-rw-r--r--src/main/scala/reading/component/index/style/Books.scala16
-rw-r--r--src/main/scala/reading/models/Difficulty.scala22
-rw-r--r--src/main/scala/reading/models/Filter.scala16
-rw-r--r--src/main/scala/reading/models/Grade.scala27
-rw-r--r--src/main/scala/reading/models/Level.scala43
-rw-r--r--src/main/scala/reading/models/Program.scala4
13 files changed, 86 insertions, 71 deletions
diff --git a/src/main/resources/cover/Le Joueur.jpg b/src/main/resources/cover/Le Joueur.jpg
new file mode 100644
index 0000000..6abfdcd
--- /dev/null
+++ b/src/main/resources/cover/Le Joueur.jpg
Binary files differ
diff --git a/src/main/resources/cover/Le Petit Prince.jpg b/src/main/resources/cover/Le Petit Prince.jpg
new file mode 100644
index 0000000..ffe69e0
--- /dev/null
+++ b/src/main/resources/cover/Le Petit Prince.jpg
Binary files differ
diff --git a/src/main/resources/cover/Les Dix petits nègres.jpg b/src/main/resources/cover/Les Dix petits nègres.jpg
new file mode 100644
index 0000000..f39a6d9
--- /dev/null
+++ b/src/main/resources/cover/Les Dix petits nègres.jpg
Binary files differ
diff --git a/src/main/resources/cover/Les Frères Karamazov.jpg b/src/main/resources/cover/Les Frères Karamazov.jpg
new file mode 100644
index 0000000..e27e3c9
--- /dev/null
+++ b/src/main/resources/cover/Les Frères Karamazov.jpg
Binary files differ
diff --git a/src/main/resources/cover/Voyage au bout de la nuit.jpg b/src/main/resources/cover/Voyage au bout de la nuit.jpg
new file mode 100644
index 0000000..73da114
--- /dev/null
+++ b/src/main/resources/cover/Voyage au bout de la nuit.jpg
Binary files differ
diff --git a/src/main/scala/reading/component/index/Books.scala b/src/main/scala/reading/component/index/Books.scala
index 421fcec..23a42da 100644
--- a/src/main/scala/reading/component/index/Books.scala
+++ b/src/main/scala/reading/component/index/Books.scala
@@ -18,19 +18,26 @@ object Books {
RxTag { implicit context =>
div(
+ BooksStyle.books,
books().sorted.map { book =>
div(
BooksStyle.book,
div(BooksStyle.title, book.title),
div(BooksStyle.author, s", ${book.author}"),
div(
- BooksStyle.description,
- div(BooksStyle.item, s"classe : ${book.programs.map(Program.level).distinct.sorted.mkString(", ")}"),
- div(BooksStyle.item, s"programme : ${book.programs.sorted.mkString(", ")}"),
- div(BooksStyle.item, s"thème : ${book.themes.sorted.mkString(", ")}"),
- div(BooksStyle.item, s"genre : ${book.genres.sorted.mkString(", ")}"),
- div(BooksStyle.item, s"période : ${book.period}"),
- div(BooksStyle.item, s"${book.pages} pages")
+ BooksStyle.detail,
+ img(
+ BooksStyle.cover,
+ src := s"cover/${book.title}.jpg"
+ ),
+ div(
+ div(BooksStyle.item, s"classe : ${book.programs.map(Program.grade).distinct.sorted.mkString(", ")}"),
+ div(BooksStyle.item, s"programme : ${book.programs.sorted.mkString(", ")}"),
+ div(BooksStyle.item, s"thème : ${book.themes.sorted.mkString(", ")}"),
+ div(BooksStyle.item, s"genre : ${book.genres.sorted.mkString(", ")}"),
+ div(BooksStyle.item, s"période : ${book.period}"),
+ div(BooksStyle.item, s"${book.pages} pages")
+ )
)
)
}
diff --git a/src/main/scala/reading/component/index/FiltersMenu.scala b/src/main/scala/reading/component/index/FiltersMenu.scala
index 51f8954..68ace94 100644
--- a/src/main/scala/reading/component/index/FiltersMenu.scala
+++ b/src/main/scala/reading/component/index/FiltersMenu.scala
@@ -17,15 +17,15 @@ object FiltersMenu {
div(
FiltersMenuStyle.render,
FiltersMenuStyle.groups,
- filters().find(_.kind == LevelKind) match {
+ filters().find(_.kind == GradeKind) match {
case None =>
- group(books, filters, "Classe", Level.values.map(Filter.apply(_)))
- case Some(level) =>
+ group(books, filters, "Classe", Grade.values.map(Filter.apply(_)))
+ case Some(grade) =>
group(books, filters, "Programme", Program.values.map(Filter.apply(_)))
},
group(books, filters, "Theme", Theme.values.map(Filter.apply(_))),
group(books, filters, "Genre", Genre.values.map(Filter.apply(_))),
- group(books, filters, "Niveau", Difficulty.filters),
+ group(books, filters, "Niveau", Level.filters),
group(books, filters, "Période", Period.values.map(Filter.apply(_)))
)
}
diff --git a/src/main/scala/reading/component/index/style/Books.scala b/src/main/scala/reading/component/index/style/Books.scala
index efc6af8..bbedf3a 100644
--- a/src/main/scala/reading/component/index/style/Books.scala
+++ b/src/main/scala/reading/component/index/style/Books.scala
@@ -8,16 +8,19 @@ object Books extends StyleSheet.Inline {
import dsl._
val books = style(
+ display.flex,
+ flexWrap.wrap
)
val book = style(
- marginBottom(30.px)
+ marginBottom(30.px),
+ marginRight(30.px)
)
val title = style(
display.inlineBlock,
fontWeight.bold,
- marginBottom(15.px),
+ marginBottom(20.px),
color(Col.congoBrown)
)
@@ -25,8 +28,13 @@ object Books extends StyleSheet.Inline {
display.inlineBlock
)
- val description = style(
- marginLeft(20.px)
+ val detail = style(
+ display.flex
+ )
+
+ val cover = style(
+ height(150.px),
+ marginRight(30.px)
)
val item = style(
diff --git a/src/main/scala/reading/models/Difficulty.scala b/src/main/scala/reading/models/Difficulty.scala
deleted file mode 100644
index e20d7b2..0000000
--- a/src/main/scala/reading/models/Difficulty.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-package reading.models
-
-object Difficulty {
- val filters: Seq[Filter] =
- Seq(
- new Filter {
- def filter(book: Book): Boolean = book.pages < 200
- val kind: FilterKind = DifficultyKind
- val name: String = "facile"
- },
- new Filter {
- def filter(book: Book): Boolean = book.pages >= 200 && book.pages < 400
- val kind: FilterKind = DifficultyKind
- val name: String = "moyen"
- },
- new Filter {
- def filter(book: Book): Boolean = book.pages > 400
- val kind: FilterKind = DifficultyKind
- val name: String = "difficile"
- }
- )
-}
diff --git a/src/main/scala/reading/models/Filter.scala b/src/main/scala/reading/models/Filter.scala
index b8adcc1..00c7994 100644
--- a/src/main/scala/reading/models/Filter.scala
+++ b/src/main/scala/reading/models/Filter.scala
@@ -10,9 +10,9 @@ sealed trait FilterKind
case object PeriodKind extends FilterKind
case object ThemeKind extends FilterKind
case object GenreKind extends FilterKind
-case object DifficultyKind extends FilterKind
-case object ProgramKind extends FilterKind
case object LevelKind extends FilterKind
+case object ProgramKind extends FilterKind
+case object GradeKind extends FilterKind
object Filter {
def apply[T](in: T)(implicit filterFactory: FilterFactory[T]): Filter =
@@ -26,7 +26,7 @@ object Filter {
def remove(fs: Seq[Filter], rf: Filter): Seq[Filter] =
fs.filterNot { f =>
- equals(f, rf) || rf.kind == LevelKind && f.kind == ProgramKind
+ equals(f, rf) || rf.kind == GradeKind && f.kind == ProgramKind
}
}
@@ -71,12 +71,12 @@ object FilterFactory {
}
}
- implicit object LevelFilter extends FilterFactory[Level] {
- def create(level: Level): Filter =
+ implicit object GradeFilter extends FilterFactory[Grade] {
+ def create(grade: Grade): Filter =
new Filter {
- def filter(book: Book): Boolean = book.programs.map(Program.level).contains(level)
- val kind: FilterKind = LevelKind
- val name: String = level.toString()
+ def filter(book: Book): Boolean = book.programs.map(Program.grade).contains(grade)
+ val kind: FilterKind = GradeKind
+ val name: String = grade.toString()
}
}
}
diff --git a/src/main/scala/reading/models/Grade.scala b/src/main/scala/reading/models/Grade.scala
new file mode 100644
index 0000000..e41d1a8
--- /dev/null
+++ b/src/main/scala/reading/models/Grade.scala
@@ -0,0 +1,27 @@
+package reading.models
+
+import enumeratum._
+
+sealed trait Grade extends EnumEntry with Ordered[Grade] {
+ import Grade._
+
+ def compare(that: Grade): Int = {
+ values.indexOf(that) - values.indexOf(this)
+ }
+
+ override def toString(): String = this match {
+ case Sixieme => "6ème"
+ case Cinquieme => "5ème"
+ case Quatrieme => "4ème"
+ case Troisieme => "3ème"
+ }
+}
+
+object Grade extends Enum[Grade] {
+ val values = findValues
+
+ case object Sixieme extends Grade
+ case object Cinquieme extends Grade
+ case object Quatrieme extends Grade
+ case object Troisieme extends Grade
+}
diff --git a/src/main/scala/reading/models/Level.scala b/src/main/scala/reading/models/Level.scala
index 329c720..c297912 100644
--- a/src/main/scala/reading/models/Level.scala
+++ b/src/main/scala/reading/models/Level.scala
@@ -1,27 +1,22 @@
package reading.models
-import enumeratum._
-
-sealed trait Level extends EnumEntry with Ordered[Level] {
- import Level._
-
- def compare(that: Level): Int = {
- values.indexOf(that) - values.indexOf(this)
- }
-
- override def toString(): String = this match {
- case Sixieme => "6ème"
- case Cinquieme => "5ème"
- case Quatrieme => "4ème"
- case Troisieme => "3ème"
- }
-}
-
-object Level extends Enum[Level] {
- val values = findValues
-
- case object Sixieme extends Level
- case object Cinquieme extends Level
- case object Quatrieme extends Level
- case object Troisieme extends Level
+object Level {
+ val filters: Seq[Filter] =
+ Seq(
+ new Filter {
+ def filter(book: Book): Boolean = book.pages < 200
+ val kind: FilterKind = LevelKind
+ val name: String = "facile"
+ },
+ new Filter {
+ def filter(book: Book): Boolean = book.pages >= 200 && book.pages < 400
+ val kind: FilterKind = LevelKind
+ val name: String = "moyen"
+ },
+ new Filter {
+ def filter(book: Book): Boolean = book.pages > 400
+ val kind: FilterKind = LevelKind
+ val name: String = "difficile"
+ }
+ )
}
diff --git a/src/main/scala/reading/models/Program.scala b/src/main/scala/reading/models/Program.scala
index 641f352..4e59364 100644
--- a/src/main/scala/reading/models/Program.scala
+++ b/src/main/scala/reading/models/Program.scala
@@ -61,8 +61,8 @@ object Program extends Enum[Program] {
case object AgirCite extends Program
case object ProgresReveScientifique extends Program
- def level(program: Program): Level = {
- import Level._
+ def grade(program: Program): Grade = {
+ import Grade._
program match {
case Monstre | RecitAventure | CreationPoetique | Resister => Sixieme