home.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  29. <h1 class="h2">Dashboard</h1>
  30. <span><small>Logged in as <b>{{ user.username }}</b></small></span>
  31. </div>
  32. <div hx-get="{% url 'user_playlists_updates' 'check-for-updates' %}" hx-trigger="load" hx-swap="outerHTML">
  33. </div>
  34. <div class="accordion" id="accordionExample">
  35. <div class="accordion-item bg-dark text-white">
  36. <h2 class="accordion-header" id="headingTwo">
  37. <button style="background-color: #cdc6e2" class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
  38. Statistics
  39. </button>
  40. </h2>
  41. <div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample">
  42. <div class="accordion-body d-flex justify-content-evenly">
  43. <div class="card" style="width: 18rem;">
  44. <div class="card-body text-black-50">
  45. <h5 class="card-title">25 total playlists</h5>
  46. <ul>
  47. <h5 class="card-title">24 owned</h5>
  48. <ul>
  49. <h5 class="card-title">4 private</h5>
  50. <h5 class="card-title">24 public</h5>
  51. </ul>
  52. <h5 class="card-title">36 Imported</h5>
  53. <ul>
  54. <h5 class="card-title">24 mixes</h5>
  55. <h5 class="card-title">12 others</h5>
  56. </ul>
  57. </ul>
  58. </div>
  59. </div>
  60. <div class="card" style="width: 18rem;">
  61. <div class="card-body">
  62. <h5 class="card-title">Card title</h5>
  63. <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
  64. <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
  65. <a href="#" class="card-link">Card link</a>
  66. <a href="#" class="card-link">Another link</a>
  67. </div>
  68. </div>
  69. <div class="card" style="width: 18rem;">
  70. <div class="card-body">
  71. <h5 class="card-title">Card title</h5>
  72. <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
  73. <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
  74. <a href="#" class="card-link">Card link</a>
  75. <a href="#" class="card-link">Another link</a>
  76. </div>
  77. </div>
  78. <div class="card" style="width: 18rem;">
  79. <div class="card-body">
  80. <h5 class="card-title">Card title</h5>
  81. <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
  82. <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
  83. <a href="#" class="card-link">Card link</a>
  84. <a href="#" class="card-link">Another link</a>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. {% if watching %}
  92. <br>
  93. <div class="border border-5 rounded-3 border-primary p-3">
  94. <h3>Continue Watching</h3>
  95. <div class="row row-cols-1 row-cols-md-4 g-4 text-dark mt-0">
  96. {% for playlist in watching|slice:"0:3" %}
  97. <div class="col">
  98. <div class="card">
  99. <a style="background-color: #7e89c2;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  100. <div class="card-body">
  101. <h5 class="card-title">
  102. {{ playlist.name }}
  103. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  104. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  105. </h5>
  106. <p class="card-text">
  107. <span class="badge bg-info text-white">15/23 viewed</span>
  108. <span class="badge bg-dark text-white">3hr. 4min. left</span>
  109. </p>
  110. <small>
  111. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  112. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  113. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  114. </small>
  115. </div>
  116. </a>
  117. </div>
  118. </div>
  119. {% if forloop.counter == 3 %}
  120. {% if watching.count|add:"-3" != 0 %}
  121. <div class="col">
  122. <div class="card">
  123. <a style="background-color: #7e89c2;" href="{% url 'all_playlists' 'watching' %}" class="list-group-item list-group-item-action" aria-current="true">
  124. <div class="card-body">
  125. <p class="card-text">
  126. <h3>+ {{ watching.count|add:"-3" }} more</h3>
  127. </p>
  128. </div>
  129. </a>
  130. </div>
  131. </div>
  132. {% endif %}
  133. {% endif %}
  134. {% endfor %}
  135. </div>
  136. </div>
  137. {% endif %}
  138. <br>
  139. <h3>Most viewed playlists <a href="{% url 'all_playlists' 'all' %}" class="btn btn-sm btn-info">View All</a></h3>
  140. {% if user_playlists %}
  141. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  142. {% for playlist in user_playlists|slice:"0:3" %}
  143. <div class="col">
  144. <div class="card">
  145. <a style="background-color: #35795b;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  146. <div class="card-body">
  147. <h5 class="card-title">
  148. #{{ forloop.counter }} <br><br>{{ playlist.name }}
  149. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  150. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  151. </h5>
  152. <p class="card-text">
  153. {% if playlist.description %}
  154. {{ playlist.description|truncatewords:"15" }}
  155. {% else %}
  156. No description
  157. {% endif %}
  158. </p>
  159. <small>
  160. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  161. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  162. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  163. </small>
  164. </div>
  165. </a>
  166. </div>
  167. </div>
  168. {% endfor %}
  169. </div>
  170. {% else %}
  171. <h5>You have no playlists ;-;</h5>
  172. {% endif %}
  173. <br>
  174. <h3>Recently Accessed</h3>
  175. {% if recently_accessed_playlists %}
  176. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  177. {% for playlist in recently_accessed_playlists %}
  178. <div class="col">
  179. <div class="card">
  180. <a style="background-color: #357779;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  181. <div class="card-body">
  182. <h5 class="card-title">
  183. {{ playlist.name }}
  184. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  185. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  186. </h5>
  187. <p class="card-text">
  188. {% if playlist.description %}
  189. {{ playlist.description|truncatewords:"15" }}
  190. {% else %}
  191. No description
  192. {% endif %}
  193. </p>
  194. <small>
  195. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  196. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  197. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  198. </small>
  199. </div>
  200. </a>
  201. </div>
  202. </div>
  203. {% endfor %}
  204. </div>
  205. {% else %}
  206. <h5>You have no playlists ;-;</h5>
  207. {% endif %}
  208. <br>
  209. <h3>Recently Added</h3>
  210. {% if recently_added_playlists %}
  211. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  212. {% for playlist in recently_added_playlists %}
  213. <div class="col">
  214. <div class="card">
  215. <a style="background-color: #958a44;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  216. <div class="card-body">
  217. <h5 class="card-title">
  218. {{ playlist.name }}
  219. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  220. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  221. </h5>
  222. <p class="card-text">
  223. {% if playlist.description %}
  224. {{ playlist.description|truncatewords:"15" }}
  225. {% else %}
  226. No description
  227. {% endif %}
  228. </p>
  229. <small>
  230. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  231. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  232. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  233. </small>
  234. </div>
  235. </a>
  236. </div>
  237. </div>
  238. {% endfor %}
  239. </div>
  240. {% else %}
  241. <h5>You have no playlists ;-;</h5>
  242. {% endif %}
  243. <br>
  244. {% endif %}
  245. {% endblock %}