update: api refactor

This commit is contained in:
unknown 2020-08-05 16:39:15 +02:00
parent 31a82a6a80
commit 009ee43264
6 changed files with 47 additions and 19 deletions

6
.gitignore vendored
View File

@ -1,5 +1,3 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies # dependencies
/node_modules /node_modules
/npm-debug.log* /npm-debug.log*
@ -9,13 +7,9 @@
# production # production
/dist /dist
/.debug
# misc
.DS_Store
# umi # umi
/src/.umi /src/.umi
/src/.umi-production /src/.umi-production
/src/.umi-test /src/.umi-test
/.env.local /.env.local
.debug/4.11/.editorconfig

View File

@ -17,7 +17,7 @@ export default defineConfig({
type: 'none', type: 'none',
}, },
alias: { alias: {
api: resolve(__dirname, './api'), api: resolve(__dirname, './node_modules/@ragestudio/ycorejs-lib'),
globals: resolve(__dirname, './globals'), globals: resolve(__dirname, './globals'),
core: resolve(__dirname, './src/core'), core: resolve(__dirname, './src/core'),
theme: resolve(__dirname, './src/theme'), theme: resolve(__dirname, './src/theme'),

View File

@ -4,26 +4,32 @@ export default [
{ {
id: 'backgroundImage', id: 'backgroundImage',
icon: <Icons.Image />, icon: <Icons.Image />,
title: 'Background Image', title: 'Background',
description: 'Change the background of the app', description: 'Change the background of the app',
}, },
{ {
id: 'backgroundColor', id: 'overlay',
icon: <Icons.Droplet />, icon: <Icons.Sidebar />,
title: 'Overlay Color', title: 'Overlay',
description: 'Description blah blah', description: 'Description blah blah',
}, },
{ {
id: 'color', id: 'color',
icon: <Icons.FormatPainterOutlined style={{ marginRight: '10px' }} />, icon: <Icons.Droplet />,
title: 'Colors', title: 'Colors',
description: 'Texts, Buttons, Sliders ...etc', description: 'Texts, Buttons, Sliders ...etc',
}, },
{ {
id: 'fontSize', id: 'text',
icon: <Icons.ZoomIn />, icon: <Icons.FontColorsOutlined style={{ marginRight: '10px' }} />,
title: 'Sizes', title: 'Text',
description: 'Zoom?', description: 'Sizes, Fonts',
},
{
id: 'sounds',
icon: <Icons.Volume2 />,
title: 'Sounds',
description: 'BlipBlopBLup',
}, },
{ {
id: 'darkmode', id: 'darkmode',

View File

@ -3,7 +3,7 @@
"UUID": "C8mVSr-4nmPp2-pr5Vrz-CU4kg4", "UUID": "C8mVSr-4nmPp2-pr5Vrz-CU4kg4",
"title": "Comty™", "title": "Comty™",
"DevBuild": true, "DevBuild": true,
"version": "0.7.31", "version": "0.4.04",
"stage": "dev-pre", "stage": "dev-pre",
"description": "", "description": "",
"author": "RageStudio", "author": "RageStudio",
@ -35,7 +35,7 @@
"@lingui/react": "^2.9.1", "@lingui/react": "^2.9.1",
"@material-ui/core": "^4.9.9", "@material-ui/core": "^4.9.9",
"@material-ui/icons": "^4.9.1", "@material-ui/icons": "^4.9.1",
"@ragestudio/ycorejs-lib": "^0.1.21", "@ragestudio/ycorejs-lib": "^0.1.22",
"antd": "^4.5.1", "antd": "^4.5.1",
"axios": "^0.19.2", "axios": "^0.19.2",
"babel-core": "^6.26.3", "babel-core": "^6.26.3",

View File

@ -128,6 +128,7 @@ export default {
e.key === payload.key? (tmp.value = payload.value) : (tmp.value = e.value) e.key === payload.key? (tmp.value = payload.value) : (tmp.value = e.value)
container_2.push(tmp) container_2.push(tmp)
}) })
}else{ }else{
container_2 = [payload] container_2 = [payload]
} }

View File

@ -36,13 +36,40 @@ class DarkMode extends React.Component{
state = { state = {
model: { active: false, autoTime: '' } model: { active: false, autoTime: '' }
} }
handleUpdate(payload){
if (!payload) {
payload = this.state.model
}
this.setState({ model: payload, processing: false })
this.props.dispatch({
type: 'app/updateTheme',
payload: {
key: 'darkmode',
value: payload
}
});
}
render(){ render(){
const promiseState = async state => new Promise(resolve => this.setState(state, resolve));
return <> return <>
<div> <div>
<h2><Icons.Moon /> Dark Mode</h2> <h2><Icons.Moon /> Dark Mode</h2>
</div> </div>
<div> <div>
<div className={styles.background_image_controls} >
<div>
<h4><Icons.Eye />Enabled</h4>
<antd.Switch
checkedChildren="Enabled"
unCheckedChildren="Disabled"
loading={this.state.processing}
onChange={(e) => {promiseState(prevState => ({ model: { ...prevState.model, active: e }})).then(() => this.handleUpdate())}}
checked={this.state.model.active}
/>
</div>
</div>
</div> </div>
</> </>