Skip to content

Commit

Permalink
Logged in users should go straight to the feed.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjp93 committed Jan 11, 2025
1 parent 6f31aa5 commit 3e20a89
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lolsite/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Home(generic.TemplateView):
class FeedView(LoginRequiredMixin, generic.ListView):
template_name = "player/feed.html"
hx_template_name = "player/_feed.html"
paginate_by = 50
paginate_by = 20

@vary_on_headers("hx-request")
def get(self, request, *args, **kwargs):
Expand Down
8 changes: 7 additions & 1 deletion templates/layout/navbar.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{% load static %}
<div class="border-gray-400 border-b-2 py-2 px-4 mb-2 flex">
<a href="{% url 'home' %}" class="mr-2">
<a
{% if request.user.is_authenticated %}
href="{% url 'feed' %}"
{% else %}
href="{% url 'home' %}"
{% endif %}
class="mr-2">
<img src="{% static 'logo-clean.png' %}" alt="hardstuck.club logo" class="w-8 h-8 logo">
</a>
<div>
Expand Down
16 changes: 13 additions & 3 deletions templates/player/feed.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@

<div class="container mx-auto px-2 flex flex-col">
<h3>Match Feed</h3>
<div hx-get="{% url 'feed' %}" hx-trigger="load" hx-swap="outerHTML">
<div>Refreshing matches...</div>
{% include "player/_feed.html" %}
{% if following %}
<div hx-get="{% url 'feed' %}" hx-trigger="load" hx-swap="outerHTML">
<div>Refreshing matches...</div>
{% include "player/_feed.html" %}
</div>
{% else %}
<div class="flex gap-x-2 flex-wrap">
You are not following any summoners. Go to a summoner page and click on the
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z" />
</svg>
icon to follow them.
</div>
{% endif %}
</div>

{% endblock content %}

0 comments on commit 3e20a89

Please sign in to comment.