diff --git a/src/components/AppLayout.tsx b/src/components/AppLayout.tsx
index 7ca23d2..7fc8e42 100644
--- a/src/components/AppLayout.tsx
+++ b/src/components/AppLayout.tsx
@@ -105,11 +105,13 @@ export default function AppLayout(props: AppLayoutProps): JSX.Element {
useEffect(() => {
appLayout.currency &&
setCurrencySelect(currencyOptions.indexOf(appLayout.currency));
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [appLayout.currency]);
useEffect(() => {
currencySelect >= 0 &&
appLayout.setCurrency(currencyOptions[currencySelect]);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [currencySelect]);
return (
@@ -398,6 +400,16 @@ export default function AppLayout(props: AppLayoutProps): JSX.Element {
+
+
+
Player name
+ appLayout.setPlayerName(e.target.value)}
+ />
+
diff --git a/src/components/Markdown/Markdawn.tsx b/src/components/Markdown/Markdawn.tsx
index 8212ad4..38bf661 100644
--- a/src/components/Markdown/Markdawn.tsx
+++ b/src/components/Markdown/Markdawn.tsx
@@ -1,3 +1,4 @@
+import { useAppLayout } from "contexts/AppLayoutContext";
import Markdown from "markdown-to-jsx";
import SceneBreak from "./SceneBreak";
@@ -7,6 +8,8 @@ type ScenBreakProps = {
};
export default function Markdawn(props: ScenBreakProps): JSX.Element {
+ const appLayout = useAppLayout();
+
if (props.text) {
return (
{return {""}}
+ component: () => {
+ return (
+
+ {appLayout.playerName ? appLayout.playerName : ""}
+
+ );
+ },
},
},
}}
@@ -27,4 +36,4 @@ export default function Markdawn(props: ScenBreakProps): JSX.Element {
);
}
return <>>;
-}
\ No newline at end of file
+}
diff --git a/src/components/Select.tsx b/src/components/Select.tsx
index c11ca95..3b2546d 100644
--- a/src/components/Select.tsx
+++ b/src/components/Select.tsx
@@ -49,7 +49,7 @@ export default function Select(props: SelectProps): JSX.Element {
{index !== props.state && (
{
setOpened(false);
diff --git a/src/contexts/AppLayoutContext.tsx b/src/contexts/AppLayoutContext.tsx
index fd7bc74..c5f82b3 100644
--- a/src/contexts/AppLayoutContext.tsx
+++ b/src/contexts/AppLayoutContext.tsx
@@ -13,6 +13,7 @@ export interface AppLayoutState {
fontSize: number | undefined;
dyslexic: boolean | undefined;
currency: string | undefined;
+ playerName: string | undefined;
setSubPanelOpen: React.Dispatch
>;
setLanguagePanelOpen: React.Dispatch<
React.SetStateAction
@@ -29,6 +30,7 @@ export interface AppLayoutState {
setFontSize: React.Dispatch>;
setDyslexic: React.Dispatch>;
setCurrency: React.Dispatch>;
+ setPlayerName: React.Dispatch>;
}
const initialState: AppLayoutState = {
@@ -42,6 +44,7 @@ const initialState: AppLayoutState = {
fontSize: 1,
dyslexic: false,
currency: "USD",
+ playerName: "",
setSubPanelOpen: () => {},
setLanguagePanelOpen: () => {},
setMainPanelReduced: () => {},
@@ -52,6 +55,7 @@ const initialState: AppLayoutState = {
setFontSize: () => {},
setDyslexic: () => {},
setCurrency: () => {},
+ setPlayerName: () => {},
};
const AppContext = React.createContext(initialState);
@@ -105,6 +109,10 @@ export const AppContextProvider = (props: Props) => {
initialState.currency
);
+ const [playerName, setPlayerName] = useStateWithLocalStorage<
+ string | undefined
+ >("playerName", initialState.playerName);
+
return (
{
fontSize,
dyslexic,
currency,
+ playerName,
setSubPanelOpen,
setLanguagePanelOpen,
setConfigPanelOpen,
@@ -128,6 +137,7 @@ export const AppContextProvider = (props: Props) => {
setFontSize,
setDyslexic,
setCurrency,
+ setPlayerName,
}}
>
{props.children}
diff --git a/src/tailwind.css b/src/tailwind.css
index 477fdd7..e1aa100 100644
--- a/src/tailwind.css
+++ b/src/tailwind.css
@@ -80,6 +80,20 @@
.prose blockquote {
@apply border-l-dark;
}
+
+ /* INPUT */
+
+ input {
+ @apply rounded-full p-2 text-center bg-light outline outline-mid outline-2 outline-offset-[-2px] hover:outline-[transparent] text-dark hover:bg-mid transition-all;
+ }
+
+ input::placeholder {
+ @apply text-dark opacity-60;
+ }
+
+ input:focus-visible {
+ @apply outline-none bg-mid shadow-inner-sm;
+ }
}
@layer components {