From 21402186807aba7dab071e5e76bb47d0fc0c9483 Mon Sep 17 00:00:00 2001
From: srgooglo <38926803+srgooglo@users.noreply.github.com>
Date: Sat, 15 Feb 2020 23:29:57 +0100
Subject: [PATCH] Styles update
---
config/app.settings.js | 3 +-
config/theme.config.js | 2 +-
config/ycore.config.js | 7 +-
globals/settings.js | 15 ++-
package.json | 4 +-
public/dark_full_logo.svg | 1 +
public/dark_logo.svg | 1 +
src/@ycore/libs/ycore_sdcp/pre.js | 10 ++
src/@ycore/libs/ycore_styles/pre.js | 14 ++-
src/@ycore/ycore_worker.js | 34 +++++-
src/components/CustomIcons/index.js | 4 +-
src/components/Layout/Header.less | 10 +-
.../Layout/{L_Sider.js => Sider.js} | 40 ++-----
.../Layout/{L_Sider.less => Sider.less} | 113 +++++++++---------
src/components/Layout/index.js | 4 +-
src/components/UserProfile/index.js | 1 -
src/layouts/BaseLayout.js | 5 +
src/layouts/PrimaryLayout.js | 25 ++--
src/layouts/PrimaryLayout.less | 14 ++-
src/models/app.js | 6 +-
src/pages/about/index.js | 21 ++++
src/pages/about/index.less | 17 +++
src/pages/main/index.js | 5 +-
src/themes/light_ng/index.less | 11 ++
src/themes/vars.less | 1 +
25 files changed, 233 insertions(+), 135 deletions(-)
create mode 100644 public/dark_full_logo.svg
create mode 100644 public/dark_logo.svg
rename src/components/Layout/{L_Sider.js => Sider.js} (88%)
rename src/components/Layout/{L_Sider.less => Sider.less} (81%)
create mode 100644 src/pages/about/index.js
create mode 100644 src/pages/about/index.less
create mode 100644 src/themes/light_ng/index.less
diff --git a/config/app.settings.js b/config/app.settings.js
index 1c05e2b2..e9e1e393 100644
--- a/config/app.settings.js
+++ b/config/app.settings.js
@@ -12,5 +12,6 @@ export var DevOptions = {
StrictLightMode: ReturnDevOption('strict_lightMode'),
SignForNotExpire: ReturnDevOption('force_showDevLogs'),
MaxJWTexpire: '1556952',
- MaxLengthPosts: '512'
+ MaxLengthPosts: '512',
+ CurrentBundle: 'light_ng'
}
\ No newline at end of file
diff --git a/config/theme.config.js b/config/theme.config.js
index d9def83d..e2034871 100644
--- a/config/theme.config.js
+++ b/config/theme.config.js
@@ -3,6 +3,6 @@ const path = require('path')
const lessToJs = require('less-vars-to-js')
module.exports = () => {
- const themePath = path.join(__dirname, '../src/themes/vars.less')
+ const themePath = path.join(__dirname, `../src/themes/vars.less`)
return lessToJs(fs.readFileSync(themePath, 'utf8'))
}
diff --git a/config/ycore.config.js b/config/ycore.config.js
index 91a9f37e..ee7913d8 100644
--- a/config/ycore.config.js
+++ b/config/ycore.config.js
@@ -1,10 +1,15 @@
module.exports = {
siteName: 'Comty',
copyright: 'RageStudio©',
- logoPath: '/logo.svg',
+
+ LogoPath: '/logo.svg',
FullLogoPath: '/full_logo.svg',
+ DarkFullLogoPath: '/dark_full_logo.svg',
+ DarkLogoPath: '/dark_logo.svg',
+
apiPrefix: '/api/v1',
fixedHeader: true, // sticky primary layout header
+ resource_bundle: 'light_ng',
App_Config: {
InitRes: { width: 1000, height: 900},
diff --git a/globals/settings.js b/globals/settings.js
index 71f3719b..ed9905f0 100644
--- a/globals/settings.js
+++ b/globals/settings.js
@@ -1,10 +1,15 @@
const fromStorage = JSON.parse(localStorage.getItem('app_settings'))
function StorageValued(e){
- const Ite = fromStorage.map(item => {
- return item.SettingID === e? item.value : null
- })
- const fr = Ite.filter(Boolean)
- return fr.toString()
+ try {
+ const Ite = fromStorage.map(item => {
+ return item.SettingID === e? item.value : null
+ })
+ const fr = Ite.filter(Boolean)
+ return fr.toString()
+ } catch (error) {
+ console.log(error)
+ return false
+ }
}
export var AppSettings = [
{
diff --git a/package.json b/package.json
index e73745b1..ac7dbc16 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,8 @@
{
"name": "comty-development",
- "version": "0.1.13",
+ "title": "Comty™",
+ "DevBuild": true,
+ "version": "0.1.15",
"description": "",
"main": "index.js",
"author": "RageStudio",
diff --git a/public/dark_full_logo.svg b/public/dark_full_logo.svg
new file mode 100644
index 00000000..78e90e9a
--- /dev/null
+++ b/public/dark_full_logo.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/public/dark_logo.svg b/public/dark_logo.svg
new file mode 100644
index 00000000..ef799d4a
--- /dev/null
+++ b/public/dark_logo.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/@ycore/libs/ycore_sdcp/pre.js b/src/@ycore/libs/ycore_sdcp/pre.js
index 07a292ce..b2d23c6f 100644
--- a/src/@ycore/libs/ycore_sdcp/pre.js
+++ b/src/@ycore/libs/ycore_sdcp/pre.js
@@ -25,6 +25,7 @@ export function InitSDCP(values, done) {
{
let cooked = JSON.parse(response)['user_data']
let Ensamblator = btoa(JSON.stringify(cooked))
+ ycore.SetupApp()
ycore.asyncSDCP.setSDCP(Ensamblator).then(() => {
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, ' SDCP Setup done') : null
return done(true)
@@ -77,4 +78,13 @@ export function SDCP() {
return null
}
}
+}
+export function SetupApp(){
+ // TODO: Default sets
+ const resourceLoad = localStorage.getItem('resource_bundle')
+ if (!resourceLoad) {
+ localStorage.setItem('resource_bundle', 'light_ng')
+ }
+
+
}
\ No newline at end of file
diff --git a/src/@ycore/libs/ycore_styles/pre.js b/src/@ycore/libs/ycore_styles/pre.js
index 9f3293d8..d1bb4bba 100644
--- a/src/@ycore/libs/ycore_styles/pre.js
+++ b/src/@ycore/libs/ycore_styles/pre.js
@@ -1,3 +1,11 @@
-export function init(){
- console.log('Init pass!! styles')
-}
+import {DevOptions} from 'ycore'
+
+export function CurrentTheme(){
+ try {
+ const bundle = localStorage.getItem('resource_bundle') || DevOptions.resource_bundle
+ console.log('Loading resource Bundle =>', bundle)
+ return bundle
+ } catch (error) {
+ return null
+ }
+}
\ No newline at end of file
diff --git a/src/@ycore/ycore_worker.js b/src/@ycore/ycore_worker.js
index eae4b9ba..bffce793 100644
--- a/src/@ycore/ycore_worker.js
+++ b/src/@ycore/ycore_worker.js
@@ -1,3 +1,4 @@
+import React from 'react'
import {AppSettings} from '../../globals/settings.js'
import {Endpoints} from 'globals/endpoints.js'
import umiRouter from 'umi/router';
@@ -12,7 +13,11 @@ export var endpoints = Endpoints;
export var yConfig = config.yConfig;
var package_json = require("../../package.json");
-
+export const AppInfo = {
+ name: package_json.title,
+ version: package_json.version,
+ logo: config.FullLogoPath
+}
export function ReturnDevOption(e){
const Ite = AppSettings.map(item => {
return item.SettingID === e? item.value : null
@@ -91,4 +96,29 @@ export const asyncSessionStorage = {
export function RefreshONCE(){
window.location.reload();
}
-
+export function DetectNoNStableBuild(e1) {
+ switch (e1) {
+ case 'TagComponent':
+ if (package_json.DevBuild == true) {
+ return React.createElement(antd.Tag, { color: 'orange' }, " No Stable");
+ }
+ if (package_json.DevBuild == false) {
+ return React.createElement(antd.Tag, { color: 'blue' }, " Stable");
+ }
+ else {
+ return ('No Stable');
+ }
+ break;
+ default:
+ if (package_json.DevBuild == true) {
+ return ('No Stable');
+ }
+ if (package_json.DevBuild == false) {
+ return ('Stable');
+ }
+ else {
+ return ('No Stable');
+ }
+ break;
+ }
+}
diff --git a/src/components/CustomIcons/index.js b/src/components/CustomIcons/index.js
index 0d39a4bb..0b357290 100644
--- a/src/components/CustomIcons/index.js
+++ b/src/components/CustomIcons/index.js
@@ -1,7 +1,7 @@
const VerifiedBadge = () => ()
const CommonThings = () => ()
-const SunSVG = () => ()
-const MoonSVG = () => ()
+const SunSVG = () => ()
+const MoonSVG = () => ()
const CustomIcons = {VerifiedBadge, CommonThings, SunSVG, MoonSVG}
export default CustomIcons
diff --git a/src/components/Layout/Header.less b/src/components/Layout/Header.less
index 3a21a945..e19aba31 100644
--- a/src/components/Layout/Header.less
+++ b/src/components/Layout/Header.less
@@ -9,9 +9,6 @@
width: 30px;
margin: 0 auto 0 auto;
height: 190px;
-
-
-
}
.brand {
display: flex;
@@ -36,7 +33,8 @@
box-shadow: 0px 9px 15px -6px rgba(158,158,158,0.82);
display: flex;
width: 100%;
- background-color: #F3F3F3;
+ background-color: #FEB500; // * #F3F3F3 *//
+ color:#fff;
height: 45px;
z-index: 9;
align-items: center;
@@ -109,7 +107,7 @@
}
.button {
- color: #b2b0c7;
+ color:#fff;
width: 40px;
height: 40px;
line-height: 40px;
@@ -128,7 +126,7 @@
.iconButton {
- color: #b2b0c7;
+ color: @Theme-Shade-Color;
width: 40px;
height: 40px;
display: flex;
diff --git a/src/components/Layout/L_Sider.js b/src/components/Layout/Sider.js
similarity index 88%
rename from src/components/Layout/L_Sider.js
rename to src/components/Layout/Sider.js
index ebd67ebc..c83360c8 100644
--- a/src/components/Layout/L_Sider.js
+++ b/src/components/Layout/Sider.js
@@ -1,10 +1,11 @@
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
+import classnames from 'classnames'
import * as antd from 'antd'
import { withI18n, Trans } from '@lingui/react'
import ScrollBar from '../ScrollBar'
import { config } from 'utils'
-import styles from './L_Sider.less'
+import styles from './Sider.less'
import * as ycore from 'ycore';
import router from 'umi/router';
import {CustomIcons} from 'components'
@@ -13,7 +14,7 @@ import {CustomIcons} from 'components'
const userData = ycore.SDCP()
@withI18n()
-class L_Sider extends PureComponent {
+class Sider extends PureComponent {
constructor(props) {
super(props);
this.state = {
@@ -48,25 +49,10 @@ class L_Sider extends PureComponent {
if (ycore.DevOptions.StrictLightMode == false) {
return "dark"
}
- if (ycore.DevOptions.StrictLightMode == true && theme == "light") {
- return "light"
- }
- if (ycore.DevOptions.StrictLightMode == true && theme == "dark") {
- return "dark"
- }
- }
- UserIsPro(){
- if (userData.is_pro == 1){
- return true
- }
- return false
- }
- UserIsAdmin(){
- if (userData.admin == 1){
- return true
- }
- return false
+ return theme
}
+
+
handleClickMenu = e => {
e.key === 'SignOut' && ycore.LogoutCall()
e.key === 'settingpage' && router.push('/settings')
@@ -103,11 +89,11 @@ class L_Sider extends PureComponent {
theme={this.StrictMode()}
width="180"
collapsed={collapsed || false}
- className={styles.sider}
+ className={classnames(styles.sider, {[styles.darkmd]: this.isDarkMode()} )}
onMouseEnter={this.hover}
onMouseLeave={this.hover}
>
-
+