From 6ca9be5ecb08c0df20cd04fd5e45459c4283c954 Mon Sep 17 00:00:00 2001 From: Marco Bonomo Date: Mon, 29 Jan 2024 17:13:14 +0100 Subject: [PATCH 01/12] =?UTF-8?q?=F0=9F=94=A5=20refactor(campaignSettings.?= =?UTF-8?q?tsx,=20projectSettings.tsx,=20workspaceSettings.tsx):=20remove?= =?UTF-8?q?=20unused=20'locale'=20property=20from=20API=20requests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/components/inviteUsers/campaignSettings.tsx | 1 - src/common/components/inviteUsers/projectSettings.tsx | 1 - src/common/components/inviteUsers/workspaceSettings.tsx | 1 - 3 files changed, 3 deletions(-) diff --git a/src/common/components/inviteUsers/campaignSettings.tsx b/src/common/components/inviteUsers/campaignSettings.tsx index 07e0bd0b9..bfaccdd4f 100644 --- a/src/common/components/inviteUsers/campaignSettings.tsx +++ b/src/common/components/inviteUsers/campaignSettings.tsx @@ -109,7 +109,6 @@ export const CampaignSettings = () => { body: { email: values.email, redirect_url: campaignRoute, - locale: i18n.language, ...(values.message && { message: values.message }), }, }) diff --git a/src/common/components/inviteUsers/projectSettings.tsx b/src/common/components/inviteUsers/projectSettings.tsx index 8ce810e46..21451c25c 100644 --- a/src/common/components/inviteUsers/projectSettings.tsx +++ b/src/common/components/inviteUsers/projectSettings.tsx @@ -84,7 +84,6 @@ export const ProjectSettings = () => { body: { email: values.email, redirect_url: projectRoute, - locale: i18n.language, ...(values.message && { message: values.message }), }, }) diff --git a/src/common/components/inviteUsers/workspaceSettings.tsx b/src/common/components/inviteUsers/workspaceSettings.tsx index 8fa74c1d1..04795b3cf 100644 --- a/src/common/components/inviteUsers/workspaceSettings.tsx +++ b/src/common/components/inviteUsers/workspaceSettings.tsx @@ -61,7 +61,6 @@ export const WorkspaceSettings = () => { wid: activeWorkspace?.id.toString() || '', body: { email: values.email, - locale: i18n.language, ...(values.message && { message: values.message }), }, }) From 89f1ebb08871c7feff83dd8e354446f63554815b Mon Sep 17 00:00:00 2001 From: Marco Bonomo Date: Mon, 29 Jan 2024 17:16:32 +0100 Subject: [PATCH 02/12] =?UTF-8?q?=F0=9F=94=A5=20refactor(workspaceSettings?= =?UTF-8?q?.tsx):=20remove=20unused=20import=20of=20i18n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/components/inviteUsers/workspaceSettings.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common/components/inviteUsers/workspaceSettings.tsx b/src/common/components/inviteUsers/workspaceSettings.tsx index 04795b3cf..ac4511112 100644 --- a/src/common/components/inviteUsers/workspaceSettings.tsx +++ b/src/common/components/inviteUsers/workspaceSettings.tsx @@ -21,7 +21,6 @@ import { usePostWorkspacesByWidUsersMutation, } from 'src/features/api'; import { useActiveWorkspace } from 'src/hooks/useActiveWorkspace'; -import i18n from 'src/i18n'; import { AddNewMemberInput } from './addNewMember'; import { PermissionSettingsFooter } from './modalFooter'; import { From 74ac4d2ef0f9cc5f40bd9a4e26e7d98f71ca4e5e Mon Sep 17 00:00:00 2001 From: Marco Bonomo Date: Mon, 29 Jan 2024 17:13:14 +0100 Subject: [PATCH 03/12] =?UTF-8?q?=F0=9F=94=A5=20refactor(campaignSettings.?= =?UTF-8?q?tsx,=20projectSettings.tsx,=20workspaceSettings.tsx):=20remove?= =?UTF-8?q?=20unused=20'locale'=20property=20from=20API=20requests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/components/inviteUsers/campaignSettings.tsx | 1 - src/common/components/inviteUsers/projectSettings.tsx | 1 - src/common/components/inviteUsers/workspaceSettings.tsx | 1 - 3 files changed, 3 deletions(-) diff --git a/src/common/components/inviteUsers/campaignSettings.tsx b/src/common/components/inviteUsers/campaignSettings.tsx index 07e0bd0b9..bfaccdd4f 100644 --- a/src/common/components/inviteUsers/campaignSettings.tsx +++ b/src/common/components/inviteUsers/campaignSettings.tsx @@ -109,7 +109,6 @@ export const CampaignSettings = () => { body: { email: values.email, redirect_url: campaignRoute, - locale: i18n.language, ...(values.message && { message: values.message }), }, }) diff --git a/src/common/components/inviteUsers/projectSettings.tsx b/src/common/components/inviteUsers/projectSettings.tsx index 8ce810e46..21451c25c 100644 --- a/src/common/components/inviteUsers/projectSettings.tsx +++ b/src/common/components/inviteUsers/projectSettings.tsx @@ -84,7 +84,6 @@ export const ProjectSettings = () => { body: { email: values.email, redirect_url: projectRoute, - locale: i18n.language, ...(values.message && { message: values.message }), }, }) diff --git a/src/common/components/inviteUsers/workspaceSettings.tsx b/src/common/components/inviteUsers/workspaceSettings.tsx index 8fa74c1d1..04795b3cf 100644 --- a/src/common/components/inviteUsers/workspaceSettings.tsx +++ b/src/common/components/inviteUsers/workspaceSettings.tsx @@ -61,7 +61,6 @@ export const WorkspaceSettings = () => { wid: activeWorkspace?.id.toString() || '', body: { email: values.email, - locale: i18n.language, ...(values.message && { message: values.message }), }, }) From adf92ec9e66b7e57c5ea8224490440ed874fd442 Mon Sep 17 00:00:00 2001 From: Marco Bonomo Date: Mon, 29 Jan 2024 17:16:32 +0100 Subject: [PATCH 04/12] =?UTF-8?q?=F0=9F=94=A5=20refactor(workspaceSettings?= =?UTF-8?q?.tsx):=20remove=20unused=20import=20of=20i18n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/components/inviteUsers/workspaceSettings.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common/components/inviteUsers/workspaceSettings.tsx b/src/common/components/inviteUsers/workspaceSettings.tsx index 04795b3cf..ac4511112 100644 --- a/src/common/components/inviteUsers/workspaceSettings.tsx +++ b/src/common/components/inviteUsers/workspaceSettings.tsx @@ -21,7 +21,6 @@ import { usePostWorkspacesByWidUsersMutation, } from 'src/features/api'; import { useActiveWorkspace } from 'src/hooks/useActiveWorkspace'; -import i18n from 'src/i18n'; import { AddNewMemberInput } from './addNewMember'; import { PermissionSettingsFooter } from './modalFooter'; import { From c78ddfe5a6fd3216656e6b7679530f5e06cec805 Mon Sep 17 00:00:00 2001 From: Marco Bonomo Date: Mon, 29 Jan 2024 17:13:14 +0100 Subject: [PATCH 05/12] =?UTF-8?q?=F0=9F=94=A5=20refactor(campaignSettings.?= =?UTF-8?q?tsx,=20projectSettings.tsx,=20workspaceSettings.tsx):=20remove?= =?UTF-8?q?=20unused=20'locale'=20property=20from=20API=20requests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/components/inviteUsers/campaignSettings.tsx | 1 - src/common/components/inviteUsers/projectSettings.tsx | 1 - src/common/components/inviteUsers/workspaceSettings.tsx | 1 - 3 files changed, 3 deletions(-) diff --git a/src/common/components/inviteUsers/campaignSettings.tsx b/src/common/components/inviteUsers/campaignSettings.tsx index 07e0bd0b9..bfaccdd4f 100644 --- a/src/common/components/inviteUsers/campaignSettings.tsx +++ b/src/common/components/inviteUsers/campaignSettings.tsx @@ -109,7 +109,6 @@ export const CampaignSettings = () => { body: { email: values.email, redirect_url: campaignRoute, - locale: i18n.language, ...(values.message && { message: values.message }), }, }) diff --git a/src/common/components/inviteUsers/projectSettings.tsx b/src/common/components/inviteUsers/projectSettings.tsx index 8ce810e46..21451c25c 100644 --- a/src/common/components/inviteUsers/projectSettings.tsx +++ b/src/common/components/inviteUsers/projectSettings.tsx @@ -84,7 +84,6 @@ export const ProjectSettings = () => { body: { email: values.email, redirect_url: projectRoute, - locale: i18n.language, ...(values.message && { message: values.message }), }, }) diff --git a/src/common/components/inviteUsers/workspaceSettings.tsx b/src/common/components/inviteUsers/workspaceSettings.tsx index 8fa74c1d1..04795b3cf 100644 --- a/src/common/components/inviteUsers/workspaceSettings.tsx +++ b/src/common/components/inviteUsers/workspaceSettings.tsx @@ -61,7 +61,6 @@ export const WorkspaceSettings = () => { wid: activeWorkspace?.id.toString() || '', body: { email: values.email, - locale: i18n.language, ...(values.message && { message: values.message }), }, }) From 99eba2ce66b526a48dab5b83a4a93254e67ba674 Mon Sep 17 00:00:00 2001 From: Marco Bonomo Date: Mon, 29 Jan 2024 17:16:32 +0100 Subject: [PATCH 06/12] =?UTF-8?q?=F0=9F=94=A5=20refactor(workspaceSettings?= =?UTF-8?q?.tsx):=20remove=20unused=20import=20of=20i18n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/components/inviteUsers/workspaceSettings.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common/components/inviteUsers/workspaceSettings.tsx b/src/common/components/inviteUsers/workspaceSettings.tsx index 04795b3cf..ac4511112 100644 --- a/src/common/components/inviteUsers/workspaceSettings.tsx +++ b/src/common/components/inviteUsers/workspaceSettings.tsx @@ -21,7 +21,6 @@ import { usePostWorkspacesByWidUsersMutation, } from 'src/features/api'; import { useActiveWorkspace } from 'src/hooks/useActiveWorkspace'; -import i18n from 'src/i18n'; import { AddNewMemberInput } from './addNewMember'; import { PermissionSettingsFooter } from './modalFooter'; import { From 2f0c56c0825030808494875cd18d34787bc89509 Mon Sep 17 00:00:00 2001 From: Marco Bonomo Date: Thu, 21 Mar 2024 15:19:41 +0100 Subject: [PATCH 07/12] =?UTF-8?q?=F0=9F=94=A8=20refactor(inviteUsers):=20r?= =?UTF-8?q?emove=20unused=20locale=20property=20in=20API=20requests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/components/inviteUsers/campaignSettings.tsx | 1 - src/common/components/inviteUsers/projectSettings.tsx | 1 - src/common/components/inviteUsers/workspaceSettings.tsx | 1 - 3 files changed, 3 deletions(-) diff --git a/src/common/components/inviteUsers/campaignSettings.tsx b/src/common/components/inviteUsers/campaignSettings.tsx index 07e0bd0b9..bfaccdd4f 100644 --- a/src/common/components/inviteUsers/campaignSettings.tsx +++ b/src/common/components/inviteUsers/campaignSettings.tsx @@ -109,7 +109,6 @@ export const CampaignSettings = () => { body: { email: values.email, redirect_url: campaignRoute, - locale: i18n.language, ...(values.message && { message: values.message }), }, }) diff --git a/src/common/components/inviteUsers/projectSettings.tsx b/src/common/components/inviteUsers/projectSettings.tsx index 8ce810e46..21451c25c 100644 --- a/src/common/components/inviteUsers/projectSettings.tsx +++ b/src/common/components/inviteUsers/projectSettings.tsx @@ -84,7 +84,6 @@ export const ProjectSettings = () => { body: { email: values.email, redirect_url: projectRoute, - locale: i18n.language, ...(values.message && { message: values.message }), }, }) diff --git a/src/common/components/inviteUsers/workspaceSettings.tsx b/src/common/components/inviteUsers/workspaceSettings.tsx index 8fa74c1d1..04795b3cf 100644 --- a/src/common/components/inviteUsers/workspaceSettings.tsx +++ b/src/common/components/inviteUsers/workspaceSettings.tsx @@ -61,7 +61,6 @@ export const WorkspaceSettings = () => { wid: activeWorkspace?.id.toString() || '', body: { email: values.email, - locale: i18n.language, ...(values.message && { message: values.message }), }, }) From ab6932152e1423ea1d09db66e20c686aff76e122 Mon Sep 17 00:00:00 2001 From: Marco Bonomo Date: Thu, 21 Mar 2024 15:21:53 +0100 Subject: [PATCH 08/12] =?UTF-8?q?=F0=9F=94=A5=20refactor(workspaceSettings?= =?UTF-8?q?.tsx):=20remove=20unused=20i18n=20import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/components/inviteUsers/workspaceSettings.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common/components/inviteUsers/workspaceSettings.tsx b/src/common/components/inviteUsers/workspaceSettings.tsx index 04795b3cf..ac4511112 100644 --- a/src/common/components/inviteUsers/workspaceSettings.tsx +++ b/src/common/components/inviteUsers/workspaceSettings.tsx @@ -21,7 +21,6 @@ import { usePostWorkspacesByWidUsersMutation, } from 'src/features/api'; import { useActiveWorkspace } from 'src/hooks/useActiveWorkspace'; -import i18n from 'src/i18n'; import { AddNewMemberInput } from './addNewMember'; import { PermissionSettingsFooter } from './modalFooter'; import { From 269f23a96cf0f40ae1500bcba5019830507a5366 Mon Sep 17 00:00:00 2001 From: ZecD Date: Fri, 22 Mar 2024 15:58:00 +0100 Subject: [PATCH 09/12] fixed localization url --- src/hooks/useLocalizeDashboardUrl.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/hooks/useLocalizeDashboardUrl.ts b/src/hooks/useLocalizeDashboardUrl.ts index 5d61cbcff..20f21f311 100644 --- a/src/hooks/useLocalizeDashboardUrl.ts +++ b/src/hooks/useLocalizeDashboardUrl.ts @@ -79,8 +79,7 @@ export const getLocalizedCampaignUrl = ( aLanguage: string ): string => { const location = window.location.host; - return aLanguage === 'en' - ? `${location}/campaigns/${aCampaignId}` - : `${location}/it/campaigns/${aCampaignId}`; + ? `${process.env.REACT_APP_CROWD_WP_URL}/campaigns/${aCampaignId}` + : `${process.env.REACT_APP_CROWD_WP_URL}/it/campaigns/${aCampaignId}`; }; From 13128f85a6b18cad13d8910682cc38ac153863e6 Mon Sep 17 00:00:00 2001 From: ZecD Date: Fri, 22 Mar 2024 17:31:40 +0100 Subject: [PATCH 10/12] test change localization --- .env.development | 2 +- .env.production | 2 +- src/hooks/useLocalizeDashboardUrl.ts | 10 ++++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.env.development b/.env.development index c42493d66..2bf0ba28e 100644 --- a/.env.development +++ b/.env.development @@ -6,4 +6,4 @@ REACT_APP_TRYBER_URL=https://dev.tryber.me REACT_ZAPIER_WEBHOOK=https://hooks.zapier.com/hooks/catch/5196925/bkxm1k6/ REACT_APP_STRAPI_URL=https://admin.unguess.io REACT_APP_STRAPI_API_URL=https://admin.unguess.io/api -REACT_APP_CROWD_WP_URL= \ No newline at end of file +REACT_APP_CROWD_WP_URL=https://dev.unguess.io \ No newline at end of file diff --git a/.env.production b/.env.production index 9121e9347..49b865f2d 100644 --- a/.env.production +++ b/.env.production @@ -4,4 +4,4 @@ REACT_APP_TRYBER_URL=https://app.tryber.me REACT_ZAPIER_WEBHOOK=https://hooks.zapier.com/hooks/catch/5196925/bkxm1k6/ REACT_APP_STRAPI_URL=https://admin.unguess.io REACT_APP_STRAPI_API_URL=https://admin.unguess.io/api -REACT_APP_CROWD_WP_URL= \ No newline at end of file +REACT_APP_CROWD_WP_URL=https://app.unguess.io \ No newline at end of file diff --git a/src/hooks/useLocalizeDashboardUrl.ts b/src/hooks/useLocalizeDashboardUrl.ts index 20f21f311..4e1e2ff27 100644 --- a/src/hooks/useLocalizeDashboardUrl.ts +++ b/src/hooks/useLocalizeDashboardUrl.ts @@ -77,9 +77,7 @@ export const getLocalizedProjectUrl = ( export const getLocalizedCampaignUrl = ( aCampaignId: number, aLanguage: string -): string => { - const location = window.location.host; - return aLanguage === 'en' - ? `${process.env.REACT_APP_CROWD_WP_URL}/campaigns/${aCampaignId}` - : `${process.env.REACT_APP_CROWD_WP_URL}/it/campaigns/${aCampaignId}`; -}; +): string => + aLanguage === 'en' + ? `${process.env.REACT_APP_CROWD_WP_URL ?? ''}/campaigns/${aCampaignId}` + : `${process.env.REACT_APP_CROWD_WP_URL ?? ''}/it/campaigns/${aCampaignId}`; From 9c636cf9032c4cedfbd11d6316cf898405e40ca7 Mon Sep 17 00:00:00 2001 From: Marco Bonomo Date: Fri, 22 Mar 2024 17:51:08 +0100 Subject: [PATCH 11/12] =?UTF-8?q?=F0=9F=94=A7=20chore(env):=20remove=20REA?= =?UTF-8?q?CT=5FAPP=5FCROWD=5FWP=5FURL=20value=20in=20development=20and=20?= =?UTF-8?q?production=20env=20files=20=F0=9F=94=A7=20chore(useLocalizeDash?= =?UTF-8?q?boardUrl.ts):=20update=20getLocalizedProjectUrl=20to=20use=20RE?= =?UTF-8?q?ACT=5FAPP=5FCROWD=5FWP=5FURL=20from=20environment=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- .env.production | 2 +- src/hooks/useLocalizeDashboardUrl.ts | 11 ++++------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.env.development b/.env.development index 2bf0ba28e..c42493d66 100644 --- a/.env.development +++ b/.env.development @@ -6,4 +6,4 @@ REACT_APP_TRYBER_URL=https://dev.tryber.me REACT_ZAPIER_WEBHOOK=https://hooks.zapier.com/hooks/catch/5196925/bkxm1k6/ REACT_APP_STRAPI_URL=https://admin.unguess.io REACT_APP_STRAPI_API_URL=https://admin.unguess.io/api -REACT_APP_CROWD_WP_URL=https://dev.unguess.io \ No newline at end of file +REACT_APP_CROWD_WP_URL= \ No newline at end of file diff --git a/.env.production b/.env.production index 49b865f2d..214e6c338 100644 --- a/.env.production +++ b/.env.production @@ -4,4 +4,4 @@ REACT_APP_TRYBER_URL=https://app.tryber.me REACT_ZAPIER_WEBHOOK=https://hooks.zapier.com/hooks/catch/5196925/bkxm1k6/ REACT_APP_STRAPI_URL=https://admin.unguess.io REACT_APP_STRAPI_API_URL=https://admin.unguess.io/api -REACT_APP_CROWD_WP_URL=https://app.unguess.io \ No newline at end of file +REACT_APP_CROWD_WP_URL= \ No newline at end of file diff --git a/src/hooks/useLocalizeDashboardUrl.ts b/src/hooks/useLocalizeDashboardUrl.ts index 4e1e2ff27..2332f6d17 100644 --- a/src/hooks/useLocalizeDashboardUrl.ts +++ b/src/hooks/useLocalizeDashboardUrl.ts @@ -66,13 +66,10 @@ export const getLocalizedBugUrl = ( export const getLocalizedProjectUrl = ( aProjectId: number, aLanguage: string -): string => { - const location = window.location.host; - - return aLanguage === 'en' - ? `${location}/projects/${aProjectId}` - : `${location}/it/projects/${aProjectId}`; -}; +): string => + aLanguage === 'en' + ? `${process.env.REACT_APP_CROWD_WP_URL ?? ''}/projects/${aProjectId}` + : `${process.env.REACT_APP_CROWD_WP_URL ?? ''}/it/projects/${aProjectId}`; export const getLocalizedCampaignUrl = ( aCampaignId: number, From 8dcc68f255cda61702eaada21b2bd9c3910c038b Mon Sep 17 00:00:00 2001 From: Marco Bonomo Date: Fri, 22 Mar 2024 19:10:21 +0100 Subject: [PATCH 12/12] =?UTF-8?q?=F0=9F=94=A7=20refactor(useLocalizeDashbo?= =?UTF-8?q?ardUrl.ts):=20refactor=20URL=20generation=20functions=20?= =?UTF-8?q?=F0=9F=94=92=20chore(useLocalizeDashboardUrl.ts):=20improve=20s?= =?UTF-8?q?ecurity=20by=20using=20window.location=20protocol=20and=20host?= =?UTF-8?q?=20in=20URL=20generation=20functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useLocalizeDashboardUrl.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/hooks/useLocalizeDashboardUrl.ts b/src/hooks/useLocalizeDashboardUrl.ts index 2332f6d17..734259785 100644 --- a/src/hooks/useLocalizeDashboardUrl.ts +++ b/src/hooks/useLocalizeDashboardUrl.ts @@ -66,15 +66,19 @@ export const getLocalizedBugUrl = ( export const getLocalizedProjectUrl = ( aProjectId: number, aLanguage: string -): string => - aLanguage === 'en' - ? `${process.env.REACT_APP_CROWD_WP_URL ?? ''}/projects/${aProjectId}` - : `${process.env.REACT_APP_CROWD_WP_URL ?? ''}/it/projects/${aProjectId}`; +): string => { + const { host, protocol } = window.location; + return aLanguage === 'en' + ? `${protocol}//${host}/projects/${aProjectId}` + : `${protocol}//${host}/it/projects/${aProjectId}`; +}; export const getLocalizedCampaignUrl = ( aCampaignId: number, aLanguage: string -): string => - aLanguage === 'en' - ? `${process.env.REACT_APP_CROWD_WP_URL ?? ''}/campaigns/${aCampaignId}` - : `${process.env.REACT_APP_CROWD_WP_URL ?? ''}/it/campaigns/${aCampaignId}`; +): string => { + const { host, protocol } = window.location; + return aLanguage === 'en' + ? `${protocol}//${host}/campaigns/${aCampaignId}` + : `${protocol}//${host}/it/campaigns/${aCampaignId}`; +};