Spaces:
Paused
Paused
Commit
·
b9ae471
1
Parent(s):
c90a662
improve UI a bit
Browse files
src/app/studio/[ownerId]/main.tsx
CHANGED
@@ -13,7 +13,7 @@ export default function Main({ videoTasks }: { videoTasks: VideoTask[] }) {
|
|
13 |
|
14 |
return (
|
15 |
<div className="flex flex-col md:flex-row">
|
16 |
-
<div className="h-full flex flex-col space-y-4 w-full md:w-[
|
17 |
<VideoForm />
|
18 |
<VideoTasksQueue videoTasks={videoTasks} onSelectVideo={selectVideo} />
|
19 |
<RefreshStudio />
|
|
|
13 |
|
14 |
return (
|
15 |
<div className="flex flex-col md:flex-row">
|
16 |
+
<div className="h-full flex flex-col space-y-4 w-full md:w-[800px] px-4 py-8">
|
17 |
<VideoForm />
|
18 |
<VideoTasksQueue videoTasks={videoTasks} onSelectVideo={selectVideo} />
|
19 |
<RefreshStudio />
|
src/components/business/tasks/columns.tsx
CHANGED
@@ -51,6 +51,7 @@ export const columns: ColumnDef<VideoTask>[] = [
|
|
51 |
</div>
|
52 |
)
|
53 |
},
|
|
|
54 |
},
|
55 |
{
|
56 |
accessorKey: "progressPercent",
|
@@ -61,21 +62,19 @@ export const columns: ColumnDef<VideoTask>[] = [
|
|
61 |
const progress = Number(row.getValue("progressPercent") || 0)
|
62 |
|
63 |
return (
|
64 |
-
<div className="flex
|
65 |
<span>{progress}%</span>
|
66 |
</div>
|
67 |
)
|
68 |
},
|
69 |
-
|
70 |
-
return value.includes(row.getValue(id))
|
71 |
-
},
|
72 |
},
|
73 |
{
|
74 |
accessorKey: "preview",
|
75 |
header: ({ column }) => (
|
76 |
null // no header
|
77 |
),
|
78 |
-
cell: ({ row }) => <div className="w-[
|
79 |
<a
|
80 |
className="hover:underline cursor-pointer"
|
81 |
target="_blank"
|
@@ -91,11 +90,11 @@ export const columns: ColumnDef<VideoTask>[] = [
|
|
91 |
header: ({ column }) => (
|
92 |
null // no header
|
93 |
),
|
94 |
-
cell: ({ row }) => <div className="
|
95 |
<a
|
96 |
className="hover:underline cursor-pointer"
|
97 |
target="_blank"
|
98 |
-
href={`${process.env.NEXT_PUBLIC_DOWNLOAD_URL}/${row.getValue("fileName")}`}>
|
99 |
</div>,
|
100 |
enableSorting: false,
|
101 |
enableHiding: false,
|
|
|
51 |
</div>
|
52 |
)
|
53 |
},
|
54 |
+
enableSorting: false,
|
55 |
},
|
56 |
{
|
57 |
accessorKey: "progressPercent",
|
|
|
62 |
const progress = Number(row.getValue("progressPercent") || 0)
|
63 |
|
64 |
return (
|
65 |
+
<div className="flex items-center">
|
66 |
<span>{progress}%</span>
|
67 |
</div>
|
68 |
)
|
69 |
},
|
70 |
+
enableSorting: false,
|
|
|
|
|
71 |
},
|
72 |
{
|
73 |
accessorKey: "preview",
|
74 |
header: ({ column }) => (
|
75 |
null // no header
|
76 |
),
|
77 |
+
cell: ({ row }) => <div className="w-[100px]">
|
78 |
<a
|
79 |
className="hover:underline cursor-pointer"
|
80 |
target="_blank"
|
|
|
90 |
header: ({ column }) => (
|
91 |
null // no header
|
92 |
),
|
93 |
+
cell: ({ row }) => <div className="">
|
94 |
<a
|
95 |
className="hover:underline cursor-pointer"
|
96 |
target="_blank"
|
97 |
+
href={`${process.env.NEXT_PUBLIC_DOWNLOAD_URL}/${row.getValue("fileName")}`}>Save</a>
|
98 |
</div>,
|
99 |
enableSorting: false,
|
100 |
enableHiding: false,
|
src/components/business/tasks/video-tasks-queue.tsx
CHANGED
@@ -95,6 +95,7 @@ export function VideoTasksQueue({
|
|
95 |
>
|
96 |
{row.getVisibleCells().map((cell) => (
|
97 |
<TableCell key={cell.id}
|
|
|
98 |
onClick={() => {
|
99 |
const videoId = `${row.getValue("id") || ""}`
|
100 |
const video = videoTasks.find(({ id }) => id === videoId)
|
|
|
95 |
>
|
96 |
{row.getVisibleCells().map((cell) => (
|
97 |
<TableCell key={cell.id}
|
98 |
+
className="cursor-pointer"
|
99 |
onClick={() => {
|
100 |
const videoId = `${row.getValue("id") || ""}`
|
101 |
const video = videoTasks.find(({ id }) => id === videoId)
|
src/components/business/video-form.tsx
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
import { useEffect, useTransition } from "react"
|
4 |
import { usePathname } from "next/navigation"
|
5 |
|
6 |
-
|
7 |
import { Textarea } from "@/components/ui/textarea"
|
8 |
import { Button } from "@/components/ui/button"
|
9 |
import { formSubmit } from "@/server/actions"
|
@@ -11,7 +11,7 @@ import { formSubmit } from "@/server/actions"
|
|
11 |
export const VideoForm = () => {
|
12 |
const pathname = usePathname()
|
13 |
const ownerId = pathname.split("/").pop()
|
14 |
-
const
|
15 |
|
16 |
return (
|
17 |
<form
|
@@ -57,8 +57,9 @@ export const VideoForm = () => {
|
|
57 |
size="lg"
|
58 |
className="text-md md:w-32"
|
59 |
type="submit"
|
|
|
60 |
>
|
61 |
-
Generate
|
62 |
</Button>
|
63 |
</div>
|
64 |
</form>
|
|
|
3 |
import { useEffect, useTransition } from "react"
|
4 |
import { usePathname } from "next/navigation"
|
5 |
|
6 |
+
import { experimental_useFormStatus as useFormStatus } from "react-dom"
|
7 |
import { Textarea } from "@/components/ui/textarea"
|
8 |
import { Button } from "@/components/ui/button"
|
9 |
import { formSubmit } from "@/server/actions"
|
|
|
11 |
export const VideoForm = () => {
|
12 |
const pathname = usePathname()
|
13 |
const ownerId = pathname.split("/").pop()
|
14 |
+
const { pending } = useFormStatus()
|
15 |
|
16 |
return (
|
17 |
<form
|
|
|
57 |
size="lg"
|
58 |
className="text-md md:w-32"
|
59 |
type="submit"
|
60 |
+
disabled={pending}
|
61 |
>
|
62 |
+
{pending ? "Loading.." : "Generate"}
|
63 |
</Button>
|
64 |
</div>
|
65 |
</form>
|
src/components/business/video-player.tsx
CHANGED
@@ -5,7 +5,9 @@ import { VideoTask } from "@/app/types"
|
|
5 |
export const VideoPlayer = ({ video }: { video?: VideoTask }) => {
|
6 |
|
7 |
if (typeof video === "undefined") {
|
8 |
-
return <
|
|
|
|
|
9 |
}
|
10 |
|
11 |
return (
|
|
|
5 |
export const VideoPlayer = ({ video }: { video?: VideoTask }) => {
|
6 |
|
7 |
if (typeof video === "undefined") {
|
8 |
+
return <div className="flex w-full h-screen items-center justify-center text-center">
|
9 |
+
<div>No video to display</div>
|
10 |
+
</div>
|
11 |
}
|
12 |
|
13 |
return (
|