diff --git a/frontend/package.json b/frontend/package.json index 627eb18..2b11eeb 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,15 +10,21 @@ "deploy": "vercel deploy --prod --token=$VERCEL_TOKEN" }, "dependencies": { + "@lexical/html": "^0.17.1", + "@lexical/link": "^0.17.1", + "@lexical/list": "^0.17.1", + "@lexical/react": "^0.17.1", + "@lexical/rich-text": "^0.17.1", + "lexical": "^0.17.1", + "mapbox-gl": "^3.6.0", "next": "14.2.6", "react": "^18", "react-dom": "^18", "react-icons": "^5.3.0", - "sharp": "^0.33.5", - "zod": "^3.23.8", - "mapbox-gl": "^3.6.0", "react-map-gl": "^7.1.7", - "swiper": "^11.1.12" + "sharp": "^0.33.5", + "swiper": "^11.1.12", + "zod": "^3.23.8" }, "devDependencies": { "@types/mapbox-gl": "^3.4.0", @@ -31,4 +37,4 @@ "tailwindcss": "^3.4.1", "typescript": "^5" } -} \ No newline at end of file +} diff --git a/frontend/public/icons/arrow-clockwise.svg b/frontend/public/icons/arrow-clockwise.svg new file mode 100644 index 0000000..b072eb0 --- /dev/null +++ b/frontend/public/icons/arrow-clockwise.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/icons/arrow-counterclockwise.svg b/frontend/public/icons/arrow-counterclockwise.svg new file mode 100644 index 0000000..b0b23b9 --- /dev/null +++ b/frontend/public/icons/arrow-counterclockwise.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/icons/journal-text.svg b/frontend/public/icons/journal-text.svg new file mode 100644 index 0000000..9b66f43 --- /dev/null +++ b/frontend/public/icons/journal-text.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/frontend/public/icons/justify.svg b/frontend/public/icons/justify.svg new file mode 100644 index 0000000..009bd72 --- /dev/null +++ b/frontend/public/icons/justify.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/public/icons/text-center.svg b/frontend/public/icons/text-center.svg new file mode 100644 index 0000000..2887a99 --- /dev/null +++ b/frontend/public/icons/text-center.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/public/icons/text-left.svg b/frontend/public/icons/text-left.svg new file mode 100644 index 0000000..0452611 --- /dev/null +++ b/frontend/public/icons/text-left.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/public/icons/text-paragraph.svg b/frontend/public/icons/text-paragraph.svg new file mode 100644 index 0000000..9779bea --- /dev/null +++ b/frontend/public/icons/text-paragraph.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/public/icons/text-right.svg b/frontend/public/icons/text-right.svg new file mode 100644 index 0000000..34686b0 --- /dev/null +++ b/frontend/public/icons/text-right.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/public/icons/type-bold.svg b/frontend/public/icons/type-bold.svg new file mode 100644 index 0000000..276d133 --- /dev/null +++ b/frontend/public/icons/type-bold.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/public/icons/type-italic.svg b/frontend/public/icons/type-italic.svg new file mode 100644 index 0000000..3ac6b09 --- /dev/null +++ b/frontend/public/icons/type-italic.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/public/icons/type-strikethrough.svg b/frontend/public/icons/type-strikethrough.svg new file mode 100644 index 0000000..1c940e4 --- /dev/null +++ b/frontend/public/icons/type-strikethrough.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/public/icons/type-underline.svg b/frontend/public/icons/type-underline.svg new file mode 100644 index 0000000..c299b8b --- /dev/null +++ b/frontend/public/icons/type-underline.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/src/actions/albumActions.ts b/frontend/src/actions/albumActions.ts index ba90c28..5fd757b 100644 --- a/frontend/src/actions/albumActions.ts +++ b/frontend/src/actions/albumActions.ts @@ -7,12 +7,11 @@ export async function createAlbumAction( markerCoordinates: CountryWithoutDescription | null, tags: string[], token: string | null, + description: string, prevState: any, formData: FormData ) { const title = formData.get('title') as string - const description = formData.get('description') as string - console.log(token) const fields = { title: title, description: description, diff --git a/frontend/src/components/CreateAlbumForm.tsx b/frontend/src/components/CreateAlbumForm.tsx index c87e4a8..ab419bf 100644 --- a/frontend/src/components/CreateAlbumForm.tsx +++ b/frontend/src/components/CreateAlbumForm.tsx @@ -11,6 +11,8 @@ import { Country, PhotoFromAlbum } from "@/interfaces/album" import { TagsInput } from "./TagsInput" import ImageDescription from "./ImageInput" import { useRouter } from "next/navigation" +import LexicalEditor from "./LexicalEditor" +import { EditorState } from "lexical" const INITIAL_STATE = { @@ -21,13 +23,15 @@ export default function CreateAlbumForm() { const [markerCoordinates, setMarkerCoordinates] = useState(null) const [albumImages, setAlbumImages] = useState([]) const [tags, setTags] = useState([]) + const [description, setDescription] = useState(""); + /* const [confirmSend, setConfirmSend] = useState(false) */ //cambiar por una cookie let token = null if (typeof window !== 'undefined') { token = localStorage.getItem('token') } - const createAlbumComplete = createAlbumAction.bind(null, albumImages, markerCoordinates, tags, token) + const createAlbumComplete = createAlbumAction.bind(null, albumImages, markerCoordinates, tags, token, description) const [formState, formAction] = useFormState( createAlbumComplete, INITIAL_STATE @@ -65,9 +69,15 @@ export default function CreateAlbumForm() { ) } + //asi es como se manejaria la descripcion del json para poder renderizarla y verla como se edito + const handleEditorChange = (editorState: EditorState) => { + const json = editorState.toJSON() + setDescription(JSON.stringify(json)) + } + useEffect(() => { if (formState.success) { - router.push(`/feed`) + /* router.push(`/feed`) */ } // eslint-disable-next-line react-hooks/exhaustive-deps }, [formState?.success]); @@ -94,21 +104,14 @@ export default function CreateAlbumForm() {
- - +
{formState?.errors?.description &&

{formState?.errors?.description}

}