add modal to new video button to explain how to upload videos

This commit is contained in:
MarconLP 2023-04-11 21:27:11 +02:00
parent 6e69c1b3e3
commit 5091bce7fb
No known key found for this signature in database
GPG key ID: F4CAFFDFA3451D5E
4 changed files with 108 additions and 6 deletions

24
package-lock.json generated
View file

@ -11,6 +11,7 @@
"dependencies": {
"@aws-sdk/client-s3": "^3.310.0",
"@aws-sdk/s3-request-presigner": "^3.310.0",
"@headlessui/react": "^1.7.13",
"@next-auth/prisma-adapter": "^1.0.5",
"@prisma/client": "^4.11.0",
"@tanstack/react-query": "^4.28.0",
@ -1429,6 +1430,21 @@
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/@headlessui/react": {
"version": "1.7.13",
"resolved": "https://registry.npmjs.org/@headlessui/react/-/react-1.7.13.tgz",
"integrity": "sha512-9n+EQKRtD9266xIHXdY5MfiXPDfYwl7zBM7KOx2Ae3Gdgxy8QML1FkCMjq6AsOf0l6N9uvI4HcFtuFlenaldKg==",
"dependencies": {
"client-only": "^0.0.1"
},
"engines": {
"node": ">=10"
},
"peerDependencies": {
"react": "^16 || ^17 || ^18",
"react-dom": "^16 || ^17 || ^18"
}
},
"node_modules/@humanwhocodes/config-array": {
"version": "0.11.8",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
@ -7346,6 +7362,14 @@
"integrity": "sha512-IoD2MfUnOV58ghIHCiil01PcohxjbYR/qCxsoC+xNgUwh1EY8jOOrYmu3d3a71+tJJ23uscEV4X2HJWMsPJu4g==",
"dev": true
},
"@headlessui/react": {
"version": "1.7.13",
"resolved": "https://registry.npmjs.org/@headlessui/react/-/react-1.7.13.tgz",
"integrity": "sha512-9n+EQKRtD9266xIHXdY5MfiXPDfYwl7zBM7KOx2Ae3Gdgxy8QML1FkCMjq6AsOf0l6N9uvI4HcFtuFlenaldKg==",
"requires": {
"client-only": "^0.0.1"
}
},
"@humanwhocodes/config-array": {
"version": "0.11.8",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",

View file

@ -12,6 +12,7 @@
"dependencies": {
"@aws-sdk/client-s3": "^3.310.0",
"@aws-sdk/s3-request-presigner": "^3.310.0",
"@headlessui/react": "^1.7.13",
"@next-auth/prisma-adapter": "^1.0.5",
"@prisma/client": "^4.11.0",
"@tanstack/react-query": "^4.28.0",

View file

@ -0,0 +1,81 @@
import { Fragment, useState } from "react";
import { Dialog, Transition } from "@headlessui/react";
export default function VideoUploadModal() {
const [isOpen, setIsOpen] = useState(false);
function closeModal() {
setIsOpen(false);
}
function openModal() {
setIsOpen(true);
}
return (
<>
<span
onClick={openModal}
className="cursor-pointer rounded border border-[#0000001a] px-2 py-2 text-sm text-[#292d34] hover:bg-[#fafbfc]"
>
New video
</span>
<Transition appear show={isOpen} as={Fragment}>
<Dialog as="div" className="relative z-10" onClose={closeModal}>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-black bg-opacity-25" />
</Transition.Child>
<div className="fixed inset-0 overflow-y-auto">
<div className="flex min-h-full items-center justify-center p-4 text-center">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 scale-95"
enterTo="opacity-100 scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-95"
>
<Dialog.Panel className="w-full max-w-md transform overflow-hidden rounded-lg bg-white p-6 text-left align-middle shadow-xl transition-all">
<Dialog.Title
as="h3"
className="text-lg font-medium leading-6 text-gray-900"
>
Install the extension
</Dialog.Title>
<div className="mt-2">
<p className="text-sm text-gray-500">
You have to install the screenity extension from the
Chrome Store. At the end of the recording you will be able
to upload the video.
</p>
</div>
<div className="mt-4">
<button
type="button"
className="inline-flex justify-center rounded border border-transparent bg-blue-100 px-4 py-2 text-sm font-medium text-blue-900 hover:bg-blue-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"
onClick={closeModal}
>
Got it, thanks!
</button>
</div>
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition>
</>
);
}

View file

@ -6,6 +6,7 @@ import Link from "next/link";
import { useSession } from "next-auth/react";
import { useRouter } from "next/router";
import Image from "next/image";
import VideoUploadModal from "~/components/VideoUploadModal";
const VideoList: NextPage = () => {
const router = useRouter();
@ -33,12 +34,7 @@ const VideoList: NextPage = () => {
<div className="flex min-h-[80px] w-full items-center justify-between border-b border-solid border-b-[#E7E9EB] bg-white px-6">
<span>Screenity</span>
<div>
<span
onClick={onUpload}
className="cursor-pointer rounded border border-[#0000001a] px-2 py-2 text-sm text-[#292d34] hover:bg-[#fafbfc]"
>
New video
</span>
<VideoUploadModal />
</div>
</div>
<div className="flex w-full grow items-start justify-center overflow-auto bg-[#fbfbfb] pt-14">