import { twc } from 'react-twc'; import { useAnalytics } from '../../Hooks/useAnalytics'; import { useGlobalSettings } from '../../Hooks/useGlobalSettings'; import { PreStartMode } from '../../Types/Settings'; import { Separator } from '../Misc/Separator'; import { Paragraph } from '../Misc/TextComponents'; import { ToggleButton } from '../Misc/ToggleButton'; import { Dialog } from './Dialog'; const SettingContainer = twc.div`w-full flex flex-col mb-2`; const ToggleContainer = twc.div`flex flex-row justify-between items-center -mb-1`; const Description = twc.p`mr-16 text-xs text-left text-text-secondary mt-1`; const baseGithubReleasesUrl = 'https://github.com/Vikeo/LifeTrinket/releases/tag/'; export const SettingsDialog = ({ dialogRef, }: { dialogRef: React.MutableRefObject; }) => { const { settings, setSettings, isPWA, version } = useGlobalSettings(); const analytics = useAnalytics(); return (
Current version: {version.installedVersion}{' '} {version.isLatest && ( (latest) )}
( { analytics.trackEvent( `current_change_log_clicked_v${version.installedVersion}` ); }} > Release notes )
{!version.isLatest && version.remoteVersion && ( <>
{version.remoteVersion} available!
( { analytics.trackEvent( `new_change_log_clicked_v${version.remoteVersion}` ); }} > Release notes )
)}
{ setSettings({ ...settings, showPlayerMenuCog: !settings.showPlayerMenuCog, }); }} /> A cog on the top right of each player's card will be shown if this is enabled. { setSettings({ ...settings, showStartingPlayer: !settings.showStartingPlayer, }); }} /> On start or reset of game, will pick a random starting player, according to the Pre-Start mode
Different ways to determine the starting player before the game starts.
{settings.preStartMode === PreStartMode.None && (
Instant: A random starting player will simply be shown on start.
)} {settings.preStartMode === PreStartMode.RandomKing && (
Royal Shuffle: Randomly pass a crown between all players, press the screen to stop it. The player who has the crown when it stops gets to start.
)} {settings.preStartMode === PreStartMode.FingerGame && (
Touch Roulette: All players put a finger on the screen, one will be chosen at random.
)} {settings.preStartMode === PreStartMode.Trivia && (
Group Trivia: A random "who is the most ..." type question will be shown, the group decides which player fits the question best.
)}
{ setSettings({ ...settings, keepAwake: !settings.keepAwake, }); }} /> Will prevent device from going to sleep while this app is open if this is enabled. { setSettings({ ...settings, goFullscreenOnStart: !settings.goFullscreenOnStart, }); }} /> Will enter fullscreen mode when starting a game if this is enabled. { setSettings({ ...settings, showAnimations: !settings.showAnimations, }); }} /> Disables the following animation:
  • Glow effect on start menu
{!isPWA && ( <> Tip: You can{' '} add this webapp to your home page on iOS or{' '} install it on Android to have it act just like a normal app! If you do, this app will work offline and the toolbar will be automatically hidden. )}
); };