diff --git a/.corenode b/.corenode index a005c72a..2b0be6b5 100755 --- a/.corenode +++ b/.corenode @@ -1,3 +1,3 @@ { - "version": "0.17.1" + "version": "0.17.2" } diff --git a/package.json b/package.json index c1d50e53..b7385a60 100644 --- a/package.json +++ b/package.json @@ -9,5 +9,5 @@ "dependencies": { "corenode": "^0.28.26" }, - "version": "0.17.1" + "version": "0.17.2" } diff --git a/packages/app/constants/settings/account.jsx b/packages/app/constants/settings/account.jsx index 9e57bb71..760eec89 100644 --- a/packages/app/constants/settings/account.jsx +++ b/packages/app/constants/settings/account.jsx @@ -144,6 +144,6 @@ export default [ "type": "Button", "icon": "LogOut", "title": "Logout", - "emitEvent": "logout", + "emitEvent": "session.logout", } ] \ No newline at end of file diff --git a/packages/app/package.json b/packages/app/package.json index 647df6bf..c4adc3a3 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,6 +1,6 @@ { "name": "comty", - "version": "0.17.1", + "version": "0.17.2", "license": "MIT", "scripts": { "dev": "vite", diff --git a/packages/app/src/App.jsx b/packages/app/src/App.jsx index 8528afcf..82f08f22 100644 --- a/packages/app/src/App.jsx +++ b/packages/app/src/App.jsx @@ -53,7 +53,7 @@ import { Translation } from "react-i18next" import { Session, User } from "models" import config from "config" -import { NotFound, RenderError, Crash, Settings, Navigation } from "components" +import { NotFound, RenderError, Crash, Settings, Navigation, Login } from "components" import { Icons } from "components/Icons" import Layout from "./layout" @@ -62,7 +62,16 @@ import * as Render from "extensions/render.extension.jsx" import "theme/index.less" class App extends React.Component { - //static debugMode = true + //static debugMode = true // this will enable debug mode of evite app (dah...) + + sessionController = new Session() + + userController = new User() + + state = { + session: null, + user: null, + } loadingMessage = false @@ -71,6 +80,16 @@ class App extends React.Component { } static eventsHandlers = { + "app.createLogin": async function () { + app.DrawerController.open("login", Login, { + componentProps: { + sessionController: this.sessionController + } + }) + }, + "session.logout": async function () { + await this.sessionController.logout() + }, "new_session": async function () { await this.flushState() await this.initialization() @@ -85,11 +104,12 @@ class App extends React.Component { this.eventBus.emit("forceToLogin") }, "forceToLogin": function () { - if (window.location.pathname !== "/login") { - this.beforeLoginLocation = window.location.pathname - } + // if (window.location.pathname !== "/login") { + // this.beforeLoginLocation = window.location.pathname + // } - window.app.setLocation("/login") + // window.app.setLocation("/login") + app.eventBus.emit("app.createLogin") }, "invalid_session": async function (error) { await this.sessionController.forgetLocalSession() @@ -246,13 +266,6 @@ class App extends React.Component { } } - sessionController = new Session() - userController = new User() - state = { - session: null, - user: null, - } - flushState = async () => { await this.setState({ session: null, user: null }) } diff --git a/packages/app/src/pages/login/index.jsx b/packages/app/src/components/Login/index.jsx similarity index 64% rename from packages/app/src/pages/login/index.jsx rename to packages/app/src/components/Login/index.jsx index 79f9f7c1..ead2d74c 100644 --- a/packages/app/src/pages/login/index.jsx +++ b/packages/app/src/components/Login/index.jsx @@ -98,46 +98,33 @@ export default class Login extends React.Component { if (typeof this.props.onDone === "function") { this.props.onDone() } - } - componentWillUnmount() { - window.app.SidebarController.toogleVisible(true) - window.app.HeaderController.toogleVisible(true) - } - - componentDidMount() { - const sidebarVisible = window.app.SidebarController.isVisible() - const headerVisible = window.app.HeaderController.isVisible() - - if (sidebarVisible) { - window.app.SidebarController.toogleVisible(false) - } - - if (headerVisible) { - window.app.HeaderController.toogleVisible(false) + if (typeof this.props.close === "function") { + this.props.close() } } render() { - return ( -
- {this.props.session &&
-

You already have a valid session.

-
- @{this.props.session.username} -
- window.app.setLocation(config.app?.mainPath ?? "/main")} >Go to main -
} -
- + return
+
+
+
- ) + {this.props.session &&
+

You already have a valid session.

+
+ @{this.props.session.username} +
+ window.app.setLocation(config.app?.mainPath ?? "/main")} >Go to main +
} + +
} } \ No newline at end of file diff --git a/packages/app/src/pages/login/index.less b/packages/app/src/components/Login/index.less similarity index 87% rename from packages/app/src/pages/login/index.less rename to packages/app/src/components/Login/index.less index 30f1dad9..14d587a4 100644 --- a/packages/app/src/pages/login/index.less +++ b/packages/app/src/components/Login/index.less @@ -1,7 +1,4 @@ -.app_login { - height: 100vh; - width: 100vw; - +.login { display: flex; flex-direction: column; align-items: center; @@ -10,6 +7,17 @@ > div { margin-bottom: 20px; } + + .header { + .logo { + width: 15vw; + + img { + width: 100%; + height: 100%; + } + } + } } .login-form { diff --git a/packages/app/src/components/formGenerator/index.jsx b/packages/app/src/components/formGenerator/index.jsx index 0ac704f6..66cab249 100644 --- a/packages/app/src/components/formGenerator/index.jsx +++ b/packages/app/src/components/formGenerator/index.jsx @@ -16,6 +16,8 @@ import { } from "antd" import HeadShake from "react-reveal/HeadShake" +import "./index.less" + const allComponents = { Input, Button, @@ -169,8 +171,9 @@ export default class FormGenerator extends React.Component { renderValidationIcon() { if (this.props.renderLoadingIcon && this.state.validating) { - return + return } + return null } @@ -376,20 +379,22 @@ export default class FormGenerator extends React.Component { return null } - return ( -
-
this.handleFinish(e)} - ref={this.ref} - {...this.props.formProps} - > - {this.renderItems(this.props.items)} - - - {this.renderValidationIcon()} -
- ) + return
+
this.handleFinish(e)} + ref={this.ref} + {...this.props.formProps} + > + {this.renderItems(this.props.items)} + + + {this.renderValidationIcon()} +
} } \ No newline at end of file diff --git a/packages/app/src/components/formGenerator/index.less b/packages/app/src/components/formGenerator/index.less new file mode 100644 index 00000000..de4bd14a --- /dev/null +++ b/packages/app/src/components/formGenerator/index.less @@ -0,0 +1,5 @@ +.formWrapper { + svg { + margin: 0; + } +} \ No newline at end of file diff --git a/packages/app/src/components/index.js b/packages/app/src/components/index.js index 5293b63a..dba491bc 100644 --- a/packages/app/src/components/index.js +++ b/packages/app/src/components/index.js @@ -22,6 +22,7 @@ export { default as Skeleton } from "./Skeleton" export { default as Navigation } from "./Navigation" export { default as ImageUploader } from "./ImageUploader" export { default as ImageViewer } from "./ImageViewer" +export { default as Login } from "./Login" // BUTTONS export { default as LikeButton } from "./LikeButton" diff --git a/packages/app/src/extensions/theme.extension.jsx b/packages/app/src/extensions/theme.extension.jsx index 913dcce9..78259161 100644 --- a/packages/app/src/extensions/theme.extension.jsx +++ b/packages/app/src/extensions/theme.extension.jsx @@ -31,32 +31,7 @@ export default class ThemeExtension extends Extension { this.resetDefault() }) - let theme = this.getStoragedTheme() - const modifications = this.getStoragedModifications() - const variantKey = this.getStoragedVariant() - - if (!theme) { - // load default theme - theme = this.getDefaultTheme() - } else { - // load URL and initialize theme - } - - // set global theme - this.theme = theme - - // override with static vars - if (theme.staticVars) { - this.update(theme.staticVars) - } - - // override theme with modifications - if (modifications) { - this.update(modifications) - } - - // apply variation - this.applyVariant(variantKey) + await this.initialize() }, ] @@ -64,6 +39,36 @@ export default class ThemeExtension extends Extension { return document.documentElement.style.getPropertyValue("--themeVariant") } + initialize = async () => { + let theme = this.getStoragedTheme() + + const modifications = this.getStoragedModifications() + const variantKey = this.getStoragedVariant() + + if (!theme) { + // load default theme + theme = this.getDefaultTheme() + } else { + // load URL and initialize theme + } + + // set global theme + this.theme = theme + + // override with static vars + if (theme.staticVars) { + this.update(theme.staticVars) + } + + // override theme with modifications + if (modifications) { + this.update(modifications) + } + + // apply variation + this.applyVariant(variantKey) + } + getRootVariables = () => { let attributes = document.documentElement.getAttribute("style").trim().split(";") attributes = attributes.slice(0, (attributes.length - 1)) @@ -108,7 +113,7 @@ export default class ThemeExtension extends Extension { window.app.settings.set("primaryColor", this.theme.staticVars.primaryColor) - return this.init() + this.initialize() } update = (update) => { diff --git a/packages/app/src/pages/users/index.jsx b/packages/app/src/pages/users/index.jsx index 503ded1a..0dabab41 100644 --- a/packages/app/src/pages/users/index.jsx +++ b/packages/app/src/pages/users/index.jsx @@ -1,6 +1,6 @@ import React from "react" import * as antd from "antd" -import { Icons } from "components/icons" +import { Icons } from "components/Icons" import { ActionsBar, SelectableList } from "components" import "./index.less" diff --git a/packages/desktop/package.json b/packages/desktop/package.json index 1a828500..98f019db 100644 --- a/packages/desktop/package.json +++ b/packages/desktop/package.json @@ -1,6 +1,6 @@ { "name": "comty-desktop", - "version": "0.17.1", + "version": "0.17.2", "main": "main/index.js", "license": "MIT", "scripts": { diff --git a/packages/server/package.json b/packages/server/package.json index 69bf6e57..d1ce0243 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@comty/server", - "version": "0.17.1", + "version": "0.17.2", "main": "dist/index.js", "scripts": { "dev": "nodemon --ignore dist/ --exec corenode-node ./src/index.js" diff --git a/packages/streaming-server/package.json b/packages/streaming-server/package.json index fd8576d8..b58ba962 100644 --- a/packages/streaming-server/package.json +++ b/packages/streaming-server/package.json @@ -1,7 +1,7 @@ { "name": "@comty/streaming-server", "author": "RageStudio", - "version": "0.17.1", + "version": "0.17.2", "main": "dist/index.js", "scripts": { "dev": "nodemon --ignore dist/ --exec corenode-node ./src/index.js"