Merge pull request 'Removed internal ticketing features, made this a github/discord API tool instead' (#1) from github into main

Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
2026-01-03 18:16:11 +00:00
3 changed files with 460 additions and 1258 deletions

1364
app.py

File diff suppressed because it is too large Load Diff

View File

@@ -4,98 +4,150 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>{% block title %}{{ brand }}{% endblock %}</title>
<link rel="icon" href="{{ url_for('favicon') }}">
<script src="https://cdn.tailwindcss.com"></script>
<style>
:root { --bt-accent: {{ accent|default('#9b5cf6') }}; }
.nav-link { @apply text-white/80 text-sm font-medium px-3 py-2 rounded-lg transition hover:text-white hover:bg-white/10; }
.nav-cta { @apply font-semibold text-black px-3 py-2 rounded-lg; background: var(--bt-accent); }
.nav-cta:hover { filter: brightness(0.95); }
.nav-active { @apply text-white bg-white/10; }
:root {
--bt-accent: {{ accent|default('#9b5cf6') }};
}
</style>
</head>
<body class="bg-[#080812] text-white min-h-screen flex flex-col">
<!-- NAVBAR -->
<header class="sticky top-0 z-40 backdrop-blur-md bg-[#0a0a15]/80 border-b border-white/10">
<div class="max-w-7xl mx-auto px-4 md:px-6">
<!-- increased height + breathing room -->
<div class="h-16 flex items-center justify-between gap-4">
<!-- Brand -->
<a href="{{ url_for('tickets') }}" class="shrink-0 text-lg md:text-xl font-bold tracking-tight flex items-center gap-1">
<span>Buff</span><span style="color:var(--bt-accent)">TEKS</span>
<a href="{{ url_for('dashboard') }}"
class="shrink-0 text-lg md:text-xl font-bold tracking-tight flex items-center gap-1">
<span>Buff</span>
<span style="color:var(--bt-accent)">TEKS</span>
</a>
{% set u = session.get('discord_user') %}
<!-- Desktop nav -->
<nav class="hidden md:flex items-center gap-3">
<a href="{{ url_for('tickets') }}" class="nav-link {% if request.endpoint == 'tickets' %}nav-active{% endif %}">Tickets</a>
{% if u and 'admin' in (u.get('site_roles') or []) %}
<a href="{{ url_for('admin_new_ticket') }}" class="nav-link {% if request.endpoint == 'admin_new_ticket' %}nav-active{% endif %}">New Ticket</a>
{% endif %}
<!-- visual divider before auth area -->
<span class="h-6 w-px bg-white/10 mx-1"></span>
<!-- Desktop Nav -->
<nav class="hidden md:flex items-center gap-3">
<a href="{{ url_for('dashboard') }}"
class="text-white/80 text-sm font-medium px-3 py-2 rounded-lg transition hover:text-white hover:bg-white/10
{% if request.endpoint == 'dashboard' %}text-white bg-white/10{% endif %}">
Dashboard
</a>
{% if u %}
<span class="text-white/60 text-sm px-1 md:px-2">Signed in as <b class="font-semibold" style="color:var(--bt-accent)">{{ u.username }}</b></span>
<a href="{{ url_for('logout') }}" class="nav-link">Log out</a>
<span class="text-white/60 text-sm px-1 md:px-2">
Signed in as
<b class="font-semibold" style="color:var(--bt-accent)">
{{ u.username }}
</b>
</span>
<a href="{{ url_for('logout') }}"
class="text-white/80 text-sm font-medium px-3 py-2 rounded-lg transition hover:text-white hover:bg-white/10">
Log out
</a>
{% else %}
<a href="{{ url_for('discord_login') }}" class="nav-cta">Sign in</a>
<a href="{{ url_for('discord_login') }}"
class="font-semibold text-black px-3 py-2 rounded-lg"
style="background:var(--bt-accent)">
Sign in
</a>
{% endif %}
</nav>
<!-- Mobile hamburger (force visible) -->
<button id="navToggle" class="md:hidden inline-flex items-center justify-center w-10 h-10 rounded-lg text-white hover:bg-white/10 focus:outline-none focus:ring-2 focus:ring-white/20" aria-label="Toggle menu" aria-expanded="false">
<!-- use stroked paths so they pop on dark bg -->
<svg id="iconOpen" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16"/>
<!-- Mobile Toggle -->
<button id="navToggle"
class="md:hidden inline-flex items-center justify-center w-10 h-10 rounded-lg
text-white hover:bg-white/10 focus:outline-none focus:ring-2 focus:ring-white/20"
aria-label="Toggle menu"
aria-expanded="false">
<svg id="iconOpen" xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6" fill="none" viewBox="0 0 24 24"
stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round"
d="M4 6h16M4 12h16M4 18h16" />
</svg>
<svg id="iconClose" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 hidden" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"/>
<svg id="iconClose" xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6 hidden" fill="none" viewBox="0 0 24 24"
stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round"
d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
<!-- Mobile menu -->
<div id="mobileMenu" class="hidden md:hidden border-t border-white/10 bg-[#0b0b17]/95 shadow-2xl">
<!-- Mobile Menu -->
<div id="mobileMenu"
class="hidden md:hidden border-t border-white/10 bg-[#0b0b17]/95 shadow-2xl transition-all duration-200">
<div class="max-w-7xl mx-auto px-4 md:px-6 py-4 flex flex-col gap-2">
<a href="{{ url_for('tickets') }}" class="nav-link {% if request.endpoint == 'tickets' %}nav-active{% endif %}">Tickets</a>
{% if u and 'admin' in (u.get('site_roles') or []) %}
<a href="{{ url_for('admin_new_ticket') }}" class="nav-link {% if request.endpoint == 'admin_new_ticket' %}nav-active{% endif %}">New Ticket</a>
{% endif %}
<a href="{{ url_for('dashboard') }}"
class="text-white/80 text-sm font-medium px-3 py-2 rounded-lg transition hover:text-white hover:bg-white/10
{% if request.endpoint == 'dashboard' %}text-white bg-white/10{% endif %}">
Dashboard
</a>
<span class="h-px bg-white/10 my-1"></span>
{% if u %}
<div class="px-3 text-sm text-white/60">Signed in as <b class="text-white">{{ u.username }}</b></div>
<a href="{{ url_for('logout') }}" class="nav-link">Log out</a>
<div class="px-3 text-sm text-white/60">
Signed in as <b class="text-white">{{ u.username }}</b>
</div>
<a href="{{ url_for('logout') }}"
class="text-white/80 text-sm font-medium px-3 py-2 rounded-lg transition hover:text-white hover:bg-white/10">
Log out
</a>
{% else %}
<a href="{{ url_for('discord_login') }}" class="nav-cta w-fit">Sign in</a>
<a href="{{ url_for('discord_login') }}"
class="font-semibold text-black px-3 py-2 rounded-lg w-fit"
style="background:var(--bt-accent)">
Sign in
</a>
{% endif %}
</div>
</div>
</header>
<!-- MAIN (added a touch more top padding so content isn't crowded) -->
<!-- MAIN -->
<main class="flex-1 max-w-7xl w-full mx-auto px-4 md:px-6 py-10">
{% block content %}{% endblock %}
</main>
<!-- FOOTER -->
<footer class="text-center py-6 text-white/40 text-sm border-t border-white/10">
&copy; {{ brand }} · Built in-house by student engineers
</footer>
<!-- Mobile Nav Script -->
<script>
const toggle = document.getElementById('navToggle');
const menu = document.getElementById('mobileMenu');
const openIcon = document.getElementById('iconOpen');
const closeIcon = document.getElementById('iconClose');
toggle?.addEventListener('click', () => {
menu.classList.toggle('hidden');
const expanded = toggle.getAttribute('aria-expanded') === 'true';
toggle.setAttribute('aria-expanded', (!expanded).toString());
openIcon.classList.toggle('hidden');
closeIcon.classList.toggle('hidden');
});
</script>
</body>
</html>

230
templates/dashboard.html Normal file
View File

@@ -0,0 +1,230 @@
{% extends "base.html" %}
{% block title %}Dashboard · {{ brand }}{% endblock %}
{% block content %}
<section class="space-y-8">
<!-- Header -->
<header class="flex flex-col md:flex-row md:items-end md:justify-between gap-4">
<div>
<h1 class="text-3xl md:text-4xl font-extrabold tracking-tight">
GitHub Dashboard
</h1>
<p class="text-white/60 mt-1">
Live view of active BuffTEKS projects
</p>
</div>
</header>
<!-- Main Grid -->
<div class="grid grid-cols-1 lg:grid-cols-[2fr_1fr] gap-6">
<!-- LEFT: Repo Grid -->
<div class="grid grid-cols-1 gap-6">
{% for repo, data in repos.items() %}
<article class="rounded-2xl border border-white/10 bg-white/5 hover:border-white/20 transition shadow-lg">
<!-- Repo Header -->
<div class="p-5 border-b border-white/10 flex items-center justify-between gap-4">
<div>
<h2 class="text-xl font-semibold tracking-tight">
{{ repo.split('/')[-1] }}
</h2>
<p class="text-sm text-white/50">
{{ repo }}
</p>
</div>
<a href="https://github.com/{{ repo }}"
target="_blank"
class="text-sm px-3 py-2 rounded-lg bg-white/10 hover:bg-white/20 transition">
Open Repo →
</a>
</div>
<!-- Stats -->
<div class="grid grid-cols-2 gap-4 p-5 border-b border-white/10">
<div class="rounded-xl bg-black/30 p-4">
<div class="text-sm text-white/50">Open Issues</div>
<div class="text-2xl font-bold mt-1">
{{ data.issues|length }}
</div>
</div>
<div class="rounded-xl bg-black/30 p-4">
<div class="text-sm text-white/50">Open PRs</div>
<div class="text-2xl font-bold mt-1">
{{ data.prs|length }}
</div>
</div>
</div>
<!-- Issues -->
<div class="p-5">
<h3 class="text-sm uppercase tracking-wide text-white/50 mb-2">
Issues
</h3>
{% if data.issues %}
<ul class="space-y-2">
{% for i in data.issues[:5] %}
<li>
<a href="{{ i.html_url }}"
target="_blank"
class="flex items-center justify-between gap-3 rounded-lg px-3 py-2 bg-black/30 hover:bg-black/50 transition">
<span class="truncate">
<span class="text-white/40 mr-2">#{{ i.number }}</span>
{{ i.title }}
</span>
<span class="text-xs text-white/40">Issue</span>
</a>
</li>
{% endfor %}
</ul>
{% else %}
<div class="text-sm text-white/40 italic">
No open issues 🎉
</div>
{% endif %}
</div>
<!-- PRs -->
<div class="p-5 pt-0">
<h3 class="text-sm uppercase tracking-wide text-white/50 mb-2">
Pull Requests
</h3>
{% if data.prs %}
<ul class="space-y-2">
{% for p in data.prs[:5] %}
<li>
<a href="{{ p.html_url }}"
target="_blank"
class="flex items-center justify-between gap-3 rounded-lg px-3 py-2 bg-black/30 hover:bg-black/50 transition">
<span class="truncate">
<span class="text-white/40 mr-2">#{{ p.number }}</span>
{{ p.title }}
</span>
<span class="text-xs text-white/40">PR</span>
</a>
</li>
{% endfor %}
</ul>
{% else %}
<div class="text-sm text-white/40 italic">
No open pull requests
</div>
{% endif %}
</div>
</article>
{% endfor %}
</div>
<!-- RIGHT: Fun Console -->
<aside class="hidden lg:flex flex-col gap-4 sticky top-24 h-fit">
<div class="rounded-2xl border border-white/10 bg-white/5 p-5 space-y-4">
<h3 class="font-semibold text-lg">Very Important Stuff</h3>
<button onclick="startDisco()"
class="w-full px-3 py-2 rounded-lg bg-white/10 hover:bg-white/20 transition">
Disco Mode
</button>
<button onclick="deployConfetti()"
class="w-full px-3 py-2 rounded-lg bg-white/10 hover:bg-white/20 transition">
Deploy Confetti
</button>
<div class="pt-2 text-xs text-white/40">
Tip: ↑ ↑ ↓ ↓ ← → ← → B A
</div>
</div>
</aside>
</div>
</section>
<!-- Fun + Konami Scripts -->
<script>
/* ───── Konami Code ───── */
const KONAMI = [
"ArrowUp","ArrowUp","ArrowDown","ArrowDown",
"ArrowLeft","ArrowRight","ArrowLeft","ArrowRight",
"b","a"
];
let buffer = [];
window.addEventListener("keydown", e => {
buffer.push(e.key);
buffer = buffer.slice(-KONAMI.length);
if (KONAMI.every((k,i) => k === buffer[i])) {
document.body.classList.add("konami");
alert("Why did Santa's helper see the doctor? Because he had a low *elf* esteem!");
buffer = [];
}
});
/* ───── Disco Mode ───── */
let disco = null;
function startDisco() {
if (disco) {
clearInterval(disco);
disco = null;
document.documentElement.style.removeProperty('--bt-accent');
return;
}
disco = setInterval(() => {
document.documentElement.style.setProperty(
'--bt-accent',
`hsl(${Math.random()*360},90%,60%)`
);
}, 400);
}
/* ───── Confetti ───── */
function deployConfetti() {
for (let i=0;i<120;i++){
const c=document.createElement("div");
Object.assign(c.style,{
position:"fixed",
left:Math.random()*100+"vw",
top:"-10px",
width:"8px",
height:"8px",
background:`hsl(${Math.random()*360},90%,60%)`,
opacity:Math.random(),
zIndex:9999,
transition:"transform 2.5s, opacity 2.5s"
});
document.body.appendChild(c);
requestAnimationFrame(()=>{
c.style.transform=`translateY(110vh) rotate(${Math.random()*720}deg)`;
c.style.opacity=0;
});
setTimeout(()=>c.remove(),2500);
}
}
/* ───── Fake Discord Ping ───── */
function discordPing(){
["📡 Pinging Discord…","🟢 Webhook alive","⚡ BuffTEKS signal strong"]
.forEach((m,i)=>setTimeout(()=>console.log(m),i*500));
}
</script>
<style>
body.konami {
animation: hue 3s linear infinite;
}
@keyframes hue {
from { filter: hue-rotate(0deg); }
to { filter: hue-rotate(360deg); }
}
</style>
{% endblock %}