From a8ee1258e8ce9048665e06b3f5291c63adb96563 Mon Sep 17 00:00:00 2001 From: Tamir <1tamir198@gmail.com> Date: Tue, 26 Mar 2024 23:45:29 +0200 Subject: [PATCH 01/10] Replace then with await --- actions/fetchProjectsData.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/actions/fetchProjectsData.ts b/actions/fetchProjectsData.ts index 94dfb4ef..703dfd85 100644 --- a/actions/fetchProjectsData.ts +++ b/actions/fetchProjectsData.ts @@ -18,20 +18,20 @@ async function fetchProjectsData({ limit = 100, filter = ProjectPaginationFilter.ALL, }: ProjectPaginationRequest) { + const response = await fetch(PROJECT_API_ENDPOINT, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ page, limit, filter }), + }); + // fetch from endpoint POST with page, limit, filter as IProjectsDataResponse - const { projects, total, languages, pageLanguages, timestamp } = await fetch( - PROJECT_API_ENDPOINT, - { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ page, limit, filter }), - } - ).then(res => res.json() as Promise); + const { projects, total, languages, pageLanguages, timestamp } = + await response.json(); return { - projects: projects, + projects, pageLanguages, }; } From ff83b98201c2263c429954344b66cfc8580a3906 Mon Sep 17 00:00:00 2001 From: Tamir <1tamir198@gmail.com> Date: Tue, 26 Mar 2024 23:51:59 +0200 Subject: [PATCH 02/10] Fix ts errors --- app/[locale]/projects/page.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/[locale]/projects/page.tsx b/app/[locale]/projects/page.tsx index a5920061..afde4763 100644 --- a/app/[locale]/projects/page.tsx +++ b/app/[locale]/projects/page.tsx @@ -79,7 +79,7 @@ const ProjectsPage = () => { }); setProjects( - projects.filter(p => + projects.filter((p :Project) => p.item.data.repository.name .toLocaleLowerCase() .trim() @@ -88,7 +88,7 @@ const ProjectsPage = () => { ); const newTags: ProjectFilter[] = []; - pageLanguages.forEach(lang => { + pageLanguages.forEach((lang : string) => { newTags.push({ name: lang, isActive: true }); }); setTags(newTags); From b6b8de412a32cd6cfc716bc094fdb2c3a202cfbe Mon Sep 17 00:00:00 2001 From: Tamir <1tamir198@gmail.com> Date: Tue, 26 Mar 2024 23:52:44 +0200 Subject: [PATCH 03/10] Fix ts erros --- app/[locale]/projects/page.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/[locale]/projects/page.tsx b/app/[locale]/projects/page.tsx index afde4763..8be2d599 100644 --- a/app/[locale]/projects/page.tsx +++ b/app/[locale]/projects/page.tsx @@ -79,7 +79,7 @@ const ProjectsPage = () => { }); setProjects( - projects.filter((p :Project) => + projects.filter((p: Project) => p.item.data.repository.name .toLocaleLowerCase() .trim() @@ -88,7 +88,7 @@ const ProjectsPage = () => { ); const newTags: ProjectFilter[] = []; - pageLanguages.forEach((lang : string) => { + pageLanguages.forEach((lang: string) => { newTags.push({ name: lang, isActive: true }); }); setTags(newTags); From 09a316b5a700f548f164bade2d4aa069ff2523e8 Mon Sep 17 00:00:00 2001 From: Tamir <1tamir198@gmail.com> Date: Wed, 27 Mar 2024 22:35:40 +0200 Subject: [PATCH 04/10] Add return type --- actions/fetchProjectsData.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/actions/fetchProjectsData.ts b/actions/fetchProjectsData.ts index 703dfd85..c9edf2c2 100644 --- a/actions/fetchProjectsData.ts +++ b/actions/fetchProjectsData.ts @@ -2,6 +2,7 @@ import { IProjectsDataResponse, + Project, ProjectPaginationFilter, } from '@/types/project'; @@ -9,6 +10,8 @@ export type ProjectPaginationRequest = { page?: number; limit?: number; filter?: ProjectPaginationFilter; + projects?: Project[]; + pageLanguages?: string[]; }; const PROJECT_API_ENDPOINT = 'https://baas-data-provider.onrender.com/projects'; From c5acf5c4dd543be08cfe089d4151f68edd4c9fde Mon Sep 17 00:00:00 2001 From: Tamir <1tamir198@gmail.com> Date: Wed, 27 Mar 2024 22:37:08 +0200 Subject: [PATCH 05/10] Remive log --- app/[locale]/projects/page.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/[locale]/projects/page.tsx b/app/[locale]/projects/page.tsx index 8be2d599..b099ef38 100644 --- a/app/[locale]/projects/page.tsx +++ b/app/[locale]/projects/page.tsx @@ -69,7 +69,6 @@ const ProjectsPage = () => { }; const debouncedFetchProjectsData = useCallback(async () => { - console.log('first', Date.now()); setLoading(true); try { const { projects, pageLanguages } = await fetchProjectsData({ From a4feb535507261f82375d9c8137d43e13b159660 Mon Sep 17 00:00:00 2001 From: Tamir <1tamir198@gmail.com> Date: Thu, 28 Mar 2024 11:04:44 +0200 Subject: [PATCH 06/10] Change return type --- actions/fetchProjectsData.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/actions/fetchProjectsData.ts b/actions/fetchProjectsData.ts index c9edf2c2..289c7bdd 100644 --- a/actions/fetchProjectsData.ts +++ b/actions/fetchProjectsData.ts @@ -10,8 +10,6 @@ export type ProjectPaginationRequest = { page?: number; limit?: number; filter?: ProjectPaginationFilter; - projects?: Project[]; - pageLanguages?: string[]; }; const PROJECT_API_ENDPOINT = 'https://baas-data-provider.onrender.com/projects'; @@ -20,7 +18,7 @@ async function fetchProjectsData({ page = 1, limit = 100, filter = ProjectPaginationFilter.ALL, -}: ProjectPaginationRequest) { +}: ProjectPaginationRequest): Promise { const response = await fetch(PROJECT_API_ENDPOINT, { method: 'POST', headers: { From 59a094e1c5acec4da646f200471579aede663061 Mon Sep 17 00:00:00 2001 From: Tamir <1tamir198@gmail.com> Date: Thu, 28 Mar 2024 11:05:42 +0200 Subject: [PATCH 07/10] Change return type --- actions/fetchProjectsData.ts | 5 +- playwright-report/index.html | 22331 +++++++++++++++++++++++++++++++++ 2 files changed, 22332 insertions(+), 4 deletions(-) create mode 100644 playwright-report/index.html diff --git a/actions/fetchProjectsData.ts b/actions/fetchProjectsData.ts index 289c7bdd..76743b87 100644 --- a/actions/fetchProjectsData.ts +++ b/actions/fetchProjectsData.ts @@ -31,10 +31,7 @@ async function fetchProjectsData({ const { projects, total, languages, pageLanguages, timestamp } = await response.json(); - return { - projects, - pageLanguages, - }; + return { projects, total, languages, pageLanguages, timestamp }; } export default fetchProjectsData; diff --git a/playwright-report/index.html b/playwright-report/index.html new file mode 100644 index 00000000..93ad5941 --- /dev/null +++ b/playwright-report/index.html @@ -0,0 +1,22331 @@ + + + + + + + Playwright Test Report + + + + +
+ + + From fe80962d70114050a4f780632e0d5b684e26b264 Mon Sep 17 00:00:00 2001 From: Tamir Abutbul <1tamir198@gmail.com> Date: Thu, 28 Mar 2024 11:08:21 +0200 Subject: [PATCH 08/10] Delete playwright-report/index.html --- playwright-report/index.html | 22331 --------------------------------- 1 file changed, 22331 deletions(-) delete mode 100644 playwright-report/index.html diff --git a/playwright-report/index.html b/playwright-report/index.html deleted file mode 100644 index 93ad5941..00000000 --- a/playwright-report/index.html +++ /dev/null @@ -1,22331 +0,0 @@ - - - - - - - Playwright Test Report - - - - -
- - - From 52724c3da705c21624b48045b8948e5be9d654ab Mon Sep 17 00:00:00 2001 From: Tamir <1tamir198@gmail.com> Date: Thu, 28 Mar 2024 11:14:26 +0200 Subject: [PATCH 09/10] Change local to use custom hook --- app/[locale]/members/page.tsx | 8 +++++--- components/BeOurFriends/BeOurFriends.tsx | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/[locale]/members/page.tsx b/app/[locale]/members/page.tsx index 96f5eb97..a3727c9e 100644 --- a/app/[locale]/members/page.tsx +++ b/app/[locale]/members/page.tsx @@ -6,7 +6,9 @@ import { MembersList } from '@/components/Members/MembersLIst/MembersList'; import { Member } from '@/types'; import { fetchFilteredMemebers } from '@/actions/fetchFilteredMemebers'; import { useTranslations } from 'next-intl'; -import useTypedLocale from '@/hooks/useTypedLocale'; +import useTextDirection from '@/hooks/useTextDirection'; + + const Magnifier: React.FC> = props => { return ( @@ -34,10 +36,10 @@ const Magnifier: React.FC> = props => { const WelcomeMessage = () => { const t = useTranslations('Members'); - const localLang = useTypedLocale(); + const direction = useTextDirection(); return (
diff --git a/components/BeOurFriends/BeOurFriends.tsx b/components/BeOurFriends/BeOurFriends.tsx index 3d842883..d5876012 100644 --- a/components/BeOurFriends/BeOurFriends.tsx +++ b/components/BeOurFriends/BeOurFriends.tsx @@ -21,7 +21,7 @@ const variants = { }; const BeOurFriends = () => { - const t = useTranslations('components.home.beOurFriends'); + const t = useTranslations('Components.home.beOurFriends'); const localLang = useLocale(); const direction = localLang == 'he' ? 'rtl' : 'ltr'; From 70466244fef59f58e903e633ca84de7b17d6e188 Mon Sep 17 00:00:00 2001 From: Tamir <1tamir198@gmail.com> Date: Thu, 28 Mar 2024 11:15:23 +0200 Subject: [PATCH 10/10] Format --- app/[locale]/members/page.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/[locale]/members/page.tsx b/app/[locale]/members/page.tsx index a3727c9e..53097a2b 100644 --- a/app/[locale]/members/page.tsx +++ b/app/[locale]/members/page.tsx @@ -8,8 +8,6 @@ import { fetchFilteredMemebers } from '@/actions/fetchFilteredMemebers'; import { useTranslations } from 'next-intl'; import useTextDirection from '@/hooks/useTextDirection'; - - const Magnifier: React.FC> = props => { return (