rewrite frontend

This commit is contained in:
Corban-Lee Jones 2024-04-18 01:05:54 +01:00
parent 4bd0ea77ab
commit 1fb7622dd1
8 changed files with 398 additions and 183 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,15 +1,22 @@
$("#themeToggle").on("click", function() {
const currentTheme = $("body").attr("data-bs-theme");
if (currentTheme == "light") {
$("body").attr("data-bs-theme", "dark");
}
else {
$("body").attr("data-bs-theme", "light");
}
const newTheme = currentTheme === "light" ? "dark" : "light";
updateTheme(newTheme);
});
function updateTheme(theme) {
$("body").attr("data-bs-theme", theme);
localStorage.setItem("theme", theme);
}
$(document).ready(function() {
// Activate all tooltips
$('[data-bs-toggle="tooltip"]').tooltip();
// Load theme
var theme = localStorage.getItem("theme");
if (theme === null)
theme = "light";
updateTheme(theme);
});

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,192 @@
{% extends "layouts/base.html" %}
{% load static %}
{% block title %} Blank Page {% endblock title %}
<!-- Specific CSS goes HERE -->
{% block stylesheets %}
<link rel="stylesheet" href="{% static 'css/home/main.css' %}">
<link rel="stylesheet" href="{% static '/css/select2-bootstrap.min.css' %}">
{% endblock stylesheets %}
{% block content %}
<!-- ### $App Screen Content ### -->
<main class="main-content bg-body-tertiary">
<div id="mainContent">
<div class="full-container d-flex">
<div class="peers flex-nowrap as-s ai-s w-100">
<div class="peer bg-body-secondary">
<div id="serverList" class="p-2 layers border-end h-100">
<div class="layer mb-2">
<button type="button" id="newServerBtn" class="btn bg-body rounded-circle bd" style="width: 50px; height: 50px;">
<span class="d-flex jc-c ai-c">
<i class="bi bi-plus-lg fs-5"></i>
</span>
</button>
</div>
</div>
</div>
<div id="noSelectedServer" class="peer-greed">
Select a server or add one
</div>
<div id="selectedServerContainer" class="peer-greed" data-guild-id="" style="display: none;">
<header class="px-4 py-3 border-bottom">
<div class="peers">
<div class="peer-greed">
<div class="peers ai-c">
<div class="peer">
<img class="selected-server-icon rounded-3" src="" alt="server icon" width="80">
</div>
<div class="peer-greed ms-4">
<h3 class="selected-server-name mb-1">none</h3>
<h6 class="selected-server-id mb-0">none</h6>
</div>
</div>
</div>
<div class="peer d-flex as-s ai-c">
<button type="button" id="newSubscriptionBtn" class="btn btn-primary">New Subscription</button>
<button type="button" id="deleteSelectedServerBtn" class="btn btn-danger ms-2">
<i class="bi bi-trash3"></i>
</button>
</div>
</div>
</header>
<div id="serverAlertContainer" class="px-4 pt-3">
<div class="alert alert-warning d-flex ai-c">
<span>
<b>PYRSS</b> can't seem to access this server!
Please ensure the server is public, or <b>PYRSS</b> is a member.
</span>
<button class="ms-auto btn btn-sm btn-warning">
Invite PYRSS
<i class="ms-2 bi bi-person-plus"></i>
</button>
</div>
<div class="alert alert-danger">
Critical Error
</div>
</div>
<div class="mx-4 rounded-3 border ov-h">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th scope="col" class="text-center">
<input type="checkbox" class="form-check-input" />
</th>
<th scope="col">Name</th>
<th scope="col">RSS URL</th>
<th scope="col">Channels</th>
<th scope="col">Created</th>
<th scope="col">Notes</th>
<th scope="col">Active</th>
<th scope="col" class="text-center">
<a href="#" class="text-body">
<i class="bi bi-plus-lg"></i>
</a>
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row" class="text-center">
<input type="checkbox" class="form-check-input" />
</th>
<td>
<a href="#">BBC News - Top Stories</a>
</td>
<td>
<a href="http://feeds.bbci.co.uk/news.rss">http://feeds.bbci.co.uk/news.rss</a>
</td>
<td>
<a href="#">3</a>
</td>
<td>2024-03-14</td>
<td>
<a href="#" class="text-body">
<i class="bi bi-chat-left-text"></i>
</a>
</td>
<td>
<input type="checkbox" class="form-check-input" />
</td>
<td class="text-center">
<a href="#" class="text-body">
<i class="bi bi-pencil"></i>
</a>
</td>
</tr>
<tr>
<th scope="row" class="text-center">
<input type="checkbox" class="form-check-input" />
</th>
<td>
<a href="#">BBC News - Entertainment & Arts</a>
</td>
<td>
<a href="http://feeds.bbci.co.uk/news.rss">http://feeds.bbci.co.uk/news/entertainment_and_arts/.rss</a>
</td>
<td>
<a href="#">2</a>
</td>
<td>2024-03-15</td>
<td>
<a href="#" class="text-body">
<i class="bi bi-chat-left-text"></i>
</a>
</td>
<td>
<input type="checkbox" class="form-check-input" />
</td>
<td class="text-center">
<a href="#" class="text-body">
<i class="bi bi-pencil"></i>
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
{% comment %} <div id="subscriptionContainer" class="container-fluid px-4">
<div class="row">
<div class="col-3 mb-4">
<div class="bg-body px-4 py-3 bd rounded-3">
add
</div>
</div>
</div>
</div> {% endcomment %}
</div>
</div>
</div>
</div>
</main>
{% include "home/includes/servermodal.html" %}
{% endblock content %}
<!-- Specific Page JS goes HERE -->
{% block javascripts %}
<script id="serverItemTemplate" type="text/template">
<div class="server-item layer mb-2" data-id="" data-guild-id="" data-name="" data-icon="">
<button type="button" class="bg-none border-0">
<img src="" class="rounded-circle" alt="" width="50" height="50">
</button>
</div>
</script>
<script src="{% static 'js/api.js' %}"></script>
<script src="{% static 'js/home.js' %}"></script>
{% endblock javascripts %}

View File

@ -1,108 +1,40 @@
{% extends "layouts/base.html" %}
{% extends 'layouts/base.html' %}
{% load static %}
{% block title %} Blank Page {% endblock title %}
{% block title %}{% endblock title %}
<!-- Specific CSS goes HERE -->
{% block stylesheets %}
<link rel="stylesheet" href="{% static 'css/home/main.css' %}">
<link rel="stylesheet" href="{% static '/css/select2-bootstrap.min.css' %}">
{% endblock stylesheets %}
{% block stylesheets %}{% endblock stylesheets %}
{% block content %}
<!-- ### $App Screen Content ### -->
<main class="main-content bg-body-tertiary">
<div id="mainContent">
<div class="full-container d-flex">
<div class="peers flex-nowrap as-s ai-s w-100">
<div class="peer bg-body-secondary">
<div id="serverList" class="p-2 layers border-end h-100">
<div class="layer mb-2">
<button type="button" id="newServerBtn" class="btn bg-body rounded-circle bd" style="width: 50px; height: 50px;">
<span class="d-flex jc-c ai-c">
<i class="bi bi-plus-lg fs-5"></i>
</span>
</button>
</div>
</div>
</div>
<div id="noSelectedServer" class="peer-greed">
Select a server or add one
</div>
<div id="selectedServerContainer" class="peer-greed" data-guild-id="" style="display: none;">
<header class="px-4 py-3 border-bottom">
<div class="peers">
<div class="peer-greed">
<div class="peers ai-c">
<div class="peer">
<img class="selected-server-icon rounded-3" src="" alt="server icon" width="80">
</div>
<div class="peer-greed ms-4">
<h3 class="selected-server-name mb-1">none</h3>
<h6 class="selected-server-id mb-0">none</h6>
</div>
</div>
</div>
<div class="peer d-flex as-s ai-c">
<button type="button" id="newSubscriptionBtn" class="btn btn-primary">New Subscription</button>
<button type="button" id="deleteSelectedServerBtn" class="btn btn-danger ms-2">
<i class="bi bi-trash3"></i>
</button>
</div>
</div>
</header>
<div id="serverAlertContainer" class="px-4 pt-3">
<div class="alert alert-warning d-flex ai-c">
<span>
<b>PYRSS</b> can't seem to access this server!
Please ensure the server is public, or <b>PYRSS</b> is a member.
</span>
<button class="ms-auto btn btn-sm btn-warning">
Invite PYRSS
<i class="ms-2 bi bi-person-plus"></i>
</button>
</div>
<div class="alert alert-danger">
Critical Error
</div>
</div>
<div id="subscriptionContainer" class="container-fluid p-4">
<div class="row">
<div class="col-3 mb-4">
<div class="bg-body p-4 bd rounded-3">
add
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container h-100">
<div class="d-flex flex-nowrap h-100">
<div class="d-flex flex-column flex-shrink-0 bg-body-secondary py-3" style="width: 4.5rem">
<ul id="serverList" class="nav nav-pills nav-flush flex-column mb-auto text-center">
<li class="nav-item"><hr class="my-2"></li>
<li class="nav-item">
<a href="#" id="newServerBtn" class="nav-link px-3 py-2 rounded-0">
<div class="text-light bg-primary rounded-circle mx-auto ratio ratio-1x1 position-relative" style="max-width: 100">
<i class="bi bi-plus-lg fs-5 position-absolute top-50 start-50 translate-middle" style="width: fit-content; height: fit-content;"></i>
</div>
</a>
</li>
</ul>
</div>
<div></div>
</div>
</main>
</div>
{% include "home/includes/servermodal.html" %}
{% endblock content %}
<!-- Specific Page JS goes HERE -->
{% block javascripts %}
{% block javascript %}
<script id="serverItemTemplate" type="text/template">
<div class="server-item layer mb-2" data-id="" data-guild-id="" data-name="" data-icon="">
<button type="button" class="bg-none border-0">
<img src="" class="rounded-circle" alt="" width="50" height="50">
</button>
</div>
<li class="nav-item server-item" data-id="" data-guild-id="" data-name="" data-icon="">
<a href="#" class="nav-link px-3 py-2 rounded-0" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-original-title="Option 1" aria-label="Option 1">
<img src="" alt="Guild Icon" class="rounded-circle" style="max-width: 100%;">
</a>
</li>
</script>
<script src="{% static 'js/api.js' %}"></script>
<script src="{% static 'js/home.js' %}"></script>
{% endblock javascripts %}
{% endblock javascript %}

View File

@ -0,0 +1,42 @@
{% load static %}
<div class="container">
<div class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container">
<a href="#" class="navbar-brand">
<img src="{% static '/images/pyrss_logo.webp' %}" alt="Logo" width="50" class="d-inline-block">
</a>
<button type="button" class="navbar-toggler" data-bs-toggle="offcanvas" data-bs-target="#navCollapse" aria-controls="navCollapse" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navCollapse" class="offcanvas offcanvas-end" tabindex="-1" aria-labelledby="navCollapseLabel">
<div class="offcanvas-header">
<h5 id="navCollapseLabel" class="offcanvas-title">PYRSS</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<ul class="navbar-nav justify-content-end flex-grow-1 pe-3 align-items-center">
<li class="nav-item">
<a href="#" id="themeToggle" class="me-3 text-body">
<i class="bi bi-sun"></i>
</a>
</li>
<li class="nav-item">
<div class="dropdown">
<button type="button" class="nav-link dropdown-toggle" data-bs-toggle="dropdown">
<img src="{{ request.user.avatar_url }}" alt="User Icon" width="30" class="rounded-circle me-2">
<span>{{ request.user.global_name }}</span>
</button>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item">Logout</a>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,108 @@
<!DOCTYPE html>
{% load static %}
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>
Django Adminator - {% block title %}{% endblock %}
</title>
<link type="text/css" rel="stylesheet" href="{% static '/css/bootstrap.css' %}" />
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<link type="text/css" rel="stylesheet" href="{% static '/css/colours.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/datepicker.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/fontawesome.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/themify-icons.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/perfectscrollbar.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/adminator.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/jquery.dataTables.min.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/select2.min.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/wavebtn.css' %}">
<link type="text/css" rel="stylesheet" href="{% static '/css/index.css' %}" />
<!-- Specific Page CSS goes HERE -->
{% block stylesheets %}{% endblock stylesheets %}
</head>
<body class="app" data-bs-theme="light">
<!-- @TOC -->
<!-- =================================================== -->
<!--
+ @Page Loader
+ @App Content
- #Left Sidebar
> $Sidebar Header
> $Sidebar Menu
- #Main
> $Topbar
> $App Screen Content
-->
<!-- @Page Loader -->
<!-- =================================================== -->
<div id='loader' class="bg-body">
<div class="spinner"></div>
</div>
<script>
window.addEventListener('load', function load() {
const loader = document.getElementById('loader');
setTimeout(function() {
loader.classList.add('fadeOut');
}, 300);
});
</script>
<!-- @App Content -->
<!-- =================================================== -->
<div>
{% include 'includes/sidebar.html' %}
<!-- #Main ============================ -->
<div class="page-container">
{% include 'includes/navigation.html' %}
{% block content %}{% endblock content %}
{% include 'includes/footer.html' %}
</div>
</div>
{% include 'includes/toasts.html' %}
<script>
const CSRF_MiddlewareToken = "{{ csrf_token }}";
const currentUserId = "{{ request.user.id }}";
</script>
{% include 'includes/scripts.html' %}
<!-- Specific Page JS goes HERE -->
{% block javascripts %}{% endblock javascripts %}
<script>
$(document).ready(function() {
$(".select-2").each(function() {
var dropdownParent = $(this).attr("data-dropdownparent");
$(this).select2({
theme: "bootstrap",
minimumResultsForSearch: 5,
dropdownParent: dropdownParent
})
})
// $(".select-2").select2({
// theme: "bootstrap",
// minimumResultsForSearch: 5
// });
});
</script>
</body>
</html>

View File

@ -1,4 +1,3 @@
<!DOCTYPE html>
{% load static %}
<html>
@ -6,75 +5,25 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>
Django Adminator - {% block title %}{% endblock %}
PYRSS{% block title %}{% endblock %}
</title>
<link type="text/css" rel="stylesheet" href="{% static '/css/bootstrap.css' %}" />
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<link type="text/css" rel="stylesheet" href="{% static '/css/colours.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/datepicker.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/fontawesome.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/themify-icons.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/perfectscrollbar.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/adminator.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/jquery.dataTables.min.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/select2.min.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static '/css/wavebtn.css' %}">
<link type="text/css" rel="stylesheet" href="{% static '/css/index.css' %}" />
<!-- Specific Page CSS goes HERE -->
{% block stylesheets %}{% endblock stylesheets %}
</head>
<body class="app" data-bs-theme="light">
<body data-bs-theme="light">
<!-- @TOC -->
<!-- =================================================== -->
<!--
+ @Page Loader
+ @App Content
- #Left Sidebar
> $Sidebar Header
> $Sidebar Menu
- #Main
> $Topbar
> $App Screen Content
-->
<!-- @Page Loader -->
<!-- =================================================== -->
<div id='loader' class="bg-body">
<div class="spinner"></div>
<div class="h-100 d-flex flex-column align-items-stretch flex-nowrap">
{% include 'includes/navbar.html' %}
{% block content %}{% endblock content %}
</div>
<script>
window.addEventListener('load', function load() {
const loader = document.getElementById('loader');
setTimeout(function() {
loader.classList.add('fadeOut');
}, 300);
});
</script>
<!-- @App Content -->
<!-- =================================================== -->
<div>
{% include 'includes/sidebar.html' %}
<!-- #Main ============================ -->
<div class="page-container">
{% include 'includes/navigation.html' %}
{% block content %}{% endblock content %}
{% include 'includes/footer.html' %}
</div>
</div>
{% comment %} {% include 'includes/footer.html' %} {% endcomment %}
{% include 'includes/toasts.html' %}
@ -83,26 +32,11 @@
const currentUserId = "{{ request.user.id }}";
</script>
{% include 'includes/scripts.html' %}
<script src="{% static '/js/jquery-3.6.0.min.js' %}"></script>
<script src="{% static '/js/bootstrap.bundle.min.js' %}"></script>
<script src="{% static '/js/base.js' %%}"></script>
<!-- Specific Page JS goes HERE -->
{% block javascripts %}{% endblock javascripts %}
<script>
$(document).ready(function() {
$(".select-2").each(function() {
var dropdownParent = $(this).attr("data-dropdownparent");
$(this).select2({
theme: "bootstrap",
minimumResultsForSearch: 5,
dropdownParent: dropdownParent
})
})
// $(".select-2").select2({
// theme: "bootstrap",
// minimumResultsForSearch: 5
// });
});
</script>
{% block javascript %}{% endblock javascript %}
</body>
</html>