Skip to content

Commit

Permalink
email change support link #434
Browse files Browse the repository at this point in the history
  • Loading branch information
io53 committed Aug 28, 2024
1 parent f929074 commit 535ef85
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/TextHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ export function addNewlines(str, newlineChar) {
})
}

export function addLink(str, key, link) {
return str.split(key).map((x, i, all) => {
return <>{x}{i === all.length-1 ? null : <a href={link} style={{ textDecoration: "underline" }} target="_blank" rel="noreferrer">{key}</a>}</>
})
}

export function addVariablesInString(str, variables) {
for (let i = 0; i < variables.length; i++) {
str = str.replace(/{.*?\}/, variables[i])
Expand Down
8 changes: 6 additions & 2 deletions src/components/MyAccountModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { Box, Button, PinInput, PinInputField, Progress } from "@chakra-ui/react
import React, { useEffect, useState } from "react";
import { withTranslation } from 'react-i18next';
import NetworkApi from "../NetworkApi";
import { logout } from "../utils/loginUtils";
import notify from "../utils/notify";
import RDialog from "./RDialog";
import { ruuviTheme } from "../themes";
import ConfirmationDialog from "./ConfirmationDialog";
import { addLink } from "../TextHelper";

function MyAccountModal(props) {
var { t, i18n } = props;
Expand All @@ -15,7 +15,6 @@ function MyAccountModal(props) {
const [activationCode, setActivationCode] = useState("")
const [isProcessingCode, setIsProcessingCode] = useState(false)
const [showDeleteAccount, setShowDeleteAccount] = useState(false)
const [loadingDelete, setLoadingDelete] = useState(false)
useEffect(() => {
async function getSubs() {
let resp = await new NetworkApi().getSubscription()
Expand Down Expand Up @@ -181,9 +180,14 @@ function MyAccountModal(props) {
)}
</Box>
<Box mt={16}></Box>
<Content>
{addLink(t("my_account_change_email"), t("my_account_change_email_link_markup"), t("my_account_change_email_link"))}
</Content>
<Box mt={4}></Box>
<Button variant='link' onClick={async () => {
setShowDeleteAccount(true)
}}>{t("delete_account")}</Button>

<ConfirmationDialog open={showDeleteAccount} title="delete_account" loading={true} description='account_delete_description' onClose={(yes) => yes ? deleteAccount() : setShowDeleteAccount(false)} />
</RDialog>
)
Expand Down
45 changes: 35 additions & 10 deletions src/localization_i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@
"graph_stats_info": "A minimum, maximum and average values in the visible timeframe are shown. You can change the visible timeframe from the dropdown menu or by using the zoom tool.",
"no_expiry_date": "No expiry date",
"shared_to_x": "Shared to {%d^%1$,d}/{%d^%2$,d}",
"settings_email_alerts": "Email Alerts",
"settings_mobile_push_alerts": "Mobile Push Alerts",
"sensor_alert_free_info": "This sensor is in Free mode. You will be able to receive local alerts via Bluetooth when using Ruuvi Station mobile and your sensor is within Bluetooth signal range. Email and push notifications are available in paid subscriptions. View subscription packages at cloud.ruuvi.com.",
"cloud_ruuvi_link": "cloud.ruuvi.com",
"cloud_ruuvi_link_url": "https://cloud.ruuvi.com",
Expand Down Expand Up @@ -286,8 +288,11 @@
"sensors_select_label": "Sensors",
"sensors_select_button": "Select",
"image_format_not_supported": "Image format not supported",
"load": "Load",
"try_refreshing_page": "Try refreshing the page"
"load": "Compare",
"try_refreshing_page": "Try refreshing the page",
"my_account_change_email": "Contact [email protected] if you wish to change the email address associated with this user account.",
"my_account_change_email_link_markup": "[email protected]",
"my_account_change_email_link": "mailto:[email protected]"
}
},
"fi": {
Expand Down Expand Up @@ -502,6 +507,8 @@
"graph_stats_info": "Minimi-, maksimi- ja keskiarvot näytettävälle aikajaksolle. Voit vaihtaa näytettävän aikajakson pudotusvalikosta tai zoom-työkalua käyttämällä.",
"no_expiry_date": "Ei päättymispäivää",
"shared_to_x": "Jaettu {%d^%1$,d}/{%d^%2$,d}",
"settings_email_alerts": "Sähköpostihälytykset",
"settings_mobile_push_alerts": "Mobiilipush-hälytykset",
"sensor_alert_free_info": "Tämä anturi on Free-tilassa. Voit vastaanottaa paikallisia hälytyksiä Bluetoothin kautta käyttäessäsi Ruuvi Station -mobiilisovellusta ja anturi on Bluetooth-signaalin kantaman sisällä. Sähköposti- ja push-ilmoitukset ovat saatavilla maksullisissa tilauksissa. Katso tilauspaketteja osoitteessa cloud.ruuvi.com/fi.",
"cloud_ruuvi_link": "cloud.ruuvi.com/fi",
"cloud_ruuvi_link_url": "https://cloud.ruuvi.com/fi",
Expand Down Expand Up @@ -577,8 +584,11 @@
"sensors_select_label": "Anturit",
"sensors_select_button": "Valitse",
"image_format_not_supported": "Kuvamuotoa ei tueta",
"load": "Lataa",
"try_refreshing_page": "Kokeile päivittää sivu uudelleen."
"load": "Vertaa",
"try_refreshing_page": "Kokeile päivittää sivu uudelleen",
"my_account_change_email": "Ota yhteyttä [email protected], jos haluat vaihtaa tämän käyttäjätilin sähköpostiosoitteen.",
"my_account_change_email_link_markup": "[email protected]",
"my_account_change_email_link": "mailto:[email protected]"
}
},
"sv": {
Expand Down Expand Up @@ -793,6 +803,8 @@
"graph_stats_info": "Ett minimi-, maximi- och medelvärde i den synliga tidsramen visas. Du kan ändra den synliga tidsramen från rullgardinsmenyn eller genom att använda zoomverktyget.",
"no_expiry_date": "Ingen utgångsdatum",
"shared_to_x": "Delad {%d^%1$,d}/{%d^%2$,d}",
"settings_email_alerts": "E-postvarningar",
"settings_mobile_push_alerts": "Mobil push-varningar",
"sensor_alert_free_info": "Den här sensorn är i Free läge. Du kommer kunna ta emot lokala varningar via Bluetooth när du använder Ruuvi Station appen och din sensor är inom Bluetooth signalräckvidd. E-post och push-meddelanden är tillgängliga i betalda prenumerationer. Visa prenumerationspaket på cloud.ruuvi.com.",
"cloud_ruuvi_link": "cloud.ruuvi.com",
"cloud_ruuvi_link_url": "https://cloud.ruuvi.com",
Expand Down Expand Up @@ -868,8 +880,11 @@
"sensors_select_label": "Sensorer",
"sensors_select_button": "Välj",
"image_format_not_supported": "Bildformat stöds inte",
"load": "Ladda",
"try_refreshing_page": "Försök att ladda om sidan"
"load": "Jämför",
"try_refreshing_page": "Försök att ladda om sidan",
"my_account_change_email": "Kontakta [email protected] om du vill ändra e-postadressen som är kopplad till detta användarkonto.",
"my_account_change_email_link_markup": "[email protected]",
"my_account_change_email_link": "mailto:[email protected]"
}
},
"fr": {
Expand Down Expand Up @@ -1084,6 +1099,8 @@
"graph_stats_info": "Des valeurs minimale, maximale et moyenne dans la période visible sont affichées. Vous pouvez modifier la période visible à partir du menu déroulant ou en utilisant l'outil de zoom.",
"no_expiry_date": "Pas de date d'expiration",
"shared_to_x": "Partagé {%d^%1$,d}/{%d^%2$,d}",
"settings_email_alerts": "Alertes courrier électronique",
"settings_mobile_push_alerts": "Alertes push mobiles",
"sensor_alert_free_info": "Ce capteur est en mode gratuit. Vous pourrez recevoir des alertes locales via Bluetooth lorsque vous utilisez Ruuvi Station mobile et que votre capteur se trouve à portée du signal Bluetooth. Les notifications par e-mail et push sont disponibles dans les abonnements payants. Consultez les forfaits d'abonnement sur cloud.ruuvi.com.",
"cloud_ruuvi_link": "cloud.ruuvi.com",
"cloud_ruuvi_link_url": "https://cloud.ruuvi.com",
Expand Down Expand Up @@ -1159,8 +1176,11 @@
"sensors_select_label": "Capteurs",
"sensors_select_button": "Sélectionner",
"image_format_not_supported": "Format d'image non pris en charge",
"load": "Charger",
"try_refreshing_page": "Essayez de rafraîchir la page"
"load": "Comparer",
"try_refreshing_page": "Essayez de rafraîchir la page",
"my_account_change_email": "Contactez [email protected] si vous souhaitez modifier l'adresse e-mail associée à ce compte utilisateur.",
"my_account_change_email_link_markup": "[email protected]",
"my_account_change_email_link": "mailto:[email protected]"
}
},
"de": {
Expand Down Expand Up @@ -1375,6 +1395,8 @@
"graph_stats_info": "Es werden ein Minimum, ein Maximum und ein Durchschnittswert im sichtbaren Zeitrahmen angezeigt. Sie können den sichtbaren Zeitrahmen über das Dropdown-Menü oder mit dem Zoom-Tool ändern.",
"no_expiry_date": "Kein Ablaufdatum",
"shared_to_x": "Freigegebene {%d^%1$,d}/{%d^%2$,d}",
"settings_email_alerts": "E-Mail-Benachrichtigungen",
"settings_mobile_push_alerts": "Mobile Push-Benachrichtigungen",
"sensor_alert_free_info": "Dieser Sensor befindet sich im Free-Modus. Sie können lokale Benachrichtigungen über Bluetooth erhalten, wenn Sie Ruuvi Station Mobile verwenden und sich Ihr Sensor in Bluetooth-Signalreichweite befindet. E-Mail- und Push-Benachrichtigungen sind in kostenpflichtigen Abonnements verfügbar. Sehen Sie sich Abonnementpakete unter cloud.ruuvi.com an.",
"cloud_ruuvi_link": "cloud.ruuvi.com",
"cloud_ruuvi_link_url": "https://cloud.ruuvi.com",
Expand Down Expand Up @@ -1450,8 +1472,11 @@
"sensors_select_label": "Sensoren",
"sensors_select_button": "Auswählen",
"image_format_not_supported": "Bildformat wird nicht unterstützt",
"load": "Laden",
"try_refreshing_page": "Versuchen Sie, die Seite neu zu laden"
"load": "Vergleichen",
"try_refreshing_page": "Versuchen Sie, die Seite neu zu laden",
"my_account_change_email": "Kontaktieren Sie [email protected], wenn Sie die mit diesem Benutzerkonto verknüpfte E-Mail-Adresse ändern möchten.",
"my_account_change_email_link_markup": "[email protected]",
"my_account_change_email_link": "mailto:[email protected]"
}
}
}

0 comments on commit 535ef85

Please sign in to comment.