feat: add report bug button

This commit is contained in:
Vitaly Turovsky 2025-07-04 18:04:24 +03:00
commit fa56d479b1
4 changed files with 54 additions and 8 deletions

View file

@ -1,3 +1,4 @@
{
"alwaysReconnectButton": true
"alwaysReconnectButton": true,
"reportBugButtonWithReconnect": true
}

View file

@ -56,6 +56,7 @@ export type AppConfig = {
defaultUsername?: string
skinTexturesProxy?: string
alwaysReconnectButton?: boolean
reportBugButtonWithReconnect?: boolean
}
export const loadAppConfig = (appConfig: AppConfig) => {

View file

@ -32,7 +32,7 @@ import Screen from './Screen'
import styles from './PauseScreen.module.css'
import { DiscordButton } from './DiscordButton'
import { showNotification } from './NotificationProvider'
import { appStatusState, reconnectReload } from './AppStatusProvider'
import { appStatusState, lastConnectOptions, reconnectReload } from './AppStatusProvider'
import NetworkStatus from './NetworkStatus'
import PauseLinkButtons from './PauseLinkButtons'
import { pixelartIcons } from './PixelartIcon'
@ -265,7 +265,7 @@ export default () => {
<div className={styles.pause_container}>
<Button className="button" style={{ width: '204px' }} onClick={onReturnPress}>Back to Game</Button>
<PauseLinkButtons />
<Button className="button" style={{ width: '204px' }} onClick={() => openOptionsMenu('main')}>Options</Button>
<Button className="button" style={{ width: '204px' }} onClick={() => openOptionsMenu('main')}>Options...</Button>
{singleplayer ? (
<div className={styles.row}>
<Button className="button" style={{ width: '170px' }} onClick={async () => clickJoinLinkButton()}>
@ -294,10 +294,54 @@ export default () => {
{fsState.inMemorySave && !fsState.syncFs && !fsState.isReadonly ? 'Save & Quit' : 'Disconnect & Reset'}
</Button>
</>}
{(noConnection || appConfig?.alwaysReconnectButton) && (
<Button className="button" style={{ width: '204px' }} onClick={reconnectReload}>
Reconnect
</Button>
{(true) && (
<div className={styles.row}>
<Button className="button" style={{ width: '98px' }} onClick={reconnectReload}>
Reconnect
</Button>
{true && (
<Button
label="Report Problem"
className="button"
style={{ width: '98px' }}
onClick={async () => {
const platform = (navigator as any).userAgentData?.platform ?? navigator.platform
const body = `Version: ${window.location.hostname}\nServer: ${lastConnectOptions.value?.server ?? '<not a server>'}\nPlatform: ${platform}\nWebsite: ${window.location.href}`
const currentHost = window.location.hostname
const options = [
'GitHub (please use it if you can)',
'Email',
...((currentHost === 'mcraft.fun' || currentHost === 'ru.mcraft.fun') ? ['Try Beta Version'] : []),
// 'Use previous versions of client'
]
const action = await showOptionsModal('Report client issue', options)
if (!action) return
switch (action) {
case 'GitHub (please use it if you can)':
openGithub(`/issues/new?body=${encodeURIComponent(body)}&title=${encodeURIComponent('[Bug Report] <describe your issue here>')}&labels=bug`)
break
case 'Email': {
window.location.href = `mailto:support@mcraft.fun?body=${encodeURIComponent(body)}`
break
}
case 'Try Beta Version': {
if (currentHost === 'mcraft.fun') {
window.location.href = 'https://s.mcraft.fun'
} else if (currentHost === 'ru.mcraft.fun') {
window.location.href = 'https://s.pcm.gg'
}
break
}
case 'Use previous versions of client':
// TODO: Implement versions screen
void showOptionsModal('Previous versions', [])
break
}
}}
/>
)}
</div>
)}
</div>
<LoadingTimer />

View file

@ -163,7 +163,7 @@ export const reloadChunks = async () => {
}
export const openGithub = (addUrl = '') => {
window.open(`${process.env.GITHUB_URL}${addUrl}`, '_blank')
window.open(`${process.env.GITHUB_URL?.replace(/\/$/, '')}${addUrl}`, '_blank')
}
export const resolveTimeout = async (promise, timeout = 10_000) => {