Clean up strings

This commit is contained in:
Manav Rathi 2024-04-03 19:51:01 +05:30
parent 1411ca6fad
commit c0fee7bc91
No known key found for this signature in database
4 changed files with 18 additions and 15 deletions

View file

@ -1,7 +1,7 @@
import { Container } from "components/Container";
import S from "utils/strings";
import React from "react";
import constants from "utils/strings";
export default function Home() {
return <Container>{constants.NOT_FOUND}</Container>;
return <Container>{S.error_404}</Container>;
}

View file

@ -1,14 +1,14 @@
import type { AppProps } from "next/app";
import Head from "next/head";
import React from "react";
import constants from "utils/strings";
import S from "utils/strings";
import "../styles/globals.css";
function MyApp({ Component, pageProps }: AppProps) {
return (
<>
<Head>
<title>{constants.TITLE}</title>
<title>{S.title}</title>
</Head>
<Component {...pageProps} />
</>

View file

@ -2,7 +2,7 @@ import { Container } from "components/Container";
import { Spinner } from "components/Spinner";
import * as React from "react";
import { parseAndHandleRequest } from "services/billing-service";
import constants from "utils/strings";
import S from "utils/strings";
export default function Home() {
const [failed, setFailed] = React.useState(false);
@ -20,9 +20,5 @@ export default function Home() {
main();
}, []);
return (
<Container>
{failed ? constants.SOMETHING_WENT_WRONG : <Spinner />}
</Container>
);
return <Container>{failed ? S.error_generic : <Spinner />}</Container>;
}

View file

@ -1,7 +1,14 @@
const englishConstants = {
TITLE: "Payments | ente.io",
SOMETHING_WENT_WRONG: "Oops, something went wrong.",
NOT_FOUND: "404 | This page could not be found.",
/**
* User facing strings in the app
*
* By keeping them separate, we make our lives easier if/when we need to
* localize the corresponding pages. Right now, these are just the values in the
* default language, English.
*/
const S = {
title: "Payments | ente.io",
error_generic: "Oops, something went wrong.",
error_404: "404 | This page could not be found.",
};
export default englishConstants;
export default S;