home.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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-info text-white">15/23 viewed</span>
  69. <span class="badge bg-dark text-white">3hr. 4min. left</span>
  70. </p>
  71. <small>
  72. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  73. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  74. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  75. </small>
  76. </div>
  77. </a>
  78. </div>
  79. </div>
  80. {% if forloop.counter == 3 %}
  81. {% if watching.count|add:"-3" != 0 %}
  82. <div class="col">
  83. <div class="card">
  84. <a style="background-color: #7e89c2;" href="{% url 'all_playlists' 'watching' %}" class="list-group-item list-group-item-action" aria-current="true">
  85. <div class="card-body">
  86. <p class="card-text">
  87. <h3>+ {{ watching.count|add:"-3" }} more</h3>
  88. </p>
  89. </div>
  90. </a>
  91. </div>
  92. </div>
  93. {% endif %}
  94. {% endif %}
  95. {% endfor %}
  96. </div>
  97. </div>
  98. {% endif %}
  99. <br>
  100. <h3><span style="border-bottom: 3px #ffffff dashed;">Most viewed playlists</span> {% if user_playlists.count > 3 %}<a href="{% url 'all_playlists' 'all' %}" class="btn btn-sm btn-info">View All</a>{% endif %}</h3>
  101. {% if user_playlists %}
  102. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  103. {% for playlist in user_playlists|slice:"0:3" %}
  104. <div class="col">
  105. <div class="card">
  106. <a style="background-color: #35795b;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  107. <div class="card-body">
  108. <h5 class="card-title">
  109. #{{ forloop.counter }} <br><br>{{ playlist.name }}
  110. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  111. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  112. </h5>
  113. <p class="card-text">
  114. {% if playlist.description %}
  115. {{ playlist.description|truncatewords:"15" }}
  116. {% else %}
  117. No description
  118. {% endif %}
  119. </p>
  120. <small>
  121. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  122. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  123. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  124. </small>
  125. </div>
  126. </a>
  127. </div>
  128. </div>
  129. {% endfor %}
  130. </div>
  131. {% else %}
  132. <br>
  133. <h5>Nothing to see here... yet.</h5>
  134. {% endif %}
  135. <br>
  136. <h3><span style="border-bottom: 3px #ffffff dashed;">Recently Accessed</span></h3>
  137. {% if recently_accessed_playlists %}
  138. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  139. {% for playlist in recently_accessed_playlists %}
  140. <div class="col">
  141. <div class="card">
  142. <a style="background-color: #357779;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  143. <div class="card-body">
  144. <h5 class="card-title">
  145. {{ playlist.name }}
  146. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  147. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  148. </h5>
  149. <p class="card-text">
  150. {% if playlist.description %}
  151. {{ playlist.description|truncatewords:"15" }}
  152. {% else %}
  153. No description
  154. {% endif %}
  155. </p>
  156. <small>
  157. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  158. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  159. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  160. </small>
  161. </div>
  162. </a>
  163. </div>
  164. </div>
  165. {% endfor %}
  166. </div>
  167. {% else %}
  168. <br>
  169. <h5>You have no playlists ;-;</h5>
  170. {% endif %}
  171. <br>
  172. <h3><span style="border-bottom: 3px #ffffff dashed;">Recently Added</span></h3>
  173. {% if recently_added_playlists %}
  174. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  175. {% for playlist in recently_added_playlists %}
  176. <div class="col">
  177. <div class="card">
  178. <a style="background-color: #958a44;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  179. <div class="card-body">
  180. <h5 class="card-title">
  181. {{ playlist.name }}
  182. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  183. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  184. </h5>
  185. <p class="card-text">
  186. {% if playlist.description %}
  187. {{ playlist.description|truncatewords:"15" }}
  188. {% else %}
  189. No description
  190. {% endif %}
  191. </p>
  192. <small>
  193. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  194. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  195. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  196. </small>
  197. </div>
  198. </a>
  199. </div>
  200. </div>
  201. {% endfor %}
  202. </div>
  203. {% else %}
  204. <br>
  205. <h5>You have no playlists ;-;</h5>
  206. {% endif %}
  207. <br>
  208. {% endif %}
  209. {% endblock %}