Skip to content

Add Gen TV livestream index#596

Open
JoaquinBN wants to merge 1 commit intodevfrom
JoaquinBN/gen-tv
Open

Add Gen TV livestream index#596
JoaquinBN wants to merge 1 commit intodevfrom
JoaquinBN/gen-tv

Conversation

@JoaquinBN
Copy link
Copy Markdown
Collaborator

Summary

  • New public Gen TV page (`/gen-tv`) listing scheduled and recorded livestreams from the GenLayer team and the broader community.
  • New `gen_tv` Django app exposing a public read-only API.
  • New `Gen TV` entry in the sidebar `Discover` group, sitting next to `Ecosystem Partners`.

What's in the UI

  • One section per category (`GenLayer Team`, `Community`); within each, three sub-sections in fixed order: Live nowUpcomingPast streams.
  • Sub-sections are dropped when empty; a category that has zero streams across all three statuses is dropped entirely so the page never shows a useless heading.
  • Each card uses the source image as background with a dark gradient, a status pill (Live / Upcoming / Ended), a duration badge, host metadata, and the title.
  • Clicking a card opens `stream.url` in a new tab.

Backend

  • `Stream` model with `title / slug / description / url / image_url / starts_at / ends_at / category / is_active`.
  • `status` is derived as a Python `@property` from `starts_at` / `ends_at` — no stored column, so the lifecycle stays consistent without a maintenance burden.
  • Single initial migration with the final schema (no historical churn).
  • API: `GET /api/v1/gen-tv/streams/?category=` (list) and `GET /api/v1/gen-tv/streams/{slug}/` (detail).

Test plan

  • `python manage.py migrate gen_tv` on a fresh DB
  • `python manage.py test gen_tv` passes
  • Add a Stream via Django admin (set `starts_at`/`ends_at` around `now`) and check that `status` flips between upcoming / live / past as time passes
  • `GET /api/v1/gen-tv/streams/` returns the seeded streams with the correct computed `status`
  • Visit `/gen-tv`; with no streams in a category that section is hidden; with no streams at all the empty state shows
  • Sidebar `Gen TV` entry highlights when on the page (desktop + mobile)

Introduces a public Gen TV surface that lists scheduled and recorded
livestreams from the GenLayer team and the broader community. The
page renders one section per category (GenLayer Team, Community) and
within each splits streams into Live / Upcoming / Past sub-sections.
Sub-sections only render when they have content, and a category that
ends up empty across all three statuses is dropped entirely so the
page never shows an unused heading.

Backend ships a small `gen_tv` Django app: a `Stream` model carrying
title, slug, source url, image, starts_at, ends_at, category, and
is_active. There is no stored status column — `status` is a Python
@Property derived from `starts_at` / `ends_at` so the lifecycle stays
consistent with the schedule without a maintenance burden. The API is
read-only with a category filter, pagination disabled (low volume).

Frontend wires the new `Gen TV` entry into the sidebar `Discover`
group (desktop + mobile), adds the route at `/gen-tv`, and ships a
`StreamCard` component under `components/portal/gen-tv/` that renders
the cover image with a dark overlay, computed-status pill, duration
badge, host metadata and title.

## Claude Implementation Notes
- backend/gen_tv/: New Django app with Stream model (status as @Property), light/full serializers, public ReadOnlyModelViewSet (slug lookup, category filter, pagination disabled), admin config (status surfaces as read-only computed_status column, date_hierarchy on starts_at), and tests/test_streams.py.
- backend/gen_tv/migrations/0001_initial.py: Single initial migration with the final schema (no status column, ends_at required).
- backend/api/urls.py: Registers StreamViewSet on the router under `gen-tv/streams`.
- backend/tally/settings.py: Adds `gen_tv` to INSTALLED_APPS.
- backend/CLAUDE.md: Adds Gen TV section, gen-tv endpoints to the summary, and the new app to the project tree.
- frontend/src/lib/api.js: Adds `genTvAPI` with `list` and `get(slug)`.
- frontend/src/routes/GenTV.svelte: New page that fetches `genTvAPI.list()`, groups by category, and renders Live / Upcoming / Past sub-sections per category with conditional rendering.
- frontend/src/components/portal/gen-tv/StreamCard.svelte: Reusable card variant (`live`, `upcoming`, `past`) with image background, dark gradient, status pill, duration badge, category + host metadata, and title.
- frontend/src/components/Sidebar.svelte: Adds a `Gen TV` entry alongside `Ecosystem Partners` in the desktop and mobile sidebars (TV / play icon, `#6D5DD3` accent when active).
- frontend/src/stores/category.js: `detectCategoryFromRoute` now also recognises `/gen-tv` (returns `global`).
- frontend/src/App.svelte: Imports `GenTV` and mounts it at `/gen-tv`.
- frontend/CLAUDE.md: Documents the new route, the `genTvAPI` entry, and the gen-tv components directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant