diff --git a/package.json b/package.json index 28f78dab..fecc5445 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "bootstrap": "^5.3.3", "email-validator": "^2.0.4", "i18next": "^23.10.1", - "need4deed-sdk": "git+https://github.com/need4deed-org/sdk.git", + "need4deed-sdk": "", "react": "^18.2.0", "react-bootstrap": "^2.10.1", "react-cookie-consent": "^9.0.0", diff --git a/src/components/Form/Submit.tsx b/src/components/Form/Submit.tsx deleted file mode 100644 index aff99c23..00000000 --- a/src/components/Form/Submit.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { FormApi, FormState } from "@tanstack/react-form"; -import { ReactFormApiLike } from "./types"; - -interface Props { - form: FormApi & ReactFormApiLike; - label?: string; - classDiv?: string; - classButton?: string; -} - -export default function Submit({ - form, - label, - classDiv, - classButton, -}: Props) { - return ( - ) => state}> - {(state: Partial>) => ( -
- -
- )} -
- ); -} diff --git a/src/components/Form/index.tsx b/src/components/Form/index.tsx deleted file mode 100644 index 58742701..00000000 --- a/src/components/Form/index.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { FormApi, FormValidators, useForm } from "@tanstack/react-form"; -import Submit from "./Submit"; -import { ReactFormApiLike } from "./types"; - -interface Props { - defaultValues: T; - validators?: FormValidators; - onSubmit: (props: { value: T; formApi: FormApi }) => void; -} - -export default function Form({ - defaultValues, - validators, - onSubmit, -}: Props) { - const form = useForm({ defaultValues, validators, onSubmit }); - return ( -
-
{ - e.preventDefault(); - e.stopPropagation(); - form.handleSubmit(); - }} - > - - form={form as FormApi & ReactFormApiLike} - label="Submit" - /> - -
- ); -} diff --git a/src/components/Form/opportunity/index.ts b/src/components/Form/opportunity/index.ts deleted file mode 100644 index 6d6c28cc..00000000 --- a/src/components/Form/opportunity/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -const defaultValues = {}; -const validators = {}; -const structure = {}; -function onSubmit({ value }: { value: typeof defaultValues }) { - // eslint-disable-next-line no-console - console.log("DEBUG:opportunity:onSubmit:value:", value); -} - -export default { defaultValues, onSubmit, validators, structure }; diff --git a/src/components/Form/types.ts b/src/components/Form/types.ts deleted file mode 100644 index c1d12f38..00000000 --- a/src/components/Form/types.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { FormState } from "@tanstack/react-form"; -import { ComponentType, ReactNode } from "react"; - -export type ReactFormApiLike = { - Subscribe: ComponentType<{ - selector: (state: FormState) => FormState; - children: (selectedState: Partial) => ReactNode; - }>; -}; diff --git a/src/components/Form/volunteer/index.ts b/src/components/Form/volunteer/index.ts deleted file mode 100644 index 76068879..00000000 --- a/src/components/Form/volunteer/index.ts +++ /dev/null @@ -1,37 +0,0 @@ -import fallbackLists from "../../forms/fallbackLists"; -import { ListsOfOptions } from "../../forms/types"; -import { getAllSelectedFalse, getScheduleState } from "../../forms/utils"; - -const lists = fallbackLists; -const defaultValues = { - name: "", - email: "", - phone: "", - postcode: "", - locations: getAllSelectedFalse(lists[ListsOfOptions.LOCATIONS]), - availability: getScheduleState(), - languagesNative: getAllSelectedFalse(lists[ListsOfOptions.LANGUAGES]), - languagesFluent: getAllSelectedFalse(lists[ListsOfOptions.LANGUAGES]), - languagesIntermediate: getAllSelectedFalse(lists[ListsOfOptions.LANGUAGES]), - activities: getAllSelectedFalse(lists[ListsOfOptions.ACTIVITIES]), - skills: getAllSelectedFalse(lists[ListsOfOptions.SKILLS]), - certOfGoodConduct: undefined, - certMeaslesVaccination: undefined, - leadFrom: getAllSelectedFalse(lists[ListsOfOptions.LEADS]), - comments: "", - consent: undefined, -}; - -const validators = {}; - -const structure = { - main: {}, - sections: {}, -}; - -function onSubmit({ value }: { value: typeof defaultValues }) { - // eslint-disable-next-line no-console - console.log("DEBUG:volunteer:onSubmit:value:", value); -} - -export default { defaultValues, onSubmit, validators, structure }; diff --git a/src/components/core/paginatedCards/PaginatedCards.tsx b/src/components/core/paginatedCards/PaginatedCards.tsx index 4e375e4c..4953f8c8 100644 --- a/src/components/core/paginatedCards/PaginatedCards.tsx +++ b/src/components/core/paginatedCards/PaginatedCards.tsx @@ -36,6 +36,7 @@ export function PaginatedCards({ const visibleCards = cards.slice(startIndex, endIndex); const nextCardElement = cards[endIndex]; + const showNavigation = totalPages > 1; const goToPage = (pageNumber: number) => { setCurrentPage(pageNumber); @@ -50,12 +51,14 @@ export function PaginatedCards({ id="paginated-cards-container" {...{ onTouchStart, onTouchEnd }} > - + {showNavigation && ( + + )} {isOverlayingCards ? ( @@ -74,13 +77,15 @@ export function PaginatedCards({ )} - + {showNavigation && ( + + )} ); } diff --git a/src/config/constants.ts b/src/config/constants.ts index 40dba87f..20ae907b 100644 --- a/src/config/constants.ts +++ b/src/config/constants.ts @@ -25,15 +25,6 @@ export const maxPLZBerlin = 14199; export const phoneRegEx = /^([+]?[\s0-9]+)?(\d{3}|[(]?[0-9]+[)])?([-]?[\s]?[0-9])+$/; -export const FF = { - NEW_FORMS_VOLUNTEER: positives.includes( - import.meta.env.VITE_FF_NEW_FORMS_VOLUNTEER, - ), - NEW_FORMS_OPPORTUNITY: positives.includes( - import.meta.env.VITE_FF_NEW_FORMS_OPPORTUNITY, - ), -}; - export const timeZone = import.meta.env.VITE_TZ || "Europe/Berlin"; export const screenSizeThresholds = { diff --git a/src/pages/Subpage.tsx b/src/pages/Subpage.tsx index a63791f3..53bf461f 100644 --- a/src/pages/Subpage.tsx +++ b/src/pages/Subpage.tsx @@ -2,16 +2,13 @@ import { Lang } from "need4deed-sdk"; import { useContext, useEffect, useMemo } from "react"; import ReactGA from "react-ga4"; import { useTranslation } from "react-i18next"; -import { useNavigate, useParams, useSearchParams } from "react-router-dom"; +import { useNavigate, useParams } from "react-router-dom"; import Announcement from "../components/Announcement"; import Event from "../components/Event/Event"; import Events from "../components/Event/Events"; import FAQs from "../components/FAQs/FAQs"; import Footer from "../components/Footer/Footer"; -import NewForm from "../components/Form"; -import opportunity from "../components/Form/opportunity"; -import volunteer from "../components/Form/volunteer"; import Form from "../components/forms"; import { FormType } from "../components/forms/types"; import Header from "../components/Header/Header"; @@ -20,7 +17,7 @@ import Cookie from "../components/Legal/Cookies"; import DataPrivacy from "../components/Legal/DataPrivacy"; import Guidelines from "../components/Legal/Guidelines"; import LegalNotice from "../components/Legal/Notice"; -import { FF, showEvent } from "../config/constants"; +import { showEvent } from "../config/constants"; import { Subpages } from "../config/types"; import AppContainerContext from "../contexts/AppContainerContext"; import useEvents from "../hooks/api/useEvents"; @@ -33,14 +30,10 @@ interface Props { function Subpage({ type }: Props) { const { i18n } = useTranslation(); const { lng } = useParams(); - const [ffNewForm] = useSearchParams(); const navigate = useNavigate(); const containerRef = useContext(AppContainerContext); const [events] = useEvents(i18n.language as Lang); - const ffOpp = ffNewForm.get("opp"); - const ffVol = ffNewForm.get("vol"); - const eventActive = useMemo( () => events?.find((event) => event.active), [events], @@ -71,19 +64,9 @@ function Subpage({ type }: Props) { case Subpages.GUIDELINES: return ; case Subpages.BECOME_VOLUNTEER: - return FF.NEW_FORMS_VOLUNTEER || ffVol ? ( - // eslint-disable-next-line react/jsx-props-no-spreading - {...volunteer} /> - ) : ( -
- ); + return ; case Subpages.ADD_OPPORTUNITY: - return FF.NEW_FORMS_OPPORTUNITY || ffOpp ? ( - // eslint-disable-next-line react/jsx-props-no-spreading - {...opportunity} /> - ) : ( - - ); + return ; case Subpages.ANNOUNCEMENT: return ; case Subpages.EVENT: diff --git a/yarn.lock b/yarn.lock index 2dc1ad62..43be9d47 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10947,9 +10947,10 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -"need4deed-sdk@git+https://github.com/need4deed-org/sdk.git": - version "0.0.7" - resolved "git+https://github.com/need4deed-org/sdk.git#3b1902a7c19966f66168d0f2ad761ea095e9dd21" +need4deed-sdk@: + version "0.0.12" + resolved "https://registry.yarnpkg.com/need4deed-sdk/-/need4deed-sdk-0.0.12.tgz#8d66a411f4ef6ce3ed5cb867457e51faf63df74c" + integrity sha512-SxTPpBMnbOD8csadN1UV/li7lXKPa9psUB0HexmC1o6PDIowMcp9ky+Ylw1dHAlQVJCYm7JdpNYq/YMobguMQA== neo-async@^2.6.0: version "2.6.2"