Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add continuous refresh #101

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion portal/templates/portal/meetings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@
color: black;
cursor: default;
}

#refresh_box {
height: 5rem;
position: fixed;
top: auto;
left: auto;
}

#refresh-counter {
width: 1rem;
}
</style>
<section class="section">
<div class="container">
Expand Down Expand Up @@ -160,6 +171,18 @@ <h2 class="title is-4">Upcoming</h2>
</div>
</section>

<div id="refresh_box" class="modal is-active is-clipped box is-flex-direction-row is-align-items-center columns mr-4 mb-4">
<div class="column is-two-thirds mr-0 pr-0">
Auto-refreshing in
</div>
<div class="column ml-1 pl-0">
<p id="refresh-counter" class="is-size-3">5</p>
</div>
<div class="column ml-3 pl-0">
<button id="pause-refresh" class="button"><i class="fa-solid fa-stop"></i></button>
</div>
</div>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/index.global.min.js"
integrity="sha256-wKSlmJX2aO3MGLwAyZeYmYpSBBI42kGszk55a52vKqs=" crossorigin="anonymous"></script>

Expand All @@ -173,4 +196,31 @@ <h2 class="title is-4">Upcoming</h2>
calendar.render();
});
</script>
{% endblock %}

<script>
const ctr_elem = document.getElementById('refresh-counter');
let ctr = 5;
let paused = false;

const countdown = () => {
if(ctr <= 0){
location.reload();
}

if(paused){
return;
}

ctr -= 0.1;
ctr_elem.innerText = Math.ceil(ctr);
setTimeout(countdown, 100);
}

setTimeout(countdown, 100);

document.getElementById('pause-refresh').addEventListener('click', () => {
paused = true;
document.getElementById('refresh_box').classList.add('is-hidden');
});
</script>
{% endblock %}
4 changes: 2 additions & 2 deletions portal/views/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def discord_flow_callback(request):
)
return redirect(reverse("magiclink:login") + "?next=/auth/discord")

return redirect(reverse("profile"))
return redirect(reverse("dashboard"))


def start_github_flow(request):
Expand Down Expand Up @@ -170,7 +170,7 @@ def github_flow_callback(request):
"No RCOS account found that matches your GitHub. Please sign in with email first and then link your GitHub account on your profile!",
)
return redirect(reverse("magiclink:login") + "?next=/auth/github")
return redirect(reverse("profile"))
return redirect(reverse("dashboard"))


@login_required
Expand Down