diff --git a/next-env.d.ts b/next-env.d.ts index 830fb59..c4b7818 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,6 +1,6 @@ /// /// -/// +import "./.next/dev/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/package.json b/package.json index 4e1fde0..6c2f5ea 100644 --- a/package.json +++ b/package.json @@ -48,5 +48,18 @@ "eslint-plugin-react-refresh": "^0.4.18", "globals": "^15.14.0", "typescript": "~5.7.2" + }, + "pnpm": { + "overrides": { + "tar@=7.5.1": ">=7.5.2", + "next@>=15.5.0-canary.0 <15.5.7": ">=15.5.7", + "next@>=15.5.1-canary.0 <15.5.8": ">=15.5.8", + "tar@<=7.5.2": ">=7.5.3", + "tar@<=7.5.3": ">=7.5.4", + "next@>=10.0.0 <15.5.10": ">=15.5.10", + "next@>=15.5.1-canary.0 <15.5.10": ">=15.5.10", + "tar@<7.5.7": ">=7.5.7", + "js-yaml@>=4.0.0 <4.1.1": ">=4.1.1" + } } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 542208b..fb733ca 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,17 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +overrides: + tar@=7.5.1: '>=7.5.2' + next@>=15.5.0-canary.0 <15.5.7: '>=15.5.7' + next@>=15.5.1-canary.0 <15.5.8: '>=15.5.8' + tar@<=7.5.2: '>=7.5.3' + tar@<=7.5.3: '>=7.5.4' + next@>=10.0.0 <15.5.10: '>=15.5.10' + next@>=15.5.1-canary.0 <15.5.10: '>=15.5.10' + tar@<7.5.7: '>=7.5.7' + js-yaml@>=4.0.0 <4.1.1: '>=4.1.1' + importers: .: @@ -42,8 +53,8 @@ importers: specifier: ^0.483.0 version: 0.483.0(react@18.3.1) next: - specifier: ^15.2.3 - version: 15.5.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: '>=15.5.10' + version: 16.1.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1) postcss: specifier: ^8.5.3 version: 8.5.6 @@ -344,50 +355,53 @@ packages: '@next/env@15.5.4': resolution: {integrity: sha512-27SQhYp5QryzIT5uO8hq99C69eLQ7qkzkDPsk3N+GuS2XgOgoYEeOav7Pf8Tn4drECOVDsDg8oj+/DVy8qQL2A==} - '@next/swc-darwin-arm64@15.5.4': - resolution: {integrity: sha512-nopqz+Ov6uvorej8ndRX6HlxCYWCO3AHLfKK2TYvxoSB2scETOcfm/HSS3piPqc3A+MUgyHoqE6je4wnkjfrOA==} + '@next/env@16.1.6': + resolution: {integrity: sha512-N1ySLuZjnAtN3kFnwhAwPvZah8RJxKasD7x1f8shFqhncnWZn4JMfg37diLNuoHsLAlrDfM3g4mawVdtAG8XLQ==} + + '@next/swc-darwin-arm64@16.1.6': + resolution: {integrity: sha512-wTzYulosJr/6nFnqGW7FrG3jfUUlEf8UjGA0/pyypJl42ExdVgC6xJgcXQ+V8QFn6niSG2Pb8+MIG1mZr2vczw==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - '@next/swc-darwin-x64@15.5.4': - resolution: {integrity: sha512-QOTCFq8b09ghfjRJKfb68kU9k2K+2wsC4A67psOiMn849K9ZXgCSRQr0oVHfmKnoqCbEmQWG1f2h1T2vtJJ9mA==} + '@next/swc-darwin-x64@16.1.6': + resolution: {integrity: sha512-BLFPYPDO+MNJsiDWbeVzqvYd4NyuRrEYVB5k2N3JfWncuHAy2IVwMAOlVQDFjj+krkWzhY2apvmekMkfQR0CUQ==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - '@next/swc-linux-arm64-gnu@15.5.4': - resolution: {integrity: sha512-eRD5zkts6jS3VfE/J0Kt1VxdFqTnMc3QgO5lFE5GKN3KDI/uUpSyK3CjQHmfEkYR4wCOl0R0XrsjpxfWEA++XA==} + '@next/swc-linux-arm64-gnu@16.1.6': + resolution: {integrity: sha512-OJYkCd5pj/QloBvoEcJ2XiMnlJkRv9idWA/j0ugSuA34gMT6f5b7vOiCQHVRpvStoZUknhl6/UxOXL4OwtdaBw==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-arm64-musl@15.5.4': - resolution: {integrity: sha512-TOK7iTxmXFc45UrtKqWdZ1shfxuL4tnVAOuuJK4S88rX3oyVV4ZkLjtMT85wQkfBrOOvU55aLty+MV8xmcJR8A==} + '@next/swc-linux-arm64-musl@16.1.6': + resolution: {integrity: sha512-S4J2v+8tT3NIO9u2q+S0G5KdvNDjXfAv06OhfOzNDaBn5rw84DGXWndOEB7d5/x852A20sW1M56vhC/tRVbccQ==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-x64-gnu@15.5.4': - resolution: {integrity: sha512-7HKolaj+481FSW/5lL0BcTkA4Ueam9SPYWyN/ib/WGAFZf0DGAN8frNpNZYFHtM4ZstrHZS3LY3vrwlIQfsiMA==} + '@next/swc-linux-x64-gnu@16.1.6': + resolution: {integrity: sha512-2eEBDkFlMMNQnkTyPBhQOAyn2qMxyG2eE7GPH2WIDGEpEILcBPI/jdSv4t6xupSP+ot/jkfrCShLAa7+ZUPcJQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-linux-x64-musl@15.5.4': - resolution: {integrity: sha512-nlQQ6nfgN0nCO/KuyEUwwOdwQIGjOs4WNMjEUtpIQJPR2NUfmGpW2wkJln1d4nJ7oUzd1g4GivH5GoEPBgfsdw==} + '@next/swc-linux-x64-musl@16.1.6': + resolution: {integrity: sha512-oicJwRlyOoZXVlxmIMaTq7f8pN9QNbdes0q2FXfRsPhfCi8n8JmOZJm5oo1pwDaFbnnD421rVU409M3evFbIqg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-win32-arm64-msvc@15.5.4': - resolution: {integrity: sha512-PcR2bN7FlM32XM6eumklmyWLLbu2vs+D7nJX8OAIoWy69Kef8mfiN4e8TUv2KohprwifdpFKPzIP1njuCjD0YA==} + '@next/swc-win32-arm64-msvc@16.1.6': + resolution: {integrity: sha512-gQmm8izDTPgs+DCWH22kcDmuUp7NyiJgEl18bcr8irXA5N2m2O+JQIr6f3ct42GOs9c0h8QF3L5SzIxcYAAXXw==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] - '@next/swc-win32-x64-msvc@15.5.4': - resolution: {integrity: sha512-1ur2tSHZj8Px/KMAthmuI9FMp/YFusMMGoRNJaRZMOlSkgvLjzosSdQI0cJAKogdHl3qXUQKL9MGaYvKwA7DXg==} + '@next/swc-win32-x64-msvc@16.1.6': + resolution: {integrity: sha512-NRfO39AIrzBnixKbjuo2YiYhB6o9d8v/ymU9m/Xk8cyVk+k7XylniXkHwjs4s70wedVffc6bQNbufk5v0xEm0A==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -571,7 +585,6 @@ packages: '@types/react-toastify@4.1.0': resolution: {integrity: sha512-u7Ie/7LHBsPVz/iJxi/WlRDS7Gh9csCJACTDXx+pSLuZCm94xpkwzhM3jV1L5ZxP/in0Gp2tFbJ91VrSGr1gyQ==} - deprecated: This is a stub types definition. react-toastify provides its own type definitions, so you do not need this installed. '@types/react@18.3.25': resolution: {integrity: sha512-oSVZmGtDPmRZtVDqvdKUi/qgCsWp5IDY29wp8na8Bj4B3cc99hfNzvNhlMkVVxctkAOGUA3Km7MMpBHAnWfcIA==} @@ -670,6 +683,10 @@ packages: balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + baseline-browser-mapping@2.9.19: + resolution: {integrity: sha512-ipDqC8FrAl/76p2SSWKSI+H9tFwm7vYqXQrItCuiVPt26Km0jS+NzSsBWAaBusvSbQcfJG+JitdMm+wZAgTYqg==} + hasBin: true + brace-expansion@1.1.12: resolution: {integrity: sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==} @@ -986,8 +1003,8 @@ packages: js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - js-yaml@4.1.0: - resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} + js-yaml@4.1.1: + resolution: {integrity: sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==} hasBin: true json-buffer@3.0.1: @@ -1146,9 +1163,9 @@ packages: natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - next@15.5.4: - resolution: {integrity: sha512-xH4Yjhb82sFYQfY3vbkJfgSDgXvBB6a8xPs9i35k6oZJRoQRihZH+4s9Yo2qsWpzBmZ3lPXaJ2KPXLfkvW4LnA==} - engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0} + next@16.1.6: + resolution: {integrity: sha512-hkyRkcu5x/41KoqnROkfTm2pZVbKxvbZRuNvKXLRXxs3VfyO0WhY50TQS40EuKO9SW3rBj/sF3WbVwDACeMZyw==} + engines: {node: '>=20.9.0'} hasBin: true peerDependencies: '@opentelemetry/api': ^1.1.0 @@ -1318,8 +1335,8 @@ packages: resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==} engines: {node: '>=6'} - tar@7.5.1: - resolution: {integrity: sha512-nlGpxf+hv0v7GkWBK2V9spgactGOp0qvfWRxUMjqHyzrt3SgwE48DIv/FhqPHJYLHpgW1opq3nERbz5Anq7n1g==} + tar@7.5.7: + resolution: {integrity: sha512-fov56fJiRuThVFXD6o6/Q354S7pnWMJIVlDBYijsTNx6jKSE4pvrDTs6lUnmGvNyfJwFQQwWy3owKz1ucIhveQ==} engines: {node: '>=18'} to-regex-range@5.0.1: @@ -1414,7 +1431,7 @@ snapshots: globals: 14.0.0 ignore: 5.3.2 import-fresh: 3.3.1 - js-yaml: 4.1.0 + js-yaml: 4.1.1 minimatch: 3.1.2 strip-json-comments: 3.1.1 transitivePeerDependencies: @@ -1570,28 +1587,30 @@ snapshots: '@next/env@15.5.4': {} - '@next/swc-darwin-arm64@15.5.4': + '@next/env@16.1.6': {} + + '@next/swc-darwin-arm64@16.1.6': optional: true - '@next/swc-darwin-x64@15.5.4': + '@next/swc-darwin-x64@16.1.6': optional: true - '@next/swc-linux-arm64-gnu@15.5.4': + '@next/swc-linux-arm64-gnu@16.1.6': optional: true - '@next/swc-linux-arm64-musl@15.5.4': + '@next/swc-linux-arm64-musl@16.1.6': optional: true - '@next/swc-linux-x64-gnu@15.5.4': + '@next/swc-linux-x64-gnu@16.1.6': optional: true - '@next/swc-linux-x64-musl@15.5.4': + '@next/swc-linux-x64-musl@16.1.6': optional: true - '@next/swc-win32-arm64-msvc@15.5.4': + '@next/swc-win32-arm64-msvc@16.1.6': optional: true - '@next/swc-win32-x64-msvc@15.5.4': + '@next/swc-win32-x64-msvc@16.1.6': optional: true '@nodelib/fs.scandir@2.1.5': @@ -1700,7 +1719,7 @@ snapshots: '@tailwindcss/oxide@4.1.14': dependencies: detect-libc: 2.1.1 - tar: 7.5.1 + tar: 7.5.7 optionalDependencies: '@tailwindcss/oxide-android-arm64': 4.1.14 '@tailwindcss/oxide-darwin-arm64': 4.1.14 @@ -1886,6 +1905,8 @@ snapshots: balanced-match@1.0.2: {} + baseline-browser-mapping@2.9.19: {} + brace-expansion@1.1.12: dependencies: balanced-match: 1.0.2 @@ -2199,7 +2220,7 @@ snapshots: js-tokens@4.0.0: {} - js-yaml@4.1.0: + js-yaml@4.1.1: dependencies: argparse: 2.0.1 @@ -2322,24 +2343,25 @@ snapshots: natural-compare@1.4.0: {} - next@15.5.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + next@16.1.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: - '@next/env': 15.5.4 + '@next/env': 16.1.6 '@swc/helpers': 0.5.15 + baseline-browser-mapping: 2.9.19 caniuse-lite: 1.0.30001747 postcss: 8.4.31 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) styled-jsx: 5.1.6(react@18.3.1) optionalDependencies: - '@next/swc-darwin-arm64': 15.5.4 - '@next/swc-darwin-x64': 15.5.4 - '@next/swc-linux-arm64-gnu': 15.5.4 - '@next/swc-linux-arm64-musl': 15.5.4 - '@next/swc-linux-x64-gnu': 15.5.4 - '@next/swc-linux-x64-musl': 15.5.4 - '@next/swc-win32-arm64-msvc': 15.5.4 - '@next/swc-win32-x64-msvc': 15.5.4 + '@next/swc-darwin-arm64': 16.1.6 + '@next/swc-darwin-x64': 16.1.6 + '@next/swc-linux-arm64-gnu': 16.1.6 + '@next/swc-linux-arm64-musl': 16.1.6 + '@next/swc-linux-x64-gnu': 16.1.6 + '@next/swc-linux-x64-musl': 16.1.6 + '@next/swc-win32-arm64-msvc': 16.1.6 + '@next/swc-win32-x64-msvc': 16.1.6 sharp: 0.34.4 transitivePeerDependencies: - '@babel/core' @@ -2498,7 +2520,7 @@ snapshots: tapable@2.3.0: {} - tar@7.5.1: + tar@7.5.7: dependencies: '@isaacs/fs-minipass': 4.0.1 chownr: 3.0.0 diff --git a/src/app/(private)/confirmar-exclusao/[token]/form.tsx b/src/app/(private)/confirmar-exclusao/[token]/form.tsx index b2ce7db..0aaab76 100644 --- a/src/app/(private)/confirmar-exclusao/[token]/form.tsx +++ b/src/app/(private)/confirmar-exclusao/[token]/form.tsx @@ -1,6 +1,6 @@ 'use client'; import { Loading } from '@/components/Loading'; -import { deleteAccount } from '@/constants/form/delete-account'; +import { DELETE_ACCOUNT } from '@/constants/form/delete-account'; import { pongDeleteAccount } from '@/service/my-account/pong-delete-account'; import { clearStorage } from '@/utils/storage/clear-storage'; import { useParams } from 'next/navigation'; @@ -31,7 +31,7 @@ export function ConfirmDeleteAccountForm() { deleteAccount(); }, []); - const current = deleteAccount.find((item) => item.key === status); + const current = DELETE_ACCOUNT.find((item) => item.key === status); return (
diff --git a/src/app/(private)/gerar-resumo/form.tsx b/src/app/(private)/gerar-resumo/form.tsx new file mode 100644 index 0000000..eb0bbbb --- /dev/null +++ b/src/app/(private)/gerar-resumo/form.tsx @@ -0,0 +1,86 @@ +'use client'; + +import { Button } from '@/components/Button'; +import { Input } from '@/components/Input'; +import { Radio } from '@/components/Radio'; +import { SummaryGenerated } from '@/components/SummaryGenerated'; +import { SUMMARY_OUTPUT_FORMATS } from '@/constants/form/summary-output-formats'; +import { generateSummary } from '@/service/summary/generate-summary'; +import { cn } from '@/utils/cn'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { SubmitHandler, useForm } from 'react-hook-form'; +import { toast } from 'react-toastify'; +import { SummaryData, summarySchema } from './summary-schema'; + +export function GenerateSummaryForm() { + const { + register, + setValue, + watch, + handleSubmit, + formState: { errors, isSubmitting }, + } = useForm({ + resolver: zodResolver(summarySchema), + defaultValues: { + output_format: SUMMARY_OUTPUT_FORMATS[0], + }, + }); + const watchFormat = watch('output_format'); + + const onSubmit: SubmitHandler = async (data) => { + const result = await generateSummary(data); + + if (!result.success) { + toast.error(result.error?.message); + return; + } + + toast.success('Resumo gerado!'); + }; + + const hasSummary = true; + + return ( +
+

+ Gere um resumo +

+ +
+
+ +
+ setValue('output_format', SUMMARY_OUTPUT_FORMATS[0])} + text="PDF" + /> + setValue('output_format', SUMMARY_OUTPUT_FORMATS[1])} + value={SUMMARY_OUTPUT_FORMATS[1]} + text="Markdown" + /> +
+ +
+ +
+
+ ); +} diff --git a/src/app/(private)/gerar-resumo/page.tsx b/src/app/(private)/gerar-resumo/page.tsx new file mode 100644 index 0000000..d2b57cf --- /dev/null +++ b/src/app/(private)/gerar-resumo/page.tsx @@ -0,0 +1,12 @@ +import { Metadata } from 'next'; +import { GenerateSummaryForm } from './form'; + +export const metadata: Metadata = { + title: 'Gerar resumo | Lectify', + description: 'Gere um resumo em formato de pdf ou md a partir de uma URL de um vídeo do YouTube', + robots: { index: false, follow: false }, +}; + +export default async function GenerateSummary() { + return ; +} diff --git a/src/app/(private)/gerar-resumo/summary-schema.ts b/src/app/(private)/gerar-resumo/summary-schema.ts new file mode 100644 index 0000000..ee6f759 --- /dev/null +++ b/src/app/(private)/gerar-resumo/summary-schema.ts @@ -0,0 +1,17 @@ +import { SUMMARY_OUTPUT_FORMATS } from '@/constants/form/summary-output-formats'; +import z from 'zod'; + +export const summarySchema = z.object({ + youtube_url: z + .string() + .trim() + .min(34, 'URL inválida') + .max(200, 'URL excede o comprimento máximo') + .regex( + /^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=|embed\/|v\/|.+\?v=)?([^&]+)/, + 'URL inválida!' + ), + output_format: z.enum(SUMMARY_OUTPUT_FORMATS), +}); + +export type SummaryData = z.infer; diff --git a/src/app/(private)/minha-conta/form.tsx b/src/app/(private)/minha-conta/form.tsx index c5262ca..639790d 100644 --- a/src/app/(private)/minha-conta/form.tsx +++ b/src/app/(private)/minha-conta/form.tsx @@ -5,15 +5,15 @@ import { patchPersonalInformations } from '@/service/my-account/patch-personal-i import { Modal } from '@/components/Modal'; import { AccountInfos } from '@/components/MyAccount/AccountInfos'; -import { deleteAccount } from '@/constants/modals/delete-account'; +import { DELETE_ACCOUNT } from '@/constants/modals/delete-account'; import { filterDirtyData } from '@/utils/form/filter-data-dirty'; +import { handleDeleteAccount } from '@/utils/handlers/handle-delete-account'; import { getInformationsSaveInStorage } from '@/utils/informations/get-informations'; import { saveInformationsInStorage } from '@/utils/storage/save-informations-storage'; import { zodResolver } from '@hookform/resolvers/zod'; import { SubmitHandler, useForm } from 'react-hook-form'; import { toast } from 'react-toastify'; import { PersonalInformationData, personalInformationSchema } from './personal-information-schema'; -import { handleDeleteAccount } from '@/utils/handlers/handle-delete-account'; export function MyAccountForm() { const info = getInformationsSaveInStorage(); @@ -81,11 +81,11 @@ export function MyAccountForm() { @@ -94,8 +94,8 @@ export function MyAccountForm() { className="w-fit py-1.5 text-xs bg-red-400 border-red-500 " aria-haspopup="dialog" aria-expanded="false" - aria-controls={`hs-${deleteAccount.id}`} - data-hs-overlay={`#hs-${deleteAccount.id}`} + aria-controls={`hs-${DELETE_ACCOUNT.id}`} + data-hs-overlay={`#hs-${DELETE_ACCOUNT.id}`} > Deletar conta diff --git a/src/components/Footer/Contacts/index.tsx b/src/components/Footer/Contacts/index.tsx index 342c9c9..978c4bd 100644 --- a/src/components/Footer/Contacts/index.tsx +++ b/src/components/Footer/Contacts/index.tsx @@ -1,11 +1,11 @@ -import { contacts } from '@/constants/footer/contacts'; +import { CONTACTS } from '@/constants/footer/contacts'; export function Contacts() { return (