From 8ff05924dd76cec13b86b237675bd489692886fa Mon Sep 17 00:00:00 2001 From: Max Lee Date: Wed, 26 Feb 2025 20:31:22 +0100 Subject: [PATCH] feat: add config option for pause screen links (#288) --- config.json | 10 ++++++++++ src/globalState.ts | 1 + src/react/DiscordButton.tsx | 8 ++++---- src/react/PauseScreen.tsx | 27 ++++++++++++++++++++++----- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/config.json b/config.json index d6d68b94..6aa86397 100644 --- a/config.json +++ b/config.json @@ -17,5 +17,15 @@ "version": "1.20.3", "description": "Very nice a polite server. Must try for everyone!" } + ], + "pauseLinks": [ + [ + { + "type": "github" + }, + { + "type": "discord" + } + ] ] } diff --git a/src/globalState.ts b/src/globalState.ts index 66959198..cc9cd127 100644 --- a/src/globalState.ts +++ b/src/globalState.ts @@ -127,6 +127,7 @@ export type AppConfig = { forceSettings?: Record // hideSettings?: Record allowAutoConnect?: boolean + pauseLinks?: Array>> } export const miscUiState = proxy({ diff --git a/src/react/DiscordButton.tsx b/src/react/DiscordButton.tsx index 3824c4c1..e8278e95 100644 --- a/src/react/DiscordButton.tsx +++ b/src/react/DiscordButton.tsx @@ -4,7 +4,7 @@ import { CSSProperties, useState } from 'react' import Button from './Button' import PixelartIcon, { pixelartIcons } from './PixelartIcon' -export const DiscordButton = () => { +export const DiscordButton = ({ text, style }: { text?: string, style?: Record }) => { const links: DropdownButtonItem[] = [ { text: 'Support Official Server (mcraft.fun)', @@ -16,7 +16,7 @@ export const DiscordButton = () => { } ] - return + return } export type DropdownButtonItem = { @@ -24,7 +24,7 @@ export type DropdownButtonItem = { clickHandler: () => void } -export const DropdownButton = ({ text, links }: { text: string, links: DropdownButtonItem[] }) => { +export const DropdownButton = ({ text, style, links }: { text: string, style?: Record, links: DropdownButtonItem[] }) => { const [isOpen, setIsOpen] = useState(false) const { refs, floatingStyles } = useFloating({ open: isOpen, @@ -50,7 +50,7 @@ export const DropdownButton = ({ text, links }: { text: string, links: DropdownB return <> ) + } else if (button.type === 'url' && button.text) { + rowButtons.push() + } + } + pauseLinks.push(
{rowButtons}
) + } + } + return -
- - -
+ {pauseLinks} {singleplayer ? (