mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
refactor & other changes
This commit is contained in:
parent
0c864e6246
commit
f493c830b5
@ -7,13 +7,13 @@ import { connect } from 'umi';
|
||||
export default class WindowNavbar extends React.Component{
|
||||
handleMinimize(){
|
||||
this.props.dispatch({
|
||||
type: "app/appControl",
|
||||
type: "app/ipcInvoke",
|
||||
payload: "minimize-window"
|
||||
})
|
||||
}
|
||||
handleClose(){
|
||||
this.props.dispatch({
|
||||
type: "app/appControl",
|
||||
type: "app/ipcInvoke",
|
||||
payload: "hide-window"
|
||||
})
|
||||
}
|
||||
|
0
src/components/ListedMenu/index.js
Normal file
0
src/components/ListedMenu/index.js
Normal file
@ -141,7 +141,7 @@ export default class PostCard extends React.Component {
|
||||
<div className={styles.post_card_title}>
|
||||
<h4 onClick={() => router.go(`@${publisher.username}`)} className={styles.titleUser}>
|
||||
@{publisher.username}
|
||||
{core.booleanFix(publisher.verified)? (<Icon style={{ color: 'blue' }} component={Icons.VerifiedBadge} />) : null}
|
||||
{core.booleanFix(publisher.verified)? (<Icon style={{ color: 'blue' }} component={Icons.verifiedBadge} />) : null}
|
||||
{core.booleanFix(publisher.nsfw_flag)? (<antd.Tag style={{ margin: '0 0 0 13px' }} color="volcano" > NSFW </antd.Tag> ) : null}
|
||||
</h4>
|
||||
<div className={styles.PostTags}>
|
||||
|
@ -281,7 +281,7 @@ class PostCreator extends React.PureComponent {
|
||||
>
|
||||
|
||||
{this.state.uploader ? (
|
||||
<Icons.xCicle style={{ margin: 0 }} />
|
||||
<Icons.XCircle style={{ margin: 0 }} />
|
||||
) : (
|
||||
<Icons.Plus style={{ margin: 0, fontSize: '14px' }} />
|
||||
)}
|
||||
|
@ -9,7 +9,9 @@ export const INVALID_PROPS = `Some props failed!`
|
||||
// HANDLERS
|
||||
export const onError = {
|
||||
internal_proccess: (...rest) => {
|
||||
verbosity({...rest})
|
||||
verbosity({...rest}, {
|
||||
type: "error"
|
||||
})
|
||||
appInterface.notify.open({
|
||||
message: INTERNAL_PROCESS_FAILED,
|
||||
description:
|
||||
|
@ -1,5 +1,5 @@
|
||||
import io from 'socket.io-client'
|
||||
import { verbosityConsole } from 'core/libs/verbosity'
|
||||
import { verbosity } from 'core/libs/verbosity'
|
||||
import { connect } from 'umi'
|
||||
import settings from 'core/libs/settings'
|
||||
|
||||
@ -63,11 +63,11 @@ export class SocketConnection{
|
||||
this.conn.open()
|
||||
this.ioConn.on("connect_error", () => {
|
||||
if (this.state.connAttemps >= maxDeep_Attemp) {
|
||||
verbosityConsole('Maximun nº of attemps reached => max', maxDeep_Attemp + 1)
|
||||
verbosity(['Maximun nº of attemps reached => max', maxDeep_Attemp + 1])
|
||||
this.conn.close()
|
||||
return false
|
||||
}
|
||||
verbosityConsole(`Strike [${this.state.connAttemps + 1}] / ${maxDeep_Attemp + 1} !`)
|
||||
verbosity([`Strike [${this.state.connAttemps + 1}] / ${maxDeep_Attemp + 1} !`])
|
||||
this.state.connAttemps = this.state.connAttemps + 1
|
||||
|
||||
})
|
||||
@ -81,7 +81,7 @@ export class SocketConnection{
|
||||
this.ioConn.disconnect()
|
||||
},
|
||||
close: () => {
|
||||
verbosityConsole("Connection closed!")
|
||||
verbosity("Connection closed!")
|
||||
this.ioConn.close()
|
||||
},
|
||||
destroy: () => {
|
||||
|
@ -94,28 +94,13 @@ export default {
|
||||
window.PluginGlobals = []
|
||||
|
||||
if (!service) {
|
||||
|
||||
}
|
||||
|
||||
if (!sessionDataframe && session ) {
|
||||
yield put({ type: 'handleUpdateData' })
|
||||
}
|
||||
|
||||
// if (session) {
|
||||
// if (pathMatchRegexp(['/', '/login'], window.location.pathname)) {
|
||||
// app.router.push({ pathname: `${app_config.MainPath}` });
|
||||
// }
|
||||
|
||||
// return true;
|
||||
// } else if (
|
||||
// !pathMatchRegexp(['', '/login'], window.location.pathname) &&
|
||||
// queryLayout(config.layouts, window.location.pathname) !== 'public'
|
||||
// ) {
|
||||
// if (validBackup == true) {
|
||||
// // logout normal
|
||||
// } else {
|
||||
// core.router.push({ pathname: '/login' });
|
||||
// }
|
||||
// }
|
||||
},
|
||||
*logout({ payload }, { call, put, select }) {
|
||||
const uuid = yield select(state => state.app.session_uuid)
|
||||
@ -131,9 +116,6 @@ export default {
|
||||
if (!payload) return false;
|
||||
const { user_id, access_token } = payload.authFrame
|
||||
yield put({ type: 'handleLogin', payload: { user_id, access_token, user_data: payload.dataFrame } })
|
||||
},
|
||||
*guestLogin({ payload }, { put, select }) {
|
||||
|
||||
},
|
||||
*initializeSocket({payload}, {select}){
|
||||
if(!payload) return false
|
||||
@ -364,14 +346,15 @@ export default {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
handleThemeChange(state, { payload }) {
|
||||
state.theme = payload;
|
||||
},
|
||||
handleCollapseSidebar(state, { payload }){
|
||||
state.sidebar_collapsed = payload
|
||||
},
|
||||
handleUpdateTheme(state, { payload }) {
|
||||
verbosity(payload)
|
||||
store.set(app_config.appTheme_container, payload);
|
||||
state.app_theme = payload
|
||||
},
|
||||
isUser(state, { payload, callback }){
|
||||
if(!payload || !callback) return false
|
||||
switch (payload) {
|
||||
@ -398,11 +381,6 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
appControl(state, {payload}){
|
||||
if (!payload) return false
|
||||
const ipc = state.electron.ipcRenderer
|
||||
ipc.invoke(payload)
|
||||
},
|
||||
ipcInvoke(state, {payload}){
|
||||
if (!payload || !state.embedded) {
|
||||
return false
|
||||
@ -418,16 +396,6 @@ export default {
|
||||
const ipc = state.electron.ipcRenderer
|
||||
ipc.send(payload.key, payload.payload)
|
||||
},
|
||||
allNotificationsRead(state) {
|
||||
state.notifications = [];
|
||||
},
|
||||
|
||||
handleUpdateTheme(state, { payload }) {
|
||||
verbosity(payload)
|
||||
store.set(app_config.appTheme_container, payload);
|
||||
state.app_theme = payload
|
||||
},
|
||||
|
||||
sessionErase(state) {
|
||||
state.service_valid = false;
|
||||
state.session_valid = false;
|
||||
|
@ -1,13 +1,70 @@
|
||||
import React from 'react'
|
||||
import settings from 'core/libs/settings'
|
||||
import verbosity from 'core/libs/verbosity'
|
||||
import * as antd from 'antd'
|
||||
|
||||
const verbosity_enabled = settings('verbosity')
|
||||
export default class Verbosity extends React.Component{
|
||||
state = {
|
||||
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
verbosity("Single text test")
|
||||
}
|
||||
|
||||
handleSend(){
|
||||
const { raw0, raw1, color, type, method, line, file, time } = this.state
|
||||
let data = []
|
||||
let params = { color, type}
|
||||
let stackTraceParams = { line, file, time, method }
|
||||
|
||||
if (typeof(raw0) !== "undefined") {
|
||||
data[0] = raw0
|
||||
}
|
||||
if (typeof(raw1) !== "undefined") {
|
||||
data[1] = raw1
|
||||
}
|
||||
|
||||
verbosity(
|
||||
data,
|
||||
params,
|
||||
stackTraceParams
|
||||
)
|
||||
}
|
||||
|
||||
render(){
|
||||
const handleRawChange = (e) => {
|
||||
const obj = {}
|
||||
obj[e.target.id] = e.target.value
|
||||
this.setState(obj)
|
||||
}
|
||||
const handleCheckChange = (e) => {
|
||||
const obj = {}
|
||||
obj[e.target.id] = e.target.checked
|
||||
this.setState(obj)
|
||||
}
|
||||
return(
|
||||
<div>
|
||||
verbosity => {verbosity_enabled ? "enabled" : "disabled"}
|
||||
|
||||
<antd.Card>
|
||||
<antd.Input id="raw0" onChange={handleRawChange} placeholder="Data 1 (string)" />
|
||||
<antd.Input id="raw1" onChange={handleRawChange} placeholder="Data 2 (string)" />
|
||||
<div style={{ display: "flex", marginTop: "20px" }}>
|
||||
<antd.Button type="primary" onClick={() => this.handleSend()}> send </antd.Button>
|
||||
<antd.Select style={{ width: "200px" }} defaultValue={this.state.type} onChange={(e) => {this.setState({ type: e})}} >
|
||||
<antd.Select.Option value="log"> log </antd.Select.Option>
|
||||
<antd.Select.Option value="debug"> debug </antd.Select.Option>
|
||||
<antd.Select.Option value="error"> error </antd.Select.Option>
|
||||
</antd.Select>
|
||||
<antd.Input id="color" onChange={(e) => handleRawChange(e)} placeholder="color" />
|
||||
<antd.Checkbox id="method" onChange={handleCheckChange}> method </antd.Checkbox>
|
||||
<antd.Checkbox id="line" onChange={handleCheckChange}> line </antd.Checkbox>
|
||||
<antd.Checkbox id="file" onChange={handleCheckChange}> file </antd.Checkbox>
|
||||
<antd.Checkbox id="time" onChange={handleCheckChange}> time </antd.Checkbox>
|
||||
|
||||
</div>
|
||||
</antd.Card>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ const menuList = [
|
||||
export default class Debug extends React.Component {
|
||||
state = {
|
||||
loading: true,
|
||||
selectKey: '',
|
||||
selectKey: 'verbosity',
|
||||
menus: []
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user