Checked Boost setup and fixed the main mismatch.
This commit is contained in:
@@ -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(),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -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(),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -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(),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user