diff --git a/app/[locale]/dashboard/[entityType]/[entitySlug]/page.tsx b/app/[locale]/dashboard/[entityType]/[entitySlug]/page.tsx index 7cb4efd6..e01da9e7 100644 --- a/app/[locale]/dashboard/[entityType]/[entitySlug]/page.tsx +++ b/app/[locale]/dashboard/[entityType]/[entitySlug]/page.tsx @@ -1,9 +1,18 @@ -import { InProgress } from '@/components/in-progress'; - -export default async function Page({ params }: { params: { id: string } }) { - return ( - <> - - - ); -} \ No newline at end of file +'use client'; + +import { useEffect } from 'react'; +import { useRouter } from 'next/navigation'; + +export default function Page({ + params, +}: { + params: { entityType: string; entitySlug: string }; +}) { + const router = useRouter(); + + useEffect(() => { + router.push(`/dashboard/${params.entityType}/${params.entitySlug}/dataset?tab=drafts`); + }, [params, router]); + + return null; // prevent rendering anything before redirect +} diff --git a/app/[locale]/dashboard/[entityType]/[entitySlug]/profile/orgProfile.tsx b/app/[locale]/dashboard/[entityType]/[entitySlug]/profile/orgProfile.tsx index a6868048..a73343d0 100644 --- a/app/[locale]/dashboard/[entityType]/[entitySlug]/profile/orgProfile.tsx +++ b/app/[locale]/dashboard/[entityType]/[entitySlug]/profile/orgProfile.tsx @@ -116,26 +116,36 @@ const OrgProfile = () => { ); const handleSave = () => { - // Create mutation input with only changed fields - const inputData: OrganizationInputPartial = { - name: formData.name, - contactEmail: formData.contactEmail, - organizationTypes: formData.organizationTypes, - homepage: formData.homepage, - description: formData.description, - id: formData.id, - linkedinProfile: formData.linkedinProfile, - githubProfile: formData.githubProfile, - twitterProfile: formData.twitterProfile, - location: formData.location, - }; + const formValidation = + formData.name && + formData.contactEmail && + formData.description && + formData.logo; - // Only add logo if it has changed - if (formData.logo instanceof File) { - inputData.logo = formData.logo; - } + if (!formValidation) { + toast('Please fill all the required fields'); + return; + } else { + const inputData: OrganizationInputPartial = { + name: formData.name, + contactEmail: formData.contactEmail, + organizationTypes: formData.organizationTypes, + homepage: formData.homepage, + description: formData.description, + id: formData.id, + linkedinProfile: formData.linkedinProfile, + githubProfile: formData.githubProfile, + twitterProfile: formData.twitterProfile, + location: formData.location, + }; + + // Only add logo if it has changed + if (formData.logo instanceof File) { + inputData.logo = formData.logo; + } - mutate({ input: inputData }); + mutate({ input: inputData }); + } }; return ( @@ -147,7 +157,7 @@ const OrgProfile = () => {
setFormData({ ...formData, name: e })} @@ -156,7 +166,7 @@ const OrgProfile = () => {
setFormData({ ...formData, contactEmail: e })} @@ -234,7 +244,7 @@ const OrgProfile = () => {
{
setFormData({ ...formData, logo: e[0] })} name={'Logo'} > diff --git a/app/[locale]/dashboard/[entityType]/[entitySlug]/profile/userProfile.tsx b/app/[locale]/dashboard/[entityType]/[entitySlug]/profile/userProfile.tsx index c16b3fbd..c88862a7 100644 --- a/app/[locale]/dashboard/[entityType]/[entitySlug]/profile/userProfile.tsx +++ b/app/[locale]/dashboard/[entityType]/[entitySlug]/profile/userProfile.tsx @@ -100,22 +100,34 @@ const UserProfile = () => { const handleSave = () => { // Create mutation input with only changed fields - const inputData: UpdateUserInput = { - firstName: formData.firstName, - lastName: formData.lastName, - bio: formData.bio, - email: formData.email, - githubProfile: formData.githubProfile, - linkedinProfile: formData.linkedinProfile, - twitterProfile: formData.twitterProfile, - location: formData.location, - }; - - // Only add logo if it has changed - if (formData.profilePicture instanceof File) { - inputData.profilePicture = formData.profilePicture; + const formValidation = + formData.firstName && + formData.lastName && + formData.email && + formData.bio && + formData.location; + + if (!formValidation) { + toast('Please fill all the required fields'); + return; + } else { + const inputData: UpdateUserInput = { + firstName: formData.firstName, + lastName: formData.lastName, + bio: formData.bio, + email: formData.email, + githubProfile: formData.githubProfile, + linkedinProfile: formData.linkedinProfile, + twitterProfile: formData.twitterProfile, + location: formData.location, + }; + + // Only add logo if it has changed + if (formData.profilePicture instanceof File) { + inputData.profilePicture = formData.profilePicture; + } + mutate({ input: inputData }); } - mutate({ input: inputData }); }; return ( @@ -129,7 +141,7 @@ const UserProfile = () => {
setFormData({ ...formData, firstName: e })} @@ -137,7 +149,7 @@ const UserProfile = () => {
setFormData({ ...formData, lastName: e })} @@ -147,7 +159,7 @@ const UserProfile = () => {
setFormData({ ...formData, email: e })} @@ -189,7 +201,7 @@ const UserProfile = () => {
{
setFormData({ ...formData, profilePicture: e[0] })} name={'Profile Picture'} > diff --git a/app/[locale]/dashboard/[entityType]/page.tsx b/app/[locale]/dashboard/[entityType]/page.tsx index 18384dea..a099130f 100644 --- a/app/[locale]/dashboard/[entityType]/page.tsx +++ b/app/[locale]/dashboard/[entityType]/page.tsx @@ -1,14 +1,15 @@ 'use client'; +import { useState } from 'react'; +import Image from 'next/image'; +import Link from 'next/link'; +import { notFound, useParams, usePathname } from 'next/navigation'; import { ApiOrganizationOrganizationTypesEnum, OrganizationInput, } from '@/gql/generated/graphql'; import { useOrganizationTypes } from '@/hooks/useOrganizationTypes'; import { useMutation } from '@tanstack/react-query'; -import Image from 'next/image'; -import Link from 'next/link'; -import { notFound, useParams, usePathname } from 'next/navigation'; import { Button, Dialog, @@ -17,16 +18,15 @@ import { Select, Text, TextField, - toast + toast, } from 'opub-ui'; -import { useState } from 'react'; -import BreadCrumbs from '@/components/BreadCrumbs'; -import { Icons } from '@/components/icons'; -import { Loading } from '@/components/loading'; import { useDashboardStore } from '@/config/store'; import { GraphQL } from '@/lib/api'; import { cn } from '@/lib/utils'; +import BreadCrumbs from '@/components/BreadCrumbs'; +import { Icons } from '@/components/icons'; +import { Loading } from '@/components/loading'; import styles from './../components/styles.module.scss'; import { organizationCreationMutation } from './schema'; @@ -90,7 +90,20 @@ const Page = () => { if (params.entityType !== 'organization') { return notFound(); } - + const handleSave = () => { + const formValidation = + formData.name && + formData.description && + formData.logo && + formData.contactEmail; + + if (!formValidation) { + toast('Please fill all the required fields'); + return; + } else { + mutate({ input: formData }); + } + }; return ( <> { ]} />
- {allEntityDetails?.organizations.length < 0 || allEntityDetails === null ? ( + {allEntityDetails?.organizations.length < 0 || + allEntityDetails === null ? ( ) : (
@@ -154,7 +168,7 @@ const Page = () => {
@@ -164,7 +178,7 @@ const Page = () => {
{
{ />
setFormData({ ...formData, logo: e[0] }) } @@ -257,9 +271,7 @@ const Page = () => { setFormData({ ...formData, location: e }) } /> - +
diff --git a/public/1org.png b/public/1org.png new file mode 100644 index 00000000..68f83cf0 Binary files /dev/null and b/public/1org.png differ diff --git a/public/1profile.png b/public/1profile.png new file mode 100644 index 00000000..59b4a011 Binary files /dev/null and b/public/1profile.png differ diff --git a/public/org.png b/public/org.png index 68f83cf0..12206157 100644 Binary files a/public/org.png and b/public/org.png differ diff --git a/public/profile.png b/public/profile.png index 59b4a011..982d10b4 100644 Binary files a/public/profile.png and b/public/profile.png differ