home.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. {% extends 'base.html' %}
  2. {% block content %}
  3. {% for message in messages %}
  4. <div class="alert alert-success alert-dismissible fade show" role="alert">
  5. {{ message }}
  6. <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
  7. </div>
  8. {% endfor %}
  9. {% if import_successful %}
  10. <br>
  11. <br>
  12. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  13. <h1>Welcome to UnTube, {{ user.username|capfirst }}</h1>
  14. </div>
  15. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  16. <h2>{{ user.profile.playlists.all.count }} playlists from YouTube have been successfully imported.</h2>
  17. </div>
  18. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  19. <h3>You'll now be able to import/export playlists from YouTube and UnTube :)</h3>
  20. </div>
  21. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  22. <a href="{% url 'home' %}" class="btn btn-lg btn-success">Go to Dashboard</a>
  23. </div>
  24. {% else %}
  25. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  26. <h1 class="h2">Dashboard</h1>
  27. <!--
  28. <div class="btn-toolbar mb-2 mb-md-0">
  29. <div class="btn-group me-2">
  30. <button type="button" class="btn btn-sm btn-outline-secondary">Share</button>
  31. <button type="button" class="btn btn-sm btn-outline-secondary">Export</button>
  32. </div>
  33. <button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle">
  34. <span data-feather="calendar"></span>
  35. This week
  36. </button>
  37. </div>
  38. -->
  39. <span><small>Logged in as <b>{{ user.username }}</b></small></span>
  40. </div>
  41. {% if watching %}
  42. <div class="border border-5 rounded-3 border-primary p-3">
  43. <h3>Continue Watching</h3>
  44. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  45. {% for playlist in watching|slice:"0:2" %}
  46. <div class="col">
  47. <div class="card">
  48. <a style="background-color: #7e89c2;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  49. <div class="card-body">
  50. <h5 class="card-title">
  51. {{ playlist.name }}
  52. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  53. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  54. </h5>
  55. <p class="card-text">
  56. {% if playlist.description %}
  57. {{ playlist.description }}
  58. {% else %}
  59. No description
  60. {% endif %}
  61. </p>
  62. <small>
  63. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  64. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  65. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  66. <span class="badge bg-info rounded-pill">2/23 viewed</span>
  67. </small>
  68. </div>
  69. </a>
  70. </div>
  71. </div>
  72. {% if forloop.counter == 2 %}
  73. {% if watching.count|add:"-2" != 0 %}
  74. <div class="col">
  75. <div class="card">
  76. <a style="background-color: #7e89c2;" href="{% url 'all_playlists' 'watching' %}" class="list-group-item list-group-item-action" aria-current="true">
  77. <div class="card-body">
  78. <p class="card-text">
  79. <h3>+ {{ watching.count|add:"-2" }} more</h3>
  80. </p>
  81. </div>
  82. </a>
  83. </div>
  84. </div>
  85. {% endif %}
  86. {% endif %}
  87. {% endfor %}
  88. </div>
  89. </div>
  90. {% endif %}
  91. <br>
  92. <h3>Most viewed playlists <a href="{% url 'all_playlists' 'all' %}" class="btn btn-sm btn-info">View All</a></h3>
  93. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  94. {% for playlist in user_playlists|slice:"0:3" %}
  95. <div class="col">
  96. <div class="card">
  97. <a style="background-color: #35795b;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  98. <div class="card-body">
  99. <h5 class="card-title">
  100. #{{ forloop.counter }} <br><br>{{ playlist.name }}
  101. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  102. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  103. </h5>
  104. <p class="card-text">
  105. {% if playlist.description %}
  106. {{ playlist.description }}
  107. {% else %}
  108. No description
  109. {% endif %}
  110. </p>
  111. <small>
  112. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  113. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  114. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  115. </small>
  116. </div>
  117. </a>
  118. </div>
  119. </div>
  120. {% endfor %}
  121. </div>
  122. <br>
  123. <h3>Recently Accessed</h3>
  124. <br>
  125. <h3>Recently Added</h3>
  126. <br>
  127. {% endif %}
  128. {% endblock %}