home.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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. <div class="row row-cols-1 row-cols-md-4 g-4 text-dark d-flex justify-content-center">
  44. <div class="col">
  45. <div class="card">
  46. <a style="background: linear-gradient(-45deg, #ae6ba3, #ab7b91, #bc8a9a, #d69aa1); background-size: 400% 400%; animation: gradient 7s ease infinite;" href="#" class="list-group-item list-group-item-action" aria-current="true">
  47. <div class="card-body">
  48. <div class="d-flex justify-content-center h1">
  49. <i class="fas fa-map-pin"></i>
  50. </div>
  51. <div class="d-flex justify-content-center h1">
  52. YOUR
  53. </div>
  54. <div class="d-flex justify-content-center h1">
  55. PINS
  56. </div>
  57. </div>
  58. </a>
  59. </div>
  60. </div>
  61. <div class="col">
  62. <div class="card">
  63. <a style="background: linear-gradient(-45deg, #0645a4, #2480cd, #84bcf3, #b7d6f7); background-size: 400% 400%; animation: gradient 7s ease infinite;" href="#" class="list-group-item list-group-item-action" aria-current="true">
  64. <div class="card-body">
  65. <div class="d-flex justify-content-center h1">
  66. <i class="fas fa-thumbs-up"></i>
  67. </div>
  68. <div class="d-flex justify-content-center h1">
  69. LIKED
  70. </div>
  71. <div class="d-flex justify-content-center h1">
  72. VIDEOS
  73. </div>
  74. </div>
  75. </a>
  76. </div>
  77. </div>
  78. <div class="col">
  79. <div class="card">
  80. <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">
  81. <div class="card-body">
  82. <div class="d-flex justify-content-center h1">
  83. <i class="fas fa-history"></i>
  84. </div>
  85. <div class="d-flex justify-content-center h1">
  86. YOUR
  87. </div>
  88. <div class="d-flex justify-content-center h1">
  89. ACTIVITY
  90. </div>
  91. </div>
  92. </a>
  93. </div>
  94. </div>
  95. </div>
  96. <br>
  97. {% if watching %}
  98. <div class="border border-5 rounded-3 border-primary p-3">
  99. <h3><span style="border-bottom: 3px #ffffff dashed;">Continue Watching</span><i class="fas fa-fire-alt ms-2" style="color: #d24646"></i></h3>
  100. <div class="row row-cols-1 row-cols-md-4 g-4 text-dark mt-0">
  101. {% for playlist in watching|slice:"0:3" %}
  102. <div class="col">
  103. <div class="card">
  104. <a style="background-color: #7e89c2;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  105. <div class="card-body">
  106. <h5 class="card-title">
  107. {{ playlist.name }}
  108. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  109. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  110. </h5>
  111. <p class="card-text">
  112. <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>
  113. {% if playlist.get_watch_time_left != "0secs." %}<span class="badge bg-dark text-white">{{ playlist.get_watch_time_left }} left</span>{% endif %}
  114. </p>
  115. {% if playlist.tags.all %}
  116. <small>
  117. <i class="fas fa-tags fa-sm" style="color: yellow"></i>
  118. {% for tag in playlist.tags.all %}
  119. <span class="badge rounded-pill bg-primary mb-lg-1">
  120. {{ tag.name }}
  121. </span>
  122. {% endfor %}
  123. </small>
  124. {% endif %}
  125. </div>
  126. </a>
  127. </div>
  128. </div>
  129. {% if forloop.counter == 3 %}
  130. {% if watching.count|add:"-3" != 0 %}
  131. <div class="col">
  132. <div class="card">
  133. <a style="background-color: #7e89c2;" href="{% url 'all_playlists' 'watching' %}" class="list-group-item list-group-item-action" aria-current="true">
  134. <div class="card-body">
  135. <p class="card-text">
  136. <h3>+ {{ watching.count|add:"-3" }} more</h3>
  137. </p>
  138. </div>
  139. </a>
  140. </div>
  141. </div>
  142. {% endif %}
  143. {% endif %}
  144. {% endfor %}
  145. </div>
  146. </div>
  147. <br>
  148. {% endif %}
  149. <div class="row text-dark mt-0 d-flex justify-content-evenly">
  150. <div class="col">
  151. <div class="card bg-dark text-white">
  152. <div class="card-body">
  153. <h6 class="d-flex align-items-center mb-3"><span class="text-info me-2">{{ user.profile.playlists.count }}</span>Playlists Statistics</h6>
  154. <small>Public <span class="text-warning ms-1">{{ statistics.public_x }}%</span></small>
  155. <div class="progress mb-3" style="height: 5px">
  156. <div class="progress-bar bg-primary" role="progressbar" style="width: {{ statistics.public_x }}%" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100"></div>
  157. </div>
  158. <small>Private <span class="text-warning ms-1">{{ statistics.private_x }}%</span></small>
  159. <div class="progress mb-3" style="height: 5px">
  160. <div class="progress-bar bg-primary" role="progressbar" style="width: {{ statistics.private_x }}%" aria-valuenow="72" aria-valuemin="0" aria-valuemax="100"></div>
  161. </div>
  162. <small>Favorites <span class="text-warning ms-1">{{ statistics.favorites_x }}%</span></small>
  163. <div class="progress mb-3" style="height: 5px">
  164. <div class="progress-bar bg-primary" role="progressbar" style="width: {{ statistics.favorites_x }}%" aria-valuenow="89" aria-valuemin="0" aria-valuemax="100"></div>
  165. </div>
  166. <small>Watching <span class="text-warning ms-1">{{ statistics.watching_x }}%</span></small>
  167. <div class="progress mb-3" style="height: 5px">
  168. <div class="progress-bar bg-primary" role="progressbar" style="width: {{ statistics.watching_x }}%" aria-valuenow="55" aria-valuemin="0" aria-valuemax="100"></div>
  169. </div>
  170. <small>Imported <span class="text-warning ms-1">{{ statistics.imported_x }}%</span></small>
  171. <div class="progress mb-3" style="height: 5px">
  172. <div class="progress-bar bg-primary" role="progressbar" style="width: {{ statistics.imported_x }}%" aria-valuenow="66" aria-valuemin="0" aria-valuemax="100"></div>
  173. </div>
  174. </div>
  175. </div>
  176. </div>
  177. <div class="col">
  178. <div class="card bg-transparent text-black border border-5 rounded-3 border-success p-3">
  179. <div class="card-body">
  180. <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>
  181. {% if user_playlists %}
  182. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  183. {% for playlist in user_playlists|slice:"0:3" %}
  184. <div class="col">
  185. <div class="card">
  186. <a style="background-color: #4790c7;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  187. <div class="card-body">
  188. <h5 class="card-title">
  189. #{{ forloop.counter }} <br><br>{{ playlist.name }}
  190. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  191. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  192. </h5>
  193. <small>
  194. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  195. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  196. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  197. </small>
  198. </div>
  199. </a>
  200. </div>
  201. </div>
  202. {% endfor %}
  203. </div>
  204. {% else %}
  205. <br>
  206. <h5>Nothing to see here... yet.</h5>
  207. {% endif %}
  208. </div>
  209. </div>
  210. </div>
  211. </div>
  212. <br>
  213. <div class="row text-dark mt-0 d-flex justify-content-evenly">
  214. <div class="col">
  215. <h3><span style="border-bottom: 3px #ffffff dashed;">Recently Added</span> <i class="fas fa-plus-square" style="color:#972727;"></i></h3>
  216. {% if recently_added_playlists %}
  217. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  218. {% for playlist in recently_added_playlists %}
  219. <div class="col">
  220. <div class="card">
  221. <a style="background-color: #958a44;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  222. <div class="card-body">
  223. <h5 class="card-title">
  224. {{ playlist.name }}
  225. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  226. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  227. </h5>
  228. <small>
  229. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  230. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  231. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  232. </small>
  233. </div>
  234. </a>
  235. </div>
  236. </div>
  237. {% endfor %}
  238. </div>
  239. {% else %}
  240. <br>
  241. <h5>You have no playlists ;-;</h5>
  242. {% endif %}
  243. </div>
  244. <div class="col">
  245. <h3><span style="border-bottom: 3px #ffffff dashed;">Recently Accessed</span> <i class="fas fa-redo fa-sm" style="color: #3c3fd2"></i></h3>
  246. {% if recently_accessed_playlists %}
  247. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  248. {% for playlist in recently_accessed_playlists %}
  249. <div class="col">
  250. <div class="card">
  251. <a style="background-color: #357779;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  252. <div class="card-body">
  253. <h5 class="card-title">
  254. {{ playlist.name }}
  255. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  256. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  257. </h5>
  258. <small>
  259. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  260. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  261. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  262. </small>
  263. </div>
  264. </a>
  265. </div>
  266. </div>
  267. {% endfor %}
  268. </div>
  269. {% else %}
  270. <br>
  271. <h5>Nothing to see here... yet.</h5>
  272. {% endif %}
  273. </div>
  274. </div>
  275. <br>
  276. <br>
  277. {% endif %}
  278. {% endblock %}