feat(plugins/settings): improve Revenge page
This commit is contained in:
parent
662d24e7eb
commit
1d32f75f79
11 changed files with 90 additions and 7 deletions
2
src/constants.ts
Normal file
2
src/constants.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export const GitHubOrganizationURL = 'https://github.com/revenge-mod'
|
||||
export const DiscordServerURL = 'https://discord.com/invite/ddcQf3s2Uq'
|
||||
|
|
@ -8,6 +8,9 @@ export const MobileSetting = {
|
|||
REVENGE_DEVELOPER: 'REVENGE_DEVELOPER',
|
||||
|
||||
// SUBSETTINGS
|
||||
REVENGE_DISCORD_SERVER: 'REVENGE_DISCORD_SERVER',
|
||||
REVENGE_GITHUB_ORGANIZATION: 'REVENGE_GITHUB_ORGANIZATION',
|
||||
RELOAD_APP: 'RELOAD_APP',
|
||||
|
||||
REVENGE_VERSION: 'REVENGE_VERSION',
|
||||
REACT_VERSION: 'REACT_VERSION',
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const HermesVersionSetting: SettingsItem = {
|
|||
IconComponent: () => <AssetIcon name="TranscriptOutlineIcon" />,
|
||||
title: () => 'Hermes',
|
||||
useDescription: () => `${props['Bytecode Version']} (${props.Build})`,
|
||||
type: 'pressable',
|
||||
type: 'static',
|
||||
}
|
||||
|
||||
export default HermesVersionSetting
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const ReactNativeVersionSetting: SettingsItem = {
|
|||
IconComponent: () => <AssetIcon name="ScienceIcon" />,
|
||||
title: () => 'React Native',
|
||||
useDescription: () => version,
|
||||
type: 'pressable',
|
||||
type: 'static',
|
||||
}
|
||||
|
||||
export default ReactNativeVersionSetting
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ const ReactVersionSetting: SettingsItem = {
|
|||
IconComponent: () => <Components.TableRow.Icon source={getAssetByName('ScienceIcon')!.id} />,
|
||||
title: () => 'React',
|
||||
useDescription: () => React.version,
|
||||
type: 'pressable',
|
||||
type: 'static',
|
||||
}
|
||||
|
||||
export default ReactVersionSetting
|
||||
|
|
|
|||
17
src/plugins/settings/definitions/ReloadAppSetting.tsx
Normal file
17
src/plugins/settings/definitions/ReloadAppSetting.tsx
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { BundleUpdaterManager } from '@revenge-mod/discord/native'
|
||||
import { React } from '@revenge-mod/react'
|
||||
|
||||
import AssetIcon from '../components/icons/AssetIcon'
|
||||
import { MobileSetting } from '../SettingsConstants'
|
||||
|
||||
import type { SettingsItem } from '@revenge-mod/discord/ui/settings'
|
||||
|
||||
const ReloadAppSetting: SettingsItem = {
|
||||
parent: MobileSetting.REVENGE,
|
||||
IconComponent: () => <AssetIcon name="RetryIcon" />,
|
||||
title: () => 'Reload App',
|
||||
onPress: () => BundleUpdaterManager.reload(),
|
||||
type: 'pressable',
|
||||
}
|
||||
|
||||
export default ReloadAppSetting
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
import { React, ReactNative } from '@revenge-mod/react'
|
||||
|
||||
import AssetIcon from '../components/icons/AssetIcon'
|
||||
import { MobileSetting } from '../SettingsConstants'
|
||||
|
||||
import type { SettingsItem } from '@revenge-mod/discord/ui/settings'
|
||||
import { DiscordServerURL } from '../../../constants'
|
||||
|
||||
const RevengeDiscordServerSetting: SettingsItem = {
|
||||
parent: MobileSetting.REVENGE,
|
||||
IconComponent: () => <AssetIcon name="Discord" />,
|
||||
title: () => 'Discord Server',
|
||||
onPress: () => ReactNative.Linking.openURL(DiscordServerURL),
|
||||
type: 'pressable',
|
||||
}
|
||||
|
||||
export default RevengeDiscordServerSetting
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
import { React, ReactNative } from '@revenge-mod/react'
|
||||
|
||||
import AssetIcon from '../components/icons/AssetIcon'
|
||||
import { MobileSetting } from '../SettingsConstants'
|
||||
|
||||
import { GitHubOrganizationURL } from '../../../constants'
|
||||
|
||||
import type { SettingsItem } from '@revenge-mod/discord/ui/settings'
|
||||
|
||||
const RevengeGitHubOrganizationSetting: SettingsItem = {
|
||||
parent: MobileSetting.REVENGE,
|
||||
IconComponent: () => <AssetIcon name="img_account_sync_github_white" />,
|
||||
title: () => 'GitHub',
|
||||
onPress: () => ReactNative.Linking.openURL(GitHubOrganizationURL),
|
||||
type: 'pressable',
|
||||
}
|
||||
|
||||
export default RevengeGitHubOrganizationSetting
|
||||
|
|
@ -8,7 +8,7 @@ const RevengeVersionSetting: SettingsItem = {
|
|||
IconComponent: RevengeIcon,
|
||||
title: () => 'Revenge',
|
||||
useDescription: () => `${__BUILD_VERSION__}-${__BUILD_COMMIT__}-${__BUILD_BRANCH__} (${__BUILD_ENV__})`,
|
||||
type: 'pressable',
|
||||
type: 'static',
|
||||
}
|
||||
|
||||
export default RevengeVersionSetting
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ import RevengeVersionSetting from './definitions/RevengeVersionSetting'
|
|||
import HermesVersionSetting from './definitions/HermesVersionSetting'
|
||||
import RevengeNotImplementedSetting from './definitions/RevengeNotImplementedSetting'
|
||||
import EvaluateJavaScriptSetting from './definitions/EvaluateJavaScriptSetting'
|
||||
import ReloadAppSetting from './definitions/ReloadAppSetting'
|
||||
import RevengeDiscordServerSetting from './definitions/RevengeDiscordServerSetting'
|
||||
import RevengeGitHubOrganizationSetting from './definitions/RevengeGitHubOrganizationSetting'
|
||||
|
||||
registerSettingsItems({
|
||||
[MobileSetting.REVENGE]: RevengeSetting,
|
||||
|
|
@ -20,6 +23,9 @@ registerSettingsItems({
|
|||
// [MobileSetting.REVENGE_THEMES]: RevengeThemesSetting,
|
||||
// [MobileSetting.REVENGE_FONTS]: RevengeFontsSetting,
|
||||
[MobileSetting.REVENGE_DEVELOPER]: RevengeDeveloperSetting,
|
||||
[MobileSetting.REVENGE_GITHUB_ORGANIZATION]: RevengeGitHubOrganizationSetting,
|
||||
[MobileSetting.REVENGE_DISCORD_SERVER]: RevengeDiscordServerSetting,
|
||||
[MobileSetting.RELOAD_APP]: ReloadAppSetting,
|
||||
[MobileSetting.REVENGE_VERSION]: RevengeVersionSetting,
|
||||
[MobileSetting.REACT_VERSION]: ReactVersionSetting,
|
||||
[MobileSetting.REACT_NATIVE_VERSION]: ReactNativeVersionSetting,
|
||||
|
|
|
|||
|
|
@ -1,20 +1,40 @@
|
|||
import { SettingListRenderer } from '@revenge-mod/discord/ui/settings'
|
||||
import { MobileSetting } from '../SettingsConstants'
|
||||
import { Components } from '../../../../lib/discord/src/ui/common'
|
||||
|
||||
export default function RevengeSettingScreen() {
|
||||
return (
|
||||
<SettingListRenderer.SettingsList
|
||||
sections={[
|
||||
{
|
||||
label: 'Revenge',
|
||||
settings: [
|
||||
MobileSetting.REVENGE_VERSION,
|
||||
MobileSetting.REVENGE_DISCORD_SERVER,
|
||||
MobileSetting.REVENGE_GITHUB_ORGANIZATION,
|
||||
],
|
||||
subLabel: (
|
||||
<>
|
||||
<Components.Text variant="text-xs/medium">
|
||||
You are using the next version of Revenge!
|
||||
</Components.Text>
|
||||
<Components.Text variant="text-xs/semibold" color="text-danger">
|
||||
This version is experimental and may be unstable.
|
||||
</Components.Text>
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: 'Versions',
|
||||
settings: [
|
||||
MobileSetting.REACT_VERSION,
|
||||
MobileSetting.REACT_NATIVE_VERSION,
|
||||
MobileSetting.HERMES_VERSION,
|
||||
],
|
||||
subLabel: [
|
||||
'You are using the next version of Revenge! This version is experimental and may be unstable.',
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Actions',
|
||||
settings: [MobileSetting.RELOAD_APP],
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue