chore: Update translations

This commit is contained in:
2023-09-27 10:36:37 +00:00
parent a780b9554d
commit 1d3db500a6
6 changed files with 28 additions and 24 deletions

View File

@ -1 +1 @@
Choose config with NODE_CONFIG_ENV: `NODE_CONFIG_ENV=iris yarn start` Choose config with NODE_CONFIG_ENV: `NODE_CONFIG_ENV=iris yarn start`

View File

@ -29,7 +29,13 @@ export default function AsyncButton(props: AsyncButtonProps) {
} }
return ( return (
<button ref={props.ref} className="spinner-button" type="button" disabled={loading || props.disabled} {...props} onClick={handle}> <button
ref={props.ref}
className="spinner-button"
type="button"
disabled={loading || props.disabled}
{...props}
onClick={handle}>
<span style={{ visibility: loading ? "hidden" : "visible" }}>{props.children}</span> <span style={{ visibility: loading ? "hidden" : "visible" }}>{props.children}</span>
{loading && ( {loading && (
<span className="spinner-wrapper"> <span className="spinner-wrapper">

View File

@ -1,18 +1,18 @@
import { useState, useEffect, FC, ComponentProps } from 'react'; import { useState, useEffect, FC, ComponentProps } from "react";
import { useIntl, FormattedMessage } from 'react-intl'; import { useIntl, FormattedMessage } from "react-intl";
type ExtendedProps = ComponentProps<typeof FormattedMessage>; type ExtendedProps = ComponentProps<typeof FormattedMessage>;
const ExtendedFormattedMessage: FC<ExtendedProps> = (props) => { const ExtendedFormattedMessage: FC<ExtendedProps> = props => {
const { id, defaultMessage, values} = props; const { id, defaultMessage, values } = props;
const { formatMessage } = useIntl(); const { formatMessage } = useIntl();
const [processedMessage, setProcessedMessage] = useState<string | null>(null); const [processedMessage, setProcessedMessage] = useState<string | null>(null);
useEffect(() => { useEffect(() => {
const translatedMessage = formatMessage({ id, defaultMessage }, values); const translatedMessage = formatMessage({ id, defaultMessage }, values);
if (typeof translatedMessage === 'string') { if (typeof translatedMessage === "string") {
setProcessedMessage(translatedMessage.replace('Snort', process.env.APP_NAME_CAPITALIZED || 'Snort')); setProcessedMessage(translatedMessage.replace("Snort", process.env.APP_NAME_CAPITALIZED || "Snort"));
} }
}, [id, defaultMessage, values, formatMessage]); }, [id, defaultMessage, values, formatMessage]);

View File

@ -1,6 +1,6 @@
import useLogin from "Hooks/useLogin"; import useLogin from "Hooks/useLogin";
import "./PinPrompt.css"; import "./PinPrompt.css";
import {ReactNode, useRef, useState} from "react"; import { ReactNode, useRef, useState } from "react";
import { FormattedMessage, useIntl } from "react-intl"; import { FormattedMessage, useIntl } from "react-intl";
import { unwrap } from "@snort/shared"; import { unwrap } from "@snort/shared";
import { EventPublisher, InvalidPinError, PinEncrypted, PinEncryptedPayload } from "@snort/system"; import { EventPublisher, InvalidPinError, PinEncrypted, PinEncryptedPayload } from "@snort/system";
@ -57,13 +57,12 @@ export function PinPrompt({
return ( return (
<Modal id="pin" onClose={() => onCancel()}> <Modal id="pin" onClose={() => onCancel()}>
<form <form
onSubmit={(e) => { onSubmit={e => {
e.preventDefault(); e.preventDefault();
if (submitButtonRef.current) { if (submitButtonRef.current) {
submitButtonRef.current.click(); submitButtonRef.current.click();
} }
}} }}>
>
<div className="flex-column g12"> <div className="flex-column g12">
<h2> <h2>
<FormattedMessage defaultMessage="Enter Pin" /> <FormattedMessage defaultMessage="Enter Pin" />
@ -71,7 +70,7 @@ export function PinPrompt({
{subTitle} {subTitle}
<input <input
type="number" type="number"
onChange={(e) => setPin(e.target.value)} onChange={e => setPin(e.target.value)}
value={pin} value={pin}
autoFocus={true} autoFocus={true}
maxLength={20} maxLength={20}

View File

@ -220,13 +220,13 @@ export class MultiAccountStore extends ExternalStore<LoginSession> {
async #loadIrisKeyIfExists() { async #loadIrisKeyIfExists() {
try { try {
const irisKeyJSON = window.localStorage.getItem('iris.myKey'); const irisKeyJSON = window.localStorage.getItem("iris.myKey");
if (irisKeyJSON) { if (irisKeyJSON) {
const irisKeyObj = JSON.parse(irisKeyJSON); const irisKeyObj = JSON.parse(irisKeyJSON);
if (irisKeyObj.priv) { if (irisKeyObj.priv) {
const privateKey = await PinEncrypted.create(irisKeyObj.priv, '1234'); const privateKey = await PinEncrypted.create(irisKeyObj.priv, "1234");
this.loginWithPrivateKey(privateKey); this.loginWithPrivateKey(privateKey);
window.localStorage.removeItem('iris.myKey'); window.localStorage.removeItem("iris.myKey");
} }
} }
} catch (e) { } catch (e) {
@ -234,7 +234,6 @@ export class MultiAccountStore extends ExternalStore<LoginSession> {
} }
} }
#migrate() { #migrate() {
let didMigrate = false; let didMigrate = false;

View File

@ -9,8 +9,8 @@ const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin"); const CopyPlugin = require("copy-webpack-plugin");
const WorkboxPlugin = require("workbox-webpack-plugin"); const WorkboxPlugin = require("workbox-webpack-plugin");
const IntlTsTransformer = require("@formatjs/ts-transformer"); const IntlTsTransformer = require("@formatjs/ts-transformer");
const { DefinePlugin } = require('webpack'); const { DefinePlugin } = require("webpack");
const appConfig = require('config'); const appConfig = require("config");
const isProduction = process.env.NODE_ENV == "production"; const isProduction = process.env.NODE_ENV == "production";
@ -49,10 +49,10 @@ const config = {
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: "public/index.html", template: "public/index.html",
favicon: appConfig.get('favicon'), favicon: appConfig.get("favicon"),
excludeChunks: ["pow", "bench"], excludeChunks: ["pow", "bench"],
templateParameters: { templateParameters: {
appTitle: appConfig.get('appTitle'), appTitle: appConfig.get("appTitle"),
}, },
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
@ -75,9 +75,9 @@ const config = {
}) })
: false, : false,
new DefinePlugin({ new DefinePlugin({
"process.env.APP_NAME": JSON.stringify(appConfig.get('appName')), "process.env.APP_NAME": JSON.stringify(appConfig.get("appName")),
"process.env.APP_NAME_CAPITALIZED": JSON.stringify(appConfig.get('appNameCapitalized')), "process.env.APP_NAME_CAPITALIZED": JSON.stringify(appConfig.get("appNameCapitalized")),
"process.env.NIP05_DOMAIN": JSON.stringify(appConfig.get('nip05Domain')), "process.env.NIP05_DOMAIN": JSON.stringify(appConfig.get("nip05Domain")),
}), }),
], ],
module: { module: {