mirror of
https://github.com/mue/mue.git
synced 2026-07-05 23:51:12 +02:00
Quote language feature and date settings
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import SettingsFunctions from '../../../modules/helpers/settings';
|
||||
import Checkbox from '../settings/Checkbox';
|
||||
import Dropdown from '../settings/Dropdown';
|
||||
import Section from '../settings/Section';
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
@@ -66,6 +67,25 @@ export default class Settings extends React.PureComponent {
|
||||
<Checkbox name='copyButton' text={this.props.language.quote.copy} />
|
||||
<Checkbox name='tweetButton' text={this.props.language.quote.tweet} />
|
||||
<Checkbox name='favouriteQuoteEnabled' text={this.props.language.quote.favourite} />
|
||||
<Dropdown label='Language' name='quotelanguage' id='quotelanguage' onChange={() => localStorage.setItem('quotelanguage', document.getElementById('quotelanguage').value)}>
|
||||
<option className='choices' value='English'>English</option>
|
||||
<option className='choices' value='French'>Français</option>
|
||||
</Dropdown>
|
||||
</Section>
|
||||
|
||||
<Section title='Date' name='date'>
|
||||
<Checkbox name='short' text='Short Date' betaFeature={true} />
|
||||
<Dropdown label='Short Format' name='dateFormat' id='dateformat' onChange={() => localStorage.setItem('dateFormat', document.getElementById('dateformat').value)}>
|
||||
<option className='choices' value='DMY'>DMY</option>
|
||||
<option className='choices' value='MDY'>MDY</option>
|
||||
<option className='choices' value='YMD'>YMD</option>
|
||||
</Dropdown>
|
||||
<br/><br/>
|
||||
<Dropdown label='Short Separator' name='shortFormat' id='shortformat' onChange={() => localStorage.setItem('shortFormat', document.getElementById('shortformat').value)}>
|
||||
<option className='choices' value='default'>Default</option>
|
||||
<option className='choices' value='dash'>Dash</option>
|
||||
<option className='choices' value='gaps'>Gaps</option>
|
||||
</Dropdown>
|
||||
</Section>
|
||||
|
||||
<BackgroundSettings language={this.props.language} toastLanguage={this.props.toastLanguage} />
|
||||
|
||||
@@ -65,7 +65,7 @@ export default class Quote extends React.PureComponent {
|
||||
if (localStorage.getItem('offlineMode') === 'true') return this.doOffline();
|
||||
|
||||
try { // First we try and get a quote from the API...
|
||||
const data = await (await fetch(Constants.API_URL + '/getQuote')).json();
|
||||
const data = await (await fetch(Constants.API_URL + '/getQuote?language=' + localStorage.getItem('quotelanguage'))).json();
|
||||
if (data.statusCode === 429) return this.doOffline(); // If we hit the ratelimit, we fallback to local quotes
|
||||
this.setState({
|
||||
quote: '"' + data.quote + '"',
|
||||
|
||||
@@ -11,9 +11,10 @@ export default class DateWidget extends React.PureComponent {
|
||||
|
||||
getDate() {
|
||||
const date = new Date();
|
||||
const short = localStorage.getItem('short');
|
||||
const dateFormat = localStorage.getItem('dateFormat');
|
||||
|
||||
if (dateFormat === 'short') {
|
||||
if (short === 'true') {
|
||||
const dateDay = date.getDate();
|
||||
const dateMonth = date.getMonth() + 1;
|
||||
const dateYear = date.getFullYear();
|
||||
|
||||
@@ -90,5 +90,13 @@
|
||||
{
|
||||
"name": "showWelcome",
|
||||
"value": true
|
||||
},
|
||||
{
|
||||
"name": "quotelanguage",
|
||||
"value": "English"
|
||||
},
|
||||
{
|
||||
"name": "date",
|
||||
"value": "false"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user