|
| 1 | +<div {{ attributes }}> |
| 2 | + <h3 class="h4 mt-5 mb-0">{{ 'hub.most_solved_puzzle'|trans }}</h3> |
| 3 | + |
| 4 | + <ul class="nav nav-fill nav-tabs mt-0" role="tablist"> |
| 5 | + <li class="nav-item"> |
| 6 | + <a class="nav-link {{ this.timespan == 'this_month' ? 'active' }}" |
| 7 | + href="#" |
| 8 | + data-action="live#action" |
| 9 | + data-live-action-param="changeTimespan" |
| 10 | + data-live-timespan-param="this_month" |
| 11 | + > |
| 12 | + <div class="text-center"> |
| 13 | + <h6 class="media-tab-title text-nowrap pt-2 mb-0">{{ 'hub.this_month'|trans|raw }}</h6> |
| 14 | + </div> |
| 15 | + </a> |
| 16 | + </li> |
| 17 | + |
| 18 | + <li class="nav-item"> |
| 19 | + <a class="nav-link {{ this.timespan == 'last_month' ? 'active' }}" |
| 20 | + href="#" |
| 21 | + data-action="live#action" |
| 22 | + data-live-action-param="changeTimespan" |
| 23 | + data-live-timespan-param="last_month" |
| 24 | + > |
| 25 | + <div class="text-center"> |
| 26 | + <h6 class="media-tab-title text-nowrap pt-2 mb-0">{{ 'hub.last_month'|trans|raw }}</h6> |
| 27 | + </div> |
| 28 | + </a> |
| 29 | + </li> |
| 30 | + |
| 31 | + <li class="nav-item"> |
| 32 | + <a class="nav-link {{ this.timespan == 'all_time' ? 'active' }}" |
| 33 | + href="#" |
| 34 | + data-action="live#action" |
| 35 | + data-live-action-param="changeTimespan" |
| 36 | + data-live-timespan-param="all_time" |
| 37 | + > |
| 38 | + <div class="text-center"> |
| 39 | + <h6 class="media-tab-title text-nowrap pt-2 mb-0">{{ 'hub.all_time'|trans|raw }}</h6> |
| 40 | + </div> |
| 41 | + </a> |
| 42 | + </li> |
| 43 | + </ul> |
| 44 | + |
| 45 | + <div data-controller="show-more-recent-activity"> |
| 46 | + <div class="table-responsive custom-table-wrapper"> |
| 47 | + <table class="table table-striped table-hover mb-0"> |
| 48 | + <tbody> |
| 49 | + {% set ranking = this.ranking %} |
| 50 | + {% for most_solved_puzzle in this.puzzles %} |
| 51 | + <tr class="{{ this.showLimit > 0 and loop.index > this.showLimit ? 'd-none' }}"> |
| 52 | + <td class="text-center"> |
| 53 | + <a href="{{ path('puzzle_detail', {puzzleId: most_solved_puzzle.puzzleId}) }}"> |
| 54 | + <img class="rounded-2" style="max-width: 80px;max-height: 80px;" alt="{{ 'puzzle_img_alt'|trans({'%puzzle%': most_solved_puzzle.manufacturerName ~ ' ' ~ most_solved_puzzle.puzzleName}) }}" src="{{ most_solved_puzzle.puzzleImage|puzzle_image('puzzle_small') }}"> |
| 55 | + </a> |
| 56 | + </td> |
| 57 | + |
| 58 | + <td class="d-none d-sm-table-cell"> |
| 59 | + <a class="d-inline-block" style="line-height: 120%" href="{{ path('puzzle_detail', {puzzleId: most_solved_puzzle.puzzleId}) }}"> |
| 60 | + <span style="color: #111;"> |
| 61 | + {{ most_solved_puzzle.manufacturerName }}<br> |
| 62 | + <small>{{ 'pieces_count'|trans({ '%count%': most_solved_puzzle.piecesCount })|raw }}</small> |
| 63 | + </span><br> |
| 64 | + |
| 65 | + <small class="puzzle-title mt-2"> |
| 66 | + {{ most_solved_puzzle.puzzleName }} |
| 67 | + </small> |
| 68 | + </a> |
| 69 | + </td> |
| 70 | + |
| 71 | + <td> |
| 72 | + <small style="color: #000;">{{ 'puzzle_solved_times'|trans({'%count%': most_solved_puzzle.solvedTimes})|capitalize|raw }}</small><br> |
| 73 | + |
| 74 | + <p class="mt-0 mb-1 d-sm-none low-line-height"> |
| 75 | + <a href="{{ path('puzzle_detail', {puzzleId: most_solved_puzzle.puzzleId}) }}"> |
| 76 | + <small>{{ most_solved_puzzle.manufacturerName }}</small><br> |
| 77 | + <small>{{ 'pieces_count'|trans({ '%count%': most_solved_puzzle.piecesCount })|raw }}</small> |
| 78 | + </a> |
| 79 | + </p> |
| 80 | + </td> |
| 81 | + <td class="text-end"> |
| 82 | + <small class="low-line-height d-inline-block">{{ 'fastest_time_short'|trans({ '%time%': most_solved_puzzle.fastestTimeSolo|puzzlingTime }) }}</small> |
| 83 | + |
| 84 | + {% if logged_user.profile is not null %} |
| 85 | + {% if ranking[most_solved_puzzle.puzzleId] is defined %} |
| 86 | + <br> |
| 87 | + <small class="mt-1 low-line-height d-inline-block">{{ 'my_time'|trans }} {{ ranking[most_solved_puzzle.puzzleId].time|puzzlingTime }}</small> |
| 88 | + {% endif %} |
| 89 | + {% endif %} |
| 90 | + </td> |
| 91 | + </tr> |
| 92 | + {% endfor %} |
| 93 | + </tbody> |
| 94 | + </table> |
| 95 | + </div> |
| 96 | + |
| 97 | + {% if this.showLimit > 0 and this.puzzles|length > this.showLimit %} |
| 98 | + <button class="mt-3 btn btn-outline-primary btn-sm" data-action="click->show-more-recent-activity#revealRows" data-show-more-recent-activity-target="button">{{ 'show_more'|trans }}</button> |
| 99 | + {% endif %} |
| 100 | + </div> |
| 101 | +</div> |
| 102 | + |
| 103 | +{% macro placeholder(props) %} |
| 104 | + <div> |
| 105 | + <h3 class="h4 mt-5 mb-0">{{ 'hub.most_solved_puzzle'|trans }}</h3> |
| 106 | + |
| 107 | + <ul class="nav nav-fill nav-tabs mt-0" role="tablist"> |
| 108 | + <li class="nav-item"> |
| 109 | + <a class="nav-link active" href="#"> |
| 110 | + <div class="text-center"> |
| 111 | + <h6 class="media-tab-title text-nowrap pt-2 mb-0">{{ 'hub.this_month'|trans|raw }}</h6> |
| 112 | + </div> |
| 113 | + </a> |
| 114 | + </li> |
| 115 | + <li class="nav-item"> |
| 116 | + <a class="nav-link" href="#"> |
| 117 | + <div class="text-center"> |
| 118 | + <h6 class="media-tab-title text-nowrap pt-2 mb-0">{{ 'hub.last_month'|trans|raw }}</h6> |
| 119 | + </div> |
| 120 | + </a> |
| 121 | + </li> |
| 122 | + <li class="nav-item"> |
| 123 | + <a class="nav-link" href="#"> |
| 124 | + <div class="text-center"> |
| 125 | + <h6 class="media-tab-title text-nowrap pt-2 mb-0">{{ 'hub.all_time'|trans|raw }}</h6> |
| 126 | + </div> |
| 127 | + </a> |
| 128 | + </li> |
| 129 | + </ul> |
| 130 | + |
| 131 | + <div class="table-responsive custom-table-wrapper"> |
| 132 | + <table class="table table-striped table-hover mb-0 placeholder-glow"> |
| 133 | + <tbody> |
| 134 | + {% set rowCount = props.showLimit > 0 ? props.showLimit : props.limit|default(4) %} |
| 135 | + {% for i in 1..rowCount %} |
| 136 | + <tr> |
| 137 | + <td class="text-center"> |
| 138 | + <span class="rounded-2 d-inline-block" style="width: 80px; height: 58px; background: #e9ecef;"></span> |
| 139 | + </td> |
| 140 | + <td class="d-none d-sm-table-cell"> |
| 141 | + <span class="d-inline-block" style="line-height: 120%;"> |
| 142 | + <span style="color: #111;"> |
| 143 | + <span class="placeholder" style="width: 85px;"></span><br> |
| 144 | + <small><span class="placeholder placeholder-sm" style="width: 55px;"></span></small> |
| 145 | + </span><br> |
| 146 | + <small class="puzzle-title mt-2"><span class="placeholder placeholder-sm" style="width: 110px;"></span></small> |
| 147 | + </span> |
| 148 | + </td> |
| 149 | + <td> |
| 150 | + <small><span class="placeholder" style="width: 75px;"></span></small><br> |
| 151 | + <p class="mt-0 mb-1 d-sm-none low-line-height"> |
| 152 | + <small><span class="placeholder placeholder-sm" style="width: 65px;"></span></small><br> |
| 153 | + <small><span class="placeholder placeholder-sm" style="width: 45px;"></span></small> |
| 154 | + </p> |
| 155 | + </td> |
| 156 | + <td class="text-end"> |
| 157 | + <small class="low-line-height d-inline-block"> |
| 158 | + <span class="placeholder placeholder-sm" style="width: 70px;"></span> |
| 159 | + </small> |
| 160 | + </td> |
| 161 | + </tr> |
| 162 | + {% endfor %} |
| 163 | + </tbody> |
| 164 | + </table> |
| 165 | + </div> |
| 166 | + |
| 167 | + {% if props.showLimit > 0 %} |
| 168 | + <button class="mt-3 btn btn-outline-primary btn-sm disabled" style="width: 100px;"> |
| 169 | + <span class="spinner-border spinner-border-sm"></span> |
| 170 | + </button> |
| 171 | + {% endif %} |
| 172 | + </div> |
| 173 | +{% endmacro %} |
0 commit comments