Changes from 1.2.1 - 1.5.1

Contains slightly modified commits from between 1.2.1 and 1.5.1.
This commit is contained in:
Thoronium
2024-10-30 13:18:07 -06:00
parent 31c60755af
commit f6f5eae31c
46 changed files with 2619 additions and 1669 deletions

View File

@@ -2,6 +2,7 @@
import { invoke } from '@tauri-apps/api/tauri'
import React from 'react'
import Tr from '../../../utils/language'
import { getConfig, getConfigOption } from '../../../utils/configuration'
import './NewsSection.css'
@@ -10,6 +11,7 @@ interface IProps {
}
interface IState {
offline: boolean
selected: string
news?: JSX.Element
commitList?: JSX.Element[]
@@ -40,6 +42,7 @@ export default class NewsSection extends React.Component<IProps, IState> {
super(props)
this.state = {
offline: false,
selected: props.selected || 'commits',
}
@@ -47,7 +50,16 @@ export default class NewsSection extends React.Component<IProps, IState> {
this.showNews = this.showNews.bind(this)
}
componentDidMount() {
async componentDidMount() {
const config = await getConfig()
this.setState({
offline: config.offline_mode || false,
})
// If offline, don't call news
if (this.state.offline) {
return
}
// Call showNews off the bat
this.showNews()
this.setSelected('commits')
@@ -110,6 +122,11 @@ export default class NewsSection extends React.Component<IProps, IState> {
}
async showNews() {
const offline_mode = await getConfigOption('offline_mode')
if (offline_mode) {
return
}
let news: JSX.Element | JSX.Element[] = <tr></tr>
switch (this.state.selected) {
@@ -124,7 +141,10 @@ export default class NewsSection extends React.Component<IProps, IState> {
case 'latest_version':
news = (
<tr>
<td>Latest version: Grasscutter 1.7.0 - Cultivation 1.2.0</td>
<td>
Work in progress area! These numbers may be outdated, so please do not use them as reference. Latest
version: Grasscutter 1.7.4 - Cultivation 1.5.1
</td>
</tr>
)
break
@@ -144,6 +164,10 @@ export default class NewsSection extends React.Component<IProps, IState> {
}
render() {
if (this.state.offline) {
return null
}
return (
<div className="NewsSection" id="newsContainer">
<div className="NewsTabs" id="newsTabsContainer">