mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
refactor & other changes
This commit is contained in:
parent
125d732b4f
commit
3142059177
@ -7,13 +7,13 @@ import { connect } from 'umi';
|
|||||||
export default class WindowNavbar extends React.Component{
|
export default class WindowNavbar extends React.Component{
|
||||||
handleMinimize(){
|
handleMinimize(){
|
||||||
this.props.dispatch({
|
this.props.dispatch({
|
||||||
type: "app/appControl",
|
type: "app/ipcInvoke",
|
||||||
payload: "minimize-window"
|
payload: "minimize-window"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
handleClose(){
|
handleClose(){
|
||||||
this.props.dispatch({
|
this.props.dispatch({
|
||||||
type: "app/appControl",
|
type: "app/ipcInvoke",
|
||||||
payload: "hide-window"
|
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}>
|
<div className={styles.post_card_title}>
|
||||||
<h4 onClick={() => router.go(`@${publisher.username}`)} className={styles.titleUser}>
|
<h4 onClick={() => router.go(`@${publisher.username}`)} className={styles.titleUser}>
|
||||||
@{publisher.username}
|
@{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}
|
{core.booleanFix(publisher.nsfw_flag)? (<antd.Tag style={{ margin: '0 0 0 13px' }} color="volcano" > NSFW </antd.Tag> ) : null}
|
||||||
</h4>
|
</h4>
|
||||||
<div className={styles.PostTags}>
|
<div className={styles.PostTags}>
|
||||||
|
@ -281,7 +281,7 @@ class PostCreator extends React.PureComponent {
|
|||||||
>
|
>
|
||||||
|
|
||||||
{this.state.uploader ? (
|
{this.state.uploader ? (
|
||||||
<Icons.xCicle style={{ margin: 0 }} />
|
<Icons.XCircle style={{ margin: 0 }} />
|
||||||
) : (
|
) : (
|
||||||
<Icons.Plus style={{ margin: 0, fontSize: '14px' }} />
|
<Icons.Plus style={{ margin: 0, fontSize: '14px' }} />
|
||||||
)}
|
)}
|
||||||
|
@ -9,7 +9,9 @@ export const INVALID_PROPS = `Some props failed!`
|
|||||||
// HANDLERS
|
// HANDLERS
|
||||||
export const onError = {
|
export const onError = {
|
||||||
internal_proccess: (...rest) => {
|
internal_proccess: (...rest) => {
|
||||||
verbosity({...rest})
|
verbosity({...rest}, {
|
||||||
|
type: "error"
|
||||||
|
})
|
||||||
appInterface.notify.open({
|
appInterface.notify.open({
|
||||||
message: INTERNAL_PROCESS_FAILED,
|
message: INTERNAL_PROCESS_FAILED,
|
||||||
description:
|
description:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import io from 'socket.io-client'
|
import io from 'socket.io-client'
|
||||||
import { verbosityConsole } from 'core/libs/verbosity'
|
import { verbosity } from 'core/libs/verbosity'
|
||||||
import { connect } from 'umi'
|
import { connect } from 'umi'
|
||||||
import settings from 'core/libs/settings'
|
import settings from 'core/libs/settings'
|
||||||
|
|
||||||
@ -63,11 +63,11 @@ export class SocketConnection{
|
|||||||
this.conn.open()
|
this.conn.open()
|
||||||
this.ioConn.on("connect_error", () => {
|
this.ioConn.on("connect_error", () => {
|
||||||
if (this.state.connAttemps >= maxDeep_Attemp) {
|
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()
|
this.conn.close()
|
||||||
return false
|
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
|
this.state.connAttemps = this.state.connAttemps + 1
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -81,7 +81,7 @@ export class SocketConnection{
|
|||||||
this.ioConn.disconnect()
|
this.ioConn.disconnect()
|
||||||
},
|
},
|
||||||
close: () => {
|
close: () => {
|
||||||
verbosityConsole("Connection closed!")
|
verbosity("Connection closed!")
|
||||||
this.ioConn.close()
|
this.ioConn.close()
|
||||||
},
|
},
|
||||||
destroy: () => {
|
destroy: () => {
|
||||||
|
@ -94,28 +94,13 @@ export default {
|
|||||||
window.PluginGlobals = []
|
window.PluginGlobals = []
|
||||||
|
|
||||||
if (!service) {
|
if (!service) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sessionDataframe && session ) {
|
if (!sessionDataframe && session ) {
|
||||||
yield put({ type: 'handleUpdateData' })
|
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 }) {
|
*logout({ payload }, { call, put, select }) {
|
||||||
const uuid = yield select(state => state.app.session_uuid)
|
const uuid = yield select(state => state.app.session_uuid)
|
||||||
@ -131,9 +116,6 @@ export default {
|
|||||||
if (!payload) return false;
|
if (!payload) return false;
|
||||||
const { user_id, access_token } = payload.authFrame
|
const { user_id, access_token } = payload.authFrame
|
||||||
yield put({ type: 'handleLogin', payload: { user_id, access_token, user_data: payload.dataFrame } })
|
yield put({ type: 'handleLogin', payload: { user_id, access_token, user_data: payload.dataFrame } })
|
||||||
},
|
|
||||||
*guestLogin({ payload }, { put, select }) {
|
|
||||||
|
|
||||||
},
|
},
|
||||||
*initializeSocket({payload}, {select}){
|
*initializeSocket({payload}, {select}){
|
||||||
if(!payload) return false
|
if(!payload) return false
|
||||||
@ -364,14 +346,15 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
|
||||||
handleThemeChange(state, { payload }) {
|
|
||||||
state.theme = payload;
|
|
||||||
},
|
},
|
||||||
handleCollapseSidebar(state, { payload }){
|
handleCollapseSidebar(state, { payload }){
|
||||||
state.sidebar_collapsed = 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 }){
|
isUser(state, { payload, callback }){
|
||||||
if(!payload || !callback) return false
|
if(!payload || !callback) return false
|
||||||
switch (payload) {
|
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}){
|
ipcInvoke(state, {payload}){
|
||||||
if (!payload || !state.embedded) {
|
if (!payload || !state.embedded) {
|
||||||
return false
|
return false
|
||||||
@ -418,16 +396,6 @@ export default {
|
|||||||
const ipc = state.electron.ipcRenderer
|
const ipc = state.electron.ipcRenderer
|
||||||
ipc.send(payload.key, payload.payload)
|
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) {
|
sessionErase(state) {
|
||||||
state.service_valid = false;
|
state.service_valid = false;
|
||||||
state.session_valid = false;
|
state.session_valid = false;
|
||||||
|
@ -1,14 +1,71 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import settings from 'core/libs/settings'
|
import settings from 'core/libs/settings'
|
||||||
|
import verbosity from 'core/libs/verbosity'
|
||||||
|
import * as antd from 'antd'
|
||||||
|
|
||||||
const verbosity_enabled = settings('verbosity')
|
const verbosity_enabled = settings('verbosity')
|
||||||
export default class Verbosity extends React.Component{
|
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(){
|
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(
|
return(
|
||||||
<div>
|
<div>
|
||||||
verbosity => {verbosity_enabled ? "enabled" : "disabled"}
|
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>
|
</div>
|
||||||
|
</antd.Card>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -56,7 +56,7 @@ const menuList = [
|
|||||||
export default class Debug extends React.Component {
|
export default class Debug extends React.Component {
|
||||||
state = {
|
state = {
|
||||||
loading: true,
|
loading: true,
|
||||||
selectKey: '',
|
selectKey: 'verbosity',
|
||||||
menus: []
|
menus: []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user