Skip to content

Commit c26e68e

Browse files
sabineCuihtlauac ALVARADO
authored andcommitted
move difficulty_to_string into template (#1151)
1 parent e68581e commit c26e68e

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/ocamlorg_data/data.ml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ end
4545
module Problem = struct
4646
include Problem
4747

48-
let difficulty_to_string = function
49-
| `Beginner -> "Beginner"
50-
| `Intermediate -> "Intermediate"
51-
| `Advanced -> "Advanced"
52-
5348
let filter_tag ?tag =
5449
let f x =
5550
Option.fold ~none:(x.tags = []) ~some:(Fun.flip List.mem x.tags) tag

src/ocamlorg_data/data.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ module Problem : sig
162162
solution : string;
163163
}
164164

165-
val difficulty_to_string : difficulty -> string
166165
val all : t list
167166
val filter_tag : ?tag:string -> t list -> t list
168167
end

src/ocamlorg_frontend/pages/problems.eml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ let danger = function
2626
| `Intermediate -> "☡"
2727
| `Advanced -> "☡☡"
2828

29+
let difficulty_to_string = function
30+
| `Beginner -> "Beginner"
31+
| `Intermediate -> "Intermediate"
32+
| `Advanced -> "Advanced"
33+
2934
let render
3035
?(difficulty_level = "All")
3136
(problems : Data.Problem.t list)
@@ -76,12 +81,12 @@ Learn_layout.render
7681
<div x-data="{statement: true}" id="<%s" problem.number %>
7782
>
7883
<div class="flex space-y-4 xl:space-y-0 flex-col xl:flex-row xl:justify-between">
79-
<span aria-hidden="true" class="danger invisible xl:visible" title="<%s Data.Problem.difficulty_to_string problem.difficulty ^ " difficulty" %>"><%s danger problem.difficulty %></span>
84+
<span aria-hidden="true" class="danger invisible xl:visible" title="<%s difficulty_to_string problem.difficulty ^ " difficulty" %>"><%s danger problem.difficulty %></span>
8085
<h4 class="font-bold text-body-600">
8186
<%s problem.title %>
82-
<span aria-hidden="true" class="ml-2 visible xl:invisible" title="<%s Data.Problem.difficulty_to_string problem.difficulty ^ " difficulty" %>"> <%s danger problem.difficulty %></span>
87+
<span aria-hidden="true" class="ml-2 visible xl:invisible" title="<%s difficulty_to_string problem.difficulty ^ " difficulty" %>"> <%s danger problem.difficulty %></span>
8388
</h4>
84-
<div class="w-0 h-0 overflow-hidden"><%s Data.Problem.difficulty_to_string problem.difficulty ^ " difficulty" %></div>
89+
<div class="w-0 h-0 overflow-hidden"><%s difficulty_to_string problem.difficulty ^ " difficulty" %></div>
8590
<div class="flex bg-body-600 bg-opacity-5 rounded-md p-1 items-center">
8691
<button
8792
class="px-3.5 h-9 font-medium flex space-x-2 items-center rounded-lg"

0 commit comments

Comments
 (0)