home.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. {% extends 'base.html' %}
  2. {% block content %}
  3. {% if messages %}
  4. {% for message in messages %}
  5. <div class="alert alert-success alert-dismissible fade show" role="alert">
  6. {{ message }}
  7. <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
  8. </div>
  9. {% endfor %}
  10. {% else %}
  11. <br>
  12. {% endif %}
  13. {% if user.profile.playlists.all.count == 0 %}
  14. <div class="alert alert-success" role="alert">
  15. <h4 class="alert-heading">It's empty in here</h4>
  16. <p>
  17. There's no playlists in your UnTube right now. You can change that by heading over to <a href="{% url 'manage_playlists' %}" class="btn btn-sm btn-primary">Manage</a> to import some public playlists into your UnTube.
  18. {% if not user.profile.imported_yt_playlists %}
  19. Or you could always head over to your <a href="{% url 'profile' %}" class="btn btn-sm btn-primary">Profile</a> to import all of your public/private YouTube playlists.
  20. {% else %}
  21. Keep in mind that your own YouTube playlists will automatically be imported into UnTube.
  22. {% endif %}
  23. </p>
  24. </div>
  25. {% endif %}
  26. {% if import_successful %}
  27. <br>
  28. <br>
  29. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  30. <h1>Welcome to UnTube, {{ user.username|capfirst }}</h1>
  31. </div>
  32. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  33. <h2>{{ user.profile.playlists.all.count }} playlists from YouTube have been successfully imported.</h2>
  34. </div>
  35. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  36. <h3>You'll now be notified on the Dashboard whenever there's any new un-exported playlists on YouTube :)</h3>
  37. </div>
  38. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  39. <a href="{% url 'home' %}" class="btn btn-lg btn-success">Go to Dashboard</a>
  40. </div>
  41. {% else %}
  42. <!--
  43. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  44. <h1 class="h2">Dashboard</h1>
  45. <span><small>Logged in as <b>{{ user.username }}</b></small></span>
  46. </div>
  47. -->
  48. {% if user.profile.imported_yt_playlists %}
  49. <div hx-get="{% url 'user_playlists_updates' 'check-for-updates' %}" hx-trigger="load" hx-swap="outerHTML">
  50. </div>
  51. {% endif %}
  52. {% if watching %}
  53. <br>
  54. <div class="border border-5 rounded-3 border-primary p-3">
  55. <h3><span style="border-bottom: 3px #ffffff dashed;">Continue Watching</span><i class="fas fa-fire-alt ms-2" style="color: #d24646"></i></h3>
  56. <div class="row row-cols-1 row-cols-md-4 g-4 text-dark mt-0">
  57. {% for playlist in watching|slice:"0:3" %}
  58. <div class="col">
  59. <div class="card">
  60. <a style="background-color: #7e89c2;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  61. <div class="card-body">
  62. <h5 class="card-title">
  63. {{ playlist.name }}
  64. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  65. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  66. </h5>
  67. <p class="card-text">
  68. <span class="badge bg-{% if playlist.watch_time_left == "0secs." %}success{% else %}info{% endif %} text-white">{{ playlist.num_videos_watched }}/{{ playlist.video_count }} viewed</span>
  69. {% if playlist.watch_time_left != "0secs." %}<span class="badge bg-dark text-white">{{ playlist.watch_time_left }} left</span>{% endif %}
  70. </p>
  71. {% if playlist.tags.all %}
  72. <small>
  73. <i class="fas fa-tags fa-sm" style="color: yellow"></i>
  74. {% for tag in playlist.tags.all %}
  75. <span class="badge rounded-pill bg-primary mb-lg-1">
  76. {{ tag.name }}
  77. </span>
  78. {% endfor %}
  79. </small>
  80. {% endif %}
  81. </div>
  82. </a>
  83. </div>
  84. </div>
  85. {% if forloop.counter == 3 %}
  86. {% if watching.count|add:"-3" != 0 %}
  87. <div class="col">
  88. <div class="card">
  89. <a style="background-color: #7e89c2;" href="{% url 'all_playlists' 'watching' %}" class="list-group-item list-group-item-action" aria-current="true">
  90. <div class="card-body">
  91. <p class="card-text">
  92. <h3>+ {{ watching.count|add:"-3" }} more</h3>
  93. </p>
  94. </div>
  95. </a>
  96. </div>
  97. </div>
  98. {% endif %}
  99. {% endif %}
  100. {% endfor %}
  101. </div>
  102. </div>
  103. {% endif %}
  104. <br>
  105. <h3><span style="border-bottom: 3px #ffffff dashed;">Most viewed playlists</span> {% if user_playlists.count > 3 %}<a href="{% url 'all_playlists' 'all' %}" class="pt-1"><i class="fas fa-binoculars"></i> </a>{% endif %}</h3>
  106. {% if user_playlists %}
  107. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  108. {% for playlist in user_playlists|slice:"0:3" %}
  109. <div class="col">
  110. <div class="card">
  111. <a style="background-color: #35795b;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  112. <div class="card-body">
  113. <h5 class="card-title">
  114. #{{ forloop.counter }} <br><br>{{ playlist.name }}
  115. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  116. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  117. </h5>
  118. <p class="card-text">
  119. {% if playlist.description %}
  120. {{ playlist.description|truncatewords:"15" }}
  121. {% else %}
  122. No description
  123. {% endif %}
  124. </p>
  125. <small>
  126. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  127. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  128. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  129. </small>
  130. </div>
  131. </a>
  132. </div>
  133. </div>
  134. {% endfor %}
  135. </div>
  136. {% else %}
  137. <br>
  138. <h5>Nothing to see here... yet.</h5>
  139. {% endif %}
  140. <br>
  141. <h3><span style="border-bottom: 3px #ffffff dashed;">Recently Accessed</span> <i class="fas fa-redo fa-sm" style="color: #3c3fd2"></i></h3>
  142. {% if recently_accessed_playlists %}
  143. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  144. {% for playlist in recently_accessed_playlists %}
  145. <div class="col">
  146. <div class="card">
  147. <a style="background-color: #357779;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  148. <div class="card-body">
  149. <h5 class="card-title">
  150. {{ playlist.name }}
  151. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  152. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  153. </h5>
  154. <p class="card-text">
  155. {% if playlist.description %}
  156. {{ playlist.description|truncatewords:"15" }}
  157. {% else %}
  158. No description
  159. {% endif %}
  160. </p>
  161. <small>
  162. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  163. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  164. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  165. </small>
  166. </div>
  167. </a>
  168. </div>
  169. </div>
  170. {% endfor %}
  171. </div>
  172. {% else %}
  173. <br>
  174. <h5>You have no playlists ;-;</h5>
  175. {% endif %}
  176. <br>
  177. <h3><span style="border-bottom: 3px #ffffff dashed;">Recently Added</span></h3>
  178. {% if recently_added_playlists %}
  179. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  180. {% for playlist in recently_added_playlists %}
  181. <div class="col">
  182. <div class="card">
  183. <a style="background-color: #958a44;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  184. <div class="card-body">
  185. <h5 class="card-title">
  186. {{ playlist.name }}
  187. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  188. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  189. </h5>
  190. <p class="card-text">
  191. {% if playlist.description %}
  192. {{ playlist.description|truncatewords:"15" }}
  193. {% else %}
  194. No description
  195. {% endif %}
  196. </p>
  197. <small>
  198. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  199. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  200. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  201. </small>
  202. </div>
  203. </a>
  204. </div>
  205. </div>
  206. {% endfor %}
  207. </div>
  208. {% else %}
  209. <br>
  210. <h5>You have no playlists ;-;</h5>
  211. {% endif %}
  212. <br>
  213. {% endif %}
  214. {% endblock %}