Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
Add framerate input to file component (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
szebniok authored Mar 21, 2024
1 parent 0ca7913 commit e5b0ec0
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/components/AddFileComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,34 @@ type Props = {
};

const urlAtom = atomWithStorage("file-path", "");
const framerateAtom = atomWithStorage<null | number>("file-framerate", null);

const AddFileComponent: FC<Props> = ({ roomId, refetchIfNeeded, hasFileComponent }) => {
const { roomApi } = useServerSdk();
const [filePath, setFilePath] = useAtom(urlAtom);
const [framerate, setFramerate] = useAtom(framerateAtom);

return (
<div className="w-full card bg-base-100 shadow-xl indicator">
<div className="card-body p-4">
<div className="flex flex-row justify-between gap-2">
<div className="flex flex-col flex-grow">
<div className="flex">
<input
value={filePath}
onChange={(e) => setFilePath(e.target.value.trim())}
className="input input-bordered flex-grow"
placeholder="File Path"
/>
<label className="ml-2 flex items-center gap-1 mr-1 min-w-0">
<span>Framerate</span>
<input
value={filePath}
onChange={(e) => setFilePath(e.target.value.trim())}
className="input input-bordered w-full"
placeholder="File Path"
type="number"
value={framerate ?? ""}
min={1}
onChange={(e) => setFramerate(parseInt(e.target.value) || null)}
className="input input-bordered flex-1 min-w-0"
placeholder="30"
/>
</div>
</label>
<div
className={!hasFileComponent ? "" : "tooltip tooltip-info z-10"}
data-tip={hasFileComponent ? "File component already exists in this room" : ""}
Expand All @@ -39,6 +50,7 @@ const AddFileComponent: FC<Props> = ({ roomId, refetchIfNeeded, hasFileComponent
type: "file",
options: {
filePath: filePath,
framerate: framerate ?? undefined,
},
})
.then(() => {
Expand Down

0 comments on commit e5b0ec0

Please sign in to comment.