userpanel.html 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>OCB - Stream Points and Rewards</title>
  5. <link rel="icon" type="image/x-icon" href="/static/img/favicon.ico">
  6. <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
  7. </head>
  8. <script src="/static/userpanel.js"></script>
  9. <div class="navbar">
  10. <div class="tab">
  11. <button class="tablinks" data-tab="ocbinfo" onclick="openTab(event, 'ocbinfo')">OwnchatBot Info</button>
  12. <button class="tablinks" data-tab="rewards" onclick="openTab(event, 'rewards')">Points and Rewards</button>
  13. <button class="tablinks" data-tab="queue" onclick="openTab(event, 'queue')">Redeems Queue</button>
  14. </div>
  15. <img src="/static/img/ownchatbotwide.png">
  16. </div>
  17. <div id='ocbinfo' class="tabcontent">
  18. <h3>OwnchatBot Info</h3>
  19. <h4>Reward types</h4>
  20. <ul>
  21. <li><u>Redeems</u> are standard stream point redeems. They get added to the queue for the streamer to fulfill.</li>
  22. <li><u>Votes</u> are just that, votes. You vote on them.</li>
  23. <li><u>Goals</u> are rewards that everyone in chat can contribute to. The streamer fulfills the reward when the goal is reached.</li>
  24. </ul>
  25. <h4>Chat commands</h4>
  26. <ul>
  27. <li>{{ prefix }}help - Shows the help message.</li>
  28. <li>{{ prefix }}points - Shows your current points.</li>
  29. <li>{{ prefix }}rewards - Shows you the list of active rewards.</li>
  30. </ul>
  31. </div>
  32. <div id='rewards' class="tabcontent">
  33. <body>
  34. <h3>Points and Rewards</h3>
  35. {% for user in users %}
  36. {% set points_label = 'point' if points_award == 1 else 'points' %}
  37. {% set minutes_label = 'minute' if points_interval == 1 else 'minutes' %}
  38. &nbsp;&nbsp;{{ user[0] }}, you currently have {{ user[1] }} {{ points_label }}.<br>
  39. &nbsp;&nbsp;You are accruing {{ points_award }} {{ points_label }} every {{ points_interval }} {{ minutes_label }}.
  40. {% endfor %}
  41. <h3>Active Votes</h3>
  42. <table>
  43. <thead>
  44. <tr>
  45. <th style="width: 20%;">Name</th>
  46. <th style="width: 40%;">Description</th>
  47. <th style="width: 20%;">Price</th>
  48. <th style="width: 20%;">Current Tally</th>
  49. </tr>
  50. </thead>
  51. <tbody>
  52. {% for vote in votes %}
  53. <tr>
  54. <td> {{ prefix }}{{ vote[0] }} </td>
  55. <td> {{ vote[2] }} </td>
  56. {% set points_label = 'point' if rewards[vote[0]]["price"] == 1 else 'points' %}
  57. <td> {{ rewards[vote[0]]["price"] }} {{ points_label }}</td>
  58. {% set votes_label = 'vote' if vote[1] == 1 else 'votes' %}
  59. <td> {{ vote[1] }} {{ votes_label }}</td>
  60. </tr>
  61. {% endfor %}
  62. </tbody>
  63. </table>
  64. <h3>Active Goals</h3>
  65. {% if goals %}
  66. <table>
  67. <thead>
  68. <tr>
  69. <th style="width: 20%;">Name</th>
  70. <th style="width: 40%;">Description</th>
  71. <th style="width: 25%;">Progress</th>
  72. <th></th>
  73. </tr>
  74. </thead>
  75. <tbody>
  76. {% for goal in goals %}
  77. <tr>
  78. <td> {{ prefix }}{{ goal[0] }} </td>
  79. <td> {{ goal[3] }} </td>
  80. {% set progress = goal[1] / goal[2] * 100 %}
  81. <td><div class="bar-light-grey bar-tiny bar-round">
  82. <div class="bar-round bar-blue" style="text-align: center; width:{{ goal[1] / goal[2] * 100 }}%;">{{ '%0.0f'| format(progress| float) }}%</div></td>
  83. {% if goal[1] == goal[2] %}
  84. <td> {{ goal[1] }} / {{ goal[2] }} <img src=/static/img/tada.png style="width: 24px; height: 24px;"></td>
  85. {% else %}
  86. <td> {{ goal[1] }} / {{ goal[2] }} </td>
  87. {% endif %}
  88. </tr>
  89. {% endfor %}
  90. </tbody>
  91. </table>
  92. {% else %}
  93. &nbsp;&nbsp;There are currently no active goals
  94. <br>
  95. {% endif %}
  96. </body>
  97. <body>
  98. <h3>Active Redeems</h3>
  99. {% if rewards %}
  100. <table>
  101. <thead>
  102. <tr>
  103. <th style="width: 20%;">Name</th>
  104. <th style="width: 40%;">Description</th>
  105. <th>Cool down</th>
  106. <th style="width: 25%;">Price</th>
  107. <th></th>
  108. </tr>
  109. </thead>
  110. <tbody>
  111. {% for reward, reward_info in rewards.items() %}
  112. {% if reward_info["type"] == "redeem" or reward_info["type"] == "special" %}
  113. <tr>
  114. <td>{{ prefix }}{{ reward }}</td>
  115. <td>{{ reward_info["info"] }}</td>
  116. {% if reward_info["cooldown"] > 0 %}
  117. {% set minutes_label = 'minute' if reward_info["cooldown"] == 1 else 'minutes' %}
  118. <td>{{ reward_info["cooldown"] }} {{ minutes_label }}</td>
  119. {% else %}
  120. <td>None</td>
  121. {% endif %}
  122. {% set points_label = 'point' if reward_info["price"] == 1 else 'points' %}
  123. <td>{{ reward_info["price"] }} {{ points_label }}</td>
  124. <td></td>
  125. </tr>
  126. {% endif %}
  127. {% endfor %}
  128. </tbody>
  129. </table>
  130. {% else %}
  131. &nbsp;&nbsp;There are currently no active redeems
  132. {% endif %}
  133. <br><br>
  134. </body>
  135. </div>
  136. <div id='queue' class="tabcontent">
  137. <body>
  138. <h3>Queue</h3>
  139. {% if queue %}
  140. <table>
  141. <thead>
  142. <tr>
  143. <th>Time</th>
  144. <th>Name</th>
  145. <th>Description</th>
  146. <th>User</th>
  147. <th></th>
  148. </tr>
  149. </thead>
  150. <tbody>
  151. {% for row in queue %}
  152. {% if not row[4] %}
  153. <tr>
  154. <td>{{ row[1].replace(tzinfo=utc_timezone).astimezone().strftime("%H:%M") }}</td>
  155. <td>{{ prefix }}{{ row[2] }}</td>
  156. <td>{{ all_rewards[row[2]]["info"] }}</td>
  157. {% if row[6] %}
  158. <td>{{ row[6] }}</td>
  159. {% else %}
  160. <td></td>
  161. {% endif %}
  162. </tr>
  163. {% endif %}
  164. {% endfor %}
  165. </tbody>
  166. </table>
  167. {% else %}
  168. &nbsp;&nbsp;The queue is currently empty
  169. {% endif %}
  170. </body>
  171. <br><br>
  172. </div><script>
  173. setTimeout(refreshPage, 30 * 1000);
  174. </script>
  175. </html>