home.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. {% extends 'base.html' %}
  2. {% block content %}
  3. <br>
  4. {% if user.profile.playlists.all.count == 0 %}
  5. <div class="alert alert-success" role="alert">
  6. <h4 class="alert-heading">It's empty in here</h4>
  7. <p>
  8. 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.
  9. {% if not user.profile.imported_yt_playlists %}
  10. 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.
  11. {% else %}
  12. Keep in mind that your own YouTube playlists will automatically be imported into UnTube.
  13. {% endif %}
  14. </p>
  15. </div>
  16. {% endif %}
  17. {% if import_successful %}
  18. <br>
  19. <br>
  20. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  21. <h1>Welcome to UnTube, {{ user.username|capfirst }}</h1>
  22. </div>
  23. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  24. <h2>{{ user.profile.playlists.all.count }} playlists from YouTube have been successfully imported.</h2>
  25. </div>
  26. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  27. <h3>You'll now be notified on the Dashboard whenever there's any new un-exported playlists on YouTube :)</h3>
  28. </div>
  29. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  30. <a href="{% url 'home' %}" class="btn btn-lg btn-success">Go to Dashboard</a>
  31. </div>
  32. {% else %}
  33. <!--
  34. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  35. <h1 class="h2">Dashboard</h1>
  36. <span><small>Logged in as <b>{{ user.username }}</b></small></span>
  37. </div>
  38. -->
  39. {% if user.profile.imported_yt_playlists %}
  40. <div hx-get="{% url 'user_playlists_updates' 'check-for-updates' %}" hx-trigger="load" hx-swap="outerHTML">
  41. </div>
  42. {% endif %}
  43. {% if watching %}
  44. <div class="border border-5 rounded-3 border-primary p-3">
  45. <h3><span style="border-bottom: 3px #ffffff dashed;">Continue Watching</span><i class="fas fa-fire-alt ms-2" style="color: #d24646"></i></h3>
  46. <div class="row row-cols-1 row-cols-md-4 g-4 text-dark mt-0">
  47. {% for playlist in watching|slice:"0:3" %}
  48. <div class="col">
  49. <div class="card">
  50. <a style="background-color: #7e89c2;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  51. <div class="card-body">
  52. <h5 class="card-title">
  53. {{ playlist.name }}
  54. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  55. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  56. </h5>
  57. <p class="card-text">
  58. <span class="badge bg-{% if playlist.get_watch_time_left == "0secs." %}success{% else %}primary{% endif %} text-white">{{ playlist.get_watched_videos_count }}/{{ playlist.get_watchable_videos_count }} viewed</span>
  59. {% if playlist.get_watch_time_left != "0secs." %}<span class="badge bg-dark text-white">{{ playlist.get_watch_time_left }} left</span>{% endif %}
  60. </p>
  61. {% if playlist.tags.all %}
  62. <small>
  63. <i class="fas fa-tags fa-sm" style="color: yellow"></i>
  64. {% for tag in playlist.tags.all %}
  65. <span class="badge rounded-pill bg-primary mb-lg-1">
  66. {{ tag.name }}
  67. </span>
  68. {% endfor %}
  69. </small>
  70. {% endif %}
  71. </div>
  72. </a>
  73. </div>
  74. </div>
  75. {% if forloop.counter == 3 %}
  76. {% if watching.count|add:"-3" != 0 %}
  77. <div class="col">
  78. <div class="card">
  79. <a style="background-color: #7e89c2;" href="{% url 'all_playlists' 'watching' %}" class="list-group-item list-group-item-action" aria-current="true">
  80. <div class="card-body">
  81. <p class="card-text">
  82. <h3>+ {{ watching.count|add:"-3" }} more</h3>
  83. </p>
  84. </div>
  85. </a>
  86. </div>
  87. </div>
  88. {% endif %}
  89. {% endif %}
  90. {% endfor %}
  91. </div>
  92. </div>
  93. <br>
  94. {% endif %}
  95. <div class="row text-dark mt-0 align-items-center">
  96. <div class="col">
  97. <div class="row">
  98. <div class="col">
  99. <div class="card" style="background: linear-gradient(-45deg, #aaae6b, #7b8eab, #8abc97, #e666f5); background-size: 400% 400%; animation: gradient 7s ease infinite;">
  100. <a href="#" class="list-group-item bg-transparent list-group-item-action" aria-current="true">
  101. <div class="card-body">
  102. <div class="d-flex justify-content-center h1">
  103. <i class="fas fa-map-pin" style="color:#c22929"></i>
  104. </div>
  105. <div class="d-flex justify-content-center h1">
  106. YOUR
  107. </div>
  108. <div class="d-flex justify-content-center h1">
  109. PINS
  110. </div>
  111. </div>
  112. </a>
  113. </div>
  114. </div>
  115. <div class="col">
  116. <div class="card" style="background: linear-gradient(-45deg, #0645a4, #2480cd, #84bcf3, #b7d6f7); background-size: 400% 400%; animation: gradient 7s ease infinite;">
  117. <a href="#" class="list-group-item list-group-item-action bg-transparent" aria-current="true">
  118. <div class="card-body">
  119. <div class="d-flex justify-content-center h1">
  120. <i class="fas fa-heart" style="color: indianred"></i>
  121. </div>
  122. <div class="d-flex justify-content-center h1">
  123. LIKED
  124. </div>
  125. <div class="d-flex justify-content-center h1">
  126. VIDEOS
  127. </div>
  128. </div>
  129. </a>
  130. </div>
  131. </div>
  132. </div>
  133. <!-- Implement later
  134. <div class="row mt-3">
  135. <div class="col">
  136. </div>
  137. <div class="col-6">
  138. <div class="card">
  139. <a style="background: linear-gradient(-45deg, #e2b968, #68af5b, #8a97bc, #d69ab2); background-size: 400% 400%; animation: gradient 7s ease infinite;" href="#" class="list-group-item list-group-item-action" aria-current="true">
  140. <div class="card-body">
  141. <div class="d-flex justify-content-center h1">
  142. <i class="fas fa-history"></i>
  143. </div>
  144. <div class="d-flex justify-content-center h1">
  145. YOUR
  146. </div>
  147. <div class="d-flex justify-content-center h1">
  148. ACTIVITY
  149. </div>
  150. </div>
  151. </a>
  152. </div>
  153. </div>
  154. <div class="col">
  155. </div>
  156. </div>
  157. -->
  158. </div>
  159. <div class="col-8">
  160. <div class="card bg-transparent text-black border border-5 rounded-3 border-success p-3">
  161. <div class="card-body">
  162. <h3><span style="border-bottom: 3px #ffffff dashed;">Most viewed playlists</span> <a href="{% url 'all_playlists' 'all' %}" class="pt-1"><i class="fas fa-binoculars"></i> </a></h3>
  163. {% if user_playlists %}
  164. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  165. {% for playlist in user_playlists|slice:"0:3" %}
  166. <div class="col">
  167. <div class="card overflow-auto" style="background-color: #4790c7;">
  168. <a href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item bg-transparent list-group-item-action" aria-current="true">
  169. <div class="card-body">
  170. <h5 class="card-title">
  171. #{{ forloop.counter }} <br><br>{{ playlist.name }}
  172. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  173. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  174. </h5>
  175. <small>
  176. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  177. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  178. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  179. </small>
  180. </div>
  181. </a>
  182. </div>
  183. </div>
  184. {% endfor %}
  185. </div>
  186. {% else %}
  187. <br>
  188. <h5>Nothing to see here... yet.</h5>
  189. {% endif %}
  190. </div>
  191. </div>
  192. </div>
  193. </div>
  194. <br>
  195. <div class="row text-dark mt-0 d-flex justify-content-evenly">
  196. <div class="col">
  197. <h3><span style="border-bottom: 3px #ffffff dashed;">Recently Added</span> <i class="fas fa-plus-square" style="color:#972727;"></i></h3>
  198. {% if recently_added_playlists %}
  199. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  200. {% for playlist in recently_added_playlists %}
  201. <div class="col">
  202. <div class="card overflow-auto" style="background-color: #958a44;">
  203. <a href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item bg-transparent list-group-item-action" aria-current="true">
  204. <div class="card-body">
  205. <h5 class="card-title">
  206. {{ playlist.name }}
  207. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  208. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  209. </h5>
  210. <small>
  211. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  212. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  213. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  214. </small>
  215. </div>
  216. </a>
  217. </div>
  218. </div>
  219. {% endfor %}
  220. </div>
  221. {% else %}
  222. <br>
  223. <h5>You have no playlists ;-;</h5>
  224. {% endif %}
  225. </div>
  226. <div class="col">
  227. <h3><span style="border-bottom: 3px #ffffff dashed;">Recently Accessed</span> <i class="fas fa-redo fa-sm" style="color: #3c3fd2"></i></h3>
  228. {% if recently_accessed_playlists %}
  229. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  230. {% for playlist in recently_accessed_playlists %}
  231. <div class="col">
  232. <div class="card overflow-auto" style="background-color: #357779;">
  233. <a href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item bg-transparent list-group-item-action" aria-current="true">
  234. <div class="card-body">
  235. <h5 class="card-title">
  236. {{ playlist.name }}
  237. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  238. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  239. </h5>
  240. <small>
  241. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  242. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  243. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  244. </small>
  245. </div>
  246. </a>
  247. </div>
  248. </div>
  249. {% endfor %}
  250. </div>
  251. {% else %}
  252. <br>
  253. <h5>Nothing to see here... yet.</h5>
  254. {% endif %}
  255. </div>
  256. </div>
  257. <br>
  258. <br>
  259. {% endif %}
  260. {% endblock %}