mirror of
https://github.com/myronblair/kino-app
synced 2026-07-27 18:29:07 -05:00
Add app version number, shown in Navbar next to the logo
New backend/VERSION file (starts at 1.0.0) served via GET /api/version, displayed as a small "v1.0.0" next to the StreamHoard wordmark. Going forward I'll bump this on meaningful changes -- patch for fixes, minor for new features, major for big/breaking redesigns.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
1.0.0
|
||||
@@ -67,6 +67,13 @@ app = FastAPI(title="StreamHoard")
|
||||
api = APIRouter(prefix="/api")
|
||||
bearer = HTTPBearer(auto_error=False)
|
||||
|
||||
APP_VERSION = (ROOT_DIR / "VERSION").read_text().strip() if (ROOT_DIR / "VERSION").is_file() else "0.0.0"
|
||||
|
||||
|
||||
@api.get("/version")
|
||||
async def get_version():
|
||||
return {"version": APP_VERSION}
|
||||
|
||||
|
||||
# ---------- Auth deps ----------
|
||||
async def get_current_user(creds: Optional[HTTPAuthorizationCredentials] = Depends(bearer)) -> dict:
|
||||
|
||||
@@ -3,12 +3,14 @@ import { useAuth } from "../lib/auth";
|
||||
import { useProfile } from "../lib/profile";
|
||||
import { Search, LogOut, Upload, Settings as SettingsIcon } from "lucide-react";
|
||||
import { useState, useEffect } from "react";
|
||||
import api from "../lib/api";
|
||||
|
||||
export const Navbar = () => {
|
||||
const { user, logout } = useAuth();
|
||||
const { active } = useProfile();
|
||||
const nav = useNavigate();
|
||||
const [scrolled, setScrolled] = useState(false);
|
||||
const [version, setVersion] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
const onScroll = () => setScrolled(window.scrollY > 20);
|
||||
@@ -16,6 +18,10 @@ export const Navbar = () => {
|
||||
return () => window.removeEventListener("scroll", onScroll);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
api.get("/version").then(({ data }) => setVersion(data.version)).catch(() => {});
|
||||
}, []);
|
||||
|
||||
const linkClass = ({ isActive }) =>
|
||||
`text-sm tracking-wide transition-colors duration-300 ${isActive ? "text-white" : "text-[#8A8A8A] hover:text-white"}`;
|
||||
|
||||
@@ -26,6 +32,7 @@ export const Navbar = () => {
|
||||
<Link to="/browse" className="flex items-center gap-2" data-testid="nav-logo">
|
||||
<span className="font-display text-2xl font-black tracking-tighter text-white">StreamHoard</span>
|
||||
<span className="text-[#D9381E] text-2xl leading-none">.</span>
|
||||
{version && <span className="text-[10px] text-[#8A8A8A] self-start mt-1" data-testid="nav-version">v{version}</span>}
|
||||
</Link>
|
||||
{user && (
|
||||
<nav className="hidden md:flex items-center gap-7">
|
||||
|
||||
Reference in New Issue
Block a user