From 34b20c92ce2300e9f69edcafdef1c25deb53c128 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 4 Aug 2023 22:16:46 +0200 Subject: [PATCH] Make `NEXT_PUBLIC_SITE_NAME` evaluate at runtime --- .idea/runConfigurations/Run_client.xml | 1 + todoblue/package.json | 2 ++ todoblue/src/app/SiteName.tsx | 7 +++++++ todoblue/src/app/page.tsx | 4 +++- todoblue/yarn.lock | 7 ++++++- 5 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 todoblue/src/app/SiteName.tsx diff --git a/.idea/runConfigurations/Run_client.xml b/.idea/runConfigurations/Run_client.xml index aef77a2..fcea7d1 100644 --- a/.idea/runConfigurations/Run_client.xml +++ b/.idea/runConfigurations/Run_client.xml @@ -9,6 +9,7 @@ + diff --git a/todoblue/package.json b/todoblue/package.json index e6f5f53..0657e6b 100644 --- a/todoblue/package.json +++ b/todoblue/package.json @@ -18,9 +18,11 @@ "@types/react": "18.2.17", "@types/react-dom": "18.2.7", "classnames": "^2.3.2", + "client-only": "^0.0.1", "next": "13.4.12", "react": "18.2.0", "react-dom": "18.2.0", + "server-only": "^0.0.1", "typescript": "5.1.6" } } diff --git a/todoblue/src/app/SiteName.tsx b/todoblue/src/app/SiteName.tsx new file mode 100644 index 0000000..df2421c --- /dev/null +++ b/todoblue/src/app/SiteName.tsx @@ -0,0 +1,7 @@ +import "server-only" + +export function SiteName() { + return <> + {process.env["NEXT_PUBLIC_SITE_NAME"] ?? "Todoblue"} + +} diff --git a/todoblue/src/app/page.tsx b/todoblue/src/app/page.tsx index f9838d6..1db888c 100644 --- a/todoblue/src/app/page.tsx +++ b/todoblue/src/app/page.tsx @@ -1,8 +1,10 @@ import {CreatePrivateBoardPanel} from "@/app/CreatePrivateBoardPanel" import {CreatePublicBoardPanel} from "@/app/CreatePublicBoardPanel" +import {SiteName} from "@/app/SiteName" import {default as React} from "react"; import style from "./page.module.css" + export default function Page() { return
@@ -15,7 +17,7 @@ function PageHeader() { return (

- {process.env.NEXT_PUBLIC_SITE_NAME ?? "Todoblue"} +

) diff --git a/todoblue/yarn.lock b/todoblue/yarn.lock index 8ac7a59..a649c92 100644 --- a/todoblue/yarn.lock +++ b/todoblue/yarn.lock @@ -154,7 +154,7 @@ classnames@^2.3.2: resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924" integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw== -client-only@0.0.1: +client-only@0.0.1, client-only@^0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/client-only/-/client-only-0.0.1.tgz#38bba5d403c41ab150bff64a95c85013cf73bca1" integrity sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA== @@ -270,6 +270,11 @@ scheduler@^0.23.0: dependencies: loose-envify "^1.1.0" +server-only@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/server-only/-/server-only-0.0.1.tgz#0f366bb6afb618c37c9255a314535dc412cd1c9e" + integrity sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA== + source-map-js@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c"