Use hub 'name' in routes & add top-post sorting

Switch hub endpoints to use the hub `name` slug and update frontend routes/clients accordingly. Backend: HubViewSet now uses lookup_field='name'; PostViewSet list supports `sort=top` with vote_score annotation and time windows/custom ranges, and a new TopPostsCursorPagination was added. Frontend: routes changed from `/hub/:id` to `/h/:name`, the generated hubs API was updated from id->name, and the hub feed client accepts `sort`, `time`, `start`, and `end` params (query key updated). Also adds new homepage UI components (HeroSection, DroneSection) and navbar improvements (scroll state, auto-close mobile menu on route changes, and small icon/class tweaks).
This commit is contained in:
2026-06-07 12:19:40 +02:00
parent cb23abeb5f
commit ad1f6a90b6
29 changed files with 1778 additions and 559 deletions

View File

@@ -1,376 +1,292 @@
/* ── Navbar ── */
.navbar {
width: 50%;
width: max-content;
margin: 0;
margin-left: auto;
margin-right: auto;
padding: 0 2em;
background-color: var(--c-boxes);
max-width: calc(100% - 2rem);
margin: 0 auto;
padding: 0.6em 2em;
/* Glass pill */
background: color-mix(in hsl, var(--c-background-light), transparent 35%);
backdrop-filter: blur(20px) saturate(1.4);
-webkit-backdrop-filter: blur(20px) saturate(1.4);
border: 1px solid color-mix(in hsl, var(--c-lines), transparent 65%);
color: white;
font-family: "Roboto Mono", monospace;
font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
display: flex;
justify-content: space-between;
align-items: center;
position: sticky;
top: 1rem;
z-index: 100;
gap: 0.5em;
border-radius: 9999px;
--nav-margin-y: 0.75em;
transition: background 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}
.scrolled {
background: color-mix(in hsl, var(--c-background-light), transparent 10%);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
border-color: color-mix(in hsl, var(--c-lines), transparent 40%);
}
.mobileNavOpen {
border-radius: 1.5rem;
top: 0;
z-index: 50;
gap: 1em;
border-bottom-left-radius: 2em;
border-bottom-right-radius: 2em;
--nav-margin-y: 1em;
opacity: 0.95;
transition: all 0.3s ease-in-out;
max-width: 100%;
width: 100%;
}
.mobileNavOpen{
border-radius: 0;
}
/* Brand */
/* ── Brand ── */
.logo {
padding-right: 1em;
border-right: 0.2em solid var(--c-lines);
padding-right: 1.5em;
border-right: 1px solid color-mix(in hsl, var(--c-lines), transparent 55%);
flex-shrink: 0;
}
.logo a {
font-size: 1.8em;
font-weight: 700;
font-size: 1.5em;
font-weight: 800;
color: white;
text-decoration: none;
transition: text-shadow 0.25s ease-in-out;
letter-spacing: -0.02em;
transition: color 0.25s ease, text-shadow 0.25s ease;
}
.logo a:hover {
text-shadow: 0.25em 0.25em 0.2em var(--c-text);
color: var(--c-text);
text-shadow: 0 0 1rem color-mix(in hsl, var(--c-text), transparent 40%);
}
/* Burger */
/* ── Burger ── */
.burger {
display: none;
background: none;
border: none;
color: white;
font-size: 1.6em;
border: 1px solid color-mix(in hsl, var(--c-lines), transparent 60%);
border-radius: 0.6rem;
color: var(--c-text);
font-size: 1.2em;
padding: 0.3em 0.5em;
cursor: pointer;
flex-shrink: 0;
transition: background 0.2s;
}
.burger:hover {
background: color-mix(in hsl, var(--c-boxes), transparent 60%);
}
/* Links container */
/* ── Links container ── */
.links {
display: flex;
gap: 3em;
gap: 0.5em;
align-items: center;
justify-content: space-around;
width: -webkit-fill-available;
justify-content: center;
}
/* Simple link */
/* ── Simple link ── */
.linkSimple {
color: var(--c-text);
color: color-mix(in hsl, var(--c-text), transparent 20%);
text-decoration: none;
font-size: 1.05em;
transition: transform 0.15s;
display: flex;
flex-direction: row;
font-size: 0.95em;
font-weight: 500;
display: inline-flex;
align-items: center;
}
/* TEXT SIZE UNIFICATION */
.linkSimple,
.user,
.linkButton {
font-size: 1.25em;
color: white;
}
.dropdown a {
font-size: 1.1em;
color: var(--c-text);
}
.linkSimple:hover {
transform: scale(1.08);
}
/* Link item with dropdown */
.linkItem {
gap: 0.35em;
padding: 0.45em 0.9em;
border-radius: 9999px;
transition: color 0.2s ease, background 0.2s ease;
position: relative;
}
/* Unified dropdown container */
.linkSimple:hover {
color: white;
background: color-mix(in hsl, var(--c-boxes), transparent 70%);
}
/* ── Dropdown item wrapper ── */
.dropdownItem {
position: relative;
}
/* ── Dropdown trigger button ── */
.linkButton {
background: none;
border: none;
color: color-mix(in hsl, var(--c-text), transparent 20%);
font-size: 0.95em;
font-weight: 500;
cursor: pointer;
display: flex;
flex-direction: row;
display: inline-flex;
align-items: center;
gap: 0.4rem;
margin: var(--nav-margin-y) auto;
width: max-content;
gap: 0.35em;
padding: 0.45em 0.9em;
border-radius: 9999px;
transition: color 0.2s ease, background 0.2s ease;
white-space: nowrap;
}
.linkButton:hover {
transform: scale(1.05);
color: white;
background: color-mix(in hsl, var(--c-boxes), transparent 70%);
transform: none;
}
/* chevron icons */
.chev {
margin-left: 0.25rem;
font-size: 0.9rem;
font-size: 0.7em;
transition: transform 0.25s ease;
}
.dropdownItem:hover .chev,
.dropdownItem:focus-within .chev {
transform: rotate(180deg);
}
.chevSmall {
margin-left: 0.25rem;
font-size: 0.75rem;
}
/* dropdown */
/* ── Dropdown panel ── */
.dropdown {
position: absolute;
top: auto;
left: 0;
width: -moz-max-content;
top: calc(100% + 0.5rem);
left: 50%;
transform: translateX(-50%) translateY(-6px);
width: max-content;
background-color: var(--c-background-light);
/* border: 1px solid var(--c-text); */
padding: 0.6rem;
/* border-radius: 0.45rem; */
border-bottom-left-radius: 1em;
border-bottom-right-radius: 1em;
display: none;
min-width: 10rem;
background: color-mix(in hsl, var(--c-background-light), transparent 10%);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border: 1px solid color-mix(in hsl, var(--c-lines), transparent 60%);
padding: 0.5rem;
border-radius: 1rem;
display: flex;
flex-direction: column;
gap: 0.35rem;
box-shadow: 0px 20px 24px 6px rgba(0, 0, 0, 0.35);
z-index: 49;
gap: 0.2rem;
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
z-index: 200;
/* Animated show */
opacity: 0;
pointer-events: none;
transition: opacity 0.2s ease, transform 0.2s ease;
}
/* show dropdown on hover or keyboard focus within */
.linkItem:hover .dropdown,
.linkItem:focus-within .dropdown,
.dropdownItem:hover .dropdown,
.dropdownItem:focus-within .dropdown {
display: flex;
opacity: 1;
pointer-events: auto;
transform: translateX(-50%) translateY(0);
}
/* nested wrapper for submenu items */
.nestedWrapper {
display: flex;
flex-direction: column;
}
/* nested toggle (button that opens nested submenu) */
.nestedToggle {
background: none;
border: none;
color: white !important;
text-align: left;
padding: 0;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 0.45rem;
width: 100%;
}
.nestedToggle:hover {
transform: scale(1.03);
}
/* Unified dropdown toggle */
.dropdownToggle {
background: none;
border: none;
color: white !important;
text-align: left;
padding: 0;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 0.45rem;
width: 100%;
}
.dropdownToggle:hover {
transform: scale(1.03);
}
/* nested submenu */
.nested {
margin-top: 0.25rem;
margin-left: 1.1rem;
display: none;
/* hidden until hover/focus within */
flex-direction: column;
gap: 0.25rem;
}
/* show nested submenu on hover/focus within */
.nestedWrapper:hover .nested,
.nestedWrapper:focus-within .nested {
display: flex;
}
/* Nested dropdown (dropdown inside dropdown) */
.dropdown .dropdown {
position: static;
border: none;
box-shadow: none;
padding-left: 0.2rem;
min-width: auto;
margin-left: 1.1rem;
}
/* links inside dropdown / nested */
.dropdown a,
.dropdown button {
color: white;
color: color-mix(in hsl, var(--c-text), transparent 15%);
text-decoration: none;
background: none;
border: none;
padding: 0.35rem 0.25rem;
padding: 0.5rem 0.75rem;
border-radius: 0.6rem;
text-align: left;
cursor: pointer;
transition: transform 0.12s;
font-size: 0.9em;
font-weight: 500;
display: inline-flex;
flex-direction: row;
align-items: center;
gap: 0.45rem;
transition: background 0.15s ease, color 0.15s ease;
width: 100%;
}
.dropdown a:hover,
.dropdown button:hover {
transform: scale(1.04);
}
/* small icons next to dropdown links */
.iconSmall {
margin-right: 0.45rem;
font-size: 0.95rem;
vertical-align: middle;
}
/* User area */
.user {
display: flex;
align-items: center;
gap: 0.6rem;
height: -webkit-fill-available;
}
.loginBtn {
width: max-content;
background: none;
border: none;
border-radius: 0;
padding: 1em;
background: color-mix(in hsl, var(--c-boxes), transparent 60%);
color: white;
font-size: 0.98rem;
transform: none;
}
/* ── Icons ── */
.iconSmall {
font-size: 0.9em;
flex-shrink: 0;
}
/* ── Login button ── */
.loginBtn {
background: linear-gradient(135deg, var(--c-other), color-mix(in hsl, var(--c-other), var(--c-boxes) 40%));
border: none;
border-radius: 9999px;
padding: 0.45em 1.1em;
color: #031D44;
font-size: 0.9em;
font-weight: 700;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 0.45rem;
}
.loginBtn svg {
font-size: 1.5rem;
gap: 0.4em;
transition: opacity 0.2s ease, transform 0.15s ease;
}
.loginBtn:hover {
background: var(--c-text);
transform: scale(1.03);
}
/* user dropdown */
.userWrapper {
height: -webkit-fill-available;
position: relative;
display: flex;
align-items: center;
}
.userWrapper .dropdown{
position: absolute;
top: 0;
left: 0;
margin-top: 3.5em;
width: max-content;
border-top-right-radius: 1em;
}
.userWrapper .dropdown a, button{
font-size: 0.9em;
}
.userButton {
display: flex;
align-items: center;
width: max-content;
gap: 0.6rem;
background: none;
border: none;
color: white;
cursor: pointer;
font-size: 1rem;
flex-wrap: wrap;
justify-content: space-between;
}
.userIcon {
font-size: inherit;
opacity: 0.9;
transform: scale(1.04);
box-shadow: 0 0 1rem color-mix(in hsl, var(--c-other), transparent 50%);
}
/* ── User avatar + username ── */
.avatar {
width: 1.8rem;
height: 1.8rem;
border-radius: 50%;
object-fit: cover;
flex-shrink: 0;
}
.username {
font-weight: 600;
font-size: 0.9em;
max-width: 8rem;
overflow: hidden;
text-overflow: ellipsis;
max-width: max-content;
text-overflow: ellipsis;
white-space: nowrap;
}
/* logout button */
/* ── Logout button ── */
.logoutBtn {
display: inline-flex;
align-items: center;
gap: 0.5rem;
background: none;
border: none;
color: white;
color: color-mix(in hsl, #ff6b6b, var(--c-text) 30%);
cursor: pointer;
border-radius: 0.6rem;
padding: 0.5rem 0.75rem;
font-size: 0.9em;
font-weight: 500;
width: 100%;
transition: background 0.15s ease, color 0.15s ease;
}
/* Responsive: mobile */
@media (max-width: 1010px) {
.logoutBtn:hover {
background: color-mix(in hsl, #ff6b6b, transparent 80%);
color: #ff9898;
transform: none;
}
/* ── Mobile ── */
@media (max-width: 900px) {
.navbar {
width: 100%;
max-width: 100%;
top: 0;
border-radius: 0;
padding: 0.7em 1.2em;
border-left: none;
border-right: none;
border-top: none;
}
.navbar .logo{
margin: auto;
text-align: center;
border: none;
.logo {
border-right: none;
padding-right: 0;
flex: 1;
}
.burger {
display: inline-block;
}
.burger svg {
width: auto;
display: inline-flex;
align-items: center;
justify-content: center;
}
.links {
@@ -378,82 +294,71 @@
left: 0;
right: 0;
top: 100%;
flex-direction: column;
gap: 0.6rem;
padding: 1rem 1.2rem;
display: none;
z-index: 40;
border-top: 1px solid rgba(255, 255, 255, 0.03);
border-bottom-left-radius: 2em;
border-bottom-right-radius: 2em;
transition: all 0.5s ease-in-out;
max-height: 0;
display: flex;
overflow: hidden;
align-items: stretch;
gap: 0.3rem;
padding: 0;
background: color-mix(in hsl, var(--c-background-light), transparent 5%);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-bottom: 1px solid color-mix(in hsl, var(--c-lines), transparent 60%);
border-bottom-left-radius: 1.5rem;
border-bottom-right-radius: 1.5rem;
overflow: hidden;
max-height: 0;
opacity: 0;
transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
}
.links.show {
max-height: 100vh;
padding: 1rem 1.2rem;
background-color: var(--c-boxes);
max-height: 80vh;
opacity: 1;
padding: 0.75rem;
overflow-y: auto;
}
.linkButton{
background-color: var(--c-background-light);
.dropdownItem {
width: 100%;
align-items: center;
margin:auto;
display: flex;
align-items: center;
justify-content: center;
padding: 1em;
transition: all 0.2s ease-in-out;
}
.linkButton:hover{
transform: none !important;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
.linkButton {
width: 100%;
justify-content: space-between;
padding: 0.75em 1em;
border-radius: 0.75rem;
background: color-mix(in hsl, var(--c-background-light), transparent 40%);
color: var(--c-text);
}
.linkSimple{
margin: var(--nav-margin-y) auto;
.linkSimple {
width: 100%;
padding: 0.75em 1em;
border-radius: 0.75rem;
justify-content: flex-start;
}
.dropdown {
position: relative;
top: 0;
left: 0;
transform: none;
opacity: 1;
pointer-events: auto;
border: none;
box-shadow: none;
padding-left: 0.2rem;
background: color-mix(in hsl, var(--c-background), transparent 20%);
border-radius: 0.75rem;
margin-top: 0.25rem;
}
.dropdownItem:hover .dropdown,
.dropdownItem:focus-within .dropdown {
transform: none;
}
.loginBtn {
width: 100%;
align-items: center;
justify-content: center;
padding: 0.75em 1em;
}
.dropdownItem{
width: 100%;
}
.nested {
margin-left: 0.6rem;
}
.dropdown .dropdown {
margin-left: 0.6rem;
}
.userButton .username{
display: none;
}
}
}