home.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. {% extends 'base.html' %}
  2. {% block content %}
  3. {% if messages %}
  4. <br>
  5. {% for message in messages %}
  6. <div class="alert alert-success alert-dismissible fade show" role="alert">
  7. {{ message }}
  8. <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
  9. </div>
  10. {% endfor %}
  11. {% endif %}
  12. {% if import_successful %}
  13. <br>
  14. <br>
  15. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  16. <h1>Welcome to UnTube, {{ user.username|capfirst }}</h1>
  17. </div>
  18. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  19. <h2>{{ user.profile.playlists.all.count }} playlists from YouTube have been successfully imported.</h2>
  20. </div>
  21. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  22. <h3>You'll now be able to import/export playlists from YouTube and UnTube :)</h3>
  23. </div>
  24. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  25. <a href="{% url 'home' %}" class="btn btn-lg btn-success">Go to Dashboard</a>
  26. </div>
  27. {% else %}
  28. <!--
  29. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  30. <h1 class="h2">Dashboard</h1>
  31. <span><small>Logged in as <b>{{ user.username }}</b></small></span>
  32. </div>
  33. -->
  34. <div hx-get="{% url 'user_playlists_updates' 'check-for-updates' %}" hx-trigger="load" hx-swap="outerHTML">
  35. </div>
  36. {% if watching %}
  37. <br>
  38. <div class="border border-5 rounded-3 border-primary p-3">
  39. <h3><span style="border-bottom: 3px #ffffff dashed;">Continue Watching</span></h3>
  40. <div class="row row-cols-1 row-cols-md-4 g-4 text-dark mt-0">
  41. {% for playlist in watching|slice:"0:3" %}
  42. <div class="col">
  43. <div class="card">
  44. <a style="background-color: #7e89c2;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  45. <div class="card-body">
  46. <h5 class="card-title">
  47. {{ playlist.name }}
  48. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  49. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  50. </h5>
  51. <p class="card-text">
  52. <span class="badge bg-info text-white">15/23 viewed</span>
  53. <span class="badge bg-dark text-white">3hr. 4min. left</span>
  54. </p>
  55. <small>
  56. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  57. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  58. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  59. </small>
  60. </div>
  61. </a>
  62. </div>
  63. </div>
  64. {% if forloop.counter == 3 %}
  65. {% if watching.count|add:"-3" != 0 %}
  66. <div class="col">
  67. <div class="card">
  68. <a style="background-color: #7e89c2;" href="{% url 'all_playlists' 'watching' %}" class="list-group-item list-group-item-action" aria-current="true">
  69. <div class="card-body">
  70. <p class="card-text">
  71. <h3>+ {{ watching.count|add:"-3" }} more</h3>
  72. </p>
  73. </div>
  74. </a>
  75. </div>
  76. </div>
  77. {% endif %}
  78. {% endif %}
  79. {% endfor %}
  80. </div>
  81. </div>
  82. {% endif %}
  83. <br>
  84. <h3><span style="border-bottom: 3px #ffffff dashed;">Most viewed playlists</span> <a href="{% url 'all_playlists' 'all' %}" class="btn btn-sm btn-info">View All</a></h3>
  85. {% if user_playlists %}
  86. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  87. {% for playlist in user_playlists|slice:"0:3" %}
  88. <div class="col">
  89. <div class="card">
  90. <a style="background-color: #35795b;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  91. <div class="card-body">
  92. <h5 class="card-title">
  93. #{{ forloop.counter }} <br><br>{{ playlist.name }}
  94. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  95. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  96. </h5>
  97. <p class="card-text">
  98. {% if playlist.description %}
  99. {{ playlist.description|truncatewords:"15" }}
  100. {% else %}
  101. No description
  102. {% endif %}
  103. </p>
  104. <small>
  105. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  106. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  107. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  108. </small>
  109. </div>
  110. </a>
  111. </div>
  112. </div>
  113. {% endfor %}
  114. </div>
  115. {% else %}
  116. <h5>You have no playlists ;-;</h5>
  117. {% endif %}
  118. <br>
  119. <h3><span style="border-bottom: 3px #ffffff dashed;">Recently Accessed</span></h3>
  120. {% if recently_accessed_playlists %}
  121. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  122. {% for playlist in recently_accessed_playlists %}
  123. <div class="col">
  124. <div class="card">
  125. <a style="background-color: #357779;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  126. <div class="card-body">
  127. <h5 class="card-title">
  128. {{ playlist.name }}
  129. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  130. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  131. </h5>
  132. <p class="card-text">
  133. {% if playlist.description %}
  134. {{ playlist.description|truncatewords:"15" }}
  135. {% else %}
  136. No description
  137. {% endif %}
  138. </p>
  139. <small>
  140. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  141. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  142. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  143. </small>
  144. </div>
  145. </a>
  146. </div>
  147. </div>
  148. {% endfor %}
  149. </div>
  150. {% else %}
  151. <h5>You have no playlists ;-;</h5>
  152. {% endif %}
  153. <br>
  154. <h3><span style="border-bottom: 3px #ffffff dashed;">Recently Added</span></h3>
  155. {% if recently_added_playlists %}
  156. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  157. {% for playlist in recently_added_playlists %}
  158. <div class="col">
  159. <div class="card">
  160. <a style="background-color: #958a44;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  161. <div class="card-body">
  162. <h5 class="card-title">
  163. {{ playlist.name }}
  164. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  165. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  166. </h5>
  167. <p class="card-text">
  168. {% if playlist.description %}
  169. {{ playlist.description|truncatewords:"15" }}
  170. {% else %}
  171. No description
  172. {% endif %}
  173. </p>
  174. <small>
  175. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  176. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  177. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  178. </small>
  179. </div>
  180. </a>
  181. </div>
  182. </div>
  183. {% endfor %}
  184. </div>
  185. {% else %}
  186. <h5>You have no playlists ;-;</h5>
  187. {% endif %}
  188. <br>
  189. {% endif %}
  190. {% endblock %}