profile.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. {% extends 'base.html' %}
  2. {% block content %}
  3. <!-- Template taken from https://www.bootdey.com/snippets/view/profile-with-data-and-skills#html -->
  4. <div class="container-fluid text-black">
  5. <div class="main-body" style="padding: 15px">
  6. <div class="row g-5">
  7. <div class="col-md-4 mb-3">
  8. <div class="card bg-dark text-white">
  9. <div class="card-body">
  10. <div class="d-flex flex-column align-items-center text-center">
  11. <img src="https://robohash.org/{{ user.username }}.png?set=set{{ user.profile.robohash_set }}" alt="{{ user.username }}" class="border border-5 border-success rounded-circle" width="150">
  12. <div class="mt-3">
  13. <h4>{{ user.get_full_name }}</h4>
  14. <p class="text-white-50 mb-1">{{ user.profile.user_summary }}</p>
  15. <p class="text-white-50 font-size-sm">{{ user.profile.user_location }}</p>
  16. <!--
  17. <button class="btn btn-primary">Follow</button>
  18. <button class="btn btn-outline-primary">Message</button> -->
  19. <a class="btn btn-outline-success" href="{% url 'settings' %}">Settings</a>
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="card mt-3 bg-dark ">
  25. <ul class="list-group list-group-flush">
  26. <li class="list-group-item bg-dark d-flex justify-content-between align-items-center flex-wrap">
  27. <h6 class="mb-0 text-white">YouTube Channel ID</h6>
  28. <span class="text-white-50">{{ user.profile.yt_channel_id }}</span>
  29. </li>
  30. <li class="list-group-item bg-dark d-flex justify-content-between align-items-center flex-wrap">
  31. <h6 class="mb-0 text-white">
  32. Followers</h6>
  33. <span class="text-white-50">0</span>
  34. </li>
  35. <li class="list-group-item bg-dark d-flex justify-content-between align-items-center flex-wrap">
  36. <h6 class="mb-0 text-white">Total Playlist Count</h6>
  37. <span class="text-white-50">{{ user.playlists.count }}</span>
  38. </li>
  39. <li class="list-group-item bg-dark d-flex justify-content-between align-items-center flex-wrap">
  40. <h6 class="mb-0 text-white">Profile Views</h6>
  41. <span class="text-white-50">0</span>
  42. </li>
  43. <li class="list-group-item bg-dark d-flex justify-content-between align-items-center flex-wrap">
  44. <h6 class="mb-0 text-white">Imported their YouTube Playlists</h6>
  45. <span class="text-white-50">
  46. {% if user.profile.imported_yt_playlists %}Yes{% else %}No{% endif %}
  47. </span>
  48. </li>
  49. </ul>
  50. </div>
  51. </div>
  52. <div class="col-md-8">
  53. <div id="settings-status-div" class="text-dark">
  54. </div>
  55. <div class="row gutters-sm">
  56. <div class="col-sm-6 mb-3">
  57. <div class="card h-100 bg-dark text-white">
  58. <div class="card-body">
  59. <h6 class="d-flex align-items-center mb-3"><span class="text-info me-2">{{ user.playlists.count }}</span>Playlists Statistics</h6>
  60. <small>Public <span class="text-warning ms-1">{{ statistics.public_x }}%</span></small>
  61. <div class="progress mb-3" style="height: 5px">
  62. <div class="progress-bar bg-primary" role="progressbar" style="width: {{ statistics.public_x }}%" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100"></div>
  63. </div>
  64. <small>Private <span class="text-warning ms-1">{{ statistics.private_x }}%</span></small>
  65. <div class="progress mb-3" style="height: 5px">
  66. <div class="progress-bar bg-primary" role="progressbar" style="width: {{ statistics.private_x }}%" aria-valuenow="72" aria-valuemin="0" aria-valuemax="100"></div>
  67. </div>
  68. <small>Favorites <span class="text-warning ms-1">{{ statistics.favorites_x }}%</span></small>
  69. <div class="progress mb-3" style="height: 5px">
  70. <div class="progress-bar bg-primary" role="progressbar" style="width: {{ statistics.favorites_x }}%" aria-valuenow="89" aria-valuemin="0" aria-valuemax="100"></div>
  71. </div>
  72. <small>Watching <span class="text-warning ms-1">{{ statistics.watching_x }}%</span></small>
  73. <div class="progress mb-3" style="height: 5px">
  74. <div class="progress-bar bg-primary" role="progressbar" style="width: {{ statistics.watching_x }}%" aria-valuenow="55" aria-valuemin="0" aria-valuemax="100"></div>
  75. </div>
  76. <small>Imported <span class="text-warning ms-1">{{ statistics.imported_x }}%</span></small>
  77. <div class="progress mb-3" style="height: 5px">
  78. <div class="progress-bar bg-primary" role="progressbar" style="width: {{ statistics.imported_x }}%" aria-valuenow="66" aria-valuemin="0" aria-valuemax="100"></div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="col-sm-6 mb-3">
  84. <div class="card h-100 bg-dark text-white overflow-auto" style="height: 100px;">
  85. <div class="card-body">
  86. <h6 class="d-flex align-items-center mb-3"><span class="text-info me-2">{{ watching.count }}</span>Watching</h6>
  87. {% if watching %}
  88. {% for pl in watching|slice:"0:5" %}
  89. <small><a href="{% url 'playlist' pl.playlist_id %}" style="text-decoration: none; color: white;">{{ pl.name|truncatechars:"40" }}</a> <span class="text-warning ms-1">{{ pl.get_watched_videos_count }}/{{ pl.get_watchable_videos_count }} viewed</span></small>
  90. <div class="progress mb-3" style="height: 5px">
  91. <div class="progress-bar bg-{% if pl.get_percent_complete == 100 %}success{% else %}primary{% endif %}" role="progressbar" style="width: {{ pl.get_percent_complete }}%" aria-valuenow="{{ pl.get_watched_videos_count }}" aria-valuemin="0" aria-valuemax="{{ pl.get_watchable_videos_count }}"></div>
  92. </div>
  93. {% if forloop.last and watching.count > 5 %}
  94. <a href="{% url 'all_playlists' 'watching' %}" style="color: white; text-decoration: none">+ {{ watching.count|add:"-5" }} more</a>
  95. {% endif %}
  96. {% endfor %}
  97. {% else %}
  98. <h5>Mark something as watching!</h5>
  99. {% endif %}
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. <div class="card bg-dark text-white mb-3">
  105. <div class="card-body">
  106. <div class="d-flex justify-content-center">
  107. No activity yet!
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. <!--
  116. <div class="container-fluid">
  117. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  118. <h1 class="h2">Settings</h1>
  119. <span><small>Logged in as <b>{{ user.username }}</b></small></span>
  120. </div>
  121. <div id="settings-status-div" class="text-dark">
  122. </div>
  123. <div id="settings-form">
  124. <div class="mb-3">
  125. <label for="username" class="form-label">Username</label>
  126. <input type="text" class="form-control" name="username" id="username" value="{{ user.username }}">
  127. </div>
  128. <fieldset disabled>
  129. <div class="mb-3">
  130. <label for="email" class="form-label">Email Address</label>
  131. <input type="email" class="form-control" id="email" aria-describedby="emailHelp" value="{{ user.email }}">
  132. <div id="emailHelp" class="form-text">This is the google account you logged in with.</div>
  133. </div>
  134. <div class="mb-3">
  135. <label for="fullname" class="form-label">Full Name</label>
  136. <input type="text" class="form-control" id="fullname" value="{{ user.get_full_name }}">
  137. </div>
  138. <div class="mb-3">
  139. <label for="ytchannelid" class="form-label">YouTube Channel ID</label>
  140. <input type="text" class="form-control" id="ytchannelid" aria-describedby="emailHelp" value="{{ user.profile.yt_channel_id }}">
  141. </div>
  142. <div class="mb-3">
  143. <label for="accesstoken" class="form-label">Access Token</label>
  144. <input type="text" class="form-control" id="accesstoken" value="{{ user.profile.access_token }}">
  145. </div>
  146. <div class="mb-3">
  147. <label for="refreshtoken" class="form-label">Refresh Token</label>
  148. <input type="text" class="form-control" id="refreshtoken" value="{{ user.profile.refresh_token }}">
  149. </div>
  150. <div class="mb-3">
  151. <label for="expiresat" class="form-label">Expires At</label>
  152. <input type="datetime-local" class="form-control" id="expiresat" value="{{ user.profile.expires_at }}">
  153. </div>
  154. </fieldset>
  155. <div class="mb-3 form-check form-switch">
  156. <input class="form-check-input" name="auto refresh playlists" type="checkbox" id="flexSwitchCheckDefault">
  157. <label class="form-check-label" for="flexSwitchCheckDefault">Automatically refresh playlists on visit</label>
  158. </div>
  159. <div class="mb-3 form-check form-switch">
  160. <input class="form-check-input" name="hide videos" type="checkbox" id="flexSwitchCheckChecked" checked>
  161. <label class="form-check-label" for="flexSwitchCheckChecked">Hide deleted/private videos</label>
  162. </div>
  163. <div class="mb-3 form-check form-switch">
  164. <input class="form-check-input" name="confirm before deleting" type="checkbox" id="flexSwitchCheckChecked" checked>
  165. <label class="form-check-label" for="flexSwitchCheckChecked">Confirm before deleting</label>
  166. </div>
  167. </div>
  168. <div>
  169. <a class="btn btn-outline-danger" href="{% url 'delete_account' %}">Delete account</a>
  170. <button type="button" hx-post="{% url 'update_settings' %}" hx-include="[id='settings-form']" hx-target="#settings-status-div" class="btn btn-success">Save</button>
  171. </div>
  172. </div>
  173. -->
  174. {% endblock %}