diff --git a/.umirc.js b/.umirc.js
index 639b1b43..b8985843 100755
--- a/.umirc.js
+++ b/.umirc.js
@@ -3,7 +3,10 @@ import { resolve } from 'path'
import { i18n } from './config/ycore.config.js'
export default {
ignoreMomentLocale: true,
- hash: true,
+ hash: false,
+
+ ssr: false,
+
targets: { ie: 9,},
treeShaking: true,
plugins: [
@@ -65,6 +68,7 @@ export default {
// Webpack Configuration
alias: {
app: resolve(__dirname, './src/@app/app.js'),
+ keys: resolve(__dirname, './config/keys.js'),
globals: resolve(__dirname, './globals'),
components: resolve(__dirname, './src/components'),
config: resolve(__dirname, './config/ycore.config.js'),
diff --git a/config/keys.js b/config/keys.js
index 5b5f8792..10542612 100755
--- a/config/keys.js
+++ b/config/keys.js
@@ -1,6 +1,8 @@
module.exports = {
- // Global Server Key (Requiered for RS-YIBTP), Not autogenerated, must be included on. (Recommended not modify this constants)
-
- server_key:
- 'f706b0a535b6c2d36545c4137a0a3a26853ea8b5-1223c9ba7923152cae28e5a2e7501b2b-50600768',
+ unsplash_key: "slrHmuo9FEJajV4xvWl38TUhbib6BhhGI4VIZ1-cqnw",
+ unsplash_secret: "dh3UlgLTdunO7a_l_iKjotXbz0xB7w5EuDIBU8Pa8pA",
+ g_recaptcha_key: '6Lc55uUUAAAAAEIACMVf3BUzAJSNCmI3RrjEirZ6',
+ g_recaptcha_secret: '6Lc55uUUAAAAAOP4OgUa5DpqJC-70t53AmW0lyYf',
+ // Global Server Key (Requiered for RS-YIBTP), Not autogenerated, must be included on. (Recommended not modify this constant)
+ server_key: 'f706b0a535b6c2d36545c4137a0a3a26853ea8b5-1223c9ba7923152cae28e5a2e7501b2b-50600768',
}
diff --git a/config/theme.config.js b/config/theme.config.js
index 6dab2f79..6ba2273b 100755
--- a/config/theme.config.js
+++ b/config/theme.config.js
@@ -3,6 +3,5 @@ const path = require('path')
const lessToJs = require('less-vars-to-js')
module.exports = () => {
- const themePath = path.join(__dirname, `../src/themes/index.less`)
- return lessToJs(fs.readFileSync(themePath, 'utf8'))
+ // return {"@__Global_backgroud_image": "url(https://images.unsplash.com/photo-1471286274405-579f8d7132d8?.jpg)"}
}
diff --git a/config/ycore.config.js b/config/ycore.config.js
index 47ae6307..21659f2f 100755
--- a/config/ycore.config.js
+++ b/config/ycore.config.js
@@ -8,19 +8,21 @@ module.exports = {
DarkLogoPath: '/dark_logo.svg',
resource_bundle: 'light_ng',
- sync_server: 'http://localhost:5500',
- server_endpoint: 'https://comty.pw',
- g_recaptcha_key: '6Lc55uUUAAAAAEIACMVf3BUzAJSNCmI3RrjEirZ6',
- g_recaptcha_secret: '6Lc55uUUAAAAAOP4OgUa5DpqJC-70t53AmW0lyYf',
+ sync_server: 'http://85.251.59.39:6050',
+ rest_server: 'https://comty.pw',
/* Layout configuration, specify which layout to use for route. */
layouts: [
{
name: 'primary',
- include: [/.*/],
- exclude: [/\/login/, /\/socket\/(.*)/, /\/publics/, /\/authorize/],
+ include: [/\/main/, /\/settings/, /\/saves/, /\/pro/, /\/chats/, /\//],
+ exclude: [/\/publics/, /\/login/ ],
},
+ {
+ name: 'public',
+ include: [/.*/]
+ }
],
i18n: {
diff --git a/globals/badges_list.js b/globals/badges_list.js
index d39f752a..5a429a45 100755
--- a/globals/badges_list.js
+++ b/globals/badges_list.js
@@ -1,13 +1,12 @@
import * as Icons from '@ant-design/icons'
-
export var BadgesType = [
{
id: 'alpha_test',
title: 'Alpha Tester',
color: 'green',
require: '',
- icon: ( ),
+ icon: ( ),
tip: 'Oh yeah!'
},
{
@@ -41,5 +40,13 @@ export var BadgesType = [
require: '',
icon: ( ),
tip: 'hump....',
+ },
+ {
+ id: 'el_walter_pro',
+ title: 'Pro Chikito',
+ color: '#a0d911',
+ require: '',
+ icon: ( ),
+ tip: 'Chikito',
}
]
diff --git a/globals/endpoints/index.js b/globals/endpoints/index.js
index d7e3836d..f7c54d44 100755
--- a/globals/endpoints/index.js
+++ b/globals/endpoints/index.js
@@ -1,2 +1,3 @@
export * from './comty_endpoints.js'
-export * from './twitter_endpoints.js'
\ No newline at end of file
+export * from './twitter_endpoints.js'
+export * from './unsplash_endpoints.js'
\ No newline at end of file
diff --git a/globals/endpoints/spotify_endpoints.js b/globals/endpoints/spotify_endpoints.js
new file mode 100644
index 00000000..11949ca3
--- /dev/null
+++ b/globals/endpoints/spotify_endpoints.js
@@ -0,0 +1,5 @@
+module.exports = {
+ autorize: 'https://accounts.spotify.com/authorize',
+}
+
+
diff --git a/globals/endpoints/unsplash_endpoints.js b/globals/endpoints/unsplash_endpoints.js
new file mode 100644
index 00000000..4188a39a
--- /dev/null
+++ b/globals/endpoints/unsplash_endpoints.js
@@ -0,0 +1,6 @@
+module.exports = {
+ unsplash_endpoints: {
+ api: "https://api.unsplash.com/",
+ search: "https://api.unsplash.com/search/photos"
+ }
+}
\ No newline at end of file
diff --git a/globals/links.js b/globals/links.js
new file mode 100644
index 00000000..52db2d5b
--- /dev/null
+++ b/globals/links.js
@@ -0,0 +1,6 @@
+module.exports = {
+ gitlab: "https://gitlab.com/rstudio-development/comty-development",
+ github:"https://github.com/srgooglo/Comty-Development",
+ trellojoin: "https://trello.com/invite/b/UbwvlG1I/2bc02725b9b210d2e9e9a82c5040b895/comty-development",
+ patreon: "https://www.patreon.com/rstudio",
+}
\ No newline at end of file
diff --git a/globals/sidebar_menu.js b/globals/sidebar_menu.js
new file mode 100644
index 00000000..714fec0a
--- /dev/null
+++ b/globals/sidebar_menu.js
@@ -0,0 +1,44 @@
+import * as Icons from '@ant-design/icons'
+import Icon from '@ant-design/icons'
+import {CustomIcons} from 'components'
+import * as Feather from 'feather-reactjs'
+
+let MenuList = [
+ {
+ id: 'main',
+ title: 'Main',
+ path: '/main',
+ require: 'login',
+ icon: ,
+ },
+ {
+ id: 'explore',
+ title: 'Explore',
+ path: '/explore',
+ require: 'login',
+ icon: ,
+ },
+ {
+ id: 'saves',
+ title: 'Saves',
+ path: '/saves',
+ require: 'login',
+ icon: ,
+ },
+ {
+ id: 'messages',
+ title: 'Messages',
+ path: '/messages',
+ require: 'login',
+ icon: ,
+ },
+ {
+ id: 'notifications',
+ title: 'Notifications',
+ path: '/notifications',
+ require: 'login',
+ icon: ,
+ },
+]
+
+export default MenuList
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
index 5668584c..ae91b13c 100755
--- a/manifest.json
+++ b/manifest.json
@@ -2,8 +2,7 @@
"name": "Comty",
"start_url": ".",
"display": "standalone",
- "background_color": "white",
- "description": "RageStudio users dashboard",
+ "description": "An client prototype of universal social network.",
"icons": [
{
"src": "logo.svg"
diff --git a/package.json b/package.json
index cc8b74bb..acabb8d2 100755
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
"UUID": "C8mVSr-4nmPp2-pr5Vrz-CU4kg4",
"title": "Comty™",
"DevBuild": true,
- "version": "0.4.06",
+ "version": "0.4.11",
"stage": "dev-pre",
"description": "",
"author": "RageStudio",
@@ -15,27 +15,35 @@
"@material-ui/core": "^4.9.9",
"@material-ui/icons": "^4.9.1",
"antd": "^4.1.2",
+ "axios": "^0.19.2",
+ "canvas": "^2.6.1",
"classnames": "^2.2.6",
+ "colorthief": "^2.3.0",
"dva": "2.4.1",
"dva-model-extend": "^0.1.2",
"enquire-js": "^0.2.1",
- "express": "^4.17.1",
- "feather-reactjs": "^2.0.9",
+ "feather-reactjs": "^2.0.13",
"interactjs": "^1.9.9",
"jquery": "^3.4.1",
"jsonwebtoken": "^8.5.1",
+ "koa": "^2.7.0",
+ "koa-compress": "^3.0.0",
+ "koa-mount": "^4.0.0",
+ "koa-static": "^5.0.0",
"localforage": "^1.7.3",
"lodash": "^4.17.15",
"md5": "^2.2.1",
"moment": "^2.24.0",
"node-sass": "^4.13.1",
+ "nodemon": "^1.19.1",
"nprogress": "^0.2.0",
"path-to-regexp": "^6.1.0",
- "peerjs": "^1.2.0",
"prop-types": "^15.7.2",
+ "puppeteer": "^3.0.3",
"radium": "^0.26.0",
"randomstring": "^1.1.5",
"react-animations": "^1.0.0",
+ "react-color": "^2.18.1",
"react-dazzle": "^1.4.0",
"react-emoji": "^0.5.0",
"react-feather": "^2.0.8",
@@ -53,6 +61,8 @@
"ts-cookies": "^1.0.0",
"umi": "^2.13.12",
"umi-plugin-react": "^1.15.7",
+ "umi-request": "^1.2.4",
+ "umi-server": "^1.2.3",
"validator": "^12.2.0",
"ycorejs": "^0.1.1"
},
diff --git a/server.js b/server.js
new file mode 100644
index 00000000..c1acfd22
--- /dev/null
+++ b/server.js
@@ -0,0 +1,51 @@
+require('regenerator-runtime/runtime');
+const server = require('umi-server');
+const Koa = require('koa');
+const compress = require('koa-compress');
+const mount = require('koa-mount');
+const { join, extname } = require('path');
+
+const isDev = process.env.NODE_ENV === 'development';
+
+const root = join(__dirname, 'dist');
+const render = server({
+ root,
+ polyfill: false,
+ dev: isDev,
+ stream: true,
+});
+
+const app = new Koa();
+app.use(
+ compress({
+ threshold: 2048,
+ flush: require('zlib').Z_SYNC_FLUSH,
+ }),
+);
+
+app.use(async (ctx, next) => {
+ const ext = extname(ctx.request.path);
+ // 符合要求的路由才进行服务端渲染,否则走静态文件逻辑
+ if (!ext) {
+ ctx.type = 'text/html';
+ ctx.status = 200;
+ const { ssrStream } = await render({
+ req: {
+ url: ctx.request.url,
+ },
+ });
+
+ ctx.body = ssrStream;
+ } else {
+ await next();
+ }
+});
+
+app.use(mount('/dist', require('koa-static')(root)));
+
+if (!process.env.NOW_ZEIT_ENV) {
+ app.listen(3000);
+ console.log('http://localhost:3000');
+}
+
+module.exports = app.callback();
\ No newline at end of file
diff --git a/src/@app/app.js b/src/@app/app.js
index 858cdae0..0ebf7934 100644
--- a/src/@app/app.js
+++ b/src/@app/app.js
@@ -1,16 +1,10 @@
-/**
- * @yCore_Worker
- *
- * @author rStudio© 2020
- * @license Pending...
- */
import * as Endpoints from 'globals/endpoints/index.js'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
+
import localforage from 'localforage'
import { format } from 'timeago.js'
import * as antd from 'antd'
import moment from 'moment'
-import React from 'react'
import config from 'config'
import './libs.js'
@@ -19,11 +13,11 @@ export * from '../../config/app.settings.js'
export * from './libs.js'
export * from 'utils'
-export var endpoints = Endpoints
-
export const package_json = require('../../package.json')
-
export const UUAID = `${package_json.name}==${package_json.UUID}`
+export const endpoints = Endpoints
+
+const prefix = package_json.name
export const AppInfo = {
apid: package_json.name,
@@ -175,6 +169,18 @@ export function arrayRemoveByID(arr, value) {
return ele.id != value
})
}
+/**
+ * Remove an element by key from an array
+ *
+ * @param array {array}
+ * @param value {string}
+ * @return object
+ */
+export function arrayRemoveByKEY(arr, value) {
+ return arr.filter(function(ele) {
+ return ele.key != value
+ })
+}
/**
* Global fix for convert '1, 0' to string boolean 'true, false'
@@ -208,83 +214,6 @@ export const time = {
}
-/**
- * Framework functionality for show with interface an notification
- *
- */
-const {FieldTimeOutlined} = require('@ant-design/icons')
-export const notify = {
- expire: (...res) => {
- antd.notification.error({
- message: 'Hey ',
- icon: ,
- description: res,
- placement: 'bottomLeft',
- })
- },
- info: (...res) => {
- antd.notification.info({
- message: 'Well',
- description: res.toString(),
- placement: 'bottomLeft',
- })
- },
- exception: (...res) => {
- antd.notification.error({
- message: 'WoW!',
- description: res.toString(),
- placement: 'bottomLeft',
- })
- },
- warn: (...res) => {
- antd.notification.warn({
- message: 'Hey!',
- description: res.toString(),
- placement: 'bottomLeft',
- })
- },
- success: (...res) => {
- antd.notification.success({
- message: 'Well',
- description: res.toString(),
- placement: 'bottomLeft',
- })
- },
- error: (...res) => {
- antd.notification.error({
- message: 'Wopss',
- description: (
-
-
An wild error appear! :
-
-
-
- {res.toString()}
-
-
- ),
- placement: 'bottomLeft',
- })
- },
- proccess: (...res) => {
- antd.notification.open({
- icon: ,
- message: 'Please wait',
- description: {res}
,
- placement: 'bottomLeft',
- })
- },
-}
-
/**
* User console with setting user permissions
*
@@ -309,6 +238,35 @@ export const yconsole = {
},
}
+export const __yconsole = {
+ showLogs: SettingStoragedValue('force_showDevLogs')? true : false,
+ log: (...cont) => {
+ console.log(...cont)
+ logger.consoles.indexeddb.log(...cont);
+ },
+ debug: (...cont) => {
+ return logger.init(function() {
+ logger.on(function() {
+ console.debug(...cont);
+ });
+ }, null, {showLogs: yconsole.showLogs});
+ },
+ error: (...cont) => {
+ return logger.init(function() {
+ logger.on(function() {
+ console.error(...cont);
+ });
+ }, null, {showLogs: yconsole.showLogs});
+ },
+ warn: (...cont) => {
+ return logger.init(function() {
+ logger.on(function() {
+ console.warn(...cont);
+ });
+ }, null, {showLogs: yconsole.showLogs});
+ },
+}
+
/**
* Request FullScreen mode
*
@@ -328,3 +286,432 @@ export function requestFullscreen() {
elem.msRequestFullscreen()
}
}
+
+export let logger = {
+ /**
+ * Is set with true or false after logger.init() invocation.
+ */
+ isIndexedDBSupported: null,
+ showLogs: true,
+
+ //// private variables
+ databaseName: `${prefix}_ycoreLogger`,
+ database: null,
+ /**
+ * Initializes window.indexedDB and logger.isIndexedDBSupported.
+ * @param callbackSuccess invokes if browser supports IndexedDB.
+ * @param callbackFail (optional) invokes if browser does not supports IndexedDB.
+ */
+ init: function(callbackSuccess, callbackFail, options) {
+ let indexedDB = window.indexedDB
+ let IDBTransaction = window.IDBTransaction
+ let IDBKeyRange = window.IDBKeyRange
+
+ // Check for options props
+ if (options) {
+ options.showLogs? logger.showLogs = options.showLogs : false
+ }
+ if (!indexedDB) {
+ if(callbackFail) {callbackFail();}
+ }
+ else {
+ if(!callbackSuccess) {
+ throw "IllegalAgrumentException. Please provide a callback for success initialization";
+ }
+ callbackSuccess();
+ }
+ },
+ /**
+ * Turns on catching all console.* methods invocations and saving logs into IndexedDB
+ * @param callback (optional) is invoked then database is successfully opened and console is replaced with logger.log2both.
+ */
+ on: function(callback) {
+ if( logger.consoles.originalIsOn === false ) {
+ logger.consoles.originalIsOn = true;
+ if( logger.database != null ) {
+ logger.replaceConsoleThenOn(callback);
+ }
+ else {
+ logger.openDb(logger.databaseName, function() {
+ logger.replaceConsoleThenOn(callback);
+ });
+ }
+ }
+ },
+ off: function() {
+ if( logger.consoles.originalIsOn === true ) {
+ console = logger.consoles.original;
+ logger.consoles.originalIsOn = false;
+ }
+ },
+ isOn: function() {
+ return logger.consoles.originalIsOn;
+ },
+ clear: function() {
+ if(logger.database == null) {
+ throw "IllegalStateException: need to logger.init() and logger.on before clearing the database, e.g. logger.init(function(){logger.on(function(){logger.clear();});});";
+ }
+ logger.consoles.original.log("logger.clear");
+ var objectStore = logger.database.transaction("logs").objectStore("logs");
+
+ objectStore.openCursor().onsuccess = function(event) {
+ var cursor = event.target.result;
+ if (cursor) {
+ // cursor.key + "=" + cursor.value
+ var request = logger.database.transaction(["logs"], "readwrite").objectStore("logs").delete(cursor.key);
+ request.onsuccess = function(event) {
+ // It's gone!
+ };
+ cursor.continue();
+ }
+ else {
+ logger.consoles.original.log("logs2indexeddb successfully cleared");
+ }
+ };
+ },
+ /**
+ * Opens a file with logs.
+ * If parameters are null (not specified) then method downloads all logs from database.
+ * If parameters are specified, then the method filters logs and provide only records
+ * that were created since fromDate to toDate.
+ * @param fromDate (optional)
+ * @param toDate (optional)
+ */
+ download: function(fromDate, toDate) {
+ var fromTime = null;
+ var toTime = null;
+ if(fromDate != null) {
+ if(toDate != null) {
+ if(typeof(fromDate.getTime) === "undefined" || typeof(toDate.getTime) === "undefined" ) {
+ throw "IllegalArgumentException: parameters must be Date objects";
+ }
+ fromTime = fromDate.getTime();
+ toTime = toDate.getTime();
+ }
+ else {
+ throw "IllegalArgumentException: Please provide either both parameters or none of them";
+ }
+ }
+ var objectStore = logger.database.transaction("logs").objectStore("logs");
+
+ var data = '';
+ objectStore.openCursor().onsuccess = function(event) {
+ var cursor = event.target.result;
+ if (cursor) {
+ var v = cursor.value;
+ if( fromTime == null || fromTime <= v.time && v.time <= toTime) {
+ data += new Date(v.time*1)+" "+ v.label+" "+ v.log+"\n";
+ }
+ cursor.continue();
+ }
+ else {
+ logger.downloadFile(data);
+ }
+ };
+ },
+ downloadToday: function() {
+ var start = new Date();
+ start.setHours(0,0,0,0);
+
+ var end = new Date();
+ end.setHours(23,59,59,999);
+ logger.download(start, end);
+ },
+ /**
+ * @private
+ */
+ downloadFile: function(data){
+ if(!data) {
+ logger.consoles.original.log("logger.download: Empty database");
+ return;
+ }
+ var filename = 'console.log'
+
+ var blob = new Blob([data], {type: 'text/plain'}),
+ e = document.createEvent('MouseEvents'),
+ a = document.createElement('a')
+
+ a.download = filename
+ a.href = window.URL.createObjectURL(blob)
+ a.dataset.downloadurl = ['text/plain', a.download, a.href].join(':')
+ e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null)
+ a.dispatchEvent(e)
+ },
+ clearAndDrop: function() {
+ logger.clear();
+ // todo replace with database drop
+ },
+ consoles: {
+ originalIsOn: false,
+ /**
+ * @private Logs into both - console and indexeddb
+ */
+ both: {
+ log: function(str) {
+ logger.showLogs ? logger.consoles.original.log(str) : null
+ logger.consoles.indexeddb.log(str);
+ },
+ warn: function(str) {
+ logger.showLogs ? logger.consoles.original.warn(str) : null
+ logger.consoles.indexeddb.warn(str);
+ },
+ trace: function(str) {
+ logger.showLogs ? logger.consoles.original.trace(str) : null
+ logger.consoles.indexeddb.trace(str);
+ },
+ error: function(str) {
+ logger.showLogs ? logger.consoles.original.error(str) : null
+ logger.consoles.indexeddb.error(str);
+ },
+ info: function(str) {
+ logger.showLogs ? logger.consoles.original.info(str) : null
+ logger.consoles.indexeddb.info(str);
+ },
+ debug: function(str) {
+ logger.showLogs ? logger.consoles.original.debug(str) : null
+ logger.consoles.indexeddb.debug(str);
+ }
+ },
+ /**
+ * @private Original console logger. No matter if logger is on or off. Is used for internal logger logging during test.
+ */
+ original: console,
+ /**
+ * @public Logger that saves data into opened IndexedDB.
+ */
+ indexeddb: {
+ log: function(str) {
+ logger.consoles.indexeddb.write2db('log', str);
+ },
+ warn: function(str) {
+ logger.consoles.indexeddb.write2db('warn', str);
+ },
+ trace: function(str) {
+ logger.consoles.indexeddb.write2db('trace', str);
+ },
+ error: function(str) {
+ logger.consoles.indexeddb.write2db('error', str);
+ },
+ info: function(str) {
+ logger.consoles.indexeddb.write2db('info', str);
+ },
+ debug: function(str) {
+ logger.consoles.indexeddb.write2db('debug', str);
+ },
+ write2db: function(label, str) {
+ var time = new Date();
+ time.setMonth(time.getMonth()-1);
+ var data = {
+ time: time.getTime()+'',
+ label: label,
+ log: str
+ };
+ logger.database.transaction(["logs"], "readwrite").objectStore("logs").add(data);
+ }
+ }
+ },
+ exceptions: {
+ uncatchable: {
+ on: function() {
+ if( logger.isOn() ) {
+ window.onerror = logger.exceptions.uncatchable.onerror.both;
+ }
+ else {
+ logger.consoles.original.warn("logger needs to be on to start catch uncatchable exceptions");
+ }
+ },
+ off: function() {
+ window.onerror = logger.exceptions.uncatchable.onerror.original;
+ },
+ onerror: {
+ original: window.onerror,
+ /**
+ * Logs exception into the database
+ */
+ custom: function (errorMsg, url, lineNumber) {
+ logger.consoles.indexeddb.error(errorMsg+" "+url+" line:"+lineNumber);
+ return false;
+ },
+ both: function (errorMsg, url, lineNumber) {
+ logger.exceptions.uncatchable.onerror.custom("UNCATCHABLE: ----------------"+errorMsg, url, lineNumber);
+ if( logger.exceptions.uncatchable.onerror.original ) {
+ logger.exceptions.uncatchable.onerror.original(errorMsg, url, lineNumber);
+ }
+ }
+ }
+ }
+ },
+ /**
+ * @private Opens database and updates schema if needed.
+ * @param dbName database name
+ * @param callbackSuccessOpen (optional) invoked after success connect and update.
+ * @param onupgradeneeded (optional) function to create different structure of the database.
+ */
+ openDb: function(dbName, callbackSuccessOpen, onupgradeneeded) {
+ logger.consoles.original.log("openDb ...");
+ // Let us open our database
+ var request = indexedDB.open(dbName, 2);
+ request.onerror = function (event) {
+ alert("Why didn't you allow my web app to use IndexedDB?!");
+ logger.consoles.original.error("openDb:", event.target.errorCode);
+ };
+ request.onsuccess = function (e) {
+ logger.database = request.result;
+ logger.consoles.original.log("openDb DONE");
+ logger.database.onerror = function (event) {
+ // Generic error handler for all errors targeted at this database's
+ // requests!
+ logger.consoles.original.error("Database error: " + event.target.errorCode);
+ };
+ if(callbackSuccessOpen) {callbackSuccessOpen();}
+ };
+ // This event is only implemented in recent browsers
+ request.onupgradeneeded = function (event) {
+ logger.consoles.original.log("openDb.onupgradeneeded");
+ var db = event.target.result;
+
+ var objectStore = db.createObjectStore("logs", { autoIncrement : true });
+
+ // Create an index to search by time
+ objectStore.createIndex("time", "time", { unique: false });
+ objectStore.createIndex("label", "label", { unique: false });
+
+ objectStore.transaction.oncomplete = function (event) {
+ logger.consoles.original.log("openDb.onupgradeneeded.transaction.oncomplete");
+ }
+ };
+ },
+ /**
+ * @private
+ */
+ replaceConsoleThenOn: function(callback) {
+ console = logger.consoles.both;
+ logger.exceptions.uncatchable.on();
+ if( callback ) callback();
+ },
+ /**
+ * Performance test methods.
+ * Use
+ * $(function () { // This is JQuery construction that needed to be sure that html document is loaded
+ logger.init(function() {// successfully initialized
+ logger.debug.startIndexedDBTest(5000, 'status');
+ }, function() {// error
+ window.alert("Your browser doesn't support a stable version of IndexedDB. Such and such feature will not be available.");
+ logger.debug.status.html("");
+ });
+ });
+ *
+ * to test 5000 writes.
+ */
+ debug: {
+ statusElementId: null,
+ startTime: null,
+ totalNumberOfWrites: null,
+
+ /**
+ * Opens database and starts WriteTest
+ * @param n number of records to write during the test.
+ * @param statusElementId html element's id to write results of the test.
+ */
+ startIndexedDBTest: function(n, statusElementId) {
+ if( !n || !statusElementId ) {
+ throw "IllegalArgumentsException";
+ }
+ logger.debug.statusElementId = statusElementId;
+ logger.debug.status('Testing...');
+
+ logger.openDb("logs2indexeddb_test", function() {
+ logger.debug.processWriteTest(logger.database, n);
+ }, logger.debug.onupgradeneeded);
+ },
+ onupgradeneeded: function (event) {
+ logger.consoles.original.log("debug.onupgradeneeded");
+ var db = event.target.result;
+
+ // Create an objectStore to hold information about our customers. We're
+ // going to use "ssn" as our key path because it's guaranteed to be
+ // unique.
+ var objectStore = db.createObjectStore("customers", { keyPath: "ssn" });
+
+ // Create an index to search customers by name. We may have duplicates
+ // so we can't use a unique index.
+ objectStore.createIndex("name", "name", { unique: false });
+
+ // Create an index to search customers by email. We want to ensure that
+ // no two customers have the same email, so use a unique index.
+ objectStore.createIndex("email", "email", { unique: true });
+
+ // Use transaction oncomplete to make sure the objectStore creation is
+ // finished
+ objectStore.transaction.oncomplete = function (event) {
+ logger.consoles.original.log("debug.onupgradeneeded.transaction.oncomplete");
+ }
+ },
+ /**
+ * @private
+ */
+ processWriteTest: function(db, n) {
+ logger.consoles.original.log("processWriteTest");
+
+ logger.debug.status('Connected to database. Preparing to process ' + n + " writes.");
+ alert("The test can take a lot of time (1-2 minutes). The browser can be locked duting the test. Ready to launch?");
+ logger.debug.status("Testing... Please wait until test will be finished.");
+
+ logger.debug.totalNumberOfWrites = n;
+ logger.debug.startTime = new Date();
+ for (var i = 0; i < n; i++) {
+ // status("Writing "+i+" record..."); // Comment this to get real time estimate
+ logger.debug.processWrite(db, i);
+ }
+ // The write will be finished after last callback
+ },
+ /**
+ * @private
+ */
+ testFinished: function () {
+ logger.consoles.original.log("testFinished");
+ var n = logger.debug.totalNumberOfWrites;
+ var end = new Date();
+ var diff = end.getMinutes() * 60 + end.getSeconds() - (logger.debug.startTime.getMinutes() * 60 + logger.debug.startTime.getSeconds());
+ var mean = diff / n;
+
+ alert("Done. Check the result on the page.");
+ logger.debug.status("One write request takes " + mean + " seconds. Test time: " + diff + " seconds");
+ },
+ /**
+ * @private
+ */
+ processWrite: function (db, i) {
+ // logger.consoles.original.log("processWrite");
+ var transaction = db.transaction(["customers"], "readwrite");
+
+ // Do something when all the data is added to the database.
+ transaction.oncomplete = function (event) {
+ // logger.consoles.original.log("processWrite.transaction.oncomplete");
+ };
+
+ transaction.onerror = function (event) {
+ // Don't forget to handle errors!
+ // logger.consoles.original.error("processWrite.transaction.onerror: "+event.code);
+ };
+
+ var objectStore = transaction.objectStore("customers");
+
+ var data = { ssn: i, name: "Bill", age: 35, email: "mail" + i + "@rtlservice.com" }
+ var request = objectStore.put(data);
+ request.onsuccess = function (event) {
+ // event.target.result == customerData[i].ssn;
+ // logger.consoles.original.log("processWrite.transaction...onsuccess: "+event.target.result);
+ if (i == logger.debug.totalNumberOfWrites - 1) {
+ logger.debug.testFinished();
+ }
+ };
+ request.onerror = function () {
+ logger.consoles.original.error("addPublication error", this.error);
+ }
+ },
+ status: function (str) {
+ document.getElementById(logger.debug.statusElementId).innerHTML = str;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/@app/libs.js b/src/@app/libs.js
index 36442218..024e6f07 100644
--- a/src/@app/libs.js
+++ b/src/@app/libs.js
@@ -2,4 +2,5 @@
export * from './libs/comty_ng/pre.js';
export * from './libs/yulio_id/pre.js';
export * from './libs/app_functions/pre.js';
-export * from './libs/api_call/pre.js';
\ No newline at end of file
+export * from './libs/api_call/pre.js';
+export * from './libs/apis/pre.js'
\ No newline at end of file
diff --git a/src/@app/libs/apis/pre.js b/src/@app/libs/apis/pre.js
new file mode 100644
index 00000000..d2146fb9
--- /dev/null
+++ b/src/@app/libs/apis/pre.js
@@ -0,0 +1 @@
+export * from './unsplash.js'
\ No newline at end of file
diff --git a/src/@app/libs/apis/unsplash.js b/src/@app/libs/apis/unsplash.js
new file mode 100644
index 00000000..98a45260
--- /dev/null
+++ b/src/@app/libs/apis/unsplash.js
@@ -0,0 +1,16 @@
+import axios from 'axios'
+import * as app from 'app'
+import keys from 'keys'
+
+export const api_unsplash = {
+ search: async (key, callback) => {
+ if (!key) return false
+ const response = await axios.get(app.endpoints.unsplash_endpoints.search, {
+ params: { query: key},
+ headers: {
+ Authorization: `Client-ID ${keys.unsplash_key}`
+ }
+ })
+ return callback(response.data.results)
+ }
+}
\ No newline at end of file
diff --git a/src/@app/libs/app_functions/modals.js b/src/@app/libs/app_functions/modals.js
index 6b576dad..996f7a56 100644
--- a/src/@app/libs/app_functions/modals.js
+++ b/src/@app/libs/app_functions/modals.js
@@ -1,7 +1,7 @@
import React from 'react'
import * as app from 'app'
import * as antd from 'antd'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import styles from './modals.less';
import classnames from 'classnames'
@@ -19,12 +19,12 @@ class __Model_postreport extends React.PureComponent {
return false
}
app.notify.info('This post has been reported successfully, our team will review it and inform you about problem resolution ...')
- app.FeedHandler.refresh()
- app.FeedHandler.goToElement(this.props.id)
+ app.RenderFeed.RefreshFeed()
+ app.RenderFeed.goToElement(this.props.id)
}, payload)
}
setTimeout(() => {
- app.OverlaySwap.close()
+ app.SwapMode.close()
}, 500)
}
@@ -116,7 +116,7 @@ export const app_modals = {
icon: ,
content: 'It seems that you want to report this post, first of all it is necessary that you take into account that this tool is only intended for serious cases and we need you to comply with some questions to be able to report this post and to guarantee the quality of service ...',
onOk() {
- return app.OverlaySwap.openFragment(<__Model_postreport id={post_id} />)
+ return app.SwapMode.openFragment(<__Model_postreport id={post_id} />)
},
onCancel() {
return false
diff --git a/src/@app/libs/app_functions/notify.js b/src/@app/libs/app_functions/notify.js
new file mode 100644
index 00000000..717b4946
--- /dev/null
+++ b/src/@app/libs/app_functions/notify.js
@@ -0,0 +1,82 @@
+import { notification } from 'antd'
+import * as Icons from 'components/Icons'
+
+export const notify = {
+ fatal: (...res) => {
+ notification.error({
+ message: 'Fatal Error',
+ icon: ,
+ description: res,
+ placement: 'bottomLeft'
+ })
+ },
+ expire: (...res) => {
+ notification.error({
+ message: 'Hey ',
+ icon: ,
+ description: res,
+ placement: 'bottomLeft',
+ })
+ },
+ info: (...res) => {
+ notification.info({
+ message: 'Well',
+ description: res.toString(),
+ placement: 'bottomLeft',
+ })
+ },
+ exception: (...res) => {
+ notification.error({
+ message: 'WoW!',
+ description: res.toString(),
+ placement: 'bottomLeft',
+ })
+ },
+ warn: (...res) => {
+ notification.warn({
+ message: 'Hey!',
+ description: res.toString(),
+ placement: 'bottomLeft',
+ })
+ },
+ success: (...res) => {
+ notification.success({
+ message: 'Well',
+ description: res.toString(),
+ placement: 'bottomLeft',
+ })
+ },
+ error: (...res) => {
+ notification.error({
+ message: 'Wopss',
+ description: (
+
+
An wild error appear! :
+
+
+
+ {res.toString()}
+
+
+ ),
+ placement: 'bottomLeft',
+ })
+ },
+ proccess: (...res) => {
+ notification.open({
+ icon: ,
+ message: 'Please wait',
+ description: {res}
,
+ placement: 'bottomLeft',
+ })
+ },
+ }
\ No newline at end of file
diff --git a/src/@app/libs/app_functions/pre.js b/src/@app/libs/app_functions/pre.js
index 1e0bd8f3..d045ff3a 100644
--- a/src/@app/libs/app_functions/pre.js
+++ b/src/@app/libs/app_functions/pre.js
@@ -1,53 +1,21 @@
-import { RenderFeed } from 'components/MainFeed'
import { transitionToogle } from '../../../pages/login'
import { SetControls, CloseControls } from 'components/Layout/ControlBar'
-import { SwapMode } from 'components/Layout/Overlay'
+
import umiRouter from 'umi/router'
import * as app from 'app'
import * as antd from 'antd'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import React from 'react'
+import { SwapMode } from 'components/Layout/Overlay'
+import { RenderFeed } from 'components/MainFeed'
+import { updateTheme } from '../../../layouts/PrimaryLayout'
+
export * from './modals.js'
+export * from './notify.js'
export {SwapMode}
-
-export function SetupApp() {
- // TODO: Default sets
- app.notify.success('Authorised, please wait...')
- const resourceLoad = localStorage.getItem('resource_bundle')
- if (!resourceLoad) {
- localStorage.setItem('resource_bundle', 'light_ng')
- }
- setTimeout(() => {
- app.router.push('main')
- }, 500)
-}
-
-export const CheckThisApp = {
- desktop_mode: () => {
- const a = localStorage.getItem('desktop_src')
- if (a == 'true') {
- return true
- }
- return false
- },
-}
-
-export const OverlaySwap = {
- close: () => {
- SwapMode.close()
- },
- openPost: e => {
- SwapMode.openPost(e)
- },
- openSearch: e => {
- SwapMode.openSearch(e)
- },
- openFragment: e =>{
- SwapMode.openFragment(e)
- }
-}
+export {RenderFeed}
export const ControlBar = {
set: e => {
@@ -58,30 +26,6 @@ export const ControlBar = {
},
}
-export const FeedHandler = {
- refresh: () => {
- RenderFeed.RefreshFeed()
- },
- killByID: (post_id) => {
- RenderFeed.killByID(post_id)
- },
- addToRend: (payload) => {
- RenderFeed.addToRend(payload)
- },
- goToElement: post_id => {
- RenderFeed.goToElement(post_id)
- },
- sync: data => {
- RenderFeed.sync(data)
- }
-}
-
-export const LoginPage = {
- transitionToogle: () => {
- transitionToogle()
- },
-}
-
export const router = {
go: e => {
goTo.element('primaryContent')
@@ -118,6 +62,7 @@ export const goTo = {
try {
document.getElementById(element).scrollIntoView()
} catch (error) {
+ console.debug(error)
return false
}
}
@@ -204,3 +149,52 @@ export const app_session = {
},
}
+export const app_theme = {
+ getString: () => {
+ return localStorage.getItem('theme_style')
+ },
+ set: (data, process) => {
+ if (!data){
+ return false
+ }
+ let newdata = []
+ if(process){
+ let style = data
+ let mix = []
+ try {
+ style[key] = value
+ const obj = Object.entries(style)
+ obj.forEach((e) => {
+ mix.push({key: e[0], value: e[1]})
+ })
+ newdata = JSON.stringify(mix)
+ } catch (error) {
+ console.log(error)
+ return false
+ }
+ }else{
+ newdata = data
+ }
+
+ localStorage.setItem('theme_style', newdata)
+ app_theme.update()
+ },
+ getStyle: () => {
+ let final = {}
+ const storaged = localStorage.getItem('theme_style')
+ if (storaged) {
+ try {
+ let scheme = JSON.parse(storaged)
+ scheme.forEach((e)=>{
+ final[e.key] = e.value
+ })
+ } catch (error) {
+ console.log(error)
+ }
+ }
+ return final
+ },
+ update: () => {
+ return updateTheme(app_theme.getStyle())
+ }
+}
\ No newline at end of file
diff --git a/src/@app/libs/comty_ng/pre.js b/src/@app/libs/comty_ng/pre.js
index b74bd209..15577525 100644
--- a/src/@app/libs/comty_ng/pre.js
+++ b/src/@app/libs/comty_ng/pre.js
@@ -1,5 +1,5 @@
import { token_data } from 'app'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
export * from './comty_post.js'
export * from './comty_user.js'
diff --git a/src/components/CustomIcons/index.js b/src/components/CustomIcons/index.js
deleted file mode 100755
index d71bfcfc..00000000
--- a/src/components/CustomIcons/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-const VerifiedBadge = () => ( )
-const CommonThings = () => ( )
-const SunSVG = () => ( )
-const MoonSVG = () => ( )
-const RobotOutlined = () => ( )
-const SavedPost = () => ( )
-const SavedPostColor = () => ( )
-const SavedPostGrey = () => ( )
-
-const CustomIcons = {SavedPostGrey, SavedPostColor, VerifiedBadge, CommonThings, SunSVG, MoonSVG, RobotOutlined, SavedPost}
-export default CustomIcons
diff --git a/src/components/HeaderSearch/index.js b/src/components/HeaderSearch/index.js
index c6716fda..58bb3292 100755
--- a/src/components/HeaderSearch/index.js
+++ b/src/components/HeaderSearch/index.js
@@ -3,7 +3,7 @@ import * as antd from 'antd'
import * as app from 'app'
import styles from './index.less'
import classnames from 'classnames'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
export const SetHeaderSearchType = {
disable: () => {
diff --git a/src/components/Icons/custom.js b/src/components/Icons/custom.js
new file mode 100644
index 00000000..0f7317c1
--- /dev/null
+++ b/src/components/Icons/custom.js
@@ -0,0 +1,8 @@
+export const VerifiedBadge = () => ( )
+export const Patreon = () => (
+
+
+
+
+
+)
\ No newline at end of file
diff --git a/src/components/Icons/index.js b/src/components/Icons/index.js
new file mode 100644
index 00000000..049e1e42
--- /dev/null
+++ b/src/components/Icons/index.js
@@ -0,0 +1,4 @@
+export * from 'feather-reactjs'
+export * from '@ant-design/icons'
+export * from './custom'
+
diff --git a/src/components/Layout/Overlay/components/component.tsx b/src/components/Layout/Overlay/components/component.tsx
index 8413cbb2..0da8dc14 100644
--- a/src/components/Layout/Overlay/components/component.tsx
+++ b/src/components/Layout/Overlay/components/component.tsx
@@ -1,6 +1,6 @@
import * as React from 'react'
import * as antd from 'antd'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import styles from '../index.less'
export interface Card_Component_props {
diff --git a/src/components/Layout/Overlay/components/layout/__pri.tsx b/src/components/Layout/Overlay/components/layout/__pri.tsx
index 96e849e8..5bbe4c77 100644
--- a/src/components/Layout/Overlay/components/layout/__pri.tsx
+++ b/src/components/Layout/Overlay/components/layout/__pri.tsx
@@ -1,6 +1,6 @@
import * as React from 'react'
import * as antd from 'antd'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import styles from '../../index.less'
import classnames from 'classnames'
import reactable from 'reactablejs'
diff --git a/src/components/Layout/Overlay/components/layout/__sec.tsx b/src/components/Layout/Overlay/components/layout/__sec.tsx
index 75d02b8b..54606072 100644
--- a/src/components/Layout/Overlay/components/layout/__sec.tsx
+++ b/src/components/Layout/Overlay/components/layout/__sec.tsx
@@ -1,7 +1,7 @@
import * as React from 'react'
import * as app from 'app'
import * as antd from 'antd'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import styles from '../../index.less'
import classnames from 'classnames'
import reactable from 'reactablejs'
diff --git a/src/components/Layout/Overlay/components/main/__searchBar.less b/src/components/Layout/Overlay/components/main/__searchBar.less
index ef4f4a74..57f9785a 100644
--- a/src/components/Layout/Overlay/components/main/__searchBar.less
+++ b/src/components/Layout/Overlay/components/main/__searchBar.less
@@ -11,7 +11,7 @@
border: 0!important;
outline: 0!important;
color: #273346;
- padding: 0 48px;
+ padding: 0 0 0 48px;
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56.966 56.966' fill='%23c1c7cd'%3e%3cpath d='M55.146 51.887L41.588 37.786A22.926 22.926 0 0046.984 23c0-12.682-10.318-23-23-23s-23 10.318-23 23 10.318 23 23 23c4.761 0 9.298-1.436 13.177-4.162l13.661 14.208c.571.593 1.339.92 2.162.92.779 0 1.518-.297 2.079-.837a3.004 3.004 0 00.083-4.242zM23.984 6c9.374 0 17 7.626 17 17s-7.626 17-17 17-17-7.626-17-17 7.626-17 17-17z'/%3e%3c/svg%3e");
background-repeat: no-repeat;
background-size: 16px;
diff --git a/src/components/Layout/Overlay/components/swapper/__priPost.js b/src/components/Layout/Overlay/components/swapper/__priPost.js
index e399b2f8..528752c4 100644
--- a/src/components/Layout/Overlay/components/swapper/__priPost.js
+++ b/src/components/Layout/Overlay/components/swapper/__priPost.js
@@ -3,58 +3,26 @@ import styles from './__priPost.less'
import * as antd from 'antd'
import * as app from 'app'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import Icon from '@ant-design/icons'
-import { MediaPlayer } from 'components'
-
-const VerifiedBadge = () => (
-
-
-
- )
+import { MediaPlayer, PostCard } from 'components'
export default class __priPost extends React.PureComponent {
- renderContent(payload) {
- const { id, postText, postFile_full, post_time, publisher } = payload
- const {isMobile}= this.props
-
- return (
-
- {postFile_full ? : null}
-
- )
- }
-
+
render() {
const {payload} = this.props
if (!payload) {
return This post not exists!!!
}
const { id, postText, postFile_full, post_time, publisher } = payload
+ const {isMobile}= this.props
+
return (
-
-
-
-
- {publisher.username}{' '}
- {app.booleanFix(publisher.verified) ? (
-
- ) : null}
-
-
- {post_time} {app.IsThisUser.dev() ? `| #${id}` : null}{' '}
-
-
-
+
+
- {this.renderContent(payload)}
)
}
diff --git a/src/components/Layout/Overlay/components/swapper/__priPost.less b/src/components/Layout/Overlay/components/swapper/__priPost.less
index 47497108..c882cb91 100644
--- a/src/components/Layout/Overlay/components/swapper/__priPost.less
+++ b/src/components/Layout/Overlay/components/swapper/__priPost.less
@@ -1,33 +1,27 @@
@import '~themes/index.less';
.contentWrapper {
- margin: auto;
width: 100%;
- padding: 20px;
+ height: 100%;
+
+ position: absolute;
+ top: 0;
+ left: 0;
+
+ align-items: center;
+ margin: auto;
+
+ background: rgba(158, 158, 158, 0.5); // Make sure this color has an opacity of less than 1
+ backdrop-filter: blur(10px); // This be the blur
+
+ display: flex;
+ align-items: center;
+ transition: all @__Global_SwapAnimDuration ease-in-out;
+
}
-
-.UserContainer {
- display: flex;
+.contentBody{
+
position: relative;
- float: right;
- z-index: 150;
- transform: translate(0, -40px);
-
- .UserContainer_text {
- margin: 0 8px;
-
- h4 {
- text-align: right;
- }
-
- p {
- word-break: break-all;
- text-align: right;
- font-size: 11px;
- color: #eeeeee !important;
- }
- }
-
-
- }
\ No newline at end of file
+ width: calc(100% - @Overlay_container2_active_width);
+}
\ No newline at end of file
diff --git a/src/components/Layout/Overlay/components/swapper/__priSearch.js b/src/components/Layout/Overlay/components/swapper/__priSearch.js
index f096632b..f4ea9af9 100644
--- a/src/components/Layout/Overlay/components/swapper/__priSearch.js
+++ b/src/components/Layout/Overlay/components/swapper/__priSearch.js
@@ -72,16 +72,18 @@ export default class __priSearch extends React.PureComponent {
}
}
EntryComponent = (t, source) => {
- function onclick(e){
+
+ function goToEntry(e){
if(!e) return false
app.router.go(`@${e}`)
}
+
try {
return (
- onclick(item.username) }>
+
goToEntry(item.username) }>
diff --git a/src/components/Layout/Overlay/components/swapper/__secComments.js b/src/components/Layout/Overlay/components/swapper/__secComments.js
index 865768f1..3fb109d1 100644
--- a/src/components/Layout/Overlay/components/swapper/__secComments.js
+++ b/src/components/Layout/Overlay/components/swapper/__secComments.js
@@ -4,7 +4,7 @@ import { SearchCard, Feather } from 'components'
import * as antd from 'antd'
import * as app from 'app'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import Icon from '@ant-design/icons'
const VerifiedBadge = () => (
diff --git a/src/components/Layout/Overlay/index.js b/src/components/Layout/Overlay/index.js
index 98a7bf03..578a4982 100644
--- a/src/components/Layout/Overlay/index.js
+++ b/src/components/Layout/Overlay/index.js
@@ -1,7 +1,7 @@
import React from 'react'
import * as app from 'app'
import * as antd from 'antd'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import styles from './index.less'
import classnames from 'classnames'
import reactable from 'reactablejs'
@@ -111,7 +111,7 @@ export const SwapMode = {
Results of {id || '... nothing ?'}
- <__priSearch lost_focus={() => SwapMode.close()} payload={tmp} />
+ <__priSearch payload={tmp} />
return OverlayLayoutComponent.setState({
diff --git a/src/components/Layout/Overlay/index.less b/src/components/Layout/Overlay/index.less
index 267d5f6f..fa34e372 100644
--- a/src/components/Layout/Overlay/index.less
+++ b/src/components/Layout/Overlay/index.less
@@ -51,12 +51,12 @@
.Overlay_wrapper {
right: 0;
top: 0;
- overflow: hidden;
-
+ z-index: 50;
+
height: 100vh;
- width: 100%;
- max-width: @Overlay_wrapper_maxwidth;
-
+ // 150px extra for left-sider
+ width: calc( 100% + 150px );
+ backdrop-filter: blur(2px);
&.mobile{
overflow-y: scroll;
flex-direction: column;
@@ -67,13 +67,14 @@
position: absolute;
width: 100%;
height: 100%;
- max-width: none;
+ width: none;
}
}
&.expand{
- max-width: calc(@Overlay_wrapper_maxwidth + 150px);
+ max-width: calc(100% + 150px);
}
+
transition: all @__Global_SwapAnimDuration ease-in-out;
}
@@ -82,25 +83,40 @@
height: 100%;
width: 100%;
+ max-width: @Overlay_wrapper_maxwidth;
+ min-width: 200px;
+
display: flex;
z-index: 50;
right: 0;
padding: 30px 30px 30px 35px;
+
+ @media (max-width: @bp-medium) {
+ padding: 30px 5px 30px 5px;
+ }
+
color: @Overlay_container1_def_color;
- background-color: #F8F6F8;
&.half {
background-color: #2d2d2d;
color: @Overlay_container1_active_color;
+ max-width: calc(100% + 150px);
}
&.full_open {
- width: @Overlay_wrapper_showFull_width;
+ max-width: none;
+ background-color: transparent;
+ position: absolute;
+ width: 100vw;
+ height: 100vh;
}
&.mobile {
+ min-width: unset;
+ max-width: unset;
+
width: 100%;
height: 0;
bottom: 0;
diff --git a/src/components/Layout/Sider/default.js b/src/components/Layout/Sider/default.js
index 35b0810d..68148b81 100755
--- a/src/components/Layout/Sider/default.js
+++ b/src/components/Layout/Sider/default.js
@@ -1,22 +1,77 @@
import React from 'react'
import * as antd from 'antd'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
+
import Icon from '@ant-design/icons'
import { withI18n, Trans } from '@lingui/react'
import styles from './default.less'
import * as app from 'app'
-import CustomIcons from '../../CustomIcons'
+import classnames from 'classnames'
@withI18n()
export default class Sider_Default extends React.PureComponent {
+ state = {
+ loading: true,
+ menus: null
+ }
+
+ require(e){
+ switch (e) {
+ case 'login':
+ return true
+ case 'admin':
+ return true
+ default:
+ return true
+ }
+ }
+
+ componentDidMount(){
+ try {
+ let tmp = [];
+ const { menus } = this.props
+ menus.forEach(e => {
+ if (this.require(e.require)) {
+ tmp.push(e)
+ }
+ });
+ this.setState({ menus: tmp, loading: false })
+ } catch (error) {
+ console.log(error)
+
+ }
+ }
+
+ renderMenus(data){
+ try {
+ return data.map(e => {
+ return(
+
+ {e.icon}
+
+ {e.title}
+
+
+ )
+ })
+ } catch (error) {
+ console.log(error)
+ return null
+ }
+ }
+
render() {
- const { handleClickMenu, logo } = this.props
+ const { handleClickMenu, logo, theme } = this.props
+ const predominantColor = theme.predominantColor || "#333"
+
+ if (this.state.loading) return
Loading
return (
-
-
-
- Explore
-
-
-
-
-
-
- Saves
-
-
-
-
-
-
-
- Marketplace
-
-
-
-
-
-
-
- Chats
-
-
+ {this.renderMenus(this.state.menus)}
@@ -69,8 +98,9 @@ export default class Sider_Default extends React.PureComponent {
diff --git a/src/components/Layout/Sider/default.less b/src/components/Layout/Sider/default.less
index 14e9bba6..463fc63c 100755
--- a/src/components/Layout/Sider/default.less
+++ b/src/components/Layout/Sider/default.less
@@ -5,36 +5,68 @@
border-color: transparent;
font-size: 13px;
font-family: @__Global_general_font_family;
+
+ width: 100%;
height: 100vh;
+
z-index: 40;
float: left;
position: relative;
+ background-color: transparent;
+ backdrop-filter: blur(2px);
+
+ &.matchColor{
+ h1,h2,h3,h4,h5,span,p,svg {
+ color: unset;
+ filter: invert(1);
+ }
+ }
+
:global {
.ant-layout-sider {
- background-color: @left_sider_backgroud;
-
+ background-color: transparent;
+ float: right;
.ant-menu {
vertical-align: middle;
- margin: 0 0 0 5px;
+ // margin: 0 0 0 5px;
}
.ant-menu-item {
- color: #333;
+
+
+ transition: @transition-ease-inout;
+
+ border-radius: 4px 8px 8px 4px;
+ padding: 2px 0 2px 24px;
+
+ text-align: left;
+ }
+
+ .ant-menu-item:hover {
+ border-radius: 8px 8px 8px 8px;
+ transform: translate(10px,0);
+
+ // background: linear-gradient(49deg, rgba(255,255,255,1) 32%, rgba(255, 255, 255, 0) 100%);
+ backdrop-filter: blur(2px);
+ border-left: 10px #FFCC00 solid;
+ color: rgb(102, 102, 102);
+ }
+
+ .ant-menu-item-selected {
+ background-color: unset;
+ // background: linear-gradient(90deg, rgb(255, 230, 0) 2%, rgba(255,255,255,0.5) 10%);
+
}
.anticon {
font-size: @left_sider_sizeIcons;
}
+
.ant-menu-inline-collapsed,
.antd-menu-vertical-left,
.ant-menu-vertical {
- :hover {
- background-color: @left_sider_menu__onhover_backgroud;
- color: @left_sider_menu__onhover_color;
- }
-
border-right: 0 solid transparent;
}
}
@@ -45,14 +77,11 @@
.left_sider_brandholder {
cursor: pointer;
- img {
- display: flex;
- vertical-align: middle;
- padding: 5px;
- margin: 7px auto 15px auto;
- width: 100%;
- max-height: 58px;
- transform: translate(2px, 0);
+ img{
+ margin: 7px 0 0 20px;
+ max-height: 70px;
+ height: 7vh;
+ filter: drop-shadow(1px 0px 1px #b9b9b9);
}
}
@@ -68,9 +97,8 @@
}
.ant-menu-item{
height: 35px!important;
- line-height: 0px!important;
- padding: 0!important;
- margin: 0!important;
+ margin-bottom: 0!important;
+ line-height: 30px;
}
}
}
@@ -84,8 +112,6 @@
.left_sider_menuContainer {
height: 100%;
margin: 18px 0 8px 0;
-
- overflow-x: hidden;
flex: 1;
:global {
@@ -126,12 +152,5 @@
animation: fadein 0.5s;
- :global {
- .ant-menu-item {
- padding: 0 !important;
- margin: 2px auto 2px 24px;
- width: 100%;
- text-align: left;
- }
- }
+
}
\ No newline at end of file
diff --git a/src/components/Layout/Sider/index.js b/src/components/Layout/Sider/index.js
index 3c5a00b2..a9756bcb 100755
--- a/src/components/Layout/Sider/index.js
+++ b/src/components/Layout/Sider/index.js
@@ -1,51 +1,29 @@
import React from 'react'
import config from 'config'
import * as app from 'app'
+import MenuList from 'globals/sidebar_menu'
import Sider_Mobile from './mobile.js'
import Sider_Default from './default.js'
class Sider extends React.PureComponent {
- onClickFunctions = {
- saves: (e) => {
- this.setState({selectedKey: e})
- app.router.go('saves')
- },
- events: (e) => {
- this.setState({selectedKey: e})
- app.router.go('events')
- },
- marketplace: (e) => {
- this.setState({selectedKey: e})
- app.router.go('marketplace')
- },
- explore: (e) => {
- this.setState({selectedKey: e})
- app.router.go('main')
- },
- chats: (e) => {
- this.setState({selectedKey: e})
- app.router.go('chats')
- }
- }
-
handleClickMenu = e => {
- e.key === 'chats' && this.onClickFunctions.chats(e.key)
+ e.key === 'messages' && app.router.go('messages')
e.key === 'SignOut' && app.app_session.logout()
e.key === 'general_settings' && app.router.go('settings')
e.key === 'profile' && app.router.goprofile()
- e.key === 'saves' && this.onClickFunctions.saves(e.key)
- e.key === 'events' && this.onClickFunctions.events(e.key)
- e.key === 'marketplace' && this.onClickFunctions.marketplace(e.key)
- e.key === 'explore' && this.onClickFunctions.explore(e.key)
- e.key === 'debug_area' && app.router.go('__m')
+ e.key === 'saves' && app.router.go('saves')
+ e.key === 'main' && app.router.go('main')
+ e.key === 'explore' && app.router.go('explore')
+ e.key === 'notifications' && app.router.go('notifications')
+ e.key === 'debug_area' && app.router.go('debug')
}
render() {
- const { isMobile } = this.props
- const sider_props = {handleClickMenu: this.handleClickMenu ,logo: config.LogoPath, menulist: null, userData: this.props.userData}
-
+ const { isMobile, theme } = this.props
+ const sider_props = {theme: theme, menus: MenuList, handleClickMenu: this.handleClickMenu ,logo: config.LogoPath, menulist: null, userData: this.props.userData}
+
if (isMobile) {
return
}
diff --git a/src/components/Layout/Sider/mobile.js b/src/components/Layout/Sider/mobile.js
index dd2366c7..53bd816b 100755
--- a/src/components/Layout/Sider/mobile.js
+++ b/src/components/Layout/Sider/mobile.js
@@ -1,12 +1,12 @@
import React from 'react'
import * as antd from 'antd'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import Icon from '@ant-design/icons'
import { withI18n, Trans } from '@lingui/react'
import styles from './mobile.less'
import * as app from 'app'
-import CustomIcons from '../../CustomIcons'
+
@withI18n()
export default class Sider_Mobile extends React.PureComponent {
diff --git a/src/components/MainFeed/index.js b/src/components/MainFeed/index.js
index 9cd3f9c9..50b51277 100755
--- a/src/components/MainFeed/index.js
+++ b/src/components/MainFeed/index.js
@@ -125,6 +125,7 @@ class MainFeed extends React.PureComponent {
more(fkey){
try {
const { get, uid, filters } = this.props
+ console.log(get)
if (!get) {
app.yconsole.error('Please, fill params with an catch type...')
return
@@ -154,7 +155,7 @@ class MainFeed extends React.PureComponent {
return true
}, payload)
} catch (err) {
- app.notify.error(err)
+ app.notify.error('[ MainFeed ]', err)
}
}
}
diff --git a/src/components/PostCard/index.js b/src/components/PostCard/index.js
index 6176b06a..d21587bf 100755
--- a/src/components/PostCard/index.js
+++ b/src/components/PostCard/index.js
@@ -1,9 +1,9 @@
import React from 'react'
import * as antd from 'antd'
import styles from './index.less'
-import { CustomIcons, Like_button, MediaPlayer } from 'components'
+import { Like_button, MediaPlayer } from 'components'
+import * as Icons from 'components/Icons'
import * as app from 'app'
-import * as Icons from '@ant-design/icons'
import Icon from '@ant-design/icons'
import classnames from 'classnames'
import * as MICON from '@material-ui/icons'
@@ -11,11 +11,21 @@ import * as MICON from '@material-ui/icons'
const { Meta } = antd.Card
// Set default by configuration
-const emptyPayload = {
- user: 'Post Empty',
- ago: 'This Post is empty',
- avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png',
- content: 'Empty',
+const defaultPayload = {
+ id: null,
+ post_time: null,
+ postText: null,
+ postFile: null,
+ publisher: null,
+ post_likes: null,
+ is_post_pinned: null,
+ is_liked: null,
+ post_comments: null,
+ get_post_comments: null,
+ postPinned: false,
+ postReported: false,
+ postBoosted: false,
+ ReportIgnore: false,
}
class PostCard extends React.PureComponent {
@@ -23,13 +33,36 @@ class PostCard extends React.PureComponent {
super(props),
this.state = {
visibleMoreMenu: false,
- postPinned: this.props.payload.is_post_pinned,
- postSaved: this.props.payload.is_post_saved,
- postReported: this.props.payload.is_post_reported,
- postBoosted: this.props.payload.is_post_boosted,
- ReportIgnore: false,
+ payload: this.props.payload,
}
}
+
+ componentDidMount(){
+ const a = this.props.payload
+ const b = defaultPayload
+ try {
+ if(a){
+ let tmp;
+ const propsArray = Object.keys(a)
+ const defaultArray = Object.keys(b)
+ propsArray.forEach(e => {
+ if (defaultArray.includes(e)){
+ tmp[e] = "something"
+ }
+
+ })
+ console.log(tmp)
+ }
+
+ else{
+ console.warn('Empty payload, setting default...')
+ this.setState({ payload: b})
+ }
+ } catch (error) {
+
+ }
+ }
+
handleVisibleChange = flag => {
this.setState({ visibleMoreMenu: flag });
};
@@ -39,10 +72,9 @@ class PostCard extends React.PureComponent {
}
render() {
- const { payload, customActions } = this.props
+ const { payload } = this.state
const ActShowMode = app.AppSettings.auto_hide_postbar
- const post_data = payload || emptyPayload;
const {
id,
post_time,
@@ -54,14 +86,17 @@ class PostCard extends React.PureComponent {
is_liked,
post_comments,
get_post_comments
- } = post_data
+ } = payload || defaultPayload
+
+ if(!id, !postText, !postFile, !publisher) return null
+
const SwapThisPost = () => {
localStorage.setItem('p_back_uid', id)
- if (postFile){
- app.SwapMode.openPost(id, post_data)
- }
+
+ app.SwapMode.openPost(id, payload)
app.SwapMode.openComments(id)
+
}
const handlePostActions = {
@@ -71,7 +106,7 @@ class PostCard extends React.PureComponent {
if (err) {
return false
}
- app.FeedHandler.killByID(post_id)
+ app.RenderFeed.killByID(post_id)
}, payload)
},
save: post_id => {
@@ -110,7 +145,7 @@ class PostCard extends React.PureComponent {
}, payload)
},
}
- const defaultActions = [
+ const actions = [
SwapThisPost()} />
,
]
- const actions = customActions || defaultActions
const MoreMenu = (
@@ -223,7 +257,7 @@ class PostCard extends React.PureComponent {
{app.booleanFix(publisher.verified) ? (
) : null}
{app.booleanFix(publisher.nsfw_flag) ? (
diff --git a/src/components/PostCreator/index.js b/src/components/PostCreator/index.js
index 4ad74a55..c323f964 100755
--- a/src/components/PostCreator/index.js
+++ b/src/components/PostCreator/index.js
@@ -2,7 +2,7 @@ import React from 'react'
import * as antd from 'antd'
import * as app from 'app'
import styles from './index.less'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import Icon from '@ant-design/icons'
import $ from 'jquery'
import * as MICONS from '@material-ui/icons'
@@ -155,7 +155,7 @@ class PostCreator extends React.PureComponent {
setTimeout(() => {
this.setState({ posting_ok: false })
}, 1000)
- app.FeedHandler.refresh()
+ app.RenderFeed.RefreshFeed()
return true
}
@@ -220,7 +220,7 @@ class PostCreator extends React.PureComponent {
)
}
this.FlushPostState()
- // app.FeedHandler.addToRend(JSON.parse(res)['data'])
+ // app.RenderFeed.addToRend(JSON.parse(res)['data'])
}, payload)
}
dropRef = React.createRef()
diff --git a/src/components/PostCreator/local_components/post_options.js b/src/components/PostCreator/local_components/post_options.js
index 5850bfd2..93c3cefa 100755
--- a/src/components/PostCreator/local_components/post_options.js
+++ b/src/components/PostCreator/local_components/post_options.js
@@ -1,7 +1,7 @@
import React from 'react'
import * as antd from 'antd'
import * as app from 'app'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import Icon from '@ant-design/icons'
import { Post_Options } from 'globals/post_options.js'
import styles from './post_options.less'
diff --git a/src/components/UserProfile/index.js b/src/components/UserProfile/index.js
index 602fe826..b1cc5458 100755
--- a/src/components/UserProfile/index.js
+++ b/src/components/UserProfile/index.js
@@ -2,8 +2,7 @@ import React from 'react'
import styles from './styles.less'
import * as app from 'app'
import * as antd from 'antd'
-import { CustomIcons, MainFeed, PostCreator } from 'components'
-import * as Icons from '@ant-design/icons'
+import { Icons, MainFeed, PostCreator } from 'components'
import Icon from '@ant-design/icons'
import Follow_btn from './components/Follow_btn.js'
import { BadgesType } from 'globals/badges_list'
@@ -199,7 +198,7 @@ className={classnames(styles.userWrapper, {
color: 'blue',
verticalAlign: 'top',
}}
- component={CustomIcons.VerifiedBadge}
+ component={Icons.VerifiedBadge}
/>
) : null}
diff --git a/src/components/index.js b/src/components/index.js
index ac5dd3d2..6b56d36d 100755
--- a/src/components/index.js
+++ b/src/components/index.js
@@ -1,7 +1,7 @@
// @alias from 'components'
// Helpers & Misc
-import CustomIcons from './CustomIcons'
+export * as Icons from './Icons'
import Loader from './Loader/Loader.js'
import App_about from './App_about'
import * as Feather from 'feather-reactjs'
@@ -35,7 +35,6 @@ export {
Loader,
PostCard,
PostCreator,
- CustomIcons,
Like_button,
MainFeed,
}
diff --git a/src/layouts/PrimaryLayout.js b/src/layouts/PrimaryLayout.js
index de174530..dbf2e0c5 100755
--- a/src/layouts/PrimaryLayout.js
+++ b/src/layouts/PrimaryLayout.js
@@ -21,13 +21,21 @@ import styles from './PrimaryLayout.less'
const { Content } = antd.Layout
const { Sider, Control, Overlay, WindowAppBar } = MyLayout
+export function updateTheme(data){
+ if (!data) return false
+ console.log(data)
+ return PrimaryComponent.setState({theme: data})
+}
+
+
@withRouter
@connect(({ app, loading }) => ({ app, loading }))
-class PrimaryLayout extends React.Component {
+class PrimaryLayout extends React.PureComponent {
constructor(props) {
super(props)
window.PrimaryComponent = this
this.state = {
+ theme: app.app_theme.getStyle(),
collapsed: app.AppSettings.default_collapse_sider ? true : false,
isMobile: false,
desktop_mode: false,
@@ -36,6 +44,7 @@ class PrimaryLayout extends React.Component {
}
componentDidMount() {
+
this.setState({
userData: app.userData(),
})
@@ -62,12 +71,22 @@ class PrimaryLayout extends React.Component {
}
render() {
- const { app, location, dispatch, children } = this.props
- const { userData, collapsed, isMobile } = this.state
+ const { location, dispatch, children } = this.props
+ const { userData, collapsed, isMobile, theme, predominantColor } = this.state
const { onCollapseChange } = this
- const { theme } = app
+
+
const SiderProps = {
+ breakpoint:{
+ xs: '480px',
+ sm: '576px',
+ md: '768px',
+ lg: '992px',
+ xl: '1200px',
+ xxl: '1600px',
+ },
+ predominantColor,
theme,
userData,
isMobile,
@@ -85,13 +104,13 @@ class PrimaryLayout extends React.Component {
userData,
isMobile,
}
-
+ console.log(theme)
return (
-
+
diff --git a/src/layouts/PrimaryLayout.less b/src/layouts/PrimaryLayout.less
index b95ad596..e2de252c 100755
--- a/src/layouts/PrimaryLayout.less
+++ b/src/layouts/PrimaryLayout.less
@@ -12,16 +12,24 @@
}
.primary_layout {
+ background-repeat: repeat-x;
+ background-size: cover;
+ background-position-y: center;
+
overflow: hidden;
- background-color: @primary_layout_backgroud;
+ background-color: transparent;
margin: auto;
+ height: 100vh;
+ width: 100vw;
+
+ transition: all @__Global_Components_transitions_dur linear;
+
&.mobile{
>.primary_layout_container {
- border-radius: 0;
- margin: 0;
padding: 0;
overflow-y: overlay;
overflow-x: hidden;
+ min-width: unset;
}
.primary_layout_content{
padding: 35px 15px 15px 15px;
@@ -31,25 +39,40 @@
// PRIMARY LAYOUT
.primary_layout_container {
- transition: background-color @__Global_layout_transitions-dur linear;
- background-color: @primary_layout_container_backgroud;
- border-radius: @primary_layout_container_border-rd;
+ background-color: transparent;
+ transition: all @__Global_Components_transitions_dur linear;
overflow-x: hidden;
- margin: 0 0 0 10px;
- width: 100vw;
+ // overflow-y: overlay;
+
+ width: auto;
height: 100vh;
position: relative;
bottom: 0;
+ display: flex;
align-self: center;
- float: left;
+
+ max-width: 750px;
+
+ min-width: 570px;
+
+ @media (min-width: @bp-medium) {
+ min-width: 650px;
+ }
+ @media (min-width: @bp-large) {
+ min-width: 850px;
+ }
+
}
.primary_layout_content {
vertical-align: middle;
width: 100%;
- float: right;
padding: @primary_layout_content_padding;
transition: all @__Global_layout_transitions-dur ease;
+
+ @media (max-width: @bp-medium) {
+ padding: 0;
+ }
}
diff --git a/src/layouts/PublicLayout.js b/src/layouts/PublicLayout.js
index caaaf5cc..9a655c3d 100755
--- a/src/layouts/PublicLayout.js
+++ b/src/layouts/PublicLayout.js
@@ -1,3 +1,67 @@
-export default ({ children }) => {
- return children
+import React from 'react'
+import store from 'store'
+
+import {
+ MyLayout,
+ PageTransition,
+} from 'components'
+import { enquireScreen, unenquireScreen } from 'enquire-js'
+import classnames from 'classnames'
+
+import * as antd from 'antd'
+import * as Icons from 'components/Icons'
+
+import styles from './PrimaryLayout.less'
+
+const { Content } = antd.Layout
+
+export default class PublicLayout extends React.Component {
+ constructor(props) {
+ super(props)
+ window.PrimaryComponent = this
+ this.state = {
+ isMobile: false,
+ }
+ }
+
+ componentDidMount() {
+ this.enquireHandler = enquireScreen(mobile => {
+ const { isMobile } = this.state
+ if (isMobile !== mobile) {
+ this.setState({
+ isMobile: mobile,
+ })
+ store.set('mobile_src', mobile)
+ }
+ })
+ }
+
+ componentWillUnmount() {
+ unenquireScreen(this.enquireHandler)
+ }
+
+
+ render() {
+ const { children } = this.props
+ const { isMobile } = this.state
+ return (
+
+
+
+
+
+ )
+ }
}
diff --git a/src/models/app.js b/src/models/app.js
index 9d73c041..42601b10 100755
--- a/src/models/app.js
+++ b/src/models/app.js
@@ -1,7 +1,7 @@
/* global window */
import { router } from 'utils'
import store from 'store'
-import { pathMatchRegexp } from 'utils'
+import { pathMatchRegexp, queryLayout } from 'utils'
import config from 'config'
import * as app from 'app'
@@ -42,23 +42,23 @@ export default {
},
effects: {
*query({ payload }, { call, put, select }) {
+ // if (queryLayout(config.layouts, window.location.pathname) == 'public') {
+ // return true
+ // }
const validBackup = app.validate.backup()
if (app.validate.session() == true) {
if (pathMatchRegexp(['/', '/login'], window.location.pathname)) {
- router.push({ pathname: '/main' })
+ router.push({ pathname: `${config.MainPath}` })
}
app._app.query()
return true
- } else if (!pathMatchRegexp(['', '/login'], window.location.pathname)) {
+ } else if (!pathMatchRegexp(['', '/login'], window.location.pathname) && queryLayout(config.layouts, window.location.pathname) !== 'public') {
if (validBackup == true) {
app._app.logout()
} else {
router.push({ pathname: '/login' })
}
}
- if (pathMatchRegexp([''], window.location.pathname)) {
- router.push({ pathname: '/login' })
- }
},
},
reducers: {
diff --git a/src/pages/debug/index.js b/src/pages/debug/index.js
new file mode 100644
index 00000000..05a3679a
--- /dev/null
+++ b/src/pages/debug/index.js
@@ -0,0 +1,21 @@
+import React from 'react'
+import * as app from 'app'
+
+export default class Debug extends React.Component{
+
+ render(){
+ return(
+ <>
+
Debug
+
app.notify.fatal('Error test! sike')} >Send Critical error
+
{
+
+
+ }}> start storage logs
+
{
+ app.logger.download();
+ }}> Download logs
+ >
+ )
+ }
+}
\ No newline at end of file
diff --git a/src/pages/index.js b/src/pages/index.js
index 5df7edbe..e7ee7acd 100755
--- a/src/pages/index.js
+++ b/src/pages/index.js
@@ -3,7 +3,9 @@ import * as app from 'app'
class Index extends PureComponent {
render() {
- app.router.go(`login`)
+ return(
+
+ )
}
}
diff --git a/src/pages/login/index.js b/src/pages/login/index.js
index 65c1b59b..df4d9527 100755
--- a/src/pages/login/index.js
+++ b/src/pages/login/index.js
@@ -4,7 +4,7 @@ import styles from './index.less'
import classnames from 'classnames'
import * as antd from 'antd'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import { RegistrationForm } from './register.js'
import { NormalLoginForm } from './login.js'
diff --git a/src/pages/login/login.js b/src/pages/login/login.js
index d41d39e9..51db4903 100755
--- a/src/pages/login/login.js
+++ b/src/pages/login/login.js
@@ -94,7 +94,6 @@ export class NormalLoginForm extends React.PureComponent {
switch (res) {
case '200': {
this.anim_transition(300)
- app.LoginPage.transitionToogle()
return
}
case '400': {
diff --git a/src/pages/main/index.js b/src/pages/main/index.js
index 36ad00c9..0f5aafe4 100755
--- a/src/pages/main/index.js
+++ b/src/pages/main/index.js
@@ -6,10 +6,10 @@ import styles from './index.less'
export default class Main extends React.Component {
render() {
return (
-
+ >
)
}
}
diff --git a/src/pages/main/index.less b/src/pages/main/index.less
index 7c81e1c2..62efef22 100755
--- a/src/pages/main/index.less
+++ b/src/pages/main/index.less
@@ -1,6 +1,2 @@
@import '~themes/index.less';
-.mainWrapper {
- position: relative;
- padding: 20px;
-}
diff --git a/src/pages/chats/Events.js b/src/pages/messages/Events.js
similarity index 100%
rename from src/pages/chats/Events.js
rename to src/pages/messages/Events.js
diff --git a/src/pages/chats/chats/ChatContainer.js b/src/pages/messages/chats/ChatContainer.js
similarity index 99%
rename from src/pages/chats/chats/ChatContainer.js
rename to src/pages/messages/chats/ChatContainer.js
index f1d0b749..a311650c 100644
--- a/src/pages/chats/chats/ChatContainer.js
+++ b/src/pages/messages/chats/ChatContainer.js
@@ -7,7 +7,7 @@ import MessageInput from '../messages/MessageInput'
import * as app from 'app'
import * as antd from 'antd'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import styles from '../styles.less'
import classnames from 'classnames'
diff --git a/src/pages/chats/chats/SideBar.js b/src/pages/messages/chats/SideBar.js
similarity index 100%
rename from src/pages/chats/chats/SideBar.js
rename to src/pages/messages/chats/SideBar.js
diff --git a/src/pages/chats/index.js b/src/pages/messages/index.js
similarity index 66%
rename from src/pages/chats/index.js
rename to src/pages/messages/index.js
index e983c4ab..9e96959c 100644
--- a/src/pages/chats/index.js
+++ b/src/pages/messages/index.js
@@ -1,7 +1,7 @@
import React from 'react'
import * as app from 'app'
import * as antd from 'antd'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import io from 'socket.io-client'
import config from 'config'
import ReactEmoji from 'react-emoji';
@@ -19,6 +19,7 @@ export default class Chats extends React.Component{
super(props);
this.state = {
+ err_tick: 0,
socket:null,
user:null,
conn: false
@@ -40,7 +41,7 @@ export default class Chats extends React.Component{
console.log(prefix, "Connected");
const payload = { id: userData.UserID, name: userData.username, avatar: userData.avatar }
socket.emit(USER_CONNECTED, payload);
- this.setState({user: payload, conn: true})
+ this.setState({user: payload, conn: true, err_tick: 0})
})
}
@@ -51,13 +52,19 @@ export default class Chats extends React.Component{
})
socket.on('reconnecting', () =>{
- console.log(prefix, 'Trying to reconnect')
+ this.setState({ err_tick: (this.state.err_tick+1) })
+ console.log(prefix, 'Trying to reconnect', this.state.err_tick)
})
}
render() {
const { socket, user } = this.state
- if(!user) return
Loading
+ if( this.state.err_tick > 2) return
+ if(!user) return
return
}
diff --git a/src/pages/chats/messages/MessageInput.js b/src/pages/messages/messages/MessageInput.js
similarity index 100%
rename from src/pages/chats/messages/MessageInput.js
rename to src/pages/messages/messages/MessageInput.js
diff --git a/src/pages/chats/messages/Messages.js b/src/pages/messages/messages/Messages.js
similarity index 100%
rename from src/pages/chats/messages/Messages.js
rename to src/pages/messages/messages/Messages.js
diff --git a/src/pages/chats/styles.less b/src/pages/messages/styles.less
similarity index 100%
rename from src/pages/chats/styles.less
rename to src/pages/messages/styles.less
diff --git a/src/pages/p/$post/index.js b/src/pages/p/$post/index.js
index 8480e979..46e50376 100755
--- a/src/pages/p/$post/index.js
+++ b/src/pages/p/$post/index.js
@@ -2,7 +2,7 @@ import React from 'react'
import { pathMatchRegexp } from 'utils'
import * as app from 'app'
import * as antd from 'antd'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
export default class Indexer_Post extends React.Component {
constructor(props) {
@@ -20,7 +20,7 @@ export default class Indexer_Post extends React.Component {
if (err) {
return false
}
- app.OverlaySwap.openPost(res)
+ app.SwapMode.openPost(res)
}, payload)
}
diff --git a/src/pages/publics/index.js b/src/pages/publics/index.js
new file mode 100644
index 00000000..f60592f1
--- /dev/null
+++ b/src/pages/publics/index.js
@@ -0,0 +1,9 @@
+import React from 'react'
+
+export default class TestPublic extends React.Component{
+ render(){
+ return(
+
Test your Publics!
+ )
+ }
+}
\ No newline at end of file
diff --git a/src/pages/publics/style_design.js b/src/pages/publics/style_design.js
new file mode 100644
index 00000000..28b89bf3
--- /dev/null
+++ b/src/pages/publics/style_design.js
@@ -0,0 +1,13 @@
+import React from 'react'
+import config from 'config'
+
+
+export default class PAGE_PUBLIC extends React.Component{
+ render(){
+ return(
+
+
Style Design
+
+ )
+ }
+}
\ No newline at end of file
diff --git a/src/pages/saves/index.js b/src/pages/saves/index.js
index 68e6ce42..a29baa72 100755
--- a/src/pages/saves/index.js
+++ b/src/pages/saves/index.js
@@ -1,7 +1,7 @@
import React from 'react'
import * as app from 'app'
import * as antd from 'antd'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import { MainFeed } from 'components'
import styles from './index.less'
diff --git a/src/pages/settings/components/about.js b/src/pages/settings/components/about.js
index 34a9abff..84808f1a 100755
--- a/src/pages/settings/components/about.js
+++ b/src/pages/settings/components/about.js
@@ -1,9 +1,32 @@
import React from 'react'
import { App_about } from 'components'
+import l from 'globals/links'
+import * as Icons from 'components/Icons'
+import * as antd from 'antd'
+
+
export default class AppAbout extends React.Component {
render() {
- return
+ return <>
+
+
+
+
🎉✨ It's completely free and open source !
+
It is an impressive amount of work and effort, help us to continue offering quality services, you can support us from our patreon campaign.
+
Support us with Patreon!
+
+
+
+
+
+
+ >
}
}
diff --git a/src/pages/settings/components/base.js b/src/pages/settings/components/base.js
index 43f55588..d965b033 100755
--- a/src/pages/settings/components/base.js
+++ b/src/pages/settings/components/base.js
@@ -3,9 +3,8 @@ import { List, Switch, Button, notification, InputNumber } from 'antd'
import { ListSettings } from '../../../../globals/settings.js'
import { ControlBar } from 'app'
import * as app from 'app'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import Icon from '@ant-design/icons'
-import { CustomIcons } from 'components'
class Base extends Component {
constructor(props) {
diff --git a/src/pages/settings/components/earnings/index.js b/src/pages/settings/components/earnings/index.js
index e27fae79..3444a281 100755
--- a/src/pages/settings/components/earnings/index.js
+++ b/src/pages/settings/components/earnings/index.js
@@ -1,7 +1,7 @@
import React from 'react'
import * as app from 'app'
import * as antd from 'antd'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
export default class Earnings extends React.Component {
diff --git a/src/pages/settings/components/help/index.js b/src/pages/settings/components/help/index.js
new file mode 100644
index 00000000..75efbdc3
--- /dev/null
+++ b/src/pages/settings/components/help/index.js
@@ -0,0 +1,9 @@
+import React from 'react'
+
+export default class Help extends React.Component{
+ render(){
+ return <>
+
+ >
+ }
+}
\ No newline at end of file
diff --git a/src/pages/settings/components/notification/index.js b/src/pages/settings/components/notification/index.js
index 193f8801..f5afa9e2 100755
--- a/src/pages/settings/components/notification/index.js
+++ b/src/pages/settings/components/notification/index.js
@@ -1,6 +1,6 @@
import React from 'react'
import * as app from 'app'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import styles from './index.less'
export default class NotificationView extends React.Component {
diff --git a/src/pages/settings/components/security/index.js b/src/pages/settings/components/security/index.js
index c97de7a9..c939d78b 100755
--- a/src/pages/settings/components/security/index.js
+++ b/src/pages/settings/components/security/index.js
@@ -1,6 +1,6 @@
import React from 'react'
import * as app from 'app'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
import * as antd from 'antd'
import styles from './index.less'
diff --git a/src/pages/settings/components/theme/index.js b/src/pages/settings/components/theme/index.js
new file mode 100644
index 00000000..bf8c0600
--- /dev/null
+++ b/src/pages/settings/components/theme/index.js
@@ -0,0 +1,230 @@
+import React from 'react'
+import * as Feather from 'feather-reactjs'
+import * as app from 'app'
+import * as antd from 'antd'
+
+import { SketchPicker } from 'react-color';
+
+import ColorThief from 'colorthief/dist/color-thief'
+var colorThief = new ColorThief();
+
+
+class BackgroundColor extends React.Component{
+ state = {
+ selected: "#fff"
+ }
+ sendChanges(){
+ this.props.changeColor(this.state.selected)
+ }
+ selectColor = (color) =>{
+ this.setState({selected: color.hex})
+ }
+ render(){
+ return <>
+
+
this.sendChanges()}> Change
+ >
+ }
+}
+
+class BackgroundImage extends React.Component{
+ state = {
+ results: []
+ }
+
+ search(key){
+ if (!key) return false
+ app.api_unsplash.search(key, (res) =>{
+ console.log(res)
+ this.setState({ results: res })
+ })
+ }
+ returnString(url){
+ this.props.selectImg(`url(${url})`)
+ }
+ render(){
+ return (
+ <>
+
Upload
+
+
+
Unsplash
+
this.search(value)} />
+ ( this.returnString(item.urls.full)} src={item.urls.small} /> ) }/>
+ >
+ )
+ }
+}
+
+export default class ThemeSettings extends React.PureComponent{
+ state = {
+ helper_visible: false,
+ helper_fragment: null,
+ style: [],
+ }
+
+ componentDidMount(){
+ this.decodeData()
+ }
+
+ decodeData(){
+ const storaged = app.app_theme.getString()
+ try {
+ if (storaged) {
+ this.decode(storaged, (res) => {
+ this.setState({ style: res })
+ })
+ }
+ } catch (error) {
+ console.log(error)
+ }
+ }
+
+ encode(data, callback){
+ if (!data) return false
+ try {
+ let mix = []
+ const obj = Object.entries(data)
+ obj.forEach((e) => {
+ mix.push({key: e[0], value: e[1]})
+ })
+ return callback(JSON.stringify(mix))
+ } catch (error) {
+ console.log(error)
+ return false
+ }
+ }
+ decode(data, callback){
+ if (!data) return false
+ try {
+ const scheme = JSON.parse(data)
+ let mix = {};
+ scheme.forEach((e)=>{
+ mix[e.key] = e.value
+ })
+ return callback(mix)
+ } catch (error) {
+ console.log(error)
+ return false
+ }
+ }
+
+ handleChanges(key, value){
+ let { style } = this.state
+ try {
+ switch (key) {
+ case "backgroundImage":{
+ if(style.backgroundColor){
+ this.handleRemove("backgroudColor")
+ }
+ style[key] = value
+ this.encode(style, (res) => {
+ app.app_theme.set(res)
+ this.setPredominantColor(value)
+ })
+ return true
+ }
+ case "backgroundColor":{
+ if(style.backgroundImage){
+ this.handleRemove("backgroundImage")
+ }
+ style[key] = value
+ this.encode(style, (res) => {
+ app.app_theme.set(res)
+ this.handleChanges("predominantColor", value)
+ })
+ }
+ default:{
+ style[key] = value
+ this.encode(style, (res) => {
+ app.app_theme.set(res)
+ })
+ }
+ }
+ this.decodeData()
+ } catch (error) {
+ console.log(error)
+ }
+ }
+
+ resetStyles(){
+ app.app_theme.set([])
+ }
+
+ handleRemove(key){
+ try {
+ const storaged = JSON.parse(app.app_theme.getString())
+ let mix = {};
+ storaged.forEach((e)=>{
+ return e.key !== key? mix[e.key] = e.value : null
+ })
+ console.log(mix)
+ this.encode(mix, (res)=> {
+ app.app_theme.set(res)
+ this.decodeData()
+ })
+ } catch (error) {
+ console.log(error)
+ return false
+ }
+
+ }
+
+ setPredominantColor(furl){
+ const _this = this
+ const img = new Image();
+ const url = ((furl.replace("url", "")).substring(1)).slice(0, -1);
+
+ img.crossOrigin = 'Anonymous';
+ img.src = url
+
+ img.addEventListener('load', function() {
+ const color = `rgb(${colorThief.getColor(img)})`
+ _this.handleChanges("predominantColor", color)
+ })
+
+ }
+
+ helper = {
+ open: (e) => {
+ this.setState({ helper_visible: true, helper_fragment: e })
+ },
+ close: () => {
+ this.setState({ helper_visible: false, helper_fragment: null })
+ },
+ backgroundImage: () => {
+ this.helper.open( this.handleChanges("backgroundImage", i)} />)
+ },
+ backgroundColor: () => {
+ this.helper.open( this.handleChanges("backgroundColor", i)} />)
+ }
+ }
+ render(){
+ return(
+
+
Theme
+
+ this.helper.backgroundImage()}> Background Image
+ this.helper.backgroundColor()}> Background Color
+ this.resetStyles()}> Reset Style
+
+
+
+ {this.state.helper_fragment}
+
+
+
+
+ )
+ }
+}
\ No newline at end of file
diff --git a/src/pages/settings/components/theme/index.less b/src/pages/settings/components/theme/index.less
new file mode 100644
index 00000000..e69de29b
diff --git a/src/pages/settings/index.js b/src/pages/settings/index.js
index d64a2207..d2825821 100755
--- a/src/pages/settings/index.js
+++ b/src/pages/settings/index.js
@@ -1,6 +1,8 @@
import React from 'react'
import { Menu } from 'antd'
-import * as Icons from '@ant-design/icons'
+import * as Icons from 'components/Icons'
+import * as Feather from 'feather-reactjs'
+
import styles from './style.less'
import NotificationView from './components/notification/index.js'
@@ -9,6 +11,7 @@ import Earnings from './components/earnings/index.js'
import Base from './components/base.js'
import AppAbout from './components/about.js'
+import Theme from './components/theme'
const { Item } = Menu
const menuMap = {
@@ -17,6 +20,11 @@ const menuMap = {
General
),
+ theme: (
+
+ Theme
+
+ ),
sync: (
Sync™
@@ -24,12 +32,12 @@ const menuMap = {
),
security: (
- Security & Privacity
+ Security & Privacity
),
notification: (
- Notification
+ Notification
),
earnings: (
@@ -37,9 +45,14 @@ const menuMap = {
Earnings
),
+ help: (
+
+ Help
+
+ ),
about: (
- About
+ About
),
}
@@ -71,6 +84,8 @@ class GeneralSettings extends React.Component {
return
case 'security':
return
+ case 'theme':
+ return
case 'notification':
return
case 'about':
@@ -89,7 +104,7 @@ class GeneralSettings extends React.Component {
- Settings{' '}
+ Settings
{
+ app.router.push('main')
+ }, 420)
},
query: () => {
const validBackup = app.validate.backup()
diff --git a/test/login.test.js b/test/login.test.js
new file mode 100644
index 00000000..460876fe
--- /dev/null
+++ b/test/login.test.js
@@ -0,0 +1,32 @@
+
+import puppeteer from 'puppeteer'
+
+describe('Login', () => {
+ let browser
+ let page
+
+ beforeAll(async () => {
+ browser = await puppeteer.launch({ args: ['--no-sandbox'] })
+ })
+
+ beforeEach(async () => {
+ page = await browser.newPage()
+ await page.goto('http://localhost:8000/en/login', {
+ waitUntil: 'networkidle2',
+ })
+ })
+
+ afterEach(() => page.close())
+
+ it('should login with failure', async () => {
+ await page.waitFor(selector => !!document.querySelector('#username'), {
+ timeout: 3000,
+ })
+ await page.type('#username', 'wrong_user')
+ await page.type('#password', 'wrong_password')
+ await page.click('button[type="button"]')
+ await page.waitForSelector('.anticon-close-circle') // should display error
+ })
+
+ afterAll(() => browser.close())
+})
\ No newline at end of file