From 599e706a2340061217120fe314c967a44e869857 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 25 Jul 2020 03:44:39 +0200 Subject: [PATCH 01/13] 0.7.25 --- .env | 6 +- .eslintignore | 7 - .eslintrc | 8 - .gitignore | 35 +- .prettierignore | 10 +- .prettierrc | 10 +- .stylelintrc.json | 9 - .travis.yml | 27 - .umirc.js | 92 --- .umirc.ts | 89 +++ .vscode/launch.json | 12 + .vsls.json | 4 - .ycorerc.js | 3 - README.md | 15 + capacitor.config.json | 8 - config/app.settings.js | 37 - config/app_keys.js | 9 + config/endpoints.js | 7 + config/id_rsa.enc | Bin 116 -> 0 bytes config/index.js | 57 ++ config/keys.js | 10 - config/theme.config.js | 7 - config/ycore.config.js | 37 - globals/debug.json | 23 - globals/endpoints/comty_endpoints.js | 6 - globals/endpoints/index.js | 3 - globals/endpoints/spotify_endpoints.js | 5 - globals/endpoints/twitter_endpoints.js | 6 - globals/endpoints/unsplash_endpoints.js | 6 - globals/settings.js | 55 +- globals/sidebar_menu.js | 20 +- jest.config.js | 3 - manifest.json | 11 - package.json | 117 ++- public/logo.svg | 11 +- server.js | 51 -- service-worker.js | 133 ---- setupTests.js | 6 - src/@app/app.js | 717 ------------------ src/@app/flags.js | 33 - src/@app/libs.js | 6 - src/@app/libs/api_call/api_call.js | 94 --- src/@app/libs/api_call/pre.js | 34 - src/@app/libs/apis/pre.js | 1 - src/@app/libs/apis/unsplash.js | 16 - src/@app/libs/app_functions/pre.js | 200 ----- src/@app/libs/comty_ng/comty_data.js | 87 --- src/@app/libs/comty_ng/comty_post.js | 216 ------ src/@app/libs/comty_ng/comty_post_comment.js | 41 - src/@app/libs/comty_ng/comty_search.js | 23 - src/@app/libs/comty_ng/comty_user.js | 109 --- src/@app/libs/comty_ng/pre.js | 119 --- src/@app/libs/yulio_id/ctid_gen.js | 34 - src/@app/libs/yulio_id/pre.js | 114 --- src/@app/libs/yulio_id/token_data.js | 44 -- src/@app/libs/yulio_id/validate.js | 64 -- src/components/{App_about => About}/index.js | 16 +- .../{App_about => About}/index.less | 0 src/components/HeaderSearch/index.js | 79 -- src/components/HeaderSearch/index.less | 78 -- src/components/Icons/custom.js | 2 +- src/components/Layout/ControlBar/index.js | 9 +- .../ControlBar/{Control.less => index.less} | 2 +- .../{component.tsx => Card_Component.tsx} | 0 .../components/{main => cards}/__searchBar.js | 9 +- .../{main => cards}/__searchBar.less | 2 +- .../{main => cards}/__suggestions.js | 0 .../{main => cards}/__suggestions.less | 0 .../components/{main => cards}/__trendings.js | 0 .../{main => cards}/__trendings.less | 2 +- .../Layout/Overlay/components/index.js | 28 +- .../Overlay/components/layout/Primary.tsx | 52 ++ .../layout/{__sec.tsx => Secondary.tsx} | 1 - .../Overlay/components/layout/__pri.tsx | 70 -- .../Overlay/components/swapper/__priPost.js | 29 - .../Overlay/components/swapper/__priPost.less | 27 - .../Overlay/components/swapper/__priSearch.js | 120 --- .../components/swapper/__priSearch.less | 58 -- .../components/swapper/__secComments.js | 147 ---- .../components/swapper/__secComments.less | 91 --- src/components/Layout/Overlay/index.js | 340 --------- src/components/Layout/Overlay/index.less | 124 +-- src/components/Layout/Overlay/index.tsx | 138 ++++ .../Sider/{default.js => default/index.js} | 87 +-- .../{default.less => default/index.less} | 10 +- src/components/Layout/Sider/index.js | 31 +- src/components/Layout/Sider/mobile.js | 51 -- src/components/Layout/Sider/mobile/index.js | 35 + .../Sider/{mobile.less => mobile/index.less} | 7 +- src/components/Layout/index.js | 3 +- src/components/Like_button/index.js | 106 --- src/components/Like_button/index.scss | 205 ----- src/components/Loader/Loader.less | 2 +- src/components/MainFeed/components/index.js | 5 - .../MainFeed/components/invalid/index.js | 24 - .../MainFeed/components/invalid/invalid.less | 0 .../MainFeed/components/newav/index.js | 11 - .../MainFeed/components/newav/newav.less | 3 - .../components/renderFeedPosts/index.js | 43 -- src/components/MainFeed/index.js | 188 ----- src/components/MainFeed/index.less | 4 - src/components/MediaPlayer/post_player.js | 62 -- src/components/Page/Page.less | 16 + src/components/Page/index.js | 32 + src/components/Players/index.js | 3 - src/components/Players/spotify_player.js | 38 - src/components/Players/spotify_player.less | 0 src/components/PostCard/index.js | 301 -------- src/components/PostCard/index.less | 231 ------ src/components/PostCreator/index.js | 416 ---------- src/components/PostCreator/index.less | 315 -------- .../local_components/post_options.js | 151 ---- .../local_components/post_options.less | 57 -- src/components/UserBadges/index.js | 10 +- .../UserProfile/components/Follow_btn.js | 17 - .../UserProfile/components/Follow_btn.scss | 57 -- .../UserProfile/components/follow_btn.scss | 65 -- src/components/UserProfile/index.js | 233 ------ src/components/UserProfile/reducers.js | 18 - src/components/UserProfile/styles.less | 179 ----- src/components/index.js | 23 +- src/core/cores/index.js | 3 + src/core/cores/interface_helper/index.js | 8 + src/core/cores/router/index.js | 39 + src/core/cores/session/index.js | 33 + src/core/cores/user/index.js | 65 ++ src/core/index.js | 284 +++++++ src/core/libs/errorhandler/index.js | 2 + src/core/libs/index.js | 5 + src/core/libs/interface/index.js | 1 + .../libs/interface/modals}/modals.js | 14 +- .../libs/interface/modals}/modals.less | 0 .../libs/interface/notify/index.js} | 0 src/core/libs/settings/index.js | 50 ++ src/core/libs/v3_model/index.js | 63 ++ src/core/libs/verbosity/index.js | 31 + src/layouts/BaseLayout.js | 16 +- src/layouts/BaseLayout.less | 2 +- src/layouts/PrimaryLayout.js | 59 +- src/layouts/PrimaryLayout.less | 13 +- src/layouts/PublicLayout.js | 67 -- src/layouts/index.js | 63 +- src/locales/en/messages.json | 54 -- src/models/app.js | 128 +++- src/pages/$page/index.js | 30 - src/pages/$page/index.less | 14 - src/pages/about/index.js | 9 - src/pages/about/index.less | 18 - src/pages/debug/index.js | 366 ++++++++- src/pages/debug/index.less | 39 + src/pages/debug/spotify.js | 47 -- src/pages/debug/youtube_sync.js | 0 src/pages/events/index.js | 10 - src/pages/events/index.less | 1 - src/pages/index.js | 56 +- src/pages/login/index.js | 132 ---- src/pages/login/index.less | 235 ------ src/pages/login/login.js | 220 ------ src/pages/login/register.js | 162 ---- src/pages/main/index.js | 10 +- src/pages/main/index.less | 2 - src/pages/marketplace/index.js | 10 - src/pages/marketplace/index.less | 1 - src/pages/messages/Events.js | 11 - src/pages/messages/chats/ChatContainer.js | 197 ----- src/pages/messages/chats/SideBar.js | 81 -- src/pages/messages/index.js | 72 -- src/pages/messages/messages/MessageInput.js | 111 --- src/pages/messages/messages/Messages.js | 59 -- src/pages/messages/styles.less | 278 ------- src/pages/p/$post/index.js | 47 -- src/pages/pro/index.js | 7 - src/pages/publics/index.js | 9 - src/pages/publics/style_design.js | 13 - src/pages/saves/index.js | 47 -- src/pages/saves/index.less | 14 - src/pages/settings/components/about.js | 4 +- src/pages/settings/components/base.js | 22 +- .../settings/components/earnings/index.js | 19 +- .../settings/components/notification/index.js | 1 - .../components/notification/index.less | 2 +- .../settings/components/security/index.js | 1 - .../settings/components/security/index.less | 2 +- .../settings/components/security/sessions.js | 15 +- src/pages/settings/components/theme/index.js | 1 - src/pages/settings/style.less | 2 +- src/{themes => theme/base}/antd-design.less | 38 +- .../base/components/Menssaging.less | 2 - .../base/components/PostCard.less | 2 - .../base/fonts-import.css} | 0 src/{themes => theme}/base/index.less | 4 + .../base/layout/LeftSider.less | 4 - .../base/layout/Overlay.less | 2 - .../base/layout/Primary_Layout.less | 2 - src/{themes => theme}/base/resolutions.less | 0 src/theme/base/vars.less | 42 + src/theme/index.less | 1 + src/themes/base/ColorScheme1.less | 44 -- src/themes/index.less | 3 - src/utils/index.js | 270 ------- src/utils/model.js | 39 - test/login.test.js | 32 - tsconfig.json | 25 + typings.d.ts | 10 + 204 files changed, 1938 insertions(+), 9329 deletions(-) delete mode 100755 .eslintignore delete mode 100755 .eslintrc delete mode 100755 .stylelintrc.json delete mode 100755 .travis.yml delete mode 100755 .umirc.js create mode 100644 .umirc.ts create mode 100644 .vscode/launch.json delete mode 100755 .vsls.json delete mode 100644 .ycorerc.js create mode 100644 README.md delete mode 100755 capacitor.config.json delete mode 100755 config/app.settings.js create mode 100644 config/app_keys.js create mode 100644 config/endpoints.js delete mode 100755 config/id_rsa.enc create mode 100644 config/index.js delete mode 100755 config/keys.js delete mode 100755 config/theme.config.js delete mode 100755 config/ycore.config.js delete mode 100755 globals/debug.json delete mode 100755 globals/endpoints/comty_endpoints.js delete mode 100755 globals/endpoints/index.js delete mode 100644 globals/endpoints/spotify_endpoints.js delete mode 100755 globals/endpoints/twitter_endpoints.js delete mode 100644 globals/endpoints/unsplash_endpoints.js delete mode 100755 jest.config.js delete mode 100755 manifest.json delete mode 100644 server.js delete mode 100755 service-worker.js delete mode 100755 setupTests.js delete mode 100644 src/@app/app.js delete mode 100644 src/@app/flags.js delete mode 100644 src/@app/libs.js delete mode 100644 src/@app/libs/api_call/api_call.js delete mode 100644 src/@app/libs/api_call/pre.js delete mode 100644 src/@app/libs/apis/pre.js delete mode 100644 src/@app/libs/apis/unsplash.js delete mode 100644 src/@app/libs/app_functions/pre.js delete mode 100644 src/@app/libs/comty_ng/comty_data.js delete mode 100644 src/@app/libs/comty_ng/comty_post.js delete mode 100644 src/@app/libs/comty_ng/comty_post_comment.js delete mode 100644 src/@app/libs/comty_ng/comty_search.js delete mode 100644 src/@app/libs/comty_ng/comty_user.js delete mode 100644 src/@app/libs/comty_ng/pre.js delete mode 100644 src/@app/libs/yulio_id/ctid_gen.js delete mode 100644 src/@app/libs/yulio_id/pre.js delete mode 100644 src/@app/libs/yulio_id/token_data.js delete mode 100644 src/@app/libs/yulio_id/validate.js rename src/components/{App_about => About}/index.js (58%) mode change 100755 => 100644 rename src/components/{App_about => About}/index.less (100%) mode change 100755 => 100644 delete mode 100755 src/components/HeaderSearch/index.js delete mode 100755 src/components/HeaderSearch/index.less rename src/components/Layout/ControlBar/{Control.less => index.less} (93%) rename src/components/Layout/Overlay/components/{component.tsx => Card_Component.tsx} (100%) rename src/components/Layout/Overlay/components/{main => cards}/__searchBar.js (79%) rename src/components/Layout/Overlay/components/{main => cards}/__searchBar.less (97%) rename src/components/Layout/Overlay/components/{main => cards}/__suggestions.js (100%) rename src/components/Layout/Overlay/components/{main => cards}/__suggestions.less (100%) rename src/components/Layout/Overlay/components/{main => cards}/__trendings.js (100%) rename src/components/Layout/Overlay/components/{main => cards}/__trendings.less (93%) create mode 100644 src/components/Layout/Overlay/components/layout/Primary.tsx rename src/components/Layout/Overlay/components/layout/{__sec.tsx => Secondary.tsx} (98%) delete mode 100644 src/components/Layout/Overlay/components/layout/__pri.tsx delete mode 100644 src/components/Layout/Overlay/components/swapper/__priPost.js delete mode 100644 src/components/Layout/Overlay/components/swapper/__priPost.less delete mode 100644 src/components/Layout/Overlay/components/swapper/__priSearch.js delete mode 100644 src/components/Layout/Overlay/components/swapper/__priSearch.less delete mode 100644 src/components/Layout/Overlay/components/swapper/__secComments.js delete mode 100644 src/components/Layout/Overlay/components/swapper/__secComments.less delete mode 100644 src/components/Layout/Overlay/index.js create mode 100644 src/components/Layout/Overlay/index.tsx rename src/components/Layout/Sider/{default.js => default/index.js} (52%) mode change 100755 => 100644 rename src/components/Layout/Sider/{default.less => default/index.less} (95%) mode change 100755 => 100644 delete mode 100755 src/components/Layout/Sider/mobile.js create mode 100644 src/components/Layout/Sider/mobile/index.js rename src/components/Layout/Sider/{mobile.less => mobile/index.less} (96%) mode change 100755 => 100644 delete mode 100755 src/components/Like_button/index.js delete mode 100755 src/components/Like_button/index.scss delete mode 100755 src/components/MainFeed/components/index.js delete mode 100755 src/components/MainFeed/components/invalid/index.js delete mode 100755 src/components/MainFeed/components/invalid/invalid.less delete mode 100755 src/components/MainFeed/components/newav/index.js delete mode 100755 src/components/MainFeed/components/newav/newav.less delete mode 100755 src/components/MainFeed/components/renderFeedPosts/index.js delete mode 100755 src/components/MainFeed/index.js delete mode 100755 src/components/MainFeed/index.less delete mode 100644 src/components/MediaPlayer/post_player.js create mode 100644 src/components/Page/Page.less create mode 100644 src/components/Page/index.js delete mode 100644 src/components/Players/index.js delete mode 100644 src/components/Players/spotify_player.js delete mode 100644 src/components/Players/spotify_player.less delete mode 100755 src/components/PostCard/index.js delete mode 100755 src/components/PostCard/index.less delete mode 100755 src/components/PostCreator/index.js delete mode 100755 src/components/PostCreator/index.less delete mode 100755 src/components/PostCreator/local_components/post_options.js delete mode 100755 src/components/PostCreator/local_components/post_options.less delete mode 100755 src/components/UserProfile/components/Follow_btn.js delete mode 100755 src/components/UserProfile/components/Follow_btn.scss delete mode 100755 src/components/UserProfile/components/follow_btn.scss delete mode 100755 src/components/UserProfile/index.js delete mode 100644 src/components/UserProfile/reducers.js delete mode 100755 src/components/UserProfile/styles.less create mode 100644 src/core/cores/index.js create mode 100644 src/core/cores/interface_helper/index.js create mode 100644 src/core/cores/router/index.js create mode 100644 src/core/cores/session/index.js create mode 100644 src/core/cores/user/index.js create mode 100644 src/core/index.js create mode 100644 src/core/libs/errorhandler/index.js create mode 100644 src/core/libs/index.js create mode 100644 src/core/libs/interface/index.js rename src/{@app/libs/app_functions => core/libs/interface/modals}/modals.js (91%) rename src/{@app/libs/app_functions => core/libs/interface/modals}/modals.less (100%) rename src/{@app/libs/app_functions/notify.js => core/libs/interface/notify/index.js} (100%) create mode 100644 src/core/libs/settings/index.js create mode 100644 src/core/libs/v3_model/index.js create mode 100644 src/core/libs/verbosity/index.js delete mode 100755 src/layouts/PublicLayout.js delete mode 100755 src/locales/en/messages.json delete mode 100755 src/pages/$page/index.js delete mode 100755 src/pages/$page/index.less delete mode 100755 src/pages/about/index.js delete mode 100755 src/pages/about/index.less create mode 100644 src/pages/debug/index.less delete mode 100644 src/pages/debug/spotify.js delete mode 100644 src/pages/debug/youtube_sync.js delete mode 100755 src/pages/events/index.js delete mode 100755 src/pages/events/index.less delete mode 100755 src/pages/login/index.js delete mode 100755 src/pages/login/index.less delete mode 100755 src/pages/login/login.js delete mode 100755 src/pages/login/register.js delete mode 100755 src/pages/main/index.less delete mode 100755 src/pages/marketplace/index.js delete mode 100755 src/pages/marketplace/index.less delete mode 100644 src/pages/messages/Events.js delete mode 100644 src/pages/messages/chats/ChatContainer.js delete mode 100644 src/pages/messages/chats/SideBar.js delete mode 100644 src/pages/messages/index.js delete mode 100644 src/pages/messages/messages/MessageInput.js delete mode 100644 src/pages/messages/messages/Messages.js delete mode 100644 src/pages/messages/styles.less delete mode 100755 src/pages/p/$post/index.js delete mode 100755 src/pages/pro/index.js delete mode 100644 src/pages/publics/index.js delete mode 100644 src/pages/publics/style_design.js delete mode 100755 src/pages/saves/index.js delete mode 100755 src/pages/saves/index.less rename src/{themes => theme/base}/antd-design.less (96%) mode change 100755 => 100644 rename src/{themes => theme}/base/components/Menssaging.less (96%) rename src/{themes => theme}/base/components/PostCard.less (93%) rename src/{themes/fonts-imports.css => theme/base/fonts-import.css} (100%) mode change 100755 => 100644 rename src/{themes => theme}/base/index.less (96%) mode change 100755 => 100644 rename src/{themes => theme}/base/layout/LeftSider.less (76%) rename src/{themes => theme}/base/layout/Overlay.less (90%) rename src/{themes => theme}/base/layout/Primary_Layout.less (81%) rename src/{themes => theme}/base/resolutions.less (100%) mode change 100755 => 100644 create mode 100644 src/theme/base/vars.less create mode 100644 src/theme/index.less delete mode 100644 src/themes/base/ColorScheme1.less delete mode 100755 src/themes/index.less delete mode 100755 src/utils/index.js delete mode 100755 src/utils/model.js delete mode 100644 test/login.test.js create mode 100644 tsconfig.json create mode 100644 typings.d.ts diff --git a/.env b/.env index 2b43de75..5ed58914 100755 --- a/.env +++ b/.env @@ -1,4 +1,2 @@ -UMI_UI=none -NODE_ENV=production - -YCORE_CONFIG=./config \ No newline at end of file +UMI_UI=true +NODE_ENV=production \ No newline at end of file diff --git a/.eslintignore b/.eslintignore deleted file mode 100755 index 96a82dff..00000000 --- a/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -src/**/*-test.js -src/public -src/routes/chart/ECharts/theme -src/routes/chart/highCharts/mapdata -src/locales/_build/ -src/locales/**/*.js -docs/**/*.js diff --git a/.eslintrc b/.eslintrc deleted file mode 100755 index e71ebc80..00000000 --- a/.eslintrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "react-app", - "rules": { - "jsx-a11y/href-no-hash": "off", - "no-console": "warn", - "valid-jsdoc": "warn" - } -} diff --git a/.gitignore b/.gitignore index 4d433501..bee1cf61 100755 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,20 @@ -coverage -dist -node_modules -npm-debug.log -yarn-error.log -yarn.lock -package-lock.json +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. -# ide -.idea +# dependencies +/node_modules +/npm-debug.log* +/yarn-error.log +/yarn.lock +/package-lock.json -# Mac General +# production +/dist + +# misc .DS_Store -.AppleDouble -.LSOverride # umi -.umi -.umi-production - -# jslingui -src/locales/_build -src/locales/**/*.js -android/ -auxCord \ No newline at end of file +/src/.umi +/src/.umi-production +/src/.umi-test +/.env.local diff --git a/.prettierignore b/.prettierignore index 1e879f7a..0d4222f5 100755 --- a/.prettierignore +++ b/.prettierignore @@ -1,6 +1,8 @@ -*.svg -*.ejs -.DS_Store +**/*.md +**/*.svg +**/*.ejs +**/*.html +package.json .umi .umi-production -src/locales/**/*.json \ No newline at end of file +.umi-test diff --git a/.prettierrc b/.prettierrc index 36301bc5..94beb148 100755 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,11 @@ { - "semi": false, "singleQuote": true, - "trailingComma": "es5" + "trailingComma": "all", + "printWidth": 80, + "overrides": [ + { + "files": ".prettierrc", + "options": { "parser": "json" } + } + ] } diff --git a/.stylelintrc.json b/.stylelintrc.json deleted file mode 100755 index b533bdd6..00000000 --- a/.stylelintrc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": ["stylelint-config-standard", "stylelint-config-prettier"], - "rules": { - "declaration-empty-line-before": null, - "no-descending-specificity": null, - "selector-pseudo-class-no-unknown": null, - "selector-pseudo-element-colon-notation": null - } -} diff --git a/.travis.yml b/.travis.yml deleted file mode 100755 index 4789d27f..00000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: node_js -node_js: - - node -script: - - npm run build -before_install: - - | - if [ "$TRAVIS_BRANCH" = "develop" ]; then - for prefixed_envvar in ${!DEV_*}; do - eval export ${prefixed_envvar#DEV_}="${!prefixed_envvar}" - done - elif [ "$TRAVIS_BRANCH" = "master" ]; then - for prefixed_envvar in ${!PROD_*}; do - eval export ${prefixed_envvar#PROD_}="${!prefixed_envvar}" - done - else - for prefixed_envvar in ${!TEST_*}; do - eval export ${prefixed_envvar#TEST_}="${!prefixed_envvar}" - done - fi - - openssl aes-256-cbc -K $encrypted_18b2305b78c9_key -iv $encrypted_18b2305b78c9_iv -in config/id_rsa.enc -out ~/.ssh/id_rsa -d - - chmod 600 ~/.ssh/id_rsa - - echo -e "Host $HOST\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - - yarn global add now -after_script: - - scp -o stricthostkeychecking=no -r ./dist root@$HOST:$BUILD_DIR - - cd ./docs && now -A $DOC_NOW_CONFIG -t $NOW_TOKEN && now alias -A $DOC_NOW_CONFIG -t $NOW_TOKEN diff --git a/.umirc.js b/.umirc.js deleted file mode 100755 index b8985843..00000000 --- a/.umirc.js +++ /dev/null @@ -1,92 +0,0 @@ -// https://umijs.org/config/ -import { resolve } from 'path' -import { i18n } from './config/ycore.config.js' -export default { - ignoreMomentLocale: true, - hash: false, - - ssr: false, - - targets: { ie: 9,}, - treeShaking: true, - plugins: [ - [ - 'umi-plugin-react', - { - dva: { - immer: true, - }, - antd: true, - dynamicImport: { - webpackChunkName: true, - loadingComponent: './components/Loader/Loader', - }, - - routes: { - exclude: [ - /model\.(j|t)sx?$/, - /service\.(j|t)sx?$/, - /models\//, - /components\//, - /services\//, - ], - update: routes => { - if (!i18n) return routes - const newRoutes = [] - - for (const item of routes[0].routes) { - newRoutes.push(item) - - if (item.path) { - newRoutes.push( - Object.assign({}, item, { - path: - `/:lang(${i18n.languages - .map(item => item.key) - .join('|')})` + item.path, - }) - ) - } - } - - routes[0].routes = newRoutes - return routes - }, - }, - dll:false, - pwa: { - manifestOptions: { - srcPath: 'manifest.json', - }, - }, - }, - ], - ], - // Theme for antd - // https://ant.design/docs/react/customize-theme - theme: './config/theme.config.js', - // 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'), - models: resolve(__dirname, './src/models'), - routes: resolve(__dirname, './src/routes'), - themes: resolve(__dirname, './src/themes'), - utils: resolve(__dirname, './src/utils'), - }, - extraBabelPresets: ['@lingui/babel-preset-react'], - extraBabelPlugins: [ - [ - 'import', - { - libraryName: 'lodash', - libraryDirectory: '', - camel2DashComponentName: false, - }, - 'lodash', - ], - ], -} diff --git a/.umirc.ts b/.umirc.ts new file mode 100644 index 00000000..84bbe396 --- /dev/null +++ b/.umirc.ts @@ -0,0 +1,89 @@ +import { defineConfig } from 'umi'; + +const fs = require('fs'); +const path = require('path'); +const lessToJs = require('less-vars-to-js'); +const { resolve } = require('path'); + +export default defineConfig({ + hash: false, + ignoreMomentLocale: true, + targets: { ie: 9 }, + dynamicImport: { + loading: 'components/Loader/Loader.js', + }, + dva: { immer: true }, + nodeModulesTransform: { + type: 'none', + }, + alias: { + api: resolve(__dirname, './api'), + globals: resolve(__dirname, './globals'), + core: resolve(__dirname, './src/core'), + theme: resolve(__dirname, './src/theme'), + config: resolve(__dirname, './config'), + components: resolve(__dirname, './src/components'), + models: resolve(__dirname, './src/models'), + routes: resolve(__dirname, './src/routes'), + }, + theme: lessToJs( + fs.readFileSync(path.join(__dirname, './src/theme/index.less'), 'utf8'), + ), + extraBabelPlugins: [ + [ + 'import', + { + libraryName: 'lodash', + libraryDirectory: '', + camel2DashComponentName: false, + }, + 'lodash', + ], + ], + + // chainWebpack: function(config, { webpack }) { + // config.module + // .rule('js-in-node_modules') + // .exclude.add(/node_modules/) + // .end() + + // config.module + // .rule('ts-in-node_modules') + // .exclude.add(/node_modules/) + // .end() + + // config.merge({ + // optimization: { + // minimize: true, + // splitChunks: { + // chunks: 'all', + // minSize: 30000, + // minChunks: 3, + // automaticNameDelimiter: '.', + // cacheGroups: { + // react: { + // name: 'react', + // priority: 20, + // test: /[\\/]node_modules[\\/](react|react-dom|react-dom-router)[\\/]/, + // }, + // antd: { + // name: 'antd', + // priority: 20, + // test: /[\\/]node_modules[\\/](antd|@ant-design\/icons)[\\/]/, + // }, + // async: { + // chunks: 'async', + // minChunks: 2, + // name: 'async', + // maxInitialRequests: 1, + // minSize: 0, + // priority: 5, + // reuseExistingChunk: true, + // }, + // }, + // }, + // }, + // }) + // }, + +}); diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..2ef6a196 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,12 @@ +{ + "configurations": [ + { + "name": "Launch via NPM", + "request": "launch", + "runtimeArgs": ["run-script", "debug"], + "runtimeExecutable": "npm", + "skipFiles": ["/**"], + "type": "pwa-node" + } + ] +} diff --git a/.vsls.json b/.vsls.json deleted file mode 100755 index 197e41f6..00000000 --- a/.vsls.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/vsls", - "gitignore":"none" -} \ No newline at end of file diff --git a/.ycorerc.js b/.ycorerc.js deleted file mode 100644 index e3059c50..00000000 --- a/.ycorerc.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - nigga: 'JeJe So FUny' -} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..07afeb7f --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# umi project + +## Getting Started + +Install dependencies, + +```bash +$ yarn +``` + +Start the dev server, + +```bash +$ yarn start +``` diff --git a/capacitor.config.json b/capacitor.config.json deleted file mode 100755 index 542d7ae1..00000000 --- a/capacitor.config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "appId": "com.ragestudio.comty", - "appName": "comty-development", - "bundledWebRuntime": false, - "npmClient": "npm", - "webDir": "dist", - "cordova": {} -} diff --git a/config/app.settings.js b/config/app.settings.js deleted file mode 100755 index 159445b6..00000000 --- a/config/app.settings.js +++ /dev/null @@ -1,37 +0,0 @@ -function SettingStoragedValue(e){ - try { - const fromStorage = JSON.parse(localStorage.getItem('app_settings')) - const Ite = fromStorage.map(item => { - return item.SettingID === e? item.value : null - }) - const fr = Ite.filter(Boolean) - return fr.toString() - } - catch (error) { - return null - } -} -const fromStorage = JSON.parse(localStorage.getItem('app_settings')) - -export var AppSettings = { - __global_server_prexif: 'https://api.ragestudio.net/RSA-COMTY/r/', - // Global Behaviors - InfiniteLoading: false, - InfiniteLogin: false, - InfiniteRegister: false, - DisableLogin: false, - DisableRegister: true, - DisablePasswordRecover: true, - disable_pro_tool: fromStorage? SettingStoragedValue('disable_pro_tool') : false, - force_showDevLogs: fromStorage? SettingStoragedValue('force_showDevLogs') : false, - SignForNotExpire: fromStorage? SettingStoragedValue('sessions_noexpire') : false, - auto_search_ontype: fromStorage? SettingStoragedValue('auto_search_ontype') : false, - auto_feedrefresh: fromStorage? SettingStoragedValue('auto_feedrefresh') : false, - auto_hide_postbar: fromStorage? SettingStoragedValue('auto_hide_postbar') : true, - MaxLengthPosts: '512', - CurrentBundle: 'light_ng', - // In KB - MaximunAPIPayload: '101376', - limit_post_catch: '20', - Maximun_tick_overrun: 10, -} \ No newline at end of file diff --git a/config/app_keys.js b/config/app_keys.js new file mode 100644 index 00000000..6f820690 --- /dev/null +++ b/config/app_keys.js @@ -0,0 +1,9 @@ +module.exports = { + 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/endpoints.js b/config/endpoints.js new file mode 100644 index 00000000..e2bfac28 --- /dev/null +++ b/config/endpoints.js @@ -0,0 +1,7 @@ +export default { + auth_server: 'POST /auth_server', + auth: 'POST /auth', + logout: 'POST /logout', + + get_data: 'POST /get-user-data', +}; diff --git a/config/id_rsa.enc b/config/id_rsa.enc deleted file mode 100755 index 5c41e85f3a3518c3b3d24513d7e0d0a00d78c93a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 116 zcmeZ`c)x!y12Y2y0}BuX*&r^62J%3_0ZfucKy>rT18F{xQJg@m2*iv&AVx?A05{Vb AssI20 diff --git a/config/index.js b/config/index.js new file mode 100644 index 00000000..2c531244 --- /dev/null +++ b/config/index.js @@ -0,0 +1,57 @@ +module.exports = { + app_config: { + siteName: 'Comty', + copyright: 'RageStudio©', + MainPath: '/', + + LogoPath: '/logo.svg', + FullLogoPath: '/full_logo.svg', + DarkFullLogoPath: '/dark_full_logo.svg', + DarkLogoPath: '/dark_logo.svg', + + api_prefix: 'ycorejs_apiv3', + app_settings_storage: 'app_settings' + }, + + i18n: { + languages: [ + { + key: 'en', + title: 'English', + }, + ], + defaultLanguage: 'en', + }, + + layouts: [ + { + name: 'primary', + include: [/\/main/, /\/settings/, /\/saves/, /\/pro/, /\/chats/, /\//], + exclude: [/\/publics/, /\/login/ ], + }, + { + name: 'public', + include: [/.*/] + } + ], + + // Default Behaviors + defaults: { + verbosity: false, + session_noexpire: false, + search_ontype: false, + overlay_loosefocus: true, + render_pagetransition_preset: 'moveToRightScaleUp', + + feed_autorefresh: false, + + post_maxlenght: '512', + post_catchlimit: '20', + post_hidebar: true, + + // In KB + api_maxpayload: '101376', + api_maxovertick: 10, + } + +}; diff --git a/config/keys.js b/config/keys.js deleted file mode 100755 index 4bbc3635..00000000 --- a/config/keys.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - spotify_client: '609f59064dfd470c8c2abffbd9044843', - spotify_secret: 'b7efd276bf2e41039dedb2a514f35951', - 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 deleted file mode 100755 index 6ba2273b..00000000 --- a/config/theme.config.js +++ /dev/null @@ -1,7 +0,0 @@ -const fs = require('fs') -const path = require('path') -const lessToJs = require('less-vars-to-js') - -module.exports = () => { - // 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 deleted file mode 100755 index 21659f2f..00000000 --- a/config/ycore.config.js +++ /dev/null @@ -1,37 +0,0 @@ -module.exports = { - siteName: 'Comty', - copyright: 'RageStudio©', - - LogoPath: '/logo.svg', - FullLogoPath: '/full_logo.svg', - DarkFullLogoPath: '/dark_full_logo.svg', - DarkLogoPath: '/dark_logo.svg', - - resource_bundle: 'light_ng', - - 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: [/\/main/, /\/settings/, /\/saves/, /\/pro/, /\/chats/, /\//], - exclude: [/\/publics/, /\/login/ ], - }, - { - name: 'public', - include: [/.*/] - } - ], - - i18n: { - languages: [ - { - key: 'en', - title: 'English', - }, - ], - defaultLanguage: 'en', - }, -} diff --git a/globals/debug.json b/globals/debug.json deleted file mode 100755 index 8816f6a8..00000000 --- a/globals/debug.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "id": "1", - "title": "PINS", - "avatar": "https://dl.ragestudio.net/statics/icons/nxkuOJlFJuAUhzlMTCEe.png", - "description": "Debug pins functions, create, modify, delete...", - "component": "PINS_debugger" - }, - { - "id": "2", - "title": "SDCP™", - "avatar":"https://dl.ragestudio.net/statics/icons/nxkuOJlFJuAUhzlMTCEe.png", - "description": "Debug SDCP Controller and data proccess", - "component": "SDCP_debugger" - }, - { - "id": "3", - "title": "API", - "avatar": "https://dl.ragestudio.net/statics/icons/nxkuOJlFJuAUhzlMTCEe.png", - "description": "Debug API Controller and data proccess", - "component": "API_debugger" - } -] \ No newline at end of file diff --git a/globals/endpoints/comty_endpoints.js b/globals/endpoints/comty_endpoints.js deleted file mode 100755 index f6a06e31..00000000 --- a/globals/endpoints/comty_endpoints.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports={ - // !!! Deprecated for the new model => v0.4.06 (up) - comty_endpoints: { - new_post: "https://comty.pw/api/new_post", - } -} \ No newline at end of file diff --git a/globals/endpoints/index.js b/globals/endpoints/index.js deleted file mode 100755 index f7c54d44..00000000 --- a/globals/endpoints/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export * from './comty_endpoints.js' -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 deleted file mode 100644 index 11949ca3..00000000 --- a/globals/endpoints/spotify_endpoints.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - autorize: 'https://accounts.spotify.com/authorize', -} - - diff --git a/globals/endpoints/twitter_endpoints.js b/globals/endpoints/twitter_endpoints.js deleted file mode 100755 index ba18f6ab..00000000 --- a/globals/endpoints/twitter_endpoints.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - twitter_endpoints: { - oa_access: "https://api.twitter.com/oauth/access_token", - oa_request: "https://api.twitter.com/oauth/request_token", - } -} \ No newline at end of file diff --git a/globals/endpoints/unsplash_endpoints.js b/globals/endpoints/unsplash_endpoints.js deleted file mode 100644 index 4188a39a..00000000 --- a/globals/endpoints/unsplash_endpoints.js +++ /dev/null @@ -1,6 +0,0 @@ -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/settings.js b/globals/settings.js index db006dcc..1aabcb77 100755 --- a/globals/settings.js +++ b/globals/settings.js @@ -1,62 +1,33 @@ -const fromStorage = JSON.parse(localStorage.getItem('app_settings')) - -function SettingStoragedValue(e) { - try { - const fromStorage = JSON.parse(localStorage.getItem('app_settings')) - const Ite = fromStorage.map(item => { - return item.SettingID === e ? item.value : null - }) - const fr = Ite.filter(Boolean) - return fr.toString() - } catch (error) { - return null - } -} - -export var ListSettings = [ +module.exports = [ { - SettingID: 'disable_pro_tool', - type: 'switch', - title: 'Hide Pro Tools', - description: 'Hide right sidebar utils of comty pro', - value: fromStorage ? SettingStoragedValue('disable_pro_tool') : false, - }, - { - SettingID: 'sessions_noexpire', + id: 'session_noexpire', type: 'switch', title: 'No expire session', description: 'Force the app to not expire any session... [Developer]', - value: fromStorage ? SettingStoragedValue('sessions_noexpire') : false, }, { - SettingID: 'auto_feedrefresh', - type: 'switch', - title: 'Auto Feed Refresh', - description: - 'Force the app to auto refresh the posts feed when exist news posts for update', - value: fromStorage ? SettingStoragedValue('auto_feedrefresh') : false, - }, - { - SettingID: 'auto_search_ontype', + id: 'search_ontype', type: 'switch', title: 'Detect input on search bar', description: 'Force the app to automaticly search when a type input is detected... [Developer]', - value: fromStorage ? SettingStoragedValue('auto_search_ontype') : false, }, { - SettingID: 'auto_hide_postbar', + id: 'post_hidebar', type: 'switch', title: 'Auto hide postbar', - description: - 'Force the app to dont hide the post actions (likes, comments ...etc) automaticly... [Developer]', - value: fromStorage ? SettingStoragedValue('auto_hide_postbar') : true, + description: 'Force the app to dont hide the post actions (likes, comments ...etc) automaticly... [Developer]', }, { - SettingID: 'force_showDevLogs', + id: 'verbosity', type: 'switch', - title: 'Show Functions Logs', + title: 'Enable core verbosity', description: 'Show all console logs... [Developer]', - value: fromStorage ? SettingStoragedValue('force_showDevLogs') : false, + }, + { + id: 'overlay_loosefocus', + type: 'switch', + title: 'Overlay loose focus', + description: 'Close the overlay when loose focus', }, ] diff --git a/globals/sidebar_menu.js b/globals/sidebar_menu.js index 714fec0a..335315b9 100644 --- a/globals/sidebar_menu.js +++ b/globals/sidebar_menu.js @@ -1,7 +1,4 @@ -import * as Icons from '@ant-design/icons' -import Icon from '@ant-design/icons' -import {CustomIcons} from 'components' -import * as Feather from 'feather-reactjs' +import * as Icons from 'components/Icons' let MenuList = [ { @@ -9,35 +6,40 @@ let MenuList = [ title: 'Main', path: '/main', require: 'login', - icon: , + icon: , + mobile: 'true' }, { id: 'explore', title: 'Explore', path: '/explore', require: 'login', - icon: , + icon: , + mobile: 'true' }, { id: 'saves', title: 'Saves', path: '/saves', require: 'login', - icon: , + icon: , + mobile: 'false' }, { id: 'messages', title: 'Messages', path: '/messages', require: 'login', - icon: , + icon: , + mobile: 'false' }, { id: 'notifications', title: 'Notifications', path: '/notifications', require: 'login', - icon: , + icon: , + mobile: 'false' }, ] diff --git a/jest.config.js b/jest.config.js deleted file mode 100755 index c52ac835..00000000 --- a/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - testURL: 'http://localhost:8000', -} diff --git a/manifest.json b/manifest.json deleted file mode 100755 index ae91b13c..00000000 --- a/manifest.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "Comty", - "start_url": ".", - "display": "standalone", - "description": "An client prototype of universal social network.", - "icons": [ - { - "src": "logo.svg" - } - ] -} diff --git a/package.json b/package.json index acabb8d2..e6760fff 100755 --- a/package.json +++ b/package.json @@ -3,111 +3,88 @@ "UUID": "C8mVSr-4nmPp2-pr5Vrz-CU4kg4", "title": "Comty™", "DevBuild": true, - "version": "0.4.11", + "version": "0.7.24", "stage": "dev-pre", "description": "", "author": "RageStudio", "license": "ISC", + "private": true, + "scripts": { + "start": "umi dev", + "build": "umi build", + "postinstall": "umi generate tmp", + "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'", + "test": "umi-test", + "test:coverage": "umi-test --coverage" + }, + "gitHooks": { + "pre-commit": "lint-staged" + }, + "lint-staged": { + "*.{js,jsx,less,md,json}": [ + "prettier --write" + ], + "*.ts?(x)": [ + "prettier --parser=typescript --write" + ] + }, "dependencies": { "@lingui/cli": "^2.9.1", "@lingui/loader": "^2.9.1", "@lingui/react": "^2.9.1", "@material-ui/core": "^4.9.9", "@material-ui/icons": "^4.9.1", - "antd": "^4.1.2", + "@ragestudio/ycorejs-lib": "^0.1.21", + "antd": "^4.3.5", "axios": "^0.19.2", - "canvas": "^2.6.1", + "babel-core": "^6.26.3", "classnames": "^2.2.6", "colorthief": "^2.3.0", - "dva": "2.4.1", "dva-model-extend": "^0.1.2", + "dva-react-hook": "^1.2.7", "enquire-js": "^0.2.1", "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", + "jquery": "^3.5.1", + "less-vars-to-js": "^1.3.0", + "lint-staged": "^10.0.7", + "localforage": "^1.7.4", + "lodash": "^4.17.19", + "moment": "^2.27.0", "node-sass": "^4.13.1", - "nodemon": "^1.19.1", "nprogress": "^0.2.0", "path-to-regexp": "^6.1.0", + "prettier": "^1.19.1", "prop-types": "^15.7.2", - "puppeteer": "^3.0.3", "radium": "^0.26.0", - "randomstring": "^1.1.5", + "react": "^16.12.0", "react-animations": "^1.0.0", "react-color": "^2.18.1", "react-dazzle": "^1.4.0", + "react-dom": "^16.12.0", "react-emoji": "^0.5.0", - "react-feather": "^2.0.8", "react-google-recaptcha": "^2.0.1", "react-helmet": "^5.2.1", "react-linkify": "^1.0.0-alpha", "react-perfect-scrollbar": "^1.5.8", "react-reveal": "^1.2.2", "react-scripts": "^3.4.1", + "react-transition-group": "^4.4.1", "react-virtualized": "^9.21.2", - "reactablejs": "^0.2.0", - "socket.io-client": "^2.3.0", + "stack-trace": "0.0.10", "store": "^2.0.12", - "timeago.js": "^4.0.2", - "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" + "styled-components": "^5.1.1", + "timeago.js": "^4.0.2" }, "devDependencies": { - "@capacitor/android": "^1.5.2", - "@capacitor/cli": "^1.5.2", - "@capacitor/core": "^1.5.2", - "@lingui/babel-preset-react": "^2.9.1", - "umi-plugin-datahub": "^4.1.0", - "@types/react": "^16.9.33", - "babel-core": "7.0.0-bridge.0", - "babel-plugin-dev-expression": "^0.2.2", - "babel-plugin-import": "^1.13.0", - "babel-plugin-macros": "^2.8.0", + "@lingui/babel-preset-react": "^2.9.0", + "@lingui/cli": "^2.9.0", + "@lingui/loader": "^2.9.0", + "@umijs/preset-react": "^1.4.0", + "babel-eslint": "^10.0.1", + "babel-plugin-dev-expression": "^0.2.1", "babel-plugin-module-resolver": "^4.0.0", - "cross-env": "^7.0.0", - "less-vars-to-js": "^1.3.0", - "module": "^1.2.5", - "now": "^17.0.3", - "workbox-webpack-plugin": "^5.0.0" - }, - "engines": { - "node": ">= 10.0.0" - }, - "lingui": { - "fallbackLocale": "en", - "sourceLocale": "en", - "localeDir": "src/locales", - "srcPathDirs": [ - "src/pages", - "src/layouts", - "src/components", - "src/layouts" - ], - "format": "minimal", - "extractBabelOptions": { - "presets": [ - "umi/babel" - ] - } - }, - "scripts": { - "analyze": "cross-env ANALYZE=1 umi build", - "build": "umi build", - "start": "umi dev", - "test": "cross-env BABELRC=none umi test" + "cross-env": "^6.0.0", + "typescript": "^3.8.3", + "umi": "^3.2.9" } } diff --git a/public/logo.svg b/public/logo.svg index afd838cd..72f77e0c 100755 --- a/public/logo.svg +++ b/public/logo.svg @@ -1 +1,10 @@ -icon_new2019_black \ No newline at end of file + + + + diff --git a/server.js b/server.js deleted file mode 100644 index c1acfd22..00000000 --- a/server.js +++ /dev/null @@ -1,51 +0,0 @@ -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/service-worker.js b/service-worker.js deleted file mode 100755 index 54a3962a..00000000 --- a/service-worker.js +++ /dev/null @@ -1,133 +0,0 @@ -// This optional code is used to register a service worker. -// register() is not called by default. - -// This lets the app load faster on subsequent visits in production, and gives -// it offline capabilities. However, it also means that developers (and users) -// will only see deployed updates on subsequent visits to a page, after all the -// existing tabs open on the page have been closed, since previously cached -// resources are updated in the background. - -// To learn more about the benefits of this model and instructions on how to -// opt-in, read http://bit.ly/CRA-PWA - -const isLocalhost = Boolean( - window.location.hostname === 'localhost' || - // [::1] is the IPv6 localhost address. - window.location.hostname === '[::1]' || - // 127.0.0.1/8 is considered localhost for IPv4. - window.location.hostname.match( - /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ - ) -); - -export function register(config) { - if ('serviceWorker' in navigator) { - console.log("The URL constructor is available in all browsers that support SW") - const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); - if (publicUrl.origin !== window.location.origin) { - console.log("Our service worker won't work if PUBLIC_URL is on a different origin from what our page is served on.") - return; - } - - window.addEventListener('load', () => { - const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; - console.log('Loading event...') - if (isLocalhost) { - // This is running on localhost. Let's check if a service worker still exists or not. - checkValidServiceWorker(swUrl, config); - - // Add some additional logging to localhost, pointing developers to the - // service worker/PWA documentation. - navigator.serviceWorker.ready.then(() => { - console.log( - 'This web app is being served cache-first by a service ' + - 'worker. To learn more, visit http://bit.ly/CRA-PWA' - ); - }); - } else { - // Is not localhost. Just register service worker - registerValidSW(swUrl, config); - } - }); - } -} - -function registerValidSW(swUrl, config) { - navigator.serviceWorker - .register(swUrl) - .then(registration => { - registration.onupdatefound = () => { - const installingWorker = registration.installing; - if (installingWorker == null) { - return; - } - installingWorker.onstatechange = () => { - if (installingWorker.state === 'installed') { - if (navigator.serviceWorker.controller) { - // At this point, the updated precached content has been fetched, - // but the previous service worker will still serve the older - // content until all client tabs are closed. - console.log( - 'New content is available and will be used when all ' + - 'tabs for this page are closed. See http://bit.ly/CRA-PWA.' - ); - - // Execute callback - if (config && config.onUpdate) { - config.onUpdate(registration); - } - } else { - // At this point, everything has been precached. - // It's the perfect time to display a - // "Content is cached for offline use." message. - console.log('Content is cached for offline use.'); - - // Execute callback - if (config && config.onSuccess) { - config.onSuccess(registration); - } - } - } - }; - }; - }) - .catch(error => { - console.error('Error during service worker registration:', error); - }); -} - -function checkValidServiceWorker(swUrl, config) { - // Check if the service worker can be found. If it can't reload the page. - fetch(swUrl) - .then(response => { - // Ensure service worker exists, and that we really are getting a JS file. - const contentType = response.headers.get('content-type'); - if ( - response.status === 404 || - (contentType != null && contentType.indexOf('javascript') === -1) - ) { - // No service worker found. Probably a different app. Reload the page. - navigator.serviceWorker.ready.then(registration => { - registration.unregister().then(() => { - window.location.reload(); - }); - }); - } else { - // Service worker found. Proceed as normal. - registerValidSW(swUrl, config); - } - }) - .catch(() => { - console.log( - 'No internet connection found. App is running in offline mode.' - ); - }); -} - -export function unregister() { - if ('serviceWorker' in navigator) { - navigator.serviceWorker.ready.then(registration => { - registration.unregister(); - }); - } -} diff --git a/setupTests.js b/setupTests.js deleted file mode 100755 index 330f214a..00000000 --- a/setupTests.js +++ /dev/null @@ -1,6 +0,0 @@ -const Enzyme = require('enzyme'); -// this is where we reference the adapter package we installed -// earlier -const EnzymeAdapter = require('enzyme-adapter-react-16'); -// This sets up the adapter to be used by Enzyme -Enzyme.configure({ adapter: new EnzymeAdapter() }); \ No newline at end of file diff --git a/src/@app/app.js b/src/@app/app.js deleted file mode 100644 index 0ebf7934..00000000 --- a/src/@app/app.js +++ /dev/null @@ -1,717 +0,0 @@ -import * as Endpoints from 'globals/endpoints/index.js' -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 config from 'config' -import './libs.js' - -export * from '../../config/app.settings.js' -export * from './libs.js' -export * from 'utils' - -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, - stage: package_json.stage, - name: package_json.title, - version: package_json.version, - logo: config.FullLogoPath, - logo_dark: config.DarkFullLogoPath, -} - -localforage.config({ - name: UUAID, - version: 1.0, - size: 4980736, - storeName: package_json.name, -}) - -/** - * Convert a base64 string in a Blob according to the data and contentType. - * - * @param b64Data {String} Pure base64 string without contentType - * @param contentType {String} the content type of the file i.e (image/jpeg - image/png - text/plain) - * @param sliceSize {Int} SliceSize to process the byteCharacters - * @return Blob - */ -export function b64toBlob(b64Data, contentType, sliceSize) { - contentType = contentType || '' - sliceSize = sliceSize || 512 - - var byteCharacters = atob(b64Data) - var byteArrays = [] - - for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) { - var slice = byteCharacters.slice(offset, offset + sliceSize) - - var byteNumbers = new Array(slice.length) - for (var i = 0; i < slice.length; i++) { - byteNumbers[i] = slice.charCodeAt(i) - } - - var byteArray = new Uint8Array(byteNumbers) - - byteArrays.push(byteArray) - } - - var blob = new Blob(byteArrays, { type: contentType }) - return blob -} - -/** - * Convert a file in a B64 string according to the file. - * - * @param file {object} Raw File object - * @return b64 {string} - */ -export function ReadFileAsB64(file, callback) { - if (file) { - var reader = new FileReader() - reader.onload = function(readerEvt) { - var binaryString = readerEvt.target.result - const a = `data:image/png;base64, ${btoa(binaryString)}` - return callback(a) - } - reader.readAsBinaryString(file) - } -} - -/** - * Handle temporal file uploads - * - * @param file {object} Raw File object - * @return boolean - */ -export function uploadFile(file) { - var formData = new FormData() - formData.append('userfile', file) - var request = new XMLHttpRequest() - request.onload = function() { - if (request.status == 200) { - return true - } else { - alert('Error! Upload failed') - } - } - request.open('POST', '/temp/file') - request.send(formData) -} - -/** - * Return the value of an object from array - * - * @param payload {object} data: (array) | key: (string for return the value) - * @return {string} Boolean value - */ -export function ReturnValueFromMap(payload) { - if (!payload) return false - const { data, key } = payload - try { - const a = data.map(item => { - return item.key === key ? item.value : null - }) - const b = a.filter(Boolean) - return b.toString() - } catch (error) { - return false - } -} - -/** - * (HELPER) Convert the localStorage values (AppSettings) parsed - * - * @param e {String} String of SettingID for search - * @return {string} Boolean value - */ -export function SettingStoragedValue(e) { - try { - const fromStorage = JSON.parse(localStorage.getItem('app_settings')) - const Ite = fromStorage.map(item => { - return item.SettingID === e ? item.value : null - }) - const fr = Ite.filter(Boolean) - return fr.toString() - } catch (error) { - return null - } -} - -/** - * Return the last object from array - * - * @param array {array} - * @return object - */ -export function objectLast(array, n) { - if (array == null) return void 0 - if (n == null) return array[array.length - 1] - return array.slice(Math.max(array.length - n, 0)) -} - -/** - * Remove an element by id from an array - * - * @param array {array} - * @param value {string} - * @return object - */ -export function arrayRemoveByID(arr, value) { - return arr.filter(function(ele) { - 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' - * - * @param e {int} Numeric boolean reference - * @return {bool} Boolean value - */ -export function booleanFix(e) { - if (e == 1) return true - return false -} - - -/** - * Handle time basic functions - * - */ -export const time = { - ago: a => { - const format = moment(a).format('DDMMYYYY') - const b = new Date(format).toLocaleString() - return time.relativeToNow(b) - }, - stmToAgo: a => { - const b = a * 1000 - return format(b) - }, - relativeToNow: (a, b) => { - return moment(a, b || 'DDMMYYYY').fromNow() - }, -} - - -/** - * User console with setting user permissions - * - * @param ... {any} Use for type of console - */ -export const yconsole = { - log: (...cont) => { - SettingStoragedValue('force_showDevLogs') ? console.log(...cont) : null - return - }, - debug: (...cont) => { - SettingStoragedValue('force_showDevLogs') ? console.debug(...cont) : null - return - }, - error: (...cont) => { - SettingStoragedValue('force_showDevLogs') ? console.error(...cont) : null - return - }, - warn: (...cont) => { - SettingStoragedValue('force_showDevLogs') ? console.warn(...cont) : null - return - }, -} - -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 - * - */ -export function requestFullscreen() { - var elem = document.documentElement - if (elem.requestFullscreen) { - elem.requestFullscreen() - } else if (elem.mozRequestFullScreen) { - /* Firefox */ - elem.mozRequestFullScreen() - } else if (elem.webkitRequestFullscreen) { - /* Chrome, Safari and Opera */ - elem.webkitRequestFullscreen() - } else if (elem.msRequestFullscreen) { - /* IE/Edge */ - 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/flags.js b/src/@app/flags.js deleted file mode 100644 index b3083de3..00000000 --- a/src/@app/flags.js +++ /dev/null @@ -1,33 +0,0 @@ -// ERROR FLAGS CODES -const flags = { - CRITICAL_ERROR: 1000, - EXCEPTION_ERROR: 1010, - WARNING_ERROR: 1020, - - API_FAIL: 100, - API_BADRESPONSE: 110, - API_BADCREDENTIAL: 120, -} - -function flag_handle(flag, ...pass){ - if (!flag) return false - switch (flag) { - case flags.CRITICAL_ERROR: - const CRITICAL_ERROR = `${flags.CRITICAL_ERROR} | ${JSON.stringify(...pass)}` - console.error(CRITICAL_ERROR) - throw new Error(CRITICAL_ERROR) - case flags.EXCEPTION_ERROR: - const EXCEPTION_ERROR = `${flags.EXCEPTION_ERROR} | ${JSON.stringify(...pass)}` - console.warn(EXCEPTION_ERROR) - return - case flags.WARNING_ERROR: - const WARNING_ERROR = `${flags.WARNING_ERROR} | ${JSON.stringify(...pass)}` - console.warn(WARNING_ERROR) - return - default: - break; - } -} - -module.exports.flags = flags -module.exports.flags_handle = flag_handle \ No newline at end of file diff --git a/src/@app/libs.js b/src/@app/libs.js deleted file mode 100644 index 024e6f07..00000000 --- a/src/@app/libs.js +++ /dev/null @@ -1,6 +0,0 @@ -// List of modules used for this app -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'; -export * from './libs/apis/pre.js' \ No newline at end of file diff --git a/src/@app/libs/api_call/api_call.js b/src/@app/libs/api_call/api_call.js deleted file mode 100644 index feb85c14..00000000 --- a/src/@app/libs/api_call/api_call.js +++ /dev/null @@ -1,94 +0,0 @@ -import jquery from 'jquery' -import * as app from 'app' - -export function API_Call(callback, endpoint, payload, options, __token) { - var prefix = `[API_Call] ` - if (!endpoint) return false - if (!payload) { - app.yconsole.log(prefix, 'Calling api without Payload!!!') - } - let payloadContainer = payload ? payload : new FormData() - payloadContainer.append('server_key', app.__server.getKey()) - - - const defaultOptions = { - method: 'POST', - timeout: 0, - processData: false, - includeUserID: false, - override__token: false, - disabledToken: false, - } - - let fendpoint - let method = defaultOptions.method - let timeout = defaultOptions.timeout - let processData = defaultOptions.processData - let includeUserID = defaultOptions.includeUserID - let override__token = defaultOptions.override__token - let disabledToken = defaultOptions.disabledToken - - if (options) { - options.method ? (method = options.method) : null - options.timeout ? (timeout = options.timeout) : null - options.processData ? (processData = true) : null - options.includeUserID ? (includeUserID = options.includeUserID) : null - options.override__token ? (override__token = options.override__token) : null - options.disabledToken ? (disabledToken = options.disabledToken) : null - } - - if (disabledToken) { - app.yconsole.log(`${prefix} Dimmissing the token generation`) - fendpoint = `${endpoint}` - } - - if (!disabledToken && !override__token) { - fendpoint = `${endpoint}?access_token=${app.token_data.__token()}` - } - - if (override__token || __token) { - if (!__token) { - app.yconsole.log(`${prefix} Missing Overriding __token`) - return - } - app.yconsole.log(`${prefix} Overriding __token => ${__token}`) - fendpoint = `${endpoint}?access_token=${__token}` - } - - if (includeUserID) { - payloadContainer.append('user_id', app.token_data.__id()) - } - - const requestOptions = { - url: fendpoint, - method: method, - timeout: timeout, - data: payloadContainer, - mimeType: 'multipart/form-data', - processData: processData, - contentType: false, - } - - jquery - .ajax(requestOptions) - .done(response => { - try { - const a = JSON.parse(response)['api_status'] - if (a == '404') { - app.api_err.tokenError(response) - } - } catch (error) { - app.yconsole.log( - '[VIOLATION] The status of the request has not been identified!' - ) - app.api_err.violation() - } - app.yconsole.debug(response) - return callback(false, response) - }) - .fail(error => { - app.yconsole.debug(`${prefix} (ERROR) `, error) - app.api_err.fail(error) - return callback(true, error) - }) -} diff --git a/src/@app/libs/api_call/pre.js b/src/@app/libs/api_call/pre.js deleted file mode 100644 index 37910210..00000000 --- a/src/@app/libs/api_call/pre.js +++ /dev/null @@ -1,34 +0,0 @@ -import * as app from 'app' -export * from './api_call.js' -import keys from '../../../../config/keys.js' - -export const api_err = { - fail: a => { - if (a) { - app.yconsole.log(a) - app.notify.error(a) - } - }, - tokenError: a => { - app.notify.expire( - 'It seems that your token has expired or no longer exists' - ) - app.router.go('login') - }, - violation: a => { - app.notify.expire( - 'It seems that there has been a problem with your token, we need you to log in again.' - ) - app.router.go('login') - }, -} - -export const __server = { - getKey: () => { - return keys.server_key - }, -} - -export function gen_endpoint(endpoint) { - return `${app.AppSettings.__global_server_prexif}${endpoint}` -} diff --git a/src/@app/libs/apis/pre.js b/src/@app/libs/apis/pre.js deleted file mode 100644 index d2146fb9..00000000 --- a/src/@app/libs/apis/pre.js +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 98a45260..00000000 --- a/src/@app/libs/apis/unsplash.js +++ /dev/null @@ -1,16 +0,0 @@ -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/pre.js b/src/@app/libs/app_functions/pre.js deleted file mode 100644 index d045ff3a..00000000 --- a/src/@app/libs/app_functions/pre.js +++ /dev/null @@ -1,200 +0,0 @@ -import { transitionToogle } from '../../../pages/login' -import { SetControls, CloseControls } from 'components/Layout/ControlBar' - -import umiRouter from 'umi/router' -import * as app from 'app' -import * as antd from 'antd' -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 {RenderFeed} - -export const ControlBar = { - set: e => { - SetControls(e) - }, - close: () => { - CloseControls() - }, -} - -export const router = { - go: e => { - goTo.element('primaryContent') - umiRouter.push({ - pathname: `/${e}`, - search: window.location.search, - }) - }, - push: e => { - umiRouter.push({ - pathname: `/${e}`, - search: window.location.search, - }) - }, - goprofile: () => { - goTo.element('primaryContent') - umiRouter.push({ - pathname: `/@${app.userData().username}`, - search: window.location.search, - }) - } -} - -export const goTo = { - top: (id)=> { - const element = document.getElementById(id) - element.scrollTop = element.scrollHeight + element.clientHeight - }, - bottom: (id) => { - const element = document.getElementById(id) - element.scrollTop = element.scrollHeight - element.clientHeight - }, - element: (element) => { - try { - document.getElementById(element).scrollIntoView() - } catch (error) { - console.debug(error) - return false - } - } - -} - -export const app_session = { - login: (callback, payload) => { - if (!payload) { - return false - } - const { EncUsername, EncPassword } = payload - - let username = atob(EncUsername) - let password = atob(EncPassword) - - const containerpayload = { username, password } - app.yulio_id.auth((err, res) => { - if (err) { - return false - } - try { - var identState = JSON.parse(res)['api_status'] - if (identState == 200) { - const UserID = JSON.parse(res)['user_id'] - const UserToken = JSON.parse(res)['access_token'] - - const preframepayload = { user_token: UserToken, user_id: UserID} - app.yulio_id.getData( - (err, res) => { - if (err) { - return false - } - - let framepayload = { token: { UserID, UserToken }, sdcp: res } - app.yconsole.log('FRAME ', framepayload) - - app.__CTID_GEN((err, res) => { - if (err) { - app.notify.error('Critical error, token declined!') - return false - } - app._app.setup() - callback(null, '200') - }, framepayload) - }, - preframepayload - ) - } - if (identState == 400) { - callback(null, '400') - } - } catch (error) { - console.log(error) - callback(true, '500') - app.notify.error('Server bad response') - } - }, containerpayload) - }, - logout: () => { - app.yulio_id.logout((err, res) => { - if (err) { - return false - } - console.log(res) - const api_state = JSON.parse(res)['api_status'] - app.yconsole.log(`Exit with => ${api_state}`) - if (api_state == '404') { - antd.notification.open({ - placement: 'topLeft', - message: 'Unexpectedly failed logout in YulioID™ ', - description: - 'It seems that your token has been removed unexpectedly and could not log out from YulioID ', - icon: , - }) - app.yconsole.log('Failed logout with YulioID™', res) - } else { - app.yconsole.log('Successful logout with YulioID™', res) - } - // Runtime after dispatch API - app.token_data.remove() - app.router.push('login') - }) - }, -} - -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/comty_data.js b/src/@app/libs/comty_ng/comty_data.js deleted file mode 100644 index 93524849..00000000 --- a/src/@app/libs/comty_ng/comty_data.js +++ /dev/null @@ -1,87 +0,0 @@ -import { API_Call, gen_endpoint } from 'app' - -export const comty_data = { - sessions: (callback) => { - let formdata = new FormData() - formdata.append('type', 'get') - - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("sessions"), - formdata - ) - }, - session_id: callback => { - let formdata = new FormData() - formdata.append('type', 'get') - - API_Call((err,res) => { - if (err) return false - try { - const a = JSON.parse(res)['data'] - return callback(err, a.session_id) - } catch (error) { - return callback(err, '0x0000') - } - }, - gen_endpoint("session_id"), - formdata) - }, - session: (callback) => { - let formdata = new FormData() - formdata.append('type', 'get') - - API_Call((err,res) => { - return callback(err, res) - }, - gen_endpoint("session_id"), - formdata) - }, - general_data: (callback, payload) => { - let formdata = new FormData(); - let callOptions = { includeUserID: false }; - - if (!payload) { - callOptions = { includeUserID: true } - formdata.append('fetch', 'notifications,friend_requests,pro_users,promoted_pages,trending_hashtag,count_new_messages') - } - - if (payload) { - payload.user_id? formdata.append('user_id', payload.user_id) : null - payload.fetch? formdata.append('fetch', payload.fetch) : null - } - - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("get-general-data"), - formdata, callOptions - ) - - }, - get_user_data: (callback, payload) => { - let formdata = new FormData(); - let callOptions = { includeUserID: false }; - - if (!payload) { - callOptions = { includeUserID: true } - formdata.append('fetch', 'user_data') - } - - if (payload) { - payload.user_id? formdata.append('user_id', payload.user_id) : null - payload.fetch? formdata.append('fetch', payload.fetch) : null - } - - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint('get-user-data'), - formdata, callOptions - ) - } -} diff --git a/src/@app/libs/comty_ng/comty_post.js b/src/@app/libs/comty_ng/comty_post.js deleted file mode 100644 index 23c284ee..00000000 --- a/src/@app/libs/comty_ng/comty_post.js +++ /dev/null @@ -1,216 +0,0 @@ -import { API_Call, endpoints, AppSettings, yconsole, gen_endpoint} from 'app' - -export const comty_post = { - getFeed: (callback, payload) => { - if (!payload) { - return false - } - const { fkey, type, id } = payload - - let formdata = new FormData() - formdata.append('after_post_id', fkey || 0) - formdata.append('limit', AppSettings.limit_post_catch || 20) - switch (type) { - case 'feed': - formdata.append('type', 'get_news_feed') - break - case 'user': - formdata.append('type', 'get_user_posts') - formdata.append('id', id) - break - default: - formdata.append('type', 'get_news_feed') - break - } - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("posts"), - formdata - ) - }, - get: (callback, payload) => { - if (!payload) { - return false - } - const { post_id, fetch } = payload - - let formdata = new FormData() - formdata.append('post_id', post_id) - formdata.append( - 'fetch', - fetch || 'post_data,post_comments,post_wondered_users,post_liked_users' - ) - - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("get-post-data"), - formdata - ) - }, - new: (callback, payload) => { - if (!payload) { - return false - } - const { privacy, text, file } = payload - - let formdata = new FormData() - formdata.append('type', 'new_post') - formdata.append('postPrivacy', privacy) - formdata.append('postText', text) - file ? formdata.append('uploadFile', file) : null - - const callOptions = { includeUserID: true } - API_Call( - (err, res) => { - return callback(err, res) - }, - // UNIQUE API !!! - endpoints.comty_endpoints.new_post, - formdata, - callOptions - ) - }, - delete: (callback, payload) => { - if (!payload) { - return false - } - const { post_id } = payload - - let formdata = new FormData() - formdata.append('action', 'delete') - formdata.append('post_id', post_id) - - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("post-actions"), - formdata - ) - }, - save: (callback, payload) => { - if (!payload) { - return false - } - const { post_id } = payload - - let formdata = new FormData() - formdata.append('action', 'save') - formdata.append('post_id', post_id) - - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("post-actions"), - formdata - ) - }, - like: (callback, payload) => { - if (!payload) { - return false - } - const { post_id } = payload - - let formdata = new FormData() - formdata.append('action', 'like') - formdata.append('post_id', post_id) - - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("post-actions"), - formdata - ) - }, - hashtag: (callback, payload) => { - if (!payload) return false - const { hashtag } = payload - // DOING - - }, - getSaved: (callback, payload) => { - if (!payload) { - yconsole.log( - 'Calling api without Payload!!! | Limmit & OffsetKey = default |' - ) - } - if (payload) { - const { limit, fkey } = payload - } - - let formdata = new FormData() - formdata.append('type', 'saved') - formdata.append('limit', payload? limit : AppSettings.limit_post_catch || 20) - formdata.append('after_post_id', payload? fkey : 0) - - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("posts"), - formdata - ) - }, - edit: (callback, payload) => {}, - __pin: (callback, payload) => {}, - __boost: (callback, payload) => { - if (!payload) { - return false - } - const { post_id } = payload - - let formdata = new FormData() - formdata.append('action', 'boost') - formdata.append('post_id', post_id) - - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("post-actions"), - formdata - ) - }, - __disableComments: (callback, payload) => { - if (!payload) { - return false - } - const { post_id } = payload - - let formdata = new FormData() - formdata.append('action', 'disable_comments') - formdata.append('post_id', post_id) - - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("post-actions"), - formdata - ) - }, - __report: (callback, payload) => { - if (!payload) { - return false - } - const { post_id } = payload - - let formdata = new FormData() - formdata.append('action', 'report') - formdata.append('post_id', post_id) - - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("post-actions"), - formdata - ) - }, -} diff --git a/src/@app/libs/comty_ng/comty_post_comment.js b/src/@app/libs/comty_ng/comty_post_comment.js deleted file mode 100644 index 6d8193c5..00000000 --- a/src/@app/libs/comty_ng/comty_post_comment.js +++ /dev/null @@ -1,41 +0,0 @@ -import { API_Call, gen_endpoint } from 'app' - -export const comty_post_comment = { - delete: (callback, payload) => { - if (!payload) { - return false - } - const { comment_id } = payload - - let formdata = new FormData() - formdata.append('type', 'delete') - formdata.append('comment_id', comment_id) - - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("comments"), - formdata - ) - }, - new: (callback, payload) => { - if (!payload) { - return false - } - const { post_id, raw_text } = payload - - let formdata = new FormData() - formdata.append('action', 'comment') - formdata.append('post_id', post_id) - formdata.append('text', raw_text) - - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("post-actions"), - formdata - ) - }, -} diff --git a/src/@app/libs/comty_ng/comty_search.js b/src/@app/libs/comty_ng/comty_search.js deleted file mode 100644 index bc4ada32..00000000 --- a/src/@app/libs/comty_ng/comty_search.js +++ /dev/null @@ -1,23 +0,0 @@ -import { API_Call, gen_endpoint } from 'app' - -export const comty_search = { - keywords: (callback, payload) => { - if (!payload) { - return false - } - const { key } = payload - - let formdata = new FormData() - formdata.append('search_key', key) - - const callOptions = { timeout: 10000 } - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("search"), - formdata, - callOptions - ) - }, -} diff --git a/src/@app/libs/comty_ng/comty_user.js b/src/@app/libs/comty_ng/comty_user.js deleted file mode 100644 index bca43b4a..00000000 --- a/src/@app/libs/comty_ng/comty_user.js +++ /dev/null @@ -1,109 +0,0 @@ -import { API_Call, get_early, gen_endpoint } from 'app' - -export const comty_user = { - setData: () => {}, - data: { - avatar: (callback,key) => { - if(!key) return false - - try { - const payload = {username: key} - get_early.user((err,res) => { - const d = JSON.parse(res)['data'] - return callback(d.avatar) - },payload) - - } catch (error) { - return false - } - - - }, - - }, - getFollowers: (callback, payload) => { - if (!payload)return false - const { user_id } = payload - - let formdata = new FormData() - formdata.append('user_id', user_id) - formdata.append('fetch', 'followers') - - API_Call( - (err,res) => { - return callback(err,res) - }, - gen_endpoint('get-user-data'), - formdata - ) - }, - follow: (callback, payload) => { - if (!payload) { - return false - } - const { user_id } = payload - - let formdata = new FormData() - formdata.append('user_id', user_id) - - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("follow-user"), - formdata - ) - }, - block: (callback, payload) => { - if (!payload) { - return false - } - const { user_id, block_action } = payload - let formdata = new FormData() - formdata.append('user_id', user_id) - formdata.append('block_action', block_action) - - API_Call((err,res)=>{ - return callback(err,res) - }, - gen_endpoint('block-user'), - formdata - ) - }, - find: (callback, payload) => { - if (!payload) { - return false - } - const { key } = payload - - let formdata = new FormData() - formdata.append('search_key', key) - - const callOptions = { timeout: 10000 } - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("find_user"), - formdata, - callOptions - ) - }, - __tags: (callback, payload) => { - if (!payload) { - return false - } - const { id } = payload - - let formdata = new FormData() - formdata.append('user_id', id) - - API_Call( - (err, res) => { - return callback(err, res) - }, - gen_endpoint("user_tags"), - formdata - ) - }, -} diff --git a/src/@app/libs/comty_ng/pre.js b/src/@app/libs/comty_ng/pre.js deleted file mode 100644 index 15577525..00000000 --- a/src/@app/libs/comty_ng/pre.js +++ /dev/null @@ -1,119 +0,0 @@ -import { token_data } from 'app' -import * as Icons from 'components/Icons' - -export * from './comty_post.js' -export * from './comty_user.js' -export * from './comty_post_comment.js' -export * from './comty_search.js' -export * from './comty_data.js' - -export const IsThisPost = { - owner: (post_uid) => { - const a = token_data.__id() - if (post_uid == a) { - return true - } - return false - }, - boosted: () => { - - }, - saved: () => { - - }, - pinned: () => { - - }, - flagged: () => { - - } -} - -export const GetPostPrivacy = { - bool: (e) => { - switch (e) { - case 'any': - return '0' - case 'only_followers': - return '1' - case 'only_follow': - return '2' - case 'private': - return '3' - default: - return '0' - } - }, - decorator: (e) => { - switch (e) { - case 'any': - return Share with everyone - case 'only_follow': - return Share with people I follow - case 'only_followers': - return Share with people follow me - case 'private': - return Dont share, only me - default: - return Unknown - } - }, - -} - -import * as app from 'app' -import * as antd from 'antd' -import io from 'socket.io-client' -import config from 'config' - -const prefix = '[Yulio Sync]' -var endpoint = config.sync_server; - -export const sync = { - listen: (callback) => { - let active = true; - if (active){ - let conn_overrun_tick = 0; - const socket = io(endpoint); - socket.on('connect_error', (error) => { - conn_overrun_tick ++ - app.yconsole.log('Overrun tick => ',conn_overrun_tick) - if (conn_overrun_tick == 1) { - antd.notification.open({ - duration: 5, - message: 'Disconected from server!', - description: 'Attempting to reconnect...', - icon: , - }); - } - if (conn_overrun_tick == app.AppSettings.Maximun_tick_overrun) { - active = false; - } - }); - socket.on('connect', () => { - conn_overrun_tick = 0 - // antd.message.success('Connected to the server') - }); - - socket.on('pull_event', function (data) { - console.log('SOCKET => ',data) - callback(data) - }); - }else{ - console.log(prefix,' Offline Mode') - } - - }, - FeedListen: (callback) => { - const socket = io(`${endpoint}/feed`); - - socket.on('pull_event', function (data) { - console.log(data) - callback(data) - }); - }, - emmitPost: (last_id) => { - const socket = io(`${endpoint}/feed`); - socket.emit('push_event', last_id); - } -} \ No newline at end of file diff --git a/src/@app/libs/yulio_id/ctid_gen.js b/src/@app/libs/yulio_id/ctid_gen.js deleted file mode 100644 index 18cf2994..00000000 --- a/src/@app/libs/yulio_id/ctid_gen.js +++ /dev/null @@ -1,34 +0,0 @@ -import * as app from 'app' -/** - * Cookies Token ID Generator - * - * @callback {func} return with (err,res) model - * @payload {object} Payload data - */ -export async function __CTID_GEN(callback, payload) { - const { token, sdcp } = payload - - const { UserID, UserToken } = token - - const { avatar, admin, pro, dev, is_pro, username } = sdcp - - const frame = { - UserID, - UserToken, - avatar, - admin, - pro, - dev, - is_pro, - username, - exp: app.AppSettings.SignForNotExpire - ? 0 - : Math.floor(Date.now() / 1000) + 60 * 60, - } - console.log(frame) - app.token_data.set(frame, done => { - done ? callback(false, true) : callback(true, false) - }) -} - - diff --git a/src/@app/libs/yulio_id/pre.js b/src/@app/libs/yulio_id/pre.js deleted file mode 100644 index 7b670762..00000000 --- a/src/@app/libs/yulio_id/pre.js +++ /dev/null @@ -1,114 +0,0 @@ -import * as app from 'app' - -// EXPORT PUBLIC WORKERS -export * from './token_data.js' -export * from './ctid_gen.js' -export * from './validate.js' - -export function userData() { - return app.token_data.get() -} - -export const IsThisUser = { - admin: () => { - return app.booleanFix(app.userData().admin) ? true : false - }, - dev: () => { - return app.booleanFix(app.userData().dev) ? true : false - }, - pro: () => { - return app.booleanFix(app.userData().is_pro) ? true : false - }, - nsfw: () => { - return app.booleanFix(app.userData().nsfw) ? true : false - }, - same: a => { - if (a == app.userData().UserID) { - return true - } - return false - }, -} - -export const get_early = { - user: (callback, payload)=>{ - if (!payload) { - return false - } - const { username } = payload - let formdata = new FormData() - formdata.append('username', username) - - const callOptions = { timeout: 10000 } - app.API_Call( - (err, res) => { - return callback(err, res) - }, - app.gen_endpoint('early_user'), - formdata, - callOptions - ) - } -} - -export const yulio_id = { - auth: (callback, payload) => { - if (!payload) return false - const { username, password } = payload - - const formdata = new FormData() - formdata.append('username', username) - formdata.append('password', password) - - const callOptions = { disabledToken: true } - app.API_Call( - (err, res) => { - return callback(err, res) - }, - app.gen_endpoint('auth'), - formdata, - callOptions - ) - }, - logout: callback => { - app.API_Call( - (err, res) => { - return callback(err, res) - }, - app.gen_endpoint('delete-access-token'), - null - ) - }, - verify: (callback, payload) => { - // TO DO - }, - sign: (callback, payload) => { - // TO DO - }, - getData: (callback, payload) => { - if (!payload) return false - const { user_token, user_id } = payload - const formdata = new FormData() - formdata.append('fetch', 'user_data') - formdata.append('user_id', user_id) - - const optionCall = { override__token: true } - app.API_Call( - (err, res) => { - try { - let a = JSON.parse(res)['user_data'] - return callback(err, a) - } catch (error) { - return callback(true, error) - } - }, - app.gen_endpoint('get-user-data'), - formdata, - optionCall, - user_token - ) - }, - setData: () => { - // TO DO - }, -} \ No newline at end of file diff --git a/src/@app/libs/yulio_id/token_data.js b/src/@app/libs/yulio_id/token_data.js deleted file mode 100644 index 5b7fb99c..00000000 --- a/src/@app/libs/yulio_id/token_data.js +++ /dev/null @@ -1,44 +0,0 @@ -import * as app from 'app' - -import Cookies from 'ts-cookies' -import {server_key} from '../../../../config/keys.js' -var jwt = require('jsonwebtoken') - -export const token_data = { - set: (value, callback) => { - jwt.sign(value, server_key, (err, token) => { - err ? null : Cookies.set('cid', token) - return callback(true) - }) - }, - getRaw: () => { - return Cookies.get('cid') - }, - get: () => { - let final = - jwt.decode(Cookies.get('cid')) || - jwt.decode(localStorage.getItem('last_backup')) - const a = jwt.decode(Cookies.get('cid')) - const b = jwt.decode(localStorage.getItem('last_backup')) - if (!a && !b) { - final = false - return final - } - if (!a) { - final = b - } - if (!b) { - final = a - } - return final - }, - remove: () => { - Cookies.remove('cid') - }, - __token: () => { - return app.token_data.get().UserToken - }, - __id: () => { - return app.token_data.get().UserID - }, -} diff --git a/src/@app/libs/yulio_id/validate.js b/src/@app/libs/yulio_id/validate.js deleted file mode 100644 index 5c699be3..00000000 --- a/src/@app/libs/yulio_id/validate.js +++ /dev/null @@ -1,64 +0,0 @@ -import * as app from 'app' -import Cookies from 'ts-cookies' -var jwt = require('jsonwebtoken') - -export const cid_backup = { - set: () => { - localStorage.setItem('last_backup', Cookies.get('cid')) - }, - get: () => { - localStorage.getItem('last_backup') - } -} - -export const validate = { - session: callback => { - let validtoken = false - const a = Cookies.get('cid') - if (a) { - const modExp = app.AppSettings.SignForNotExpire - const ad = jwt.decode(a) - - let notexp = true // Sets if this is expired (Default is not expired) - let exists = false // Sets if this exist - - ad ? (exists = true) : null - - const tokenExp = ad.exp * 1000 - const tokenExpLocale = new Date(tokenExp).toLocaleString() - const now = new Date().getTime() - - app.yconsole.log( - `TOKEN EXP => ${tokenExp} ${ - modExp ? '( Infinite )' : `( ${tokenExpLocale} )` - } || NOW => ${now}` - ) - - if (modExp == false) { - if (tokenExp < now) { - app.yconsole.log('This token is expired !!!') - notexp = false - } - } - if (notexp && exists) { - validtoken = true - } - } - - if (callback) { - callback(validtoken) - } - return validtoken - }, - backup: () => { - let ValidBackupToken = false - let LastestToken = cid_backup.get() - if (LastestToken) { - let LastestTokenDC = jwt.decode(LastestToken) - if (LastestTokenDC) { - ValidBackupToken = true - } - } - return ValidBackupToken - } -} diff --git a/src/components/App_about/index.js b/src/components/About/index.js old mode 100755 new mode 100644 similarity index 58% rename from src/components/App_about/index.js rename to src/components/About/index.js index 0df90d67..25a79ae7 --- a/src/components/App_about/index.js +++ b/src/components/About/index.js @@ -1,11 +1,13 @@ import React from 'react' import styles from './index.less' -import * as app from 'app' +import { app_info, UUAID, package_json } from 'core' import * as antd from 'antd' +const { logo, name, version, stage } = app_info + export default class App_About extends React.Component { DetectNoNStableBuild() { - if (app.package_json.DevBuild == false) { + if (package_json.DevBuild == false) { return Stable } else { return No Stable @@ -14,13 +16,13 @@ export default class App_About extends React.Component { render() { return (
- + -

{app.AppInfo.name}

- {app.UUAID} +

{name}

+ {UUAID}
- v{app.AppInfo.version} - {app.AppInfo.stage} + v{version} + {stage} {this.DetectNoNStableBuild()}
diff --git a/src/components/App_about/index.less b/src/components/About/index.less old mode 100755 new mode 100644 similarity index 100% rename from src/components/App_about/index.less rename to src/components/About/index.less diff --git a/src/components/HeaderSearch/index.js b/src/components/HeaderSearch/index.js deleted file mode 100755 index 58bb3292..00000000 --- a/src/components/HeaderSearch/index.js +++ /dev/null @@ -1,79 +0,0 @@ -import React, { Component } from 'react' -import * as antd from 'antd' -import * as app from 'app' -import styles from './index.less' -import classnames from 'classnames' -import * as Icons from 'components/Icons' - -export const SetHeaderSearchType = { - disable: () => { - window.HeaderSearchComponent.setState({ searchidden: true }) - }, - enable: () => { - window.HeaderSearchComponent.setState({ searchidden: false }) - }, -} -export default class HeaderSearch extends Component { - constructor(props) { - super(props) - window.HeaderSearchComponent = this - this.state = { - value: '', - searchidden: false, - framelocation: 'primary', - } - } - - openSearcher = () => { - const { value } = this.state - if (value.length < 1) return false - if (value == /\s/) return false - app.SwapMode.openSearch(value); - } - - sendToSearch = () => { - const { value } = this.state - app.router.go(`s/${value}`) - } - - onChange = e => { - const { value } = e.target - this.setState({ value: value }) - if (app.AppSettings.auto_search_ontype == 'true') { - this.autosend() - } - } - - autosend = () => { - let timeout = null - let input = document.getElementById('search_input') - input.addEventListener('keyup', e => { - clearTimeout(timeout) - timeout = setTimeout(() => { - const { value } = this.state - app.router.go(`s/${value}`) - }, 500) - }) - } - - render() { - const { searchidden } = this.state - return ( -
- - } - placeholder=" Search on Comty..." - onChange={this.onChange} - onPressEnter={this.openSearcher} - /> - -
- ) - } -} diff --git a/src/components/HeaderSearch/index.less b/src/components/HeaderSearch/index.less deleted file mode 100755 index 90ab4950..00000000 --- a/src/components/HeaderSearch/index.less +++ /dev/null @@ -1,78 +0,0 @@ -@import '~themes/index.less'; - -.HeaderSearchWrapper { - z-index: 20; - top: 0; - display: flex; - margin: auto; - max-width: 510px; - min-width: 265px; - width: auto; - height: 50px; - - &.hidden { - display: none; - } -} - -.headerSearch { - width: 100%; - height: 100%; - - :global { - .ant-input-affix-wrapper { - height: 100%; - width: 100%; - display: flex; - - - margin: 0; - padding: 0; - - } - - .ant-input-affix-wrapper .ant-input-prefix { - left: 12px; - } - - .ant-input-affix-wrapper { - background-color: transparent !important; - border-color: transparent; - border-radius: 12px; - } - - .ant-input-affix-wrapper>input.ant-input { - padding: 0 0 0 30px; - border: inherit; - outline: inherit; - } - - .ant-input-affix-wrapper .ant-input-prefix, - .ant-input-affix-wrapper .ant-input-suffix { - background-color: transparent !important; - border-color: transparent; - border-radius: 12px; - position: absolute; - top: 50%; - z-index: 2; - display: -ms-flexbox; - display: flex; - -ms-flex-align: center; - align-items: center; - color: rgba(0, 0, 0, .65); - line-height: 0; - -ms-transform: translateY(-50%); - transform: translateY(-50%); - color: #9d9da7 !important; - } - - .ant-input { - border-radius: 12px; - color: #9D9DA7; - background-color: #FFFFFF; - border-color: transparent; - height: 50px; - width: 510px; - } - } -} diff --git a/src/components/Icons/custom.js b/src/components/Icons/custom.js index 0f7317c1..3953bb42 100644 --- a/src/components/Icons/custom.js +++ b/src/components/Icons/custom.js @@ -1,6 +1,6 @@ export const VerifiedBadge = () => ( ) export const Patreon = () => ( - + diff --git a/src/components/Layout/ControlBar/index.js b/src/components/Layout/ControlBar/index.js index fc525438..efe3de80 100644 --- a/src/components/Layout/ControlBar/index.js +++ b/src/components/Layout/ControlBar/index.js @@ -1,7 +1,6 @@ import React from 'react' import * as antd from 'antd' -import * as app from 'app' -import styles from './Control.less' +import styles from './index.less' import classnames from 'classnames' import Radium, { StyleRoot } from 'radium' @@ -35,15 +34,13 @@ class Control extends React.PureComponent { FadeIN: true, } } - DummySetControls = e => { - app.yconsole.log('Controls recived => ', e) + set = e => { if (this.state.Show == false) { this.setState({ FadeIN: true }) } this.setState({ Show: true, RenderFragment: e }) } - DummyCloseControls() { - app.yconsole.log('Closing Control Bar...') + close() { this.setState({ FadeIN: false }) setTimeout(() => this.setState({ Show: false, RenderFragment: null }), 1000) } diff --git a/src/components/Layout/ControlBar/Control.less b/src/components/Layout/ControlBar/index.less similarity index 93% rename from src/components/Layout/ControlBar/Control.less rename to src/components/Layout/ControlBar/index.less index 43fe0437..6a7cae7b 100644 --- a/src/components/Layout/ControlBar/Control.less +++ b/src/components/Layout/ControlBar/index.less @@ -1,4 +1,4 @@ -@import '~themes/index.less'; +@import '~theme/index.less'; .ControlCard { overflow: hidden; diff --git a/src/components/Layout/Overlay/components/component.tsx b/src/components/Layout/Overlay/components/Card_Component.tsx similarity index 100% rename from src/components/Layout/Overlay/components/component.tsx rename to src/components/Layout/Overlay/components/Card_Component.tsx diff --git a/src/components/Layout/Overlay/components/main/__searchBar.js b/src/components/Layout/Overlay/components/cards/__searchBar.js similarity index 79% rename from src/components/Layout/Overlay/components/main/__searchBar.js rename to src/components/Layout/Overlay/components/cards/__searchBar.js index 98d28708..bf8c4a03 100644 --- a/src/components/Layout/Overlay/components/main/__searchBar.js +++ b/src/components/Layout/Overlay/components/cards/__searchBar.js @@ -1,6 +1,6 @@ import React from 'react' -import * as app from 'app' import styles from './__searchBar.less' +import {newSearch} from "core/cores/interface_helper" export default class __searchBar extends React.Component{ state = { @@ -10,15 +10,13 @@ export default class __searchBar extends React.Component{ const { value } = this.state if (value.length < 1) return false if (value == /\s/) return false - app.SwapMode.openSearch(value); + newSearch({ keyword: value }); } onChange = e => { const { value } = e.target this.setState({ value: value }) - if (app.AppSettings.auto_search_ontype == 'true') { - this.autosend() - } } + handleKey = (e) =>{ if (e.key == 'Enter') { this.openSearcher() @@ -30,7 +28,6 @@ export default class __searchBar extends React.Component{ diff --git a/src/components/Layout/Overlay/components/main/__searchBar.less b/src/components/Layout/Overlay/components/cards/__searchBar.less similarity index 97% rename from src/components/Layout/Overlay/components/main/__searchBar.less rename to src/components/Layout/Overlay/components/cards/__searchBar.less index 57f9785a..4d77eaf1 100644 --- a/src/components/Layout/Overlay/components/main/__searchBar.less +++ b/src/components/Layout/Overlay/components/cards/__searchBar.less @@ -1,4 +1,4 @@ -@import '~themes/index.less'; +@import '~theme/index.less'; .search_bar { height: 24px; diff --git a/src/components/Layout/Overlay/components/main/__suggestions.js b/src/components/Layout/Overlay/components/cards/__suggestions.js similarity index 100% rename from src/components/Layout/Overlay/components/main/__suggestions.js rename to src/components/Layout/Overlay/components/cards/__suggestions.js diff --git a/src/components/Layout/Overlay/components/main/__suggestions.less b/src/components/Layout/Overlay/components/cards/__suggestions.less similarity index 100% rename from src/components/Layout/Overlay/components/main/__suggestions.less rename to src/components/Layout/Overlay/components/cards/__suggestions.less diff --git a/src/components/Layout/Overlay/components/main/__trendings.js b/src/components/Layout/Overlay/components/cards/__trendings.js similarity index 100% rename from src/components/Layout/Overlay/components/main/__trendings.js rename to src/components/Layout/Overlay/components/cards/__trendings.js diff --git a/src/components/Layout/Overlay/components/main/__trendings.less b/src/components/Layout/Overlay/components/cards/__trendings.less similarity index 93% rename from src/components/Layout/Overlay/components/main/__trendings.less rename to src/components/Layout/Overlay/components/cards/__trendings.less index 6f9bf2a2..62c96009 100644 --- a/src/components/Layout/Overlay/components/main/__trendings.less +++ b/src/components/Layout/Overlay/components/cards/__trendings.less @@ -1,4 +1,4 @@ -@import '~themes/index.less'; +@import '~theme/index.less'; .trendings{ word-break: break-all; diff --git a/src/components/Layout/Overlay/components/index.js b/src/components/Layout/Overlay/components/index.js index 9e7505cd..4b655452 100644 --- a/src/components/Layout/Overlay/components/index.js +++ b/src/components/Layout/Overlay/components/index.js @@ -1,26 +1,16 @@ +import Primary from './layout/Primary.tsx' +import Secondary from './layout/Secondary.tsx' +import Card_Component from './Card_Component.tsx' - -import Card_Component from './component.tsx' - -import __sec from './layout/__sec.tsx' -import __pri from './layout/__pri.tsx' - -import __searchBar from './main/__searchBar' -import __trendings from './main/__trendings' -import __suggestions from './main/__suggestions' - -import __priPost from './swapper/__priPost' -import __secComments from './swapper/__secComments' -import __priSearch from './swapper/__priSearch' +import __searchBar from './cards/__searchBar' +import __trendings from './cards/__trendings' +import __suggestions from './cards/__suggestions' export { Card_Component, - __sec, - __pri, - __trendings, + Secondary, + Primary, __searchBar, + __trendings, __suggestions, - __priPost, - __secComments, - __priSearch } \ No newline at end of file diff --git a/src/components/Layout/Overlay/components/layout/Primary.tsx b/src/components/Layout/Overlay/components/layout/Primary.tsx new file mode 100644 index 00000000..8413a559 --- /dev/null +++ b/src/components/Layout/Overlay/components/layout/Primary.tsx @@ -0,0 +1,52 @@ +import * as React from 'react' +import * as antd from 'antd' +import * as Icons from 'components/Icons' +import styles from '../../index.less' +import classnames from 'classnames' +import { Swapper } from '../../index.tsx' + +export interface overlay_primary_props { + y?: number; + getRef: React.Ref; + isMobile: boolean; + fragment: any; + mode: string; + closable: boolean; +} + + +const renderExit = ( +
+ } onClick={() => Swapper.closeAll()}> Back +
+) + + +const overlay_primary = (props: overlay_primary_props) => { + const { fragment, mode, isMobile } = props + return ( +
+
+ {props.mode === 'full' || props.mode === 'half'? renderExit : null} + {fragment} +
+
+ ) +} + + +overlay_primary.defaultProps = { + mode: false, + fragment: null, + isMobile: false, + closable: true, + y: 0, +} + +export default overlay_primary \ No newline at end of file diff --git a/src/components/Layout/Overlay/components/layout/__sec.tsx b/src/components/Layout/Overlay/components/layout/Secondary.tsx similarity index 98% rename from src/components/Layout/Overlay/components/layout/__sec.tsx rename to src/components/Layout/Overlay/components/layout/Secondary.tsx index 54606072..43d420ab 100644 --- a/src/components/Layout/Overlay/components/layout/__sec.tsx +++ b/src/components/Layout/Overlay/components/layout/Secondary.tsx @@ -4,7 +4,6 @@ import * as antd from 'antd' import * as Icons from 'components/Icons' import styles from '../../index.less' import classnames from 'classnames' -import reactable from 'reactablejs' export interface __sec_props { y?: number; diff --git a/src/components/Layout/Overlay/components/layout/__pri.tsx b/src/components/Layout/Overlay/components/layout/__pri.tsx deleted file mode 100644 index 5bbe4c77..00000000 --- a/src/components/Layout/Overlay/components/layout/__pri.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import * as React from 'react' -import * as antd from 'antd' -import * as Icons from 'components/Icons' -import styles from '../../index.less' -import classnames from 'classnames' -import reactable from 'reactablejs' - -export interface __pri_props { - y?: number; - getRef: React.Ref; - isMobile: boolean; - functs: any; - render: any; - type: any; -} - -const isOpen = (props: __pri_props) => { - const t_full = props.type === 'full_open'? true : false - const t_half = props.type === 'half'? true: false - if (t_full || t_half ) { - return true - } - return false -} - -const renderExit = (props: __pri_props) => { - const {functs} = props - if (isOpen) { - return
- } onClick={() => functs.Swapper.close()}> Back -
- } - return null -} - - -const __pri = (props: __pri_props) => { - const { render, type, isMobile } = props - const t_full = type == 'full_open'? true : false - const t_half = type == 'half'? true : false - - - return ( -
- -
- {renderExit} - {render} -
-
- ) -} - - -__pri.defaultProps = { - render: null, - y: 0, - isMobile: false, - functs: null, - type: null, -} - -export default __pri \ No newline at end of file diff --git a/src/components/Layout/Overlay/components/swapper/__priPost.js b/src/components/Layout/Overlay/components/swapper/__priPost.js deleted file mode 100644 index 528752c4..00000000 --- a/src/components/Layout/Overlay/components/swapper/__priPost.js +++ /dev/null @@ -1,29 +0,0 @@ -import React from 'react' -import styles from './__priPost.less' - -import * as antd from 'antd' -import * as app from 'app' -import * as Icons from 'components/Icons' -import Icon from '@ant-design/icons' - -import { MediaPlayer, PostCard } from 'components' - -export default class __priPost extends React.PureComponent { - - 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 ( -
-
- -
-
- ) - } - } \ No newline at end of file diff --git a/src/components/Layout/Overlay/components/swapper/__priPost.less b/src/components/Layout/Overlay/components/swapper/__priPost.less deleted file mode 100644 index c882cb91..00000000 --- a/src/components/Layout/Overlay/components/swapper/__priPost.less +++ /dev/null @@ -1,27 +0,0 @@ -@import '~themes/index.less'; - -.contentWrapper { - width: 100%; - 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; - -} - -.contentBody{ - - position: relative; - 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 deleted file mode 100644 index f4ea9af9..00000000 --- a/src/components/Layout/Overlay/components/swapper/__priSearch.js +++ /dev/null @@ -1,120 +0,0 @@ -import React from 'react' -import styles from './__priSearch.less' - -import * as antd from 'antd' -import * as app from 'app' -import Icon from '@ant-design/icons' - -const VerifiedBadge = () => ( - - - -) - -export default class __priSearch extends React.PureComponent { - renderResult = source => { - try { - const Empty = ( -
- -
- ) - - // TO DO: Settings serach & Post Search - const usersParsed = JSON.parse(source)['users'] - const groupsParsed = JSON.parse(source)['groups'] - const pagesParsed = JSON.parse(source)['pages'] - - const users = () => { - if (usersParsed.length >= 1) { - app.yconsole.log('Users => ', usersParsed) - return this.EntryComponent('Users', usersParsed) - } - } - const groups = () => { - if (groupsParsed.length >= 1) { - app.yconsole.log('Groups => ', groupsParsed) - return this.EntryComponent('Groups', groupsParsed) - } - } - const pages = () => { - if (pagesParsed.length >= 1) { - app.yconsole.log('Pages => ', pagesParsed) - return this.EntryComponent('Pages', pagesParsed) - } - } - - if ( - !usersParsed.length >= 1 && - !groupsParsed.length >= 1 && - !pagesParsed.length >= 1 - ) { - return Empty - } - - return [users(), groups(), pages()] - } catch (error) { - return ( -
-

Render Error

-
- ) - } - } - EntryComponent = (t, source) => { - - function goToEntry(e){ - if(!e) return false - app.router.go(`@${e}`) - } - - try { - return ( - -
goToEntry(item.username) }> -
- -

- @{item.username} - {app.booleanFix(item.verified) ? ( - - ) : null} -

- -
-
-

{item.about}

-
-
- } - /> - - ) - } catch (error) { - return ( -
-

Render Error

-
- ) - } - } - render(){ - return( -
- {this.renderResult(this.props.payload)} -
- ) - } - } \ No newline at end of file diff --git a/src/components/Layout/Overlay/components/swapper/__priSearch.less b/src/components/Layout/Overlay/components/swapper/__priSearch.less deleted file mode 100644 index 08aba5d4..00000000 --- a/src/components/Layout/Overlay/components/swapper/__priSearch.less +++ /dev/null @@ -1,58 +0,0 @@ -@import '~themes/index.less'; - -.search_wrapper{ - color: #201F23; - height: 100%; - width: 82%; - margin: auto; - :global{ - .ant-result-title{ - color: #fff; - } - .ant-result-subtitle{ - color: #fff; - - } - .ant-list-items{ - height: 82vh; - overflow: scroll; - } - } - } - - .search_card { - position: relative; - background-color: rgba(255, 255, 255, 0.034); - margin: 10px 0 10px 0; - border-radius: 8px; - padding: 10px; - word-break: break-all; - color: #fff; - cursor: pointer; - - .search_title { - display: flex; - - img { - float: left; - width: 30px; - height: 30px; - border-radius: 12px; - } - - .search_user_username { - margin: 0 5px 0 8px; - vertical-align: middle; - height: 100%; - color: #fff; - line-height: 25px; - } - } - - .search_text { - margin: 10px 0 0 0; - } - - } - - \ No newline at end of file diff --git a/src/components/Layout/Overlay/components/swapper/__secComments.js b/src/components/Layout/Overlay/components/swapper/__secComments.js deleted file mode 100644 index 3fb109d1..00000000 --- a/src/components/Layout/Overlay/components/swapper/__secComments.js +++ /dev/null @@ -1,147 +0,0 @@ -import React from 'react' -import styles from './__secComments.less' -import { SearchCard, Feather } from 'components' - -import * as antd from 'antd' -import * as app from 'app' -import * as Icons from 'components/Icons' -import Icon from '@ant-design/icons' - -const VerifiedBadge = () => ( - - - -) - -export default class __secComments extends React.Component { - state = { - comment_data: this.props.payload, - raw_comment: '', - loading: false, - } - handleDeleteComment(id) { - app.yconsole.log(`Removing Comment with id => ${id}`) - app.comty_post_comment.delete( - (err, res) => { - if (err) { - return false - } - return this.reloadComments() - }, - { comment_id: id } - ) - } - handleNewComment() { - const { raw_comment } = this.state - const { post_id } = this.props - if (raw_comment) { - const payload = { post_id: post_id, raw_text: raw_comment } - app.comty_post_comment.new((err, res) => { - if (err) { - app.notify.error('This action could not be performed.', err) - } - this.setState({ raw_comment: '' }) - return this.reloadComments() - }, payload) - } - return false - } - - renderComment = a => { - const { id, time, Orginaltext, publisher } = a - const CommentMenu = ( - - this.handleDeleteComment(id)} - > - Delete - - - ) - return ( -
-
- -

- @{publisher.username}{' '} - {app.booleanFix(publisher.verified) ? ( - - ) : null} -

- -

e.preventDefault()} - className={styles.comment_user_ago} - > - {app.time.stmToAgo(time)} -

-
-
-
-

{Orginaltext}

-
-
- ) - } - HandleCommentInput = e => { - const { value } = e.target - this.setState({ raw_comment: value }) - } - reloadComments() { - try { - this.setState({ loading: true }) - const payload = { post_id: this.props.post_id } - app.comty_post.get((err, res) => { - const post_comments = JSON.parse(res)['post_comments'] - this.setState({ comment_data: post_comments, loading: false }) - }, payload) - } catch (error) { - return false - } - } - - render() { - const { comment_data, loading } = this.state - - return ( -
-
-

Comments ({comment_data.length})

-
-
- {loading ? ( - - ) : ( - this.renderComment(item)} - /> - )} -
-
-
- this.handleNewComment()} - placeholder="Write a comment..." - allowClear - onChange={this.HandleCommentInput} - /> -
-
-
- ) - } - } \ No newline at end of file diff --git a/src/components/Layout/Overlay/components/swapper/__secComments.less b/src/components/Layout/Overlay/components/swapper/__secComments.less deleted file mode 100644 index bb15e411..00000000 --- a/src/components/Layout/Overlay/components/swapper/__secComments.less +++ /dev/null @@ -1,91 +0,0 @@ -@import '~themes/index.less'; - -.comments_body { - height: 100%; - padding: 50px 10px 10px 20px; - font-family: @__Global_general_font_family; - - .comments_body_title { - font-size: 12px; - - h1 { - font-weight: 550; - letter-spacing: 0.01px; - } - } - - .comments_cards_wrapper { - z-index: 50; - overflow-y: scroll!important; - height: 70vh; //84%; - - .comment_card { - overflow-y: scroll!important; - position: relative; - width: 100%; - max-height: 100px; - word-break: break-all; - margin: 0 0 10px 0; - - .comment_title { - display: flex; - img { - float: left; - width: 30px; - height: 30px; - border-radius: 12px; - } - - .comment_user_username { - margin: 0 5px 0 8px; - vertical-align: middle; - height: 100%; - color: #2d2d2d; - line-height: 25px; - } - - .comment_user_ago { - cursor: pointer; - position: absolute; - right: 0; - text-align: right; - font-size: 9px; - } - } - - - - } - } - - .comment_box { - width: 100%; - bottom: 0; - right: 0; - position: absolute; - z-index: 100; - padding-top: 20px; - padding-bottom: 60px; - border-radius: 0 0 0 32px; - - .comment_box_body { - border-radius: 5px; - width: 85%; - height: 40px; - margin: auto; - background-color: #f8f6f8; - - :global { - - .ant-input-affix-wrapper, - .ant-input { - padding: 4px 5px; - background-color: transparent; - border: 0; - } - } - } - } - - } - \ No newline at end of file diff --git a/src/components/Layout/Overlay/index.js b/src/components/Layout/Overlay/index.js deleted file mode 100644 index 578a4982..00000000 --- a/src/components/Layout/Overlay/index.js +++ /dev/null @@ -1,340 +0,0 @@ -import React from 'react' -import * as app from 'app' -import * as antd from 'antd' -import * as Icons from 'components/Icons' -import styles from './index.less' -import classnames from 'classnames' -import reactable from 'reactablejs' - -import { - __sec, - __pri, - __trendings, - __searchBar, - __suggestions, - __priPost, - __secComments, - __priSearch, -} from './components' - -export const SwapMode = { - loose_focus: () => { - OverlayLayoutComponent.loose_focus() - }, - close: () => { - OverlayLayoutComponent.Swapper.close() - }, - openFragment: (fragment)=>{ - if (!fragment) return false - return OverlayLayoutComponent.setState({ - rd__sec: fragment, - __sec_active: true, - }) - }, - openPost: async (id, content) => { - if (!id) return false - let tmp; - - let promise = new Promise((res, rej) => { - const payload = { post_id: id } - app.comty_post.get((err, response) => { - try { - res(JSON.parse(response)['post_data']) - } catch (error) { - console.log(error) - } - }, payload) - }); - - if (!content){ - tmp = await promise - } - if (content){ - tmp = content - } - - const pdata = <__priPost isMobile={OverlayLayoutComponent.props.isMobile} payload={tmp}/> - - return OverlayLayoutComponent.setState({ - rd__pri: pdata, - __pri_full: true - }) - - }, - openComments: async (id, content) => { - if (!id) return false - let tmp; - - let promise = new Promise((res, rej) => { - const payload = { post_id: id } - app.comty_post.get((err, response) => { - try { - res(JSON.parse(response)['post_comments']) - }catch (error) { - console.log(error) - } - }, payload) - }); - - if (!content){ - tmp = await promise - } - if (content){ - tmp = content - } - - const pdata = <__secComments post_id={id} payload={tmp} /> - return OverlayLayoutComponent.setState({ - rd__sec: pdata, - __sec_active: true, - }) - - }, - openSearch: async (id, content) => { - if (!id) return false - let tmp; - let promise = new Promise((res, rej) => { - const payload = { key: id } - app.comty_search.keywords((err, response) => { - res(response) - }, payload) - }); - - if (!content){ - tmp = await promise; - } - if (content){ - tmp = content; - } - - const pdata =
-

- Results of {id || '... nothing ?'} -

- <__priSearch payload={tmp} /> -
- - return OverlayLayoutComponent.setState({ - rd__pri: pdata, - __pri_half: true, - }) - - }, - -} - -export default class Overlay extends React.PureComponent { - constructor(props) { - super(props), - (window.OverlayLayoutComponent = this), - (this.state = { - loading: true, - gen_data: null, - // Lays - rd__pri: null, - rd__sec: null, - __pri_full: false, - __pri_half: false, - __sec_active: false, - __sec_full: false, - }) - this.setWrapperRef = this.setWrapperRef.bind(this); - this.handleClickOutside = this.handleClickOutside.bind(this); - } - - Swapper = { - close: () => { - this.setState({ - rd__pri: null, - rd__sec: null, - __pri_full: false, - __pri_half: false, - __sec_active: false, - __sec_full: false, - }) - }, - } - - handle_Exit(event) { - if (event.keyCode === 27) { - SwapMode.close() - } - } - - loose_focus(){ - if (this.isOpen()) { - SwapMode.close() - } - } - - handle_genData() { - app.comty_data.general_data((err, res) => { - if (err) return false - try { - const notification_data = JSON.parse(res)['notifications'] - const trending_hashtag = JSON.parse(res)['trending_hashtag'] - this.setState({ - loading: false, - gen_data: res, - notification_data: notification_data, - trending_hashtag: trending_hashtag, - }) - } catch (error) { - console.log(error) - return null - } - }) - } - - isOpen() { - if ( - this.state.__pri_full || - this.state.__pri_half || - this.state.__sec_active || - this.state.__sec_full - ) - return true - return false - } - - - componentDidMount() { - this.handle_genData() - if(this.props.isMobile){ - window.addEventListener('popstate', function(event) { - SwapMode.close() - }, false); - } - } - - componentWillUnmount() { - if(this.props.isMobile){ - document.removeEventListener('popstate', null) - } - document.removeEventListener('keydown', this.handle_Exit, false) - } - - componentDidUpdate() { - if (this.isOpen()) { - document.addEventListener('keydown', this.handle_Exit, false) - document.addEventListener('mousedown', this.handleClickOutside); - - } else { - document.removeEventListener('mousedown', this.handleClickOutside); - } - } - /** - * Set the wrapper ref - */ - setWrapperRef(node) { - this.wrapperRef = node; - } - - /** - * Alert if clicked on outside of element - */ - handleClickOutside(event) { - if (this.wrapperRef && !this.wrapperRef.contains(event.target)) { - SwapMode.close() - } - } - - renderTarget(target) { - try { - switch (target) { - case '__pri': { - const fragment = this.state.rd__pri - if (!fragment && !this.props.isMobile) { - return {this.__main()} - } - return {fragment} - } - case '__sec': { - const fragment = this.state.rd__sec - return <> - {this.props.isMobile?
: null} - {fragment} - - } - default: - return

Invalid Render Target

- } - } catch (error) { - console.log(error) - return null - } - } - renderExit(target){ - if (!target) return null - const { rd__pri, rd__sec } = this.state - const btn =
} onClick={() => this.Swapper.close()}> Back
- if (this.isOpen()) { - switch (target) { - case '__pri':{ - if (rd__pri&&rd__sec) { - return btn - } - if (!rd__sec) { - return btn - } - return null - } - case '__sec':{ - if (!rd__pri && this.props.isMobile) { - return null - } - if (!rd__pri) { - return btn - } - return null - } - default: - return null - } - } - return null - } - __main(){ - const fragment = this.state.rd__pr - if (!fragment && !this.props.isMobile) { - return ( - - -
<__searchBar />
-
<__trendings data={this.state.trending_hashtag} />
-
<__suggestions />
- -
- ) - } - - } - render() { - const { userData, isMobile } = this.props - const __sec_functs = (this.Swapper) - if (!this.state.loading) - return ( - <> -
- - - <__pri render={this.renderTarget('__pri')} isMobile={isMobile} functs={__sec_functs} type={this.state.__pri_full? "full_open" : this.state.__pri_half? "half" : null} /> - <__sec render={this.renderTarget('__sec')} isMobile={isMobile} functs={__sec_functs} type={this.state.__sec_full? "full_open" : this.state.__sec_active? "active" : null} /> - - - -
- - ) - return null - } -} diff --git a/src/components/Layout/Overlay/index.less b/src/components/Layout/Overlay/index.less index fa34e372..31caad5c 100644 --- a/src/components/Layout/Overlay/index.less +++ b/src/components/Layout/Overlay/index.less @@ -1,4 +1,4 @@ -@import '~themes/index.less'; +@import '~theme/index.less'; .render_component { width: 100%; @@ -20,19 +20,6 @@ } } -.mobile_drag{ - width: 100%; - height: auto; - .inner_drag{ - height: 6px; - margin: auto; - width: 20%; - background-color: #2d2d2d; - border-radius: 12px; - } -} - - .exit_button{ position: relative; z-index: 52; @@ -74,12 +61,11 @@ &.expand{ max-width: calc(100% + 150px); } - transition: all @__Global_SwapAnimDuration ease-in-out; } -.Overlay_container_1 { +.overlay_primary_wrapper { height: 100%; width: 100%; @@ -99,13 +85,21 @@ color: @Overlay_container1_def_color; + .renderBody{ + height: 100%; + width: 100%; + > div { + margin-bottom: 35px; + } + } + &.half { background-color: #2d2d2d; color: @Overlay_container1_active_color; max-width: calc(100% + 150px); } - &.full_open { + &.full{ max-width: none; background-color: transparent; position: absolute; @@ -113,44 +107,6 @@ height: 100vh; } - &.mobile { - min-width: unset; - max-width: unset; - - width: 100%; - height: 0; - bottom: 0; - opacity: 0; - - top: unset; - overflow: hidden; - - border-radius: 12px 12px 0 0; - flex-direction: column; - - :global{ - .comments_body { - padding: 30px 10px 10px 10px; - } - } - - &.full_open { - opacity: 1; - height: 100vh; - .pri_body{ - width: 100%; - - } - } - - &.half { - opacity: 1; - height: 95vh; - } - - transition: all @__Global_Components_transitions_dur linear; - } - :global { .ant-btn { color: @Overlay_container_1_btn_color; @@ -165,17 +121,12 @@ } } - .pri_body{ - height: 100%; - width: 100%; - } - transition: all @__Global_SwapAnimDuration ease-in-out; border-radius: @__Global_layout_border-rd; } -.Overlay_container_2 { +.overlay_secondary_wrapper { position: absolute; z-index: 55; height: 100vh; @@ -193,53 +144,6 @@ &.active { width: @Overlay_container2_active_width; opacity: 1; - - } - - &.mobile { - width: 100%; - height: 0; - bottom: 0; - opacity: 0; - - top: unset; - - transform: translate(0, 86%); - border-radius: 12px 12px 0 0; - flex-direction: column; - - overflow-y: overlay; - overflow-x: hidden; - - touch-action: none; - user-select: none; - cursor: default; - - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - -o-user-select: none; - user-select: none; - - -webkit-touch-action: none; - -moz-touch-action: none; - -ms-touch-action: none; - touch-action: none; - :global{ - .comments_body { - padding: 30px 10px 10px 10px; - } - } - - &.active { - opacity: 1; - height: 100%; - } - - &.full_open { - opacity: 1; - height: 100vh; - } } @@ -247,10 +151,6 @@ } - .Overlay_body_component{ - // Spacing between components - margin-bottom: 35px; - } .renderSearch_wrapper { height: 87vh; diff --git a/src/components/Layout/Overlay/index.tsx b/src/components/Layout/Overlay/index.tsx new file mode 100644 index 00000000..ffa16241 --- /dev/null +++ b/src/components/Layout/Overlay/index.tsx @@ -0,0 +1,138 @@ +import React from 'react' +import verbosity from 'core/libs/verbosity' +import { connect } from 'umi' +import classnames from 'classnames' +import styles from './index.less' +import * as errorhandler from 'core/libs/errorhandler' + +import { + Primary, + Secondary, + Card_Component, + __searchBar +} from './components' + + +export let Swapper = { + isOpen: (...props) => { + window.OverlayComponent.swap.isOpen(...props) + }, + closeAll: (...props) => { + window.OverlayComponent.swap.closeAll(...props) + }, + openFragment: (...props) => { + window.OverlayComponent.swap.openFragment(...props) + } +} + + +@connect(({ app }) => ({ app })) +export default class Overlay extends React.PureComponent { + constructor(props) { + super(props); + this.state = { + loading: true, + }; + this.setWrapperRef = this.setWrapperRef.bind(this); + this.handleClickOutside = this.handleClickOutside.bind(this); + this.keydownFilter = this.keydownFilter.bind(this); + window.OverlayComponent = this; + + } + + swap = { + isOpen: () => { + return this.props.app.overlayActive + }, + closeAll: () => { + this.props.dispatch({ + type: 'app/updateState', + payload: { + overlayActive: false, + overlayElement: null + }, + }); + }, + openFragment: (payload) => { + if (!payload) return false; + verbosity.debug('Dispatching fragment =>', payload) + this.props.dispatch({ + type: 'app/updateState', + payload: { + overlayActive: true, + overlayElement: payload + }, + }); + } + } + + keydownFilter(event) { + if (event.keyCode === 27) { + this.swap.closeAll() + } + } + + handleClickOutside(event) { + if (this.wrapperRef && !this.wrapperRef.contains(event.target)) { + this.swap.closeAll() + } + } + + + componentDidUpdate() { + if (this.props.app.overlayElement) { + document.addEventListener('keydown', this.keydownFilter, false) + document.addEventListener('mousedown', this.handleClickOutside); + } else { + document.removeEventListener('mousedown', this.handleClickOutside); + } + } + /** + * Set the wrapper ref + */ + setWrapperRef(node) { + this.wrapperRef = node; + } + + + render() { + const { overlayElement, overlayActive } = this.props.app + + const renderElement = () => { + + if (overlayElement && overlayActive) { + const renderProps = {id: overlayElement.id, mode: overlayElement.mode, fragment: overlayElement.element} + switch (overlayElement.position) { + case 'primary':{ + return + } + case 'secondary':{ + return + } + default:{ + verbosity.error(errorhandler.OVERLAY_BADPOSITION) + return null + } + } + } + + return( +
<__searchBar />
yeah
} /> + ) + + } + + + return ( + <> +
+ {renderElement()} +
+ + ) + } +} diff --git a/src/components/Layout/Sider/default.js b/src/components/Layout/Sider/default/index.js old mode 100755 new mode 100644 similarity index 52% rename from src/components/Layout/Sider/default.js rename to src/components/Layout/Sider/default/index.js index 68148b81..4ecb0a02 --- a/src/components/Layout/Sider/default.js +++ b/src/components/Layout/Sider/default/index.js @@ -1,72 +1,32 @@ import React from 'react' import * as antd from 'antd' import * as Icons from 'components/Icons' +import styles from './index.less' -import Icon from '@ant-design/icons' - -import { withI18n, Trans } from '@lingui/react' -import styles from './default.less' -import * as app from 'app' -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) - - } + this.setState({ menus: this.props.menus, loading: false }) } renderMenus(data){ - try { - return data.map(e => { - return( - - {e.icon} - - {e.title} - - - ) - }) - } catch (error) { - console.log(error) - return null - } + return data.map(e => { + return( + + {e.icon} + {e.title} + + ) + }) } render() { - const { handleClickMenu, logo, theme } = this.props - const predominantColor = theme.predominantColor || "#333" - - if (this.state.loading) return
Loading
- return ( + const { handleClickMenu, logo } = this.props + return this.state.loading? null : (
app.router.go('main')} + onClick={() => handleClickMenu({key: '/'})} src={logo} />
- {this.renderMenus(this.state.menus)} -
@@ -100,33 +58,18 @@ export default class Sider_Default extends React.PureComponent { className={styles.left_sider_menuItems} mode="vertical" onClick={handleClickMenu} - > - + - Settings - - {app.IsThisUser.dev() ? ( - - - Debug - - ) : ( - undefined - )} - + - Logout - -
-
diff --git a/src/components/Layout/Sider/default.less b/src/components/Layout/Sider/default/index.less old mode 100755 new mode 100644 similarity index 95% rename from src/components/Layout/Sider/default.less rename to src/components/Layout/Sider/default/index.less index 463fc63c..758f9e44 --- a/src/components/Layout/Sider/default.less +++ b/src/components/Layout/Sider/default/index.less @@ -1,4 +1,4 @@ -@import '~themes/index.less'; +@import '~theme/index.less'; .left_sider_wrapper { @@ -33,8 +33,6 @@ } .ant-menu-item { - - transition: @transition-ease-inout; border-radius: 4px 8px 8px 4px; @@ -78,10 +76,10 @@ cursor: pointer; img{ - margin: 7px 0 0 20px; + margin: 15px 0 0 0; max-height: 70px; - height: 7vh; - filter: drop-shadow(1px 0px 1px #b9b9b9); + height: 5vh; + width: 5vh; } } diff --git a/src/components/Layout/Sider/index.js b/src/components/Layout/Sider/index.js index a9756bcb..1db8c9b8 100755 --- a/src/components/Layout/Sider/index.js +++ b/src/components/Layout/Sider/index.js @@ -1,33 +1,22 @@ import React from 'react' -import config from 'config' -import * as app from 'app' +import { app_config } from 'config' +import { router } from 'core/cores' import MenuList from 'globals/sidebar_menu' -import Sider_Mobile from './mobile.js' -import Sider_Default from './default.js' +import Sider_Mobile from './mobile' +import Sider_Default from './default' class Sider extends React.PureComponent { - + handleClickMenu = e => { - 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' && 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') + router.go(e.key) } render() { - 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 - } - return + const { isMobile } = this.props + const sider_props = { menus: MenuList, handleClickMenu: this.handleClickMenu, logo: app_config.LogoPath } + + return isMobile? : } } diff --git a/src/components/Layout/Sider/mobile.js b/src/components/Layout/Sider/mobile.js deleted file mode 100755 index 53bd816b..00000000 --- a/src/components/Layout/Sider/mobile.js +++ /dev/null @@ -1,51 +0,0 @@ -import React from 'react' -import * as antd from 'antd' -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' - - -@withI18n() -export default class Sider_Mobile extends React.PureComponent { - render() { - const { handleClickMenu, userData } = this.props - return ( -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- ) - } -} diff --git a/src/components/Layout/Sider/mobile/index.js b/src/components/Layout/Sider/mobile/index.js new file mode 100644 index 00000000..42445532 --- /dev/null +++ b/src/components/Layout/Sider/mobile/index.js @@ -0,0 +1,35 @@ +import React from 'react' +import * as antd from 'antd' +import * as Icons from 'components/Icons' +import styles from './index.less' + +export default class Sider_Mobile extends React.PureComponent { + + renderMenus(data){ + // filter by item with mobile support + return data.map(e => { + return( + {e.icon} + ) + }) + } + + render() { + const { handleClickMenu, menus } = this.props + return ( +
+ + + {this.renderMenus(menus)} + + +
+ ) + } +} diff --git a/src/components/Layout/Sider/mobile.less b/src/components/Layout/Sider/mobile/index.less old mode 100755 new mode 100644 similarity index 96% rename from src/components/Layout/Sider/mobile.less rename to src/components/Layout/Sider/mobile/index.less index fcc8eb2a..6e0e6e4e --- a/src/components/Layout/Sider/mobile.less +++ b/src/components/Layout/Sider/mobile/index.less @@ -1,5 +1,4 @@ -@import '~themes/index.less'; - +@import '~theme/index.less'; .left_sider_wrapper { overflow: hidden!important; @@ -43,8 +42,4 @@ } } } - - - } - diff --git a/src/components/Layout/index.js b/src/components/Layout/index.js index b776cda4..a755a706 100755 --- a/src/components/Layout/index.js +++ b/src/components/Layout/index.js @@ -1,4 +1,5 @@ import Sider from './Sider' import Control from './ControlBar' -import Overlay from './Overlay' +import Overlay from './Overlay/index.tsx' + export { Sider, Control, Overlay } diff --git a/src/components/Like_button/index.js b/src/components/Like_button/index.js deleted file mode 100755 index c1c332a9..00000000 --- a/src/components/Like_button/index.js +++ /dev/null @@ -1,106 +0,0 @@ -import React from 'react' -import styles from './index.scss' -import * as app from 'app' -import classnames from 'classnames' - -class Like_button extends React.PureComponent { - constructor(props) { - super(props), - this.state = { - liked: this.props.liked, - likes: this.props.count, - type: this.props.liked ? 'dislike' : 'like', - clicked: false, - } - } - - SumLike() { - this.setState({ - likes: parseInt(this.state.likes) + 1, - type: 'dislike', - }) - setTimeout(() => { - this.setState({ liked: true }) - }, 500) - } - RestLike() { - this.setState({ - likes: parseInt(this.state.likes) - 1, - type: 'like', - }) - setTimeout(() => { - this.setState({ liked: false }) - }, 500) - } - - dispatchLike(e) { - const { type } = this.state - app.yconsole.log(`Dispatch ${type} to post id => ${e}`) - this.setState({ clicked: true }) - setTimeout(() => { - this.setState({ clicked: false }) - }, 500) - const payload = { post_id: e } - app.comty_post.like((err, res) => { - if (err) { - app.notify.error(res) - return - } - if (type == 'like') { - this.SumLike() - } - if (type == 'dislike') { - this.RestLike() - } - }, payload) - } - render() { - const { id } = this.props - const { likes, liked, clicked } = this.state - if (!id) { - app.yconsole.error('[LikeBTN] No post id provided!') - return null - } - return ( -
- -

- {likes} -

-
- ) - } -} - -export default Like_button diff --git a/src/components/Like_button/index.scss b/src/components/Like_button/index.scss deleted file mode 100755 index 2f10bdf9..00000000 --- a/src/components/Like_button/index.scss +++ /dev/null @@ -1,205 +0,0 @@ - .like_button, - .like_button:before, - .like_button:after { - position: relative; - box-sizing: border-box; - } - - .ripple, - .ripple:before, - .ripple:after { - position: relative; - box-sizing: border-box; - } - - .btnWrapper { - display: flex; - } - - .likeCounter { - font-family: "Poppins", sans-serif; - line-height: 70px; - margin: 0 0 0 10px; - - opacity: 0; - transform: perspective(100px) translateZ(10px); - filter: blur(10px); - letter-spacing: 0.1em; - - &.active { - opacity: 1; - transform: perspective(100px) translateZ(0px); - filter: blur(0px); - letter-spacing: 0.15em; - transition: opacity 1000ms linear, transform 1000ms linear, filter 400ms linear, letter-spacing 1000ms linear; - } - - &.past { - opacity: 0; - transform: perspective(100px) translateZ(-10px); - filter: blur(10px); - letter-spacing: 0.2em; - transition: opacity 1000ms linear, transform 1000ms linear, filter 400ms linear, letter-spacing 1000ms linear; - } - - } - - .like_button { - --color-heart: #EA442B; - --easing: cubic-bezier(.7, 0, .3, 1); - --duration: .5s; - - font-size: 40px; - border: none; - border-radius: 50%; - background: white; - width: 1em; - height: 1em; - padding: 0; - margin: 0; - outline: none; - z-index: 2; - transition: transform var(--duration) var(--easing); - cursor: pointer; - - &:before { - z-index: -1; - content: ''; - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - border-radius: inherit; - transition: inherit; - } - - &:after { - content: ''; - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: #fff; - border-radius: inherit; - z-index: -1; - } - - - - - @keyframes depress { - - from, - to { - transform: none; - } - - 50% { - transform: translateY(5%) scale(0.9); - } - } - - @keyframes depress-shadow { - - from, - to { - transform: none; - } - - 50% { - transform: scale(0.5); - } - } - } - - .like_wrapper { - display: grid; - align-items: center; - justify-content: center; - z-index: 1; - - >* { - margin: auto; - grid-area: 1 / 1; - } - } - - .heart { - width: .5em; - height: .5em; - display: block; - transform-origin: center 80%; - - >path { - stroke: var(--color-heart); - stroke-width: 2; - transition: fill var(--duration) var(--easing); - fill: var(--color-heart); - } - - &.empty { - >path { - stroke: var(--color-heart); - stroke-width: 2; - transition: fill var(--duration) var(--easing); - fill: transparent; - } - } - - &.clickanim { - animation: heart-bounce var(--duration) var(--easing); - - @keyframes heart-bounce { - 40% { - transform: scale(0.7); - } - - 0%, - 80%, - 100% { - transform: scale(1); - } - } - } - - animation: none; - } - - .ripple { - height: 1em; - width: 1em; - border-radius: 50%; - overflow: hidden; - z-index: 1; - - &:before { - content: ''; - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - border: .4em solid var(--color-heart); - border-radius: inherit; - transform: scale(0); - } - - &.clickanim { - &:before { - animation: ripple-out var(--duration) var(--easing); - - @keyframes ripple-out { - from { - transform: scale(0); - } - - to { - transform: scale(5); - } - } - } - } - - } diff --git a/src/components/Loader/Loader.less b/src/components/Loader/Loader.less index 87342ddf..5d5d7628 100755 --- a/src/components/Loader/Loader.less +++ b/src/components/Loader/Loader.less @@ -1,4 +1,4 @@ -@import '~themes/index.less'; +@import '~theme/index.less'; .wrapper { font-family: @__Global_general_font_family; diff --git a/src/components/MainFeed/components/index.js b/src/components/MainFeed/components/index.js deleted file mode 100755 index 2042fda5..00000000 --- a/src/components/MainFeed/components/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import ComponentNewAV from './newav' -import ComponentInvalid from './invalid' -import renderFeedPosts from './renderFeedPosts' - -export { ComponentNewAV, ComponentInvalid, renderFeedPosts } \ No newline at end of file diff --git a/src/components/MainFeed/components/invalid/index.js b/src/components/MainFeed/components/invalid/index.js deleted file mode 100755 index 80f65615..00000000 --- a/src/components/MainFeed/components/invalid/index.js +++ /dev/null @@ -1,24 +0,0 @@ -import { Card } from 'antd' -import { ExclamationCircleOutlined } from '@ant-design/icons' - -const ComponentInvalid = fn => { - return ( - -

- Invalid Data -

- - If this error has occurred several times, try restarting the app - -
- ) -} - -export default ComponentInvalid diff --git a/src/components/MainFeed/components/invalid/invalid.less b/src/components/MainFeed/components/invalid/invalid.less deleted file mode 100755 index e69de29b..00000000 diff --git a/src/components/MainFeed/components/newav/index.js b/src/components/MainFeed/components/newav/index.js deleted file mode 100755 index 214c327c..00000000 --- a/src/components/MainFeed/components/newav/index.js +++ /dev/null @@ -1,11 +0,0 @@ -import { Button } from 'antd' -import styles from './newav.less' -const ComponentNewAV = fn => { - return ( -
- -
- ) -} - -export default ComponentNewAV \ No newline at end of file diff --git a/src/components/MainFeed/components/newav/newav.less b/src/components/MainFeed/components/newav/newav.less deleted file mode 100755 index 9e5529d8..00000000 --- a/src/components/MainFeed/components/newav/newav.less +++ /dev/null @@ -1,3 +0,0 @@ -.main_feed_newav{ - -} \ No newline at end of file diff --git a/src/components/MainFeed/components/renderFeedPosts/index.js b/src/components/MainFeed/components/renderFeedPosts/index.js deleted file mode 100755 index 81aaf990..00000000 --- a/src/components/MainFeed/components/renderFeedPosts/index.js +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react' -import { PostCard } from 'components' -import { yconsole } from 'app' -import { Button, List } from 'antd' -import { DownSquareOutlined } from '@ant-design/icons' -const renderFeedPosts = payload => { - const { data, loading, isEnd, feedGet } = payload - const loadMore = - !isEnd && !loading ? ( -
-
- ) : null - try { - yconsole.log(data) - return ( - ( -
- -
- )} - /> - ) - } catch (err) { - return false - } -} - -export default renderFeedPosts diff --git a/src/components/MainFeed/index.js b/src/components/MainFeed/index.js deleted file mode 100755 index 50b51277..00000000 --- a/src/components/MainFeed/index.js +++ /dev/null @@ -1,188 +0,0 @@ -import React from 'react' -import * as antd from 'antd' -import * as app from 'app' -import styles from './index.less' - -import { ComponentNewAV, ComponentInvalid, renderFeedPosts } from './components/index.js' - -export const RenderFeed = { - RefreshFeed: () => { - window.MainFeedComponent.feedGet.first() - return - }, - killByID: post_id => { - window.MainFeedComponent.killByID(post_id) - return - }, - addToRend: payload => { - window.MainFeedComponent.addToRend(payload) - return - }, - goToElement: post_id => { - app.goTo.element(post_id) - }, - disableMenu: () => { - window.MainFeedComponent.setState({ - disableMenu: true, - }) - }, - sync: (c) => { - window.MainFeedComponent.syncService(c) - return - } -} -class MainFeed extends React.PureComponent { - constructor(props) { - super(props) - window.MainFeedComponent = this - this.state = { - AutoFeed: this.props.auto? true:false, - NewAV: false, - invalid: false, - loading: false, - disableMenu: false, - data: [], - fkey: 0, - } - } - - componentDidMount() { - this.feedGet.first() - app.sync.FeedListen((data) => { - this.syncService(data) - }) - } - - toogleLoader() { - this.setState({ loading: !this.state.loading }) - } - - syncService(data){ - if (!data) return false - const { last_post_id, now } = data - const first = this.state.data[0] - if (first){ - const a = first.id - console.log(` SYNC => ${last_post_id} | LAST => ${a}`) - if(last_post_id>a){ - this.setState({ NewAV: true }) - } - } - } - - killByID(post_id) { - const a = this.state.data - const b = app.arrayRemoveByID(a, post_id) - this.setState({ data: b }) - } - - addToRend(payload) { - let a = this.state.data - a.unshift(payload) - this.setState({ data: a }) - } - - feedGet = { - first: ()=>{ - try { - const { get, uid, filters } = this.props - if (this.props.custompayload) { - this.setState({ - isEnd: true, - NewAV: false, - data: this.props.custompayload, - loading: false, - }) - return - } - if (!get) { - app.yconsole.error('Please, fill params with an catch type...') - return - } - this.toogleLoader() - const payload = { fkey: 0, type: get, id: uid } - app.comty_post.getFeed((err, res) => { - if (err) { - app.notify.error('Error when get data from this input') - return - } - if (JSON.parse(res).api_status == '400') { - this.setState({ invalid: true }) - return - } - try { - const parsed = JSON.parse(res)['data'] - const isEnd =parsed.length < app.AppSettings.limit_post_catch ? true : false - this.setState({ NewAV: false, isEnd: isEnd, data: parsed, loading: false }) - } catch (error) { - app.yconsole.log(error) - } - }, payload) - } catch (err) { - app.notify.error('err') - } - }, - 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 - } - if (!fkey) { - app.yconsole.warn( - 'Please, provide a fkey for offset the feed, default using => 0' - ) - } - this.toogleLoader() - const getLastPost = app.objectLast(this.state.data) - app.yconsole.log('LAST POST ID =>', getLastPost.id) - - const payload = { fkey: getLastPost.id, type: get, id: uid } - app.comty_post.getFeed((err, res) => { - if (err) { - return false - } - const oldData = this.state.data - const parsed = JSON.parse(res)['data'] - const mix = oldData.concat(parsed) - const isEnd = - parsed.length < app.AppSettings.limit_post_catch ? true : false - this.setState({ isEnd: isEnd, data: mix, loading: false }, () => - app.goTo.element(getLastPost.id) - ) - return true - }, payload) - } catch (err) { - app.notify.error('[ MainFeed ]', err) - } - } - } - - - render() { - const { data, loading, isEnd, invalid, NewAV, AutoFeed } = this.state - const renderFeedPosts_payload = {data: data, loading: loading, isEnd: isEnd, feedGet: this.feedGet} - - if (invalid){ - return ComponentInvalid() - } - if (loading) { - return ( - - - - ) - } - if (!loading) { - return ( -
- {AutoFeed? NewAV? ComponentNewAV(() => this.feedGet.first()) : null : null} - {renderFeedPosts(renderFeedPosts_payload)} -
- ) - } - } -} -export default MainFeed diff --git a/src/components/MainFeed/index.less b/src/components/MainFeed/index.less deleted file mode 100755 index 599b9120..00000000 --- a/src/components/MainFeed/index.less +++ /dev/null @@ -1,4 +0,0 @@ -.main_feed_wrapper{ - scroll-behavior: smooth; - -} diff --git a/src/components/MediaPlayer/post_player.js b/src/components/MediaPlayer/post_player.js deleted file mode 100644 index 0844fda5..00000000 --- a/src/components/MediaPlayer/post_player.js +++ /dev/null @@ -1,62 +0,0 @@ -export class PostPlayer extends React.PureComponent { - player() { - const { file } = this.props - let type - - const ImageExtensions = ['.png', '.jpg', '.jpeg', '.gif'] - const VideoExtensions = ['.mp4', '.mov', '.avi'] - const AudioExtensions = ['.mp3', '.ogg', '.wav'] - - const FilesAllowed = ImageExtensions.concat( - VideoExtensions, - AudioExtensions - ) - - for (const prop in FilesAllowed) { - if (file.includes(`${ImageExtensions[prop]}`)) { - type = 'image' - } - if (file.includes(`${VideoExtensions[prop]}`)) { - type = 'video' - } - if (file.includes(`${AudioExtensions[prop]}`)) { - type = 'audio' - } - } - - if (type == 'video') { - // const payload = {type: 'video', sources: [{src: file,}]} - // return ( - // - // ) - return ( - - ) - } - if (type == 'audio') { - return ( - - ) - } - if (type == 'image') { - return - } - } - render() { - return ( -
- {this.player()} -
- ) - } - } - \ No newline at end of file diff --git a/src/components/Page/Page.less b/src/components/Page/Page.less new file mode 100644 index 00000000..1c0a5e54 --- /dev/null +++ b/src/components/Page/Page.less @@ -0,0 +1,16 @@ +@import '~theme/index.less'; + +.contentInner { + background: #fff; + padding: 24px; + box-shadow: @shadow-1; + min-height: ~'calc(100vh - 230px)'; + position: relative; +} + +@media (max-width: 767px) { + .contentInner { + padding: 12px; + min-height: ~'calc(100vh - 160px)'; + } +} diff --git a/src/components/Page/index.js b/src/components/Page/index.js new file mode 100644 index 00000000..97e100ce --- /dev/null +++ b/src/components/Page/index.js @@ -0,0 +1,32 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import classnames from 'classnames'; +import styles from './Page.less'; + +export default class Page extends Component { + render() { + const { className, children, loading = false, inner = false } = this.props; + const loadingStyle = { + height: 'calc(100vh - 184px)', + overflow: 'hidden', + }; + return ( +
+ {loading ? 'Loading' : ''} + {children} +
+ ); + } +} + +Page.propTypes = { + className: PropTypes.string, + children: PropTypes.node, + loading: PropTypes.bool, + inner: PropTypes.bool, +}; diff --git a/src/components/Players/index.js b/src/components/Players/index.js deleted file mode 100644 index b9b2d7ab..00000000 --- a/src/components/Players/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Spotify_player from './spotify_player.js' - -export default { Spotify_player } \ No newline at end of file diff --git a/src/components/Players/spotify_player.js b/src/components/Players/spotify_player.js deleted file mode 100644 index 4eda6141..00000000 --- a/src/components/Players/spotify_player.js +++ /dev/null @@ -1,38 +0,0 @@ -import React from 'react' -import * as antd from 'antd' -import * as Icons from 'components/Icons' -import * as app from 'app' -import styles from './spotify_player.less' - -export default class Spotify_player extends React.PureComponent{ - - state = { - room_id: null, - niga: false, - styleMariaguno: { color: "green" }, - styleJoto: { color: "blue" } - - } - - componentDidMount(){ - const { room_id } = this.props - if (room_id) { this.setState({ room_id: room_id })} - - } - - render(){ - const { niga, styleMariaguno, styleJoto } = this.state - - const toogleMariaguana = () => { - this.setState({ niga: !niga }) - - } - - return( -
-

Seccion id: {this.state.room_id}

- toogleMariaguana()} > Mariguano MODO -
- ) - } -} \ No newline at end of file diff --git a/src/components/Players/spotify_player.less b/src/components/Players/spotify_player.less deleted file mode 100644 index e69de29b..00000000 diff --git a/src/components/PostCard/index.js b/src/components/PostCard/index.js deleted file mode 100755 index 14f8bfd5..00000000 --- a/src/components/PostCard/index.js +++ /dev/null @@ -1,301 +0,0 @@ -import React from 'react' -import * as antd from 'antd' -import styles from './index.less' -import { Like_button, MediaPlayer } from 'components' -import * as Icons from 'components/Icons' -import * as app from 'app' -import Icon from '@ant-design/icons' -import classnames from 'classnames' -import * as MICON from '@material-ui/icons' - -const { Meta } = antd.Card - -// Set default by configuration -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 { - constructor(props) { - super(props), - this.state = { - visibleMoreMenu: 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 }); - }; - - toogleMoreMenu(){ - this.setState({visibleMoreMenu: !this.state.visibleMoreMenu}) - } - - render() { - const { payload } = this.state - const ActShowMode = app.AppSettings.auto_hide_postbar - - const { - id, - post_time, - postText, - postFile, - publisher, - post_likes, - is_post_pinned, - is_liked, - post_comments, - get_post_comments - } = payload || defaultPayload - - if(!id, !postText, !postFile, !publisher) return null - - - const SwapThisPost = () => { - localStorage.setItem('p_back_uid', id) - - app.SwapMode.openPost(id, payload) - app.SwapMode.openComments(id) - - } - - const handlePostActions = { - delete: post_id => { - const payload = { post_id: post_id } - app.comty_post.delete((err, res) => { - if (err) { - return false - } - app.RenderFeed.killByID(post_id) - }, payload) - }, - save: post_id => { - const payload = { post_id: post_id } - app.comty_post.save((err, res) => { - if (err) { - return false - } - if (this.state.postSaved == false) { - app.notify.success('Post Saved') - this.setState({ postSaved: true }) - return - } else { - app.notify.info('Removed from Saved') - this.setState({ postSaved: false }) - } - }, payload) - }, - report: post_id => { - app.app_modals.report_post(post_id) - }, - boost: post_id => { - const payload = { post_id: post_id } - app.comty_post.__boost((err, res) => { - if (err) { - return false - } - if (this.state.postBoosted == false) { - app.notify.success('Post Boosted') - this.setState({ postBoosted: true }) - return - } else { - app.notify.info('Post Unboosted') - this.setState({ postBoosted: false }) - } - }, payload) - }, - } - const actions = [ - , - , - 0 ? true : false}> - SwapThisPost()} /> - , - ] - - const MoreMenu = ( - - {app.IsThisPost.owner(publisher.id) ? ( - - handlePostActions.delete(id) & this.toogleMoreMenu()} - okText="Yes" - cancelText="No" - > - Remove post - - - - ) : null} - {app.IsThisPost.owner(publisher.id) ? ( - app.IsThisUser.pro(publisher.id) ? ( - handlePostActions.boost(id) & this.toogleMoreMenu()} - key="boost_post" - > - - {this.state.postBoosted ? 'Unboost' : 'Boost'} - - ) : null - ) : null} - {app.IsThisPost.owner(publisher.id) ?
: null} - handlePostActions.save(id) & this.toogleMoreMenu()} - key="save_post" - > - - {this.state.postSaved ? 'Unsave post' : 'Save Post'} - - {this.state.postReported? null: - handlePostActions.report(id) & this.toogleMoreMenu() } - key="report_post" - > - Report post - - } -
- ) - - return ( -
- SwapThisPost()} - hoverable - className={ActShowMode ? null : styles.showMode} - actions={actions} - > - {this.state.ReportIgnore ? null : this.state.postReported ? ( -
- -

It seems that this post has been reported

-

The content may be inappropriate or compromising

- { - this.setState({ ReportIgnore: true }) - }} - > - Ignore - -
- ) : null} -
- - -
- } - title={ -
-

- app.router.go(`@${publisher.username}`) - } - className={styles.titleUser} - > - @{publisher.username} - {app.booleanFix(publisher.verified) ? ( - - ) : null} - {app.booleanFix(publisher.nsfw_flag) ? ( - - NSFW - - ) : null} -

-
-
- - - -
- {app.booleanFix(is_post_pinned) ? ( - - ) : null} -
-
- } - description={{post_time}} - bordered="false" - /> - {postText ? ( -
- -

-

- ) : null} - {postFile ? ( -
- -
- ) : null} -
- -
-
- - - ) - } -} -export default PostCard diff --git a/src/components/PostCard/index.less b/src/components/PostCard/index.less deleted file mode 100755 index f43f40d9..00000000 --- a/src/components/PostCard/index.less +++ /dev/null @@ -1,231 +0,0 @@ -@import '~themes/index.less'; - -.post_card_flaggedWarning { - border-radius: @post_card_general_border-rd; - width: 100%; - text-align: center; - position: absolute; - z-index: 20; - background: @post_card_flaggedWarning_backgroud; - font-family: @__Global_general_font_family; - padding: @post_card_flaggedWarning_padding; - - :global { - .anticon { - font-size: @post_card_flaggedWarning_iconSize; - } - } -} - -.post_card_wrapper { - box-shadow: @post_card_wrapper_shadow; - border-radius: @post_card_general_border-rd; - max-width: 510px; - min-width: 265px; - width: auto; - margin: 23px auto 50px auto; - - :global { - .ant-card-meta-detail>div:not(:last-child) { - margin: 0 - } - - .ant-card { - border-radius: @post_card_general_border-rd; - border: 0; - border-top: 1px solid #4646460c; - } - - .ant-card-body { - padding: 0; - } - - .ant-card-actions { - border-top: 0; - background: @post_card_wrapper_actions_backgroud; - height: 30px; - position: relative; - transition: opacity @__Global_Components_transitions_dur linear, position @__Global_Components_transitions_dur linear, transform @__Global_Components_transitions_dur linear; - border-radius: 0 0 10px 10px; - opacity: 0; - - &.showMode { - opacity: 1; - transform: translate(0, 15px); - } - } - - .ant-card-actions:hover { - opacity: 1; - transform: translate(0, 15px); - transition: opacity @__Global_Components_transitions_dur linear, position @__Global_Components_transitions_dur linear, transform @__Global_Components_transitions_dur linear; - } - - .ant-card-actions>li>.anticon { - font-size: 16px; - line-height: 22px; - width: 40px; - height: 40px; - background: @post_card_wrapper_actions_icon_backgroud; - border-radius: 23px; - } - - .ant-card-actions>li { - margin: -20px 0 0 0; - border-right: 0; - - .ant-badge-count { - width: 20px; - text-align: left; - - span { - font-size: 12px; - } - - .ant-scroll-number-only>p.ant-scroll-number-only-unit { - height: 20px; - width: 20px; - margin: 0; - line-height: 20px; - padding: 0 0 0 1px; - } - } - - span { - font-size: 16px; - line-height: 22px; - width: 40px; - height: 40px; - background: @post_card_wrapper_actions_icon_backgroud; - border-radius: 23px; - margin: auto; - } - - svg { - height: 20px; - width: 20px; - height: 100%; - vertical-align: middle; - } - #feather_icon{ margin-right: unset!important; } - } - } -} - -.post_include { - padding: 13px 0 5px 0; - transition: all 150ms linear; - - &.blur { - filter: blur(10px); - } -} - -.showMode { - :global { - ul { - opacity: 1 !important; - transform: translate(0, 15px); - } - } -} - - -.post_card_title { - display: flex; - - h4 { - cursor: pointer; - } - -} - -.postAvatar { - position: absolute; - left: -8px; - top: -8px; - display: flex; -} - -.titleUser { - display: flex; - font-family: @__Global_general_font_family; - margin: 0 0 0 50px; -} - -.textAgo { - display: flex; - font-size: 10px; - margin: 0 0 0 53px; -} - -.PostTags { - float: right; - width: 100%; - z-index: 10; - - :global { - .anticon { - color: @post_card_wrapper_tags_color_default; - float: right; - margin: -0 6px 0 0; - font-size: 17px; - } - - } -} - -.post_card_content { - word-break: break-all; - display: flex; - border-radius: 3px; - margin: 23px 24px 23px 24px; - - h3 { - font-family: @__Global_general_font_family; - color: @post_card_wrapper_post_content_color; - font-weight: @post_card_wrapper_post_content_weight; - font-size: @post_card_wrapper_post_content_fontSize; - letter-spacing: @post_card_wrapper_post_content_letterSpacing; - } -} - -.post_card_file { - display: flex; - margin: 23px 0 5px 0; - max-height: 600px; - overflow: hidden; - - h3 { - color: rgb(85, 85, 85); - font-weight: 470; - } -} - -.likebtn { - :global { - svg { - color: rgba(0, 0, 0, 0.45); - } - - svg:hover { - color: rgb(233, 35, 68); - transition: all 0.2s linear; - } - } -} - -.ellipsisIcon { - color: rgba(0, 0, 0, 0.45); - width: 100%; - position: absolute; - text-align: center; - margin: auto; - font-size: 30px; - transition: opacity 150ms linear; -} - -.ellipsisIcon:hover { - opacity: 0; - transition: opacity 150ms linear; -} \ No newline at end of file diff --git a/src/components/PostCreator/index.js b/src/components/PostCreator/index.js deleted file mode 100755 index c323f964..00000000 --- a/src/components/PostCreator/index.js +++ /dev/null @@ -1,416 +0,0 @@ -import React from 'react' -import * as antd from 'antd' -import * as app from 'app' -import styles from './index.less' -import * as Icons from 'components/Icons' -import Icon from '@ant-design/icons' -import $ from 'jquery' -import * as MICONS from '@material-ui/icons' - -import Post_options from './local_components/post_options' -import { optionBox } from './local_components/post_options' - -function getBase64(img, callback) { - const reader = new FileReader() - reader.addEventListener('load', () => callback(reader.result)) - reader.readAsDataURL(img) -} - -export function HandleVisibility() { - window.PostCreatorComponent.ToogleVisibility() -} - -class PostCreator extends React.PureComponent { - constructor(props) { - super(props), - window.PostCreatorComponent = this, - this.state = { - visible: true, - FadeIN: true, - keys_remaining: app.AppSettings.MaxLengthPosts, - rawtext: '', - posting: false, - posting_ok: false, - shareWith: 'any', - uploader: false, - Schedule: false, - } - } - - renderPostPlayer(payload) { - const { file, fileURL } = this.state - const videofilter = file.type.includes('video') - const imagefilter = file.type.includes('image') - const audiofilter = file.type.includes('audio') - if (imagefilter) { - return ( -
-
- this.handleDeleteFile()} - icon={} - /> -
-
- -
-
- ) - } - if (videofilter) { - return ( -
-
- this.handleDeleteFile()} - icon={} - /> -
-
- -
-
- ) - } - if (audiofilter) { - return ( -