Checked Boost setup and fixed the main mismatch.

This commit is contained in:
2026-05-15 18:04:01 +03:30
parent dff0f62107
commit 77bd834e2c
6 changed files with 72 additions and 48 deletions

View File

@@ -32,6 +32,8 @@ import { UserMenuContent } from '@/components/user-menu-content';
import { useCurrentUrl } from '@/hooks/use-current-url';
import { useInitials } from '@/hooks/use-initials';
import { cn } from '@/lib/utils';
import { dashboard, home } from '@/routes';
import { dashboard as adminDashboard } from '@/routes/admin';
import type { BreadcrumbItem, NavItem } from '@/types';
type Props = {
@@ -49,12 +51,12 @@ export function AppHeader({ breadcrumbs = [] }: Props) {
const mainNavItems: NavItem[] = [
{
title: 'Live',
href: '/',
href: home(),
icon: Radio,
},
{
title: 'Studio',
href: '/dashboard',
href: dashboard(),
icon: LayoutGrid,
},
];
@@ -62,7 +64,7 @@ export function AppHeader({ breadcrumbs = [] }: Props) {
if (auth.user?.is_admin) {
mainNavItems.push({
title: 'Admin',
href: '/admin',
href: adminDashboard(),
icon: Shield,
});
}
@@ -118,7 +120,7 @@ export function AppHeader({ breadcrumbs = [] }: Props) {
</div>
<Link
href="/"
href={home()}
prefetch
className="flex items-center space-x-2"
>
@@ -167,7 +169,7 @@ export function AppHeader({ breadcrumbs = [] }: Props) {
size="icon"
className="group h-9 w-9 cursor-pointer"
>
<Link href="/">
<Link href={home()}>
<Search className="!size-5 opacity-80 group-hover:opacity-100" />
</Link>
</Button>
@@ -175,7 +177,7 @@ export function AppHeader({ breadcrumbs = [] }: Props) {
<Tooltip>
<TooltipTrigger asChild>
<Link
href="/"
href={home()}
className="group inline-flex h-9 w-9 items-center justify-center rounded-md bg-transparent p-0 text-sm font-medium text-accent-foreground ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-none"
>
<span className="sr-only">

View File

@@ -12,6 +12,8 @@ import {
SidebarMenuButton,
SidebarMenuItem,
} from '@/components/ui/sidebar';
import { dashboard, home } from '@/routes';
import { dashboard as adminDashboard } from '@/routes/admin';
import type { NavItem } from '@/types';
export function AppSidebar() {
@@ -19,12 +21,12 @@ export function AppSidebar() {
const mainNavItems: NavItem[] = [
{
title: 'Live',
href: '/',
href: home(),
icon: Radio,
},
{
title: 'Studio',
href: '/dashboard',
href: dashboard(),
icon: LayoutGrid,
},
];
@@ -32,7 +34,7 @@ export function AppSidebar() {
if (auth.user?.is_admin) {
mainNavItems.push({
title: 'Admin',
href: '/admin',
href: adminDashboard(),
icon: Shield,
});
}
@@ -43,7 +45,7 @@ export function AppSidebar() {
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton size="lg" asChild>
<Link href="/" prefetch>
<Link href={home()} prefetch>
<AppLogo />
</Link>
</SidebarMenuButton>

View File

@@ -1,6 +1,10 @@
import { Head, Link, router } from '@inertiajs/react';
import { Ban, Radio, Shield, StopCircle, Undo2 } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { dashboard as adminDashboard } from '@/routes/admin';
import { stop as stopBroadcast } from '@/routes/admin/broadcasts';
import { restore, suspend } from '@/routes/admin/channels';
import { show as showChannel } from '@/routes/channels';
type LiveBroadcast = {
id: number;
@@ -89,7 +93,9 @@ export default function AdminDashboard({
<div className="flex gap-2">
<Button asChild variant="outline" size="sm">
<Link
href={`/channels/${broadcast.channel.slug}`}
href={showChannel(
broadcast.channel.slug,
)}
>
Open
</Link>
@@ -99,7 +105,7 @@ export default function AdminDashboard({
size="sm"
onClick={() =>
router.post(
`/admin/broadcasts/${broadcast.id}/stop`,
stopBroadcast(broadcast.id),
)
}
>
@@ -136,9 +142,7 @@ export default function AdminDashboard({
</div>
<div className="flex gap-2">
<Button asChild variant="outline" size="sm">
<Link
href={`/channels/${channel.slug}`}
>
<Link href={showChannel(channel.slug)}>
Open
</Link>
</Button>
@@ -148,7 +152,7 @@ export default function AdminDashboard({
size="sm"
onClick={() =>
router.post(
`/admin/channels/${channel.slug}/restore`,
restore(channel.slug),
)
}
>
@@ -161,7 +165,7 @@ export default function AdminDashboard({
size="sm"
onClick={() =>
router.post(
`/admin/channels/${channel.slug}/suspend`,
suspend(channel.slug),
)
}
>
@@ -183,7 +187,7 @@ AdminDashboard.layout = {
breadcrumbs: [
{
title: 'Admin',
href: '/admin',
href: adminDashboard(),
},
],
};

View File

@@ -12,6 +12,9 @@ import type { FormEvent } from 'react';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { VideoPlayer } from '@/components/video-player';
import { home, login } from '@/routes';
import { follow, unfollow } from '@/routes/channels';
import { store as storeChat } from '@/routes/channels/chat';
import type {
BroadcastSummary,
ChannelDetail,
@@ -39,7 +42,7 @@ export default function ChannelShow({
function submitChat(event: FormEvent) {
event.preventDefault();
chatForm.post(`/channels/${channel.slug}/chat`, {
chatForm.submit(storeChat(channel.slug), {
preserveScroll: true,
onSuccess: () => chatForm.reset('body'),
});
@@ -108,13 +111,13 @@ export default function ChannelShow({
onClick={() =>
isFollowing
? router.delete(
`/channels/${channel.slug}/follow`,
unfollow(channel.slug),
{
preserveScroll: true,
},
)
: router.post(
`/channels/${channel.slug}/follow`,
follow(channel.slug),
undefined,
{
preserveScroll: true,
@@ -127,7 +130,7 @@ export default function ChannelShow({
</Button>
) : (
<Button asChild variant="outline">
<Link href="/login">
<Link href={login()}>
<LogIn className="size-4" />
Log in to follow
</Link>
@@ -244,7 +247,7 @@ export default function ChannelShow({
variant="outline"
className="w-full"
>
<Link href="/login">Log in to chat</Link>
<Link href={login()}>Log in to chat</Link>
</Button>
)}
</div>
@@ -258,7 +261,7 @@ ChannelShow.layout = {
breadcrumbs: [
{
title: 'Channel',
href: '/',
href: home(),
},
],
};

View File

@@ -1,4 +1,4 @@
import { Head, router, useForm } from '@inertiajs/react';
import { Head, Link, router, useForm } from '@inertiajs/react';
import {
Copy,
KeyRound,
@@ -13,6 +13,17 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { useClipboard } from '@/hooks/use-clipboard';
import { dashboard as dashboardRoute } from '@/routes';
import { show as showChannel } from '@/routes/channels';
import {
stop as stopBroadcastRoute,
store as storeBroadcastRoute,
} from '@/routes/creator/broadcasts';
import {
store as storeChannelRoute,
update as updateChannelRoute,
} from '@/routes/creator/channel';
import { rotate as rotateStreamKeyRoute } from '@/routes/creator/stream-key';
import type { BroadcastSummary, Category } from '@/types';
type CreatorChannel = {
@@ -46,6 +57,7 @@ export default function Dashboard({
recentBroadcasts,
}: Props) {
const [, copy] = useClipboard();
const liveBroadcast = channel?.live_broadcast ?? null;
const createForm = useForm({
display_name: '',
slug: '',
@@ -65,17 +77,17 @@ export default function Dashboard({
function createChannel(event: FormEvent) {
event.preventDefault();
createForm.post('/creator/channel');
createForm.submit(storeChannelRoute());
}
function updateChannel(event: FormEvent) {
event.preventDefault();
channelForm.patch('/creator/channel');
channelForm.submit(updateChannelRoute());
}
function createBroadcast(event: FormEvent) {
event.preventDefault();
broadcastForm.post('/creator/broadcasts', {
broadcastForm.submit(storeBroadcastRoute(), {
onSuccess: () => broadcastForm.reset('title', 'recording_enabled'),
});
}
@@ -96,10 +108,10 @@ export default function Dashboard({
</div>
{channel && (
<Button asChild variant="outline">
<a href={`/channels/${channel.slug}`}>
<Link href={showChannel(channel.slug)}>
<Radio className="size-4" />
View channel
</a>
</Link>
</Button>
)}
</div>
@@ -353,7 +365,9 @@ export default function Dashboard({
size="sm"
onClick={() =>
router.post(
`/creator/broadcasts/${broadcast.id}/stop`,
stopBroadcastRoute(
broadcast.id,
),
)
}
>
@@ -404,9 +418,7 @@ export default function Dashboard({
<Button
variant="outline"
onClick={() =>
router.post(
'/creator/stream-key/rotate',
)
router.post(rotateStreamKeyRoute())
}
>
<RotateCw className="size-4" />
@@ -415,18 +427,17 @@ export default function Dashboard({
</div>
</section>
{channel.live_broadcast && (
{liveBroadcast && (
<section className="rounded-md border bg-card p-5">
<h2 className="mb-3 font-semibold">
Current live session
</h2>
<div className="space-y-2 text-sm">
<div className="font-medium">
{channel.live_broadcast.title}
{liveBroadcast.title}
</div>
<div className="text-muted-foreground">
{channel.live_broadcast
.recording_enabled
{liveBroadcast.recording_enabled
? 'Recording enabled'
: 'Live only'}
</div>
@@ -435,7 +446,9 @@ export default function Dashboard({
size="sm"
onClick={() =>
router.post(
`/creator/broadcasts/${channel.live_broadcast?.id}/stop`,
stopBroadcastRoute(
liveBroadcast.id,
),
)
}
>
@@ -457,7 +470,7 @@ Dashboard.layout = {
breadcrumbs: [
{
title: 'Creator Studio',
href: '/dashboard',
href: dashboardRoute(),
},
],
};

View File

@@ -10,6 +10,8 @@ import {
import { useMemo, useState } from 'react';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { dashboard, home, login, register } from '@/routes';
import { show as showChannel } from '@/routes/channels';
import type { Category, ChannelCard } from '@/types';
type Props = {
@@ -52,7 +54,7 @@ export default function Welcome({
<header className="border-b">
<div className="mx-auto flex h-16 w-full max-w-7xl items-center gap-4 px-4">
<Link
href="/"
href={home()}
className="flex items-center gap-2 font-semibold"
>
<span className="flex size-9 items-center justify-center rounded-md bg-neutral-950 text-white dark:bg-white dark:text-neutral-950">
@@ -64,7 +66,7 @@ export default function Welcome({
<div className="ml-auto flex items-center gap-2">
{auth.user ? (
<Button asChild size="sm">
<Link href="/dashboard">
<Link href={dashboard()}>
<LayoutDashboard className="size-4" />
Dashboard
</Link>
@@ -72,11 +74,11 @@ export default function Welcome({
) : (
<>
<Button asChild variant="ghost" size="sm">
<Link href="/login">Log in</Link>
<Link href={login()}>Log in</Link>
</Button>
{canRegister && (
<Button asChild size="sm">
<Link href="/register">
<Link href={register()}>
<UserPlus className="size-4" />
Register
</Link>
@@ -122,9 +124,7 @@ export default function Welcome({
</div>
<Button asChild variant="outline">
<Link
href={
auth.user ? '/dashboard' : '/register'
}
href={auth.user ? dashboard() : register()}
>
{auth.user
? 'Open studio'
@@ -173,7 +173,7 @@ export default function Welcome({
{filteredChannels.map((channel) => (
<Link
key={channel.id}
href={`/channels/${channel.slug}`}
href={showChannel(channel.slug)}
className="group overflow-hidden rounded-md border bg-card text-card-foreground transition-colors hover:border-neutral-400 dark:hover:border-neutral-600"
>
<div className="flex aspect-video items-center justify-center bg-neutral-950 text-white">