mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
improve: secondary model 2
This commit is contained in:
parent
86c37b49a2
commit
e2b3f0b69b
16
.prev/.editorconfig
Normal file
16
.prev/.editorconfig
Normal file
@ -0,0 +1,16 @@
|
||||
# http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
2
.prev/.env
Normal file
2
.prev/.env
Normal file
@ -0,0 +1,2 @@
|
||||
UMI_UI=none
|
||||
NODE_ENV=production
|
7
.prev/.eslintignore
Normal file
7
.prev/.eslintignore
Normal file
@ -0,0 +1,7 @@
|
||||
src/**/*-test.js
|
||||
src/public
|
||||
src/routes/chart/ECharts/theme
|
||||
src/routes/chart/highCharts/mapdata
|
||||
src/locales/_build/
|
||||
src/locales/**/*.js
|
||||
docs/**/*.js
|
8
.prev/.eslintrc
Normal file
8
.prev/.eslintrc
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "react-app",
|
||||
"rules": {
|
||||
"jsx-a11y/href-no-hash": "off",
|
||||
"no-console": "warn",
|
||||
"valid-jsdoc": "warn"
|
||||
}
|
||||
}
|
24
.prev/.gitignore
vendored
Normal file
24
.prev/.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
coverage
|
||||
dist
|
||||
node_modules
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
|
||||
# ide
|
||||
.idea
|
||||
|
||||
# Mac General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# umi
|
||||
.umi
|
||||
.umi-production
|
||||
|
||||
# jslingui
|
||||
src/locales/_build
|
||||
src/locales/**/*.js
|
||||
android/
|
6
.prev/.prettierignore
Normal file
6
.prev/.prettierignore
Normal file
@ -0,0 +1,6 @@
|
||||
*.svg
|
||||
*.ejs
|
||||
.DS_Store
|
||||
.umi
|
||||
.umi-production
|
||||
src/locales/**/*.json
|
5
.prev/.prettierrc
Normal file
5
.prev/.prettierrc
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5"
|
||||
}
|
9
.prev/.stylelintrc.json
Normal file
9
.prev/.stylelintrc.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"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
|
||||
}
|
||||
}
|
27
.prev/.travis.yml
Normal file
27
.prev/.travis.yml
Normal file
@ -0,0 +1,27 @@
|
||||
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
|
91
.prev/.umirc.js
Normal file
91
.prev/.umirc.js
Normal file
@ -0,0 +1,91 @@
|
||||
// https://umijs.org/config/
|
||||
import { resolve } from 'path'
|
||||
import { i18n } from './config/ycore.config.js'
|
||||
export default {
|
||||
ignoreMomentLocale: true,
|
||||
hash: true,
|
||||
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: {
|
||||
ycore: resolve(__dirname, './src/@ycore/ycore_worker.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',
|
||||
],
|
||||
],
|
||||
|
||||
|
||||
|
||||
}
|
4
.prev/.vsls.json
Normal file
4
.prev/.vsls.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/vsls",
|
||||
"gitignore":"none"
|
||||
}
|
201
.prev/LICENSE
Normal file
201
.prev/LICENSE
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
8
.prev/capacitor.config.json
Normal file
8
.prev/capacitor.config.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"appId": "com.ragestudio.comty",
|
||||
"appName": "comty-development",
|
||||
"bundledWebRuntime": false,
|
||||
"npmClient": "npm",
|
||||
"webDir": "dist",
|
||||
"cordova": {}
|
||||
}
|
11
.prev/comty_dev.service
Normal file
11
.prev/comty_dev.service
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Comty_Development
|
||||
|
||||
[Service]
|
||||
ExecStart=npm start
|
||||
Restart=always
|
||||
User=root
|
||||
WorkingDirectory=/ycore/development/comty-development
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
11
.prev/comty_dist.service
Normal file
11
.prev/comty_dist.service
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Comty_Development
|
||||
|
||||
[Service]
|
||||
ExecStart=serve ./dist
|
||||
Restart=always
|
||||
User=root
|
||||
WorkingDirectory=/ycore/development/comty-development
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
36
.prev/config/app.settings.js
Normal file
36
.prev/config/app.settings.js
Normal file
@ -0,0 +1,36 @@
|
||||
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'
|
||||
}
|
BIN
.prev/config/id_rsa.enc
Normal file
BIN
.prev/config/id_rsa.enc
Normal file
Binary file not shown.
6
.prev/config/keys.js
Normal file
6
.prev/config/keys.js
Normal file
@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
// Global Server Key (Requiered for RS-YIBTP), Not autogenerated, must be included on. (Recommended not modify this constants)
|
||||
|
||||
server_key:
|
||||
'f706b0a535b6c2d36545c4137a0a3a26853ea8b5-1223c9ba7923152cae28e5a2e7501b2b-50600768',
|
||||
}
|
8
.prev/config/theme.config.js
Normal file
8
.prev/config/theme.config.js
Normal file
@ -0,0 +1,8 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const lessToJs = require('less-vars-to-js')
|
||||
|
||||
module.exports = () => {
|
||||
const themePath = path.join(__dirname, `../src/themes/index.less`)
|
||||
return lessToJs(fs.readFileSync(themePath, 'utf8'))
|
||||
}
|
35
.prev/config/ycore.config.js
Normal file
35
.prev/config/ycore.config.js
Normal file
@ -0,0 +1,35 @@
|
||||
module.exports = {
|
||||
server_endpoint: 'https://comty.julioworld.club',
|
||||
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://eu653-node.ragestudio.net:5500',
|
||||
|
||||
g_recaptcha_key: '6Lc55uUUAAAAAEIACMVf3BUzAJSNCmI3RrjEirZ6',
|
||||
g_recaptcha_secret: '6Lc55uUUAAAAAOP4OgUa5DpqJC-70t53AmW0lyYf',
|
||||
|
||||
/* Layout configuration, specify which layout to use for route. */
|
||||
layouts: [
|
||||
{
|
||||
name: 'primary',
|
||||
include: [/.*/],
|
||||
exclude: [/\/login/, /\/socket\/(.*)/, /\/publics/, /\/authorize/],
|
||||
},
|
||||
],
|
||||
|
||||
i18n: {
|
||||
languages: [
|
||||
{
|
||||
key: 'en',
|
||||
title: 'English',
|
||||
},
|
||||
],
|
||||
defaultLanguage: 'en',
|
||||
},
|
||||
}
|
64
.prev/dev-server.sh
Normal file
64
.prev/dev-server.sh
Normal file
@ -0,0 +1,64 @@
|
||||
#!/bin/sh
|
||||
|
||||
pause(){
|
||||
read -p "Press [Enter] key to continue..." fackEnterKey
|
||||
}
|
||||
|
||||
start_cli_dev(){
|
||||
sudo npm start
|
||||
}
|
||||
|
||||
start_dev(){
|
||||
sudo systemctl start comty_dev
|
||||
echo "Starting dev server..."
|
||||
}
|
||||
|
||||
stop_dev(){
|
||||
sudo systemctl stop comty_dev
|
||||
echo "Stoping dev server..."
|
||||
}
|
||||
show_logs(){
|
||||
sudo journalctl -u comty_dev
|
||||
}
|
||||
update(){
|
||||
git reset --merge&&git fetch --all&&git reset --hard origin/master
|
||||
|
||||
|
||||
}
|
||||
|
||||
show_menus() {
|
||||
clear
|
||||
echo "~~~~~~~~~~~~~~~~~~~~~"
|
||||
echo " Development Server "
|
||||
echo "~~~~~~~~~~~~~~~~~~~~~"
|
||||
echo "1. Start CLI Server"
|
||||
echo "2. Start Server"
|
||||
echo "3. Stop Server"
|
||||
echo "4. Show DevServer Logs"
|
||||
echo "5. Update from Git"
|
||||
echo ""
|
||||
echo "0. Exit"
|
||||
}
|
||||
|
||||
read_options(){
|
||||
local choice
|
||||
read -p "Enter choice [ 1 - 5 ] " choice
|
||||
case $choice in
|
||||
0) exit 0;;
|
||||
1) start_cli_dev ;;
|
||||
2) start_dev ;;
|
||||
3) stop_dev ;;
|
||||
4) show_logs;;
|
||||
5) update;;
|
||||
*) echo -e "${RED}Error...${STD}" && sleep 2
|
||||
esac
|
||||
}
|
||||
|
||||
trap '' SIGINT SIGQUIT SIGTSTP
|
||||
|
||||
while true
|
||||
do
|
||||
|
||||
show_menus
|
||||
read_options
|
||||
done
|
59
.prev/dist-server.sh
Normal file
59
.prev/dist-server.sh
Normal file
@ -0,0 +1,59 @@
|
||||
#!/bin/sh
|
||||
|
||||
pause(){
|
||||
read -p "Press [Enter] key to continue..." fackEnterKey
|
||||
}
|
||||
|
||||
start_cli_dev(){
|
||||
sudo serve ./dist
|
||||
}
|
||||
|
||||
start_dev(){
|
||||
sudo systemctl start comty_dist
|
||||
echo "Starting dev server..."
|
||||
}
|
||||
|
||||
stop_dev(){
|
||||
sudo systemctl stop comty_dist
|
||||
echo "Stoping dev server..."
|
||||
}
|
||||
show_logs(){
|
||||
sudo journalctl -u comty_dist
|
||||
pause
|
||||
}
|
||||
|
||||
|
||||
show_menus() {
|
||||
clear
|
||||
echo "~~~~~~~~~~~~~~~~~~~~~"
|
||||
echo " BuildServe Server "
|
||||
echo "~~~~~~~~~~~~~~~~~~~~~"
|
||||
echo "1. Start CLI Server"
|
||||
echo "2. Start Server"
|
||||
echo "3. Stop Server"
|
||||
echo "4. Show DevServer Logs"
|
||||
echo ""
|
||||
echo "0. Exit"
|
||||
}
|
||||
|
||||
read_options(){
|
||||
local choice
|
||||
read -p "Enter choice [ 1 - 4 ] " choice
|
||||
case $choice in
|
||||
0) exit 0;;
|
||||
1) start_cli_dev ;;
|
||||
2) start_dev ;;
|
||||
3) stop_dev ;;
|
||||
4) show_logs;;
|
||||
*) echo -e "${RED}Error...${STD}" && sleep 2
|
||||
esac
|
||||
}
|
||||
|
||||
trap '' SIGINT SIGQUIT SIGTSTP
|
||||
|
||||
while true
|
||||
do
|
||||
|
||||
show_menus
|
||||
read_options
|
||||
done
|
45
.prev/globals/badges_list.js
Normal file
45
.prev/globals/badges_list.js
Normal file
@ -0,0 +1,45 @@
|
||||
import * as Icons from '@ant-design/icons'
|
||||
|
||||
|
||||
export var BadgesType = [
|
||||
{
|
||||
id: 'alpha_test',
|
||||
title: 'Alpha Tester',
|
||||
color: 'green',
|
||||
require: '',
|
||||
icon: (<Icons.BugOutlined />),
|
||||
tip: 'Oh yeah!'
|
||||
},
|
||||
{
|
||||
id: 'nsfw_flag',
|
||||
title: 'NSFW',
|
||||
color: 'volcano',
|
||||
require: 'nsfw_flag',
|
||||
icon: (<Icons.RocketOutlined />),
|
||||
tip: 'NSFW',
|
||||
},
|
||||
{
|
||||
id: 'pro',
|
||||
title: 'CPRO™',
|
||||
color: 'purple',
|
||||
require: 'pro',
|
||||
icon: (<Icons.RocketOutlined />),
|
||||
tip: 'CPRO™',
|
||||
},
|
||||
{
|
||||
id: 'dev',
|
||||
title: 'DEVELOPER',
|
||||
color: 'default',
|
||||
require: 'dev',
|
||||
icon: (<Icons.RocketOutlined />),
|
||||
tip: 'DEVELOPER',
|
||||
},
|
||||
{
|
||||
id: 'professional_retarder',
|
||||
title: 'Professional Retarder',
|
||||
color: 'gold',
|
||||
require: '',
|
||||
icon: (<Icons.SmileOutlined />),
|
||||
tip: 'hump....',
|
||||
}
|
||||
]
|
23
.prev/globals/debug.json
Normal file
23
.prev/globals/debug.json
Normal file
@ -0,0 +1,23 @@
|
||||
[
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
23
.prev/globals/endpoints.js
Normal file
23
.prev/globals/endpoints.js
Normal file
@ -0,0 +1,23 @@
|
||||
module.exports = {
|
||||
Endpoints: {
|
||||
comments_actions: "https://api.ragestudio.net/RSA-COMTY/r/comments?access_token=",
|
||||
get_post_data: "https://api.ragestudio.net/RSA-COMTY/r/get-post-data?access_token=",
|
||||
get_user_tags: "https://api.ragestudio.net/RSA-COMTY/r/user_tags?access_token=",
|
||||
get_general_data: "https://api.ragestudio.net/RSA-COMTY/r/get-general-data?access_token=",
|
||||
follow_user: "https://api.ragestudio.net/RSA-COMTY/r/follow-user?access_token=",
|
||||
action_post: "https://api.ragestudio.net/RSA-COMTY/r/post-actions?access_token=",
|
||||
get_posts: "https://api.ragestudio.net/RSA-COMTY/r/posts?access_token=",
|
||||
find_user: "https://api.ragestudio.net/RSA-COMTY/r/find_user?access_token=",
|
||||
search_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/search?access_token=",
|
||||
all_sessions: "https://api.ragestudio.net/RSA-COMTY/r/sessions?access_token=",
|
||||
get_sessions: "https://api.ragestudio.net/RSA-COMTY/r/session_id?access_token=",
|
||||
auth_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/auth",
|
||||
new_post: "https://comty.julioworld.club/api/new_post?access_token=",
|
||||
get_config_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/get-site-settings?access_token=",
|
||||
get_userData_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/get-user-data?access_token=",
|
||||
update_userData_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/update-user-data?access_token=",
|
||||
removeToken: "https://api.ragestudio.net/RSA-COMTY/r/delete-access-token?access_token=",
|
||||
register_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/create-account",
|
||||
resetPassword_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/send-reset-password-email?access_token=",
|
||||
}
|
||||
}
|
23
.prev/globals/endpoints/comty_endpoints.js
Normal file
23
.prev/globals/endpoints/comty_endpoints.js
Normal file
@ -0,0 +1,23 @@
|
||||
module.exports={
|
||||
comty_endpoints: {
|
||||
comments_actions: "https://api.ragestudio.net/RSA-COMTY/r/comments?access_token=",
|
||||
get_post_data: "https://api.ragestudio.net/RSA-COMTY/r/get-post-data?access_token=",
|
||||
get_user_tags: "https://api.ragestudio.net/RSA-COMTY/r/user_tags?access_token=",
|
||||
get_general_data: "https://api.ragestudio.net/RSA-COMTY/r/get-general-data?access_token=",
|
||||
follow_user: "https://api.ragestudio.net/RSA-COMTY/r/follow-user?access_token=",
|
||||
action_post: "https://api.ragestudio.net/RSA-COMTY/r/post-actions?access_token=",
|
||||
get_posts: "https://api.ragestudio.net/RSA-COMTY/r/posts?access_token=",
|
||||
find_user: "https://api.ragestudio.net/RSA-COMTY/r/find_user?access_token=",
|
||||
search_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/search?access_token=",
|
||||
all_sessions: "https://api.ragestudio.net/RSA-COMTY/r/sessions?access_token=",
|
||||
get_sessions: "https://api.ragestudio.net/RSA-COMTY/r/session_id?access_token=",
|
||||
auth_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/auth",
|
||||
new_post: "https://comty.julioworld.club/api/new_post?access_token=",
|
||||
get_config_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/get-site-settings?access_token=",
|
||||
get_userData_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/get-user-data?access_token=",
|
||||
update_userData_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/update-user-data?access_token=",
|
||||
removeToken: "https://api.ragestudio.net/RSA-COMTY/r/delete-access-token?access_token=",
|
||||
register_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/create-account",
|
||||
resetPassword_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/send-reset-password-email?access_token=",
|
||||
}
|
||||
}
|
2
.prev/globals/endpoints/index.js
Normal file
2
.prev/globals/endpoints/index.js
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './comty_endpoints.js'
|
||||
export * from './twitter_endpoints.js'
|
6
.prev/globals/endpoints/twitter_endpoints.js
Normal file
6
.prev/globals/endpoints/twitter_endpoints.js
Normal file
@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
twitter_endpoints: {
|
||||
oa_access: "https://api.twitter.com/oauth/access_token",
|
||||
oa_request: "https://api.twitter.com/oauth/request_token",
|
||||
}
|
||||
}
|
22
.prev/globals/post_options.js
Normal file
22
.prev/globals/post_options.js
Normal file
@ -0,0 +1,22 @@
|
||||
import * as Icons from '@ant-design/icons'
|
||||
|
||||
export var Post_Options = [
|
||||
{
|
||||
key: 'pro_boost',
|
||||
icon: <Icons.RocketOutlined />,
|
||||
type: 'switch',
|
||||
title: 'CPRO™ Boost',
|
||||
description: '',
|
||||
require: 'pro',
|
||||
value: false,
|
||||
},
|
||||
{
|
||||
key: 'allow_comments',
|
||||
icon: <Icons.CommentOutlined />,
|
||||
type: 'switch',
|
||||
title: 'Allow Comments',
|
||||
description: '',
|
||||
require: '',
|
||||
value: true,
|
||||
},
|
||||
]
|
62
.prev/globals/settings.js
Normal file
62
.prev/globals/settings.js
Normal file
@ -0,0 +1,62 @@
|
||||
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 = [
|
||||
{
|
||||
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',
|
||||
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',
|
||||
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',
|
||||
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,
|
||||
},
|
||||
{
|
||||
SettingID: 'force_showDevLogs',
|
||||
type: 'switch',
|
||||
title: 'Show Functions Logs',
|
||||
description: 'Show all console logs... [Developer]',
|
||||
value: fromStorage ? SettingStoragedValue('force_showDevLogs') : false,
|
||||
},
|
||||
]
|
3
.prev/jest.config.js
Normal file
3
.prev/jest.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
testURL: 'http://localhost:8000',
|
||||
}
|
12
.prev/manifest.json
Normal file
12
.prev/manifest.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "Comty",
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"background_color": "white",
|
||||
"description": "RageStudio users dashboard",
|
||||
"icons": [
|
||||
{
|
||||
"src": "logo.svg"
|
||||
}
|
||||
]
|
||||
}
|
131
.prev/package.json
Normal file
131
.prev/package.json
Normal file
@ -0,0 +1,131 @@
|
||||
{
|
||||
"name": "comty-development",
|
||||
"UUID": "C8mVSr-4nmPp2-pr5Vrz-CU4kg4",
|
||||
"title": "Comty™",
|
||||
"DevBuild": true,
|
||||
"version": "0.3.02",
|
||||
"stage": "dev-pre",
|
||||
"description": "",
|
||||
"main": "app/main.js",
|
||||
"author": "RageStudio",
|
||||
"license": "ISC",
|
||||
"build": {
|
||||
"appId": "com.ragestudio.comtydesktop",
|
||||
"mac": {
|
||||
"category": "ragestudio.comty.social.desktop"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/compatible": "^1.0.1",
|
||||
"@ant-design/pro-layout": "^5.0.6",
|
||||
"@capacitor/android": "^1.5.2",
|
||||
"@capacitor/cli": "^1.5.2",
|
||||
"@capacitor/core": "^1.5.2",
|
||||
"@lingui/react": "^2.9.1",
|
||||
"@material-ui/core": "^4.9.3",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"antd": "^4.1.0",
|
||||
"axios": "^0.19.2",
|
||||
"bag.js": "0.0.2",
|
||||
"classnames": "^2.2.6",
|
||||
"cryptr": "^6.0.1",
|
||||
"dotenv": "^8.2.0",
|
||||
"dva": "2.4.1",
|
||||
"dva-model-extend": "^0.1.2",
|
||||
"enquire-js": "^0.2.1",
|
||||
"jquery": "^3.4.1",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"localforage": "^1.7.3",
|
||||
"lodash": "^4.17.15",
|
||||
"md5": "^2.2.1",
|
||||
"moment": "^2.24.0",
|
||||
"node-sass": "^4.13.1",
|
||||
"nprogress": "^0.2.0",
|
||||
"os-utils": "0.0.14",
|
||||
"path-to-regexp": "^6.1.0",
|
||||
"plyr-react": "^2.2.0",
|
||||
"prop-types": "^15.7.2",
|
||||
"radium": "^0.26.0",
|
||||
"react-animations": "^1.0.0",
|
||||
"react-dazzle": "^1.4.0",
|
||||
"react-google-recaptcha": "^2.0.1",
|
||||
"react-helmet": "^5.2.1",
|
||||
"react-perfect-scrollbar": "^1.5.8",
|
||||
"react-reveal": "^1.2.2",
|
||||
"react-scripts": "^3.4.1",
|
||||
"react-select-country-list": "^2.1.2",
|
||||
"react-sound": "^1.2.0",
|
||||
"react-virtualized": "^9.21.2",
|
||||
"socket.io-client": "^2.3.0",
|
||||
"store": "^2.0.12",
|
||||
"timeago.js": "^4.0.2",
|
||||
"ts-cookies": "^1.0.0",
|
||||
"umi-plugin-datahub": "^4.1.0",
|
||||
"validator": "^12.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@lingui/babel-preset-react": "^2.9.1",
|
||||
"@lingui/cli": "^2.9.1",
|
||||
"@lingui/loader": "^2.9.1",
|
||||
"@types/react": "^16.9.19",
|
||||
"babel-core": "7.0.0-bridge.0",
|
||||
"babel-eslint": "^10.0.3",
|
||||
"babel-plugin-dev-expression": "^0.2.2",
|
||||
"babel-plugin-import": "^1.13.0",
|
||||
"babel-plugin-macros": "^2.8.0",
|
||||
"babel-plugin-module-resolver": "^4.0.0",
|
||||
"cross-env": "^7.0.0",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-react-app": "^5.2.0",
|
||||
"eslint-plugin-flowtype": "^4.6.0",
|
||||
"eslint-plugin-import": "^2.20.1",
|
||||
"eslint-plugin-jsx-a11y": "^6.2.3",
|
||||
"eslint-plugin-react": "^7.18.3",
|
||||
"husky": "^4.2.3",
|
||||
"less-vars-to-js": "^1.3.0",
|
||||
"lint-staged": "^10.0.7",
|
||||
"module": "^1.2.5",
|
||||
"now": "^17.0.3",
|
||||
"prettier": "^1.19.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"stylelint": "^13.1.0",
|
||||
"stylelint-config-prettier": "^8.0.1",
|
||||
"stylelint-config-standard": "^20.0.0",
|
||||
"typescript": "^3.8.3",
|
||||
"umi": "^2.13.3",
|
||||
"umi-plugin-react": "^1.15.2",
|
||||
"wait-on": "^4.0.0",
|
||||
"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": {
|
||||
"clean": "rimraf dist",
|
||||
"analyze": "cross-env ANALYZE=1 umi build",
|
||||
"build": "umi build",
|
||||
"start": "umi dev",
|
||||
"test": "cross-env BABELRC=none umi test",
|
||||
"prettier": "prettier --write 'src/**/*.{js,less}'",
|
||||
"add-locale": "lingui add-locale",
|
||||
"extract": "lingui extract",
|
||||
"trans": "lingui extract --clean && node ./scripts/translate.js"
|
||||
}
|
||||
}
|
1
.prev/public/dark_full_logo.svg
Normal file
1
.prev/public/dark_full_logo.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg id="Capa_1" data-name="Capa 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 872.96 353.22"><defs><style>.cls-1{fill:#2b2c2e;}.cls-2{fill:#f3b425;}</style></defs><title>BalckComtyNG-Logo</title><path class="cls-1" d="M508.52,166.9c16.74-19.81,45-20.54,63.07-10.8,21,11.33,32.12,29,31.92,54.52q-.35,43.2.06,86.4c0,4.75-1.23,5.91-5.52,5.74-8.89-.37-17.82-.37-26.71,0-4.45.18-5.89-.87-5.84-6,.28-28.61.15-57.23.13-85.85,0-18.45-12.92-27.37-28.67-19.7-6.86,3.35-9.09,9.71-9.09,17.31q0,43.2,0,86.41c0,9,1,7.62-7.16,7.7-8.55.09-17.11-.22-25.66.12-4.26.17-5.6-1-5.57-5.77.22-28.61.12-57.23.09-85.85,0-3.32.19-6.68-.88-9.92-3.89-11.84-17.82-16.77-27.72-9.72-6,4.28-9.29,9.92-9.23,18,.2,29-.06,58,.2,87,.05,5.3-1.5,6.47-6.13,6.29-9.24-.37-18.5-.21-27.75-.05-2.95.05-4.31-.44-4.3-4.16q.18-70.8.11-141.59c0-1.35-.68-3.56,1.14-3.78,3.19-.4,6.65-1.42,9.58.87a31.77,31.77,0,0,1,4,4.41c5,5.79,5,5.82,11.09,1.5a51,51,0,0,1,22.25-9.07C479.9,148.17,495.75,152.45,508.52,166.9Z" transform="translate(-12.17 -6.57)"/><path class="cls-1" d="M843.78,298.68c-3.36-.73-5.31.77-7.29,1.73-17.69,8.66-34.83,5.65-51.27-3.46-22.64-12.54-33.4-33.26-33.78-60-.37-26.38,0-52.77-.19-79.16,0-3.9,1.08-5.11,4.73-5,9.25.24,18.51.31,27.76,0,4.31-.16,5.62,1.13,5.58,5.84-.23,23.23-.13,46.45-.07,69.68,0,4.45.19,8.92.62,13.34,1.19,12.07,7.17,20.39,18.08,24s20.57,1.67,28.89-7.2c6.92-7.36,10-15.85,9.86-26.36-.37-24.53,0-49.06-.2-73.59,0-4.17.73-5.89,5.1-5.72,9.77.36,19.55.22,29.33,0,3.17-.06,4.21,1,4.2,4.44-.1,42.36.13,84.73-.18,127.1-.14,20.42-8.19,38-21.52,52-13.87,14.59-31,23.07-51,23.42-6.63.12-13.27-.12-19.9-.05-2.42,0-3.42-.82-3.4-3.53.1-10.41.15-20.81,0-31.22-.06-3.73,1.94-3.56,4.37-3.62,8-.2,16,.92,24-.77,8.3-1.75,14.8-6.31,20-13.21C839.5,304.66,841.44,301.9,843.78,298.68Z" transform="translate(-12.17 -6.57)"/><path class="cls-1" d="M703.29,153.08c8,0,16.06.12,24.08-.06,3-.06,4.38.63,4.3,4.27-.22,9.83-.2,19.68,0,29.52.07,3.45-1,4.4-4.17,4.37-15.88-.15-31.76.17-47.63-.22-4.8-.12-5.88,1.6-5.79,6.19.24,12.25.85,24.55.08,36.74-1.1,17.26,15.32,31,28.25,30.7,8.38-.17,16.76.13,25.13-.08,3.23-.07,4.19,1.07,4.13,4.45-.18,9.84,0,19.68-.07,29.52,0,2,.44,4.3-2.66,4.17-14.25-.61-28.66,1.8-42.71-2.26-23.79-6.88-39.76-22.35-47.17-47.86a81.94,81.94,0,0,1-2.92-23.32c0-11.33-.09-22.66.06-34,0-3.06-.73-4.16-3.77-4.23-4.42-.09-10.34,2.31-12.85-1.21-2.13-3-.62-8.93-.65-13.57,0-5.57.39-11.18-.12-16.7-.53-5.67,1.57-7.22,6.42-6.49,2,.31,4.2-.16,6.27.1,3.65.45,4.77-1,4.73-4.93-.19-16.53,0-33.06-.17-49.58-.06-4.22.79-5.85,5.12-5.68,9.41.37,18.85.33,28.26,0,4-.13,5,1.32,5,5.38-.19,16.52.05,33-.17,49.55-.06,4.19,1.07,5.45,5,5.3C687.23,152.86,695.27,153.08,703.29,153.08Z" transform="translate(-12.17 -6.57)"/><path class="cls-1" d="M317,305.48c-105.54-6.08-96.87-163.56,7.16-158.23C421.18,156.65,412.92,304.26,317,305.48Zm.91-119.79c-51-.11-49.27,80.52-.75,81.23C368.21,266.19,366.62,186.35,317.88,185.69Z" transform="translate(-12.17 -6.57)"/><path class="cls-1" d="M65.81,201.94a99.4,99.4,0,0,1,22.54-63.18c26.28-32.3,60.3-44.42,100-37.77,16.86,2.82,31.7,10.71,45.55,21,2.2,1.64,1.88,3.34.48,5.1-7,8.81-11.71,19.19-17.44,28.88-1.38,2.34-2.41,2.63-4.29,1-.79-.69-1.8-1.13-2.54-1.87-18.9-19-54.52-20.41-76.11-5-9.33,6.65-15.9,15.06-21.52,25.1-9.14,16.34-9.58,33.62-2.89,50.08,9.07,22.35,25.54,36.66,48.74,40.48,19.38,3.18,37.1-1.07,52.17-15.1,3-2.74,4.91-3.46,7.42,1,5.14,9.19,9.57,18.89,16.3,27,1.57,1.89,1.88,3.67-.52,5.49-20.36,15.43-42.86,23.65-68,22.76A99.34,99.34,0,0,1,114.68,291c-20.59-13.21-34.88-31.53-43.24-55.72C67.74,224.64,66.25,214,65.81,201.94Z" transform="translate(-12.17 -6.57)"/><path class="cls-2" d="M23.86,93.48c-4.66,0-8-2.53-10.15-6.63a11.41,11.41,0,0,1,.44-12.15c9.5-13.91,21.42-25.17,34.6-35A189.69,189.69,0,0,1,71.38,24.93,181.12,181.12,0,0,1,120.11,7c5.25-1.13,10.27-.22,13.68,4.59,5.08,7.19,1.69,17.32-6.7,19.22-14,3.18-27.77,7.38-40.62,14.1A156.19,156.19,0,0,0,51.34,69.77,145.41,145.41,0,0,0,35.11,87.71C31.69,92.24,29.31,93.46,23.86,93.48Z" transform="translate(-12.17 -6.57)"/><path class="cls-2" d="M84.13,72.24c9.54-6.15,15.92-9.6,19.52-11.48A94.55,94.55,0,0,1,121,54c5.56-1.59,7.9-1.7,10.32-1.06.87.23,8.35,2.33,10.14,9.49a13.72,13.72,0,0,1-1.1,9.06c-1.71,3.21-4.94,5.5-9.5,6.47C111.7,82,95.45,92,81,105.43a93.29,93.29,0,0,0-9.2,10.65c-3.59,4.54-8.14,6.54-13.46,5.2a11.63,11.63,0,0,1-5.39-2.93,12.59,12.59,0,0,1-3.75-7.53c-.35-3.17.69-5.54,2-8.41a31.19,31.19,0,0,1,6.9-9.65A202.75,202.75,0,0,1,84.13,72.24Z" transform="translate(-12.17 -6.57)"/></svg>
|
After Width: | Height: | Size: 4.4 KiB |
1
.prev/public/dark_logo.svg
Normal file
1
.prev/public/dark_logo.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg id="Capa_1" data-name="Capa 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 185.74 232.39"><defs><style>.cls-1{fill:#2b2c2e;}.cls-2{fill:#feb500;}</style></defs><title>black_icon_new2019_black</title><path class="cls-1" d="M342.49,451.06c8.28,8.2,16.5,16.44,24.86,24.55,1.85,1.8.6,2.83-.41,4.08-15.56,19.36-35.85,29.16-60.57,27.74-35.91-2.07-63-26.9-67.73-62.51-5.41-40.92,21.42-78.11,59-85.47,25.83-5.05,55.39,7.3,69.51,29.39,1.07,1.68,2.31,2.94.15,5-8.15,7.85-16.08,15.91-24.21,24-.37-.34-.84-.57-1-.93C334.77,401.49,322.76,394,307,395c-13.74.89-25.63,11.25-30.41,26.51-7,22.32,3.85,43.55,25,48.88C317.7,474.46,332.28,467.59,342.49,451.06Z" transform="translate(-182.77 -275.17)"/><path class="cls-2" d="M192.52,352.88c-3.43-.21-6.6-2.45-8.51-6.25a10.13,10.13,0,0,1,1-11.27,152.39,152.39,0,0,1,33-32.36,159,159,0,0,1,61.51-27.38c8-1.68,13.53,1.45,15.06,8.26,1.48,6.53-2.47,11.86-10.49,13.61-33,7.21-59.84,24.16-80.78,50.57C200.76,351.35,197.56,352.84,192.52,352.88Z" transform="translate(-182.77 -275.17)"/><path class="cls-2" d="M228.48,378.16c-5.69.06-9-2.26-11.2-6.11a9.71,9.71,0,0,1,.8-11.28c17.71-23.09,41-37.62,69.2-44.2,5.59-1.3,11.28,2.58,12.63,8,1.59,6.42-1.53,12.16-8.11,13.87a110.09,110.09,0,0,0-24.27,9,100.52,100.52,0,0,0-31.21,26C234,376.28,231.31,378.28,228.48,378.16Z" transform="translate(-182.77 -275.17)"/></svg>
|
After Width: | Height: | Size: 1.3 KiB |
BIN
.prev/public/favicon.ico
Normal file
BIN
.prev/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
1
.prev/public/full_logo.svg
Normal file
1
.prev/public/full_logo.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg id="Capa_1" data-name="Capa 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 872.96 353.22"><defs><style>.cls-1{fill:#fff;}.cls-2{fill:#f3b425;}</style></defs><title>ComtyNG-Logo</title><path class="cls-1" d="M508.52,166.9c16.74-19.81,45-20.54,63.07-10.8,21,11.33,32.12,29,31.92,54.52q-.35,43.2.06,86.4c0,4.75-1.23,5.91-5.52,5.74-8.89-.37-17.82-.37-26.71,0-4.45.18-5.89-.87-5.84-6,.28-28.61.15-57.23.13-85.85,0-18.45-12.92-27.37-28.67-19.7-6.86,3.35-9.09,9.71-9.09,17.31q0,43.2,0,86.41c0,9,1,7.62-7.16,7.7-8.55.09-17.11-.22-25.66.12-4.26.17-5.6-1-5.57-5.77.22-28.61.12-57.23.09-85.85,0-3.32.19-6.68-.88-9.92-3.89-11.84-17.82-16.77-27.72-9.72-6,4.28-9.29,9.92-9.23,18,.2,29-.06,58,.2,87,.05,5.3-1.5,6.47-6.13,6.29-9.24-.37-18.5-.21-27.75-.05-2.95.05-4.31-.44-4.3-4.16q.18-70.8.11-141.59c0-1.35-.68-3.56,1.14-3.78,3.19-.4,6.65-1.42,9.58.87a31.77,31.77,0,0,1,4,4.41c5,5.79,5,5.82,11.09,1.5a51,51,0,0,1,22.25-9.07C479.9,148.17,495.75,152.45,508.52,166.9Z" transform="translate(-12.17 -6.57)"/><path class="cls-1" d="M843.78,298.68c-3.36-.73-5.31.77-7.29,1.73-17.69,8.66-34.83,5.65-51.27-3.46-22.64-12.54-33.4-33.26-33.78-60-.37-26.38,0-52.77-.19-79.16,0-3.9,1.08-5.11,4.73-5,9.25.24,18.51.31,27.76,0,4.31-.16,5.62,1.13,5.58,5.84-.23,23.23-.13,46.45-.07,69.68,0,4.45.19,8.92.62,13.34,1.19,12.07,7.17,20.39,18.08,24s20.57,1.67,28.89-7.2c6.92-7.36,10-15.85,9.86-26.36-.37-24.53,0-49.06-.2-73.59,0-4.17.73-5.89,5.1-5.72,9.77.36,19.55.22,29.33,0,3.17-.06,4.21,1,4.2,4.44-.1,42.36.13,84.73-.18,127.1-.14,20.42-8.19,38-21.52,52-13.87,14.59-31,23.07-51,23.42-6.63.12-13.27-.12-19.9-.05-2.42,0-3.42-.82-3.4-3.53.1-10.41.15-20.81,0-31.22-.06-3.73,1.94-3.56,4.37-3.62,8-.2,16,.92,24-.77,8.3-1.75,14.8-6.31,20-13.21C839.5,304.66,841.44,301.9,843.78,298.68Z" transform="translate(-12.17 -6.57)"/><path class="cls-1" d="M703.29,153.08c8,0,16.06.12,24.08-.06,3-.06,4.38.63,4.3,4.27-.22,9.83-.2,19.68,0,29.52.07,3.45-1,4.4-4.17,4.37-15.88-.15-31.76.17-47.63-.22-4.8-.12-5.88,1.6-5.79,6.19.24,12.25.85,24.55.08,36.74-1.1,17.26,15.32,31,28.25,30.7,8.38-.17,16.76.13,25.13-.08,3.23-.07,4.19,1.07,4.13,4.45-.18,9.84,0,19.68-.07,29.52,0,2,.44,4.3-2.66,4.17-14.25-.61-28.66,1.8-42.71-2.26-23.79-6.88-39.76-22.35-47.17-47.86a81.94,81.94,0,0,1-2.92-23.32c0-11.33-.09-22.66.06-34,0-3.06-.73-4.16-3.77-4.23-4.42-.09-10.34,2.31-12.85-1.21-2.13-3-.62-8.93-.65-13.57,0-5.57.39-11.18-.12-16.7-.53-5.67,1.57-7.22,6.42-6.49,2,.31,4.2-.16,6.27.1,3.65.45,4.77-1,4.73-4.93-.19-16.53,0-33.06-.17-49.58-.06-4.22.79-5.85,5.12-5.68,9.41.37,18.85.33,28.26,0,4-.13,5,1.32,5,5.38-.19,16.52.05,33-.17,49.55-.06,4.19,1.07,5.45,5,5.3C687.23,152.86,695.27,153.08,703.29,153.08Z" transform="translate(-12.17 -6.57)"/><path class="cls-1" d="M317,305.48c-105.54-6.08-96.87-163.56,7.16-158.23C421.18,156.65,412.92,304.26,317,305.48Zm.91-119.79c-51-.11-49.27,80.52-.75,81.23C368.21,266.19,366.62,186.35,317.88,185.69Z" transform="translate(-12.17 -6.57)"/><path class="cls-1" d="M65.81,201.94a99.4,99.4,0,0,1,22.54-63.18c26.28-32.3,60.3-44.42,100-37.77,16.86,2.82,31.7,10.71,45.55,21,2.2,1.64,1.88,3.34.48,5.1-7,8.81-11.71,19.19-17.44,28.88-1.38,2.34-2.41,2.63-4.29,1-.79-.69-1.8-1.13-2.54-1.87-18.9-19-54.52-20.41-76.11-5-9.33,6.65-15.9,15.06-21.52,25.1-9.14,16.34-9.58,33.62-2.89,50.08,9.07,22.35,25.54,36.66,48.74,40.48,19.38,3.18,37.1-1.07,52.17-15.1,3-2.74,4.91-3.46,7.42,1,5.14,9.19,9.57,18.89,16.3,27,1.57,1.89,1.88,3.67-.52,5.49-20.36,15.43-42.86,23.65-68,22.76A99.34,99.34,0,0,1,114.68,291c-20.59-13.21-34.88-31.53-43.24-55.72C67.74,224.64,66.25,214,65.81,201.94Z" transform="translate(-12.17 -6.57)"/><path class="cls-2" d="M23.86,93.48c-4.66,0-8-2.53-10.15-6.63a11.41,11.41,0,0,1,.44-12.15c9.5-13.91,21.42-25.17,34.6-35A189.69,189.69,0,0,1,71.38,24.93,181.12,181.12,0,0,1,120.11,7c5.25-1.13,10.27-.22,13.68,4.59,5.08,7.19,1.69,17.32-6.7,19.22-14,3.18-27.77,7.38-40.62,14.1A156.19,156.19,0,0,0,51.34,69.77,145.41,145.41,0,0,0,35.11,87.71C31.69,92.24,29.31,93.46,23.86,93.48Z" transform="translate(-12.17 -6.57)"/><path class="cls-2" d="M84.13,72.24c9.54-6.15,15.92-9.6,19.52-11.48A94.55,94.55,0,0,1,121,54c5.56-1.59,7.9-1.7,10.32-1.06.87.23,8.35,2.33,10.14,9.49a13.72,13.72,0,0,1-1.1,9.06c-1.71,3.21-4.94,5.5-9.5,6.47C111.7,82,95.45,92,81,105.43a93.29,93.29,0,0,0-9.2,10.65c-3.59,4.54-8.14,6.54-13.46,5.2a11.63,11.63,0,0,1-5.39-2.93,12.59,12.59,0,0,1-3.75-7.53c-.35-3.17.69-5.54,2-8.41a31.19,31.19,0,0,1,6.9-9.65A202.75,202.75,0,0,1,84.13,72.24Z" transform="translate(-12.17 -6.57)"/></svg>
|
After Width: | Height: | Size: 4.3 KiB |
1
.prev/public/logo.svg
Normal file
1
.prev/public/logo.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg id="Capa_1" data-name="Capa 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 185.74 232.39"><defs><style>.cls-1{fill:#fff;}.cls-2{fill:#feb500;}</style></defs><title>icon_new2019_black</title><path class="cls-1" d="M342.49,451.06c8.28,8.2,16.5,16.44,24.86,24.55,1.85,1.8.6,2.83-.41,4.08-15.56,19.36-35.85,29.16-60.57,27.74-35.91-2.07-63-26.9-67.73-62.51-5.41-40.92,21.42-78.11,59-85.47,25.83-5.05,55.39,7.3,69.51,29.39,1.07,1.68,2.31,2.94.15,5-8.15,7.85-16.08,15.91-24.21,24-.37-.34-.84-.57-1-.93C334.77,401.49,322.76,394,307,395c-13.74.89-25.63,11.25-30.41,26.51-7,22.32,3.85,43.55,25,48.88C317.7,474.46,332.28,467.59,342.49,451.06Z" transform="translate(-182.77 -275.17)"/><path class="cls-2" d="M192.52,352.88c-3.43-.21-6.6-2.45-8.51-6.25a10.13,10.13,0,0,1,1-11.27,152.39,152.39,0,0,1,33-32.36,159,159,0,0,1,61.51-27.38c8-1.68,13.53,1.45,15.06,8.26,1.48,6.53-2.47,11.86-10.49,13.61-33,7.21-59.84,24.16-80.78,50.57C200.76,351.35,197.56,352.84,192.52,352.88Z" transform="translate(-182.77 -275.17)"/><path class="cls-2" d="M228.48,378.16c-5.69.06-9-2.26-11.2-6.11a9.71,9.71,0,0,1,.8-11.28c17.71-23.09,41-37.62,69.2-44.2,5.59-1.3,11.28,2.58,12.63,8,1.59,6.42-1.53,12.16-8.11,13.87a110.09,110.09,0,0,0-24.27,9,100.52,100.52,0,0,0-31.21,26C234,376.28,231.31,378.28,228.48,378.16Z" transform="translate(-182.77 -275.17)"/></svg>
|
After Width: | Height: | Size: 1.3 KiB |
133
.prev/service-worker.js
Normal file
133
.prev/service-worker.js
Normal file
@ -0,0 +1,133 @@
|
||||
// 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();
|
||||
});
|
||||
}
|
||||
}
|
6
.prev/setupTests.js
Normal file
6
.prev/setupTests.js
Normal file
@ -0,0 +1,6 @@
|
||||
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() });
|
8
.prev/src/@ycore/libs.js
Normal file
8
.prev/src/@ycore/libs.js
Normal file
@ -0,0 +1,8 @@
|
||||
// List of modules used for this app
|
||||
export * from './libs/comty_ng/pre.js';
|
||||
export * from './libs/ycore_sync/pre.js';
|
||||
export * from './libs/yulio_id/pre.js';
|
||||
export * from './libs/ycore_styles/pre.js';
|
||||
export * from './libs/ycore_sdcp/pre.js';
|
||||
export * from './libs/app_functions/pre.js';
|
||||
export * from './libs/rs_cloud/pre.js';
|
126
.prev/src/@ycore/libs/app_functions/modals.js
Normal file
126
.prev/src/@ycore/libs/app_functions/modals.js
Normal file
@ -0,0 +1,126 @@
|
||||
import React from 'react'
|
||||
import * as ycore from 'ycore'
|
||||
import * as antd from 'antd'
|
||||
import * as Icons from '@ant-design/icons'
|
||||
import styles from './modals.less';
|
||||
import classnames from 'classnames'
|
||||
|
||||
const isMobile = localStorage.getItem('mobile_src')
|
||||
|
||||
class __Model_postreport extends React.PureComponent {
|
||||
state = {
|
||||
step: 1
|
||||
}
|
||||
end(){
|
||||
if(this.props.id){
|
||||
const payload = { post_id: this.props.id }
|
||||
ycore.comty_post.__report((err, res) => {
|
||||
if (err) {
|
||||
return false
|
||||
}
|
||||
ycore.notify.info('This post has been reported successfully, our team will review it and inform you about problem resolution ...')
|
||||
ycore.FeedHandler.refresh()
|
||||
ycore.FeedHandler.goToElement(this.props.id)
|
||||
}, payload)
|
||||
}
|
||||
setTimeout(() => {
|
||||
ycore.SecondarySwap.close()
|
||||
}, 500)
|
||||
|
||||
}
|
||||
next(){
|
||||
let a = this.state.step
|
||||
|
||||
if(a<3)a++
|
||||
this.setState({step: a })
|
||||
}
|
||||
status(i){
|
||||
const a = this.state.step
|
||||
if (a==i) return 'process'
|
||||
if (a>i) return 'finish'
|
||||
if (a<i) return 'wait'
|
||||
}
|
||||
renderStep(){
|
||||
const a = this.state.step
|
||||
switch (a) {
|
||||
case 1:
|
||||
return (
|
||||
<div className={styles.post_report_body}>
|
||||
<h1>Report an post</h1>
|
||||
<p>This tool is intended for the community in a public way to help identify problematic or abusive content and for legitimate purposes.</p><br/>
|
||||
<p>To ensure the proper use of this tool, before proceeding, you must understand the following:</p>
|
||||
<antd.Checkbox onChange={this.validate.term_1}>I understand and agree that my complaint may be sent to the party that posted the content in question.</antd.Checkbox>
|
||||
<antd.Checkbox onChange={this.validate.term_2}>I understand that the abuse of this tool may have consequences for my account</antd.Checkbox>
|
||||
<br/><br/>{this.state.term_1 && this.state.term_2? <antd.Button onClick={() => this.next()} >Next</antd.Button> : null}
|
||||
</div>
|
||||
)
|
||||
case 2:
|
||||
return(
|
||||
<div className={styles.post_report_body}>
|
||||
<br/>
|
||||
<h3>For this report or complaint to be fair, make sure that the reason is for the following reasons:</h3>
|
||||
<br/>
|
||||
<p>- Harmful content or hate speech</p>
|
||||
<p>- Violent or repulsive content</p>
|
||||
<p>- Misleading advertising or spam</p>
|
||||
<p>- Illegal activities</p>
|
||||
<p>- Sexual content</p>
|
||||
<p>- Or any other activity that violates the terms and conditions of use</p>
|
||||
<antd.Checkbox onChange={this.validate.term_3}>I am sure and understand that the reason for this report is included in the above list.</antd.Checkbox>
|
||||
<br/><br/>{this.state.term_3? <antd.Button onClick={() => this.next()} >Next</antd.Button> : null}
|
||||
|
||||
</div>
|
||||
)
|
||||
case 3:
|
||||
return (
|
||||
<div className={styles.post_report_body}>
|
||||
<br/>
|
||||
<h3>Given the above circumstances, to send this report or report please confirm that you understand and are following that you want to carry out this action</h3>
|
||||
<antd.Checkbox onChange={this.validate.confirm}>I am sure of what I do and I want to send this complaint or report</antd.Checkbox>
|
||||
<br/><br/>{this.state.term_confirm? <antd.Button onClick={() => this.end()} >Send report</antd.Button> : null}
|
||||
|
||||
</div>
|
||||
)
|
||||
default:
|
||||
return null
|
||||
}
|
||||
}
|
||||
validate = {
|
||||
term_1: (e) =>{this.setState({ term_1: e.target.checked })},
|
||||
term_2: (e) =>{this.setState({ term_2: e.target.checked })},
|
||||
term_3: (e) =>{this.setState({ term_3: e.target.checked })},
|
||||
confirm: (e) =>{this.setState({ term_confirm: e.target.checked })}
|
||||
}
|
||||
|
||||
render(){
|
||||
return(
|
||||
<div className={classnames(styles.post_report_main, {[styles.mobile]: isMobile})}>
|
||||
<div>
|
||||
<antd.Steps>
|
||||
<antd.Steps.Step status={this.status(1)} title="Summary" icon={<Icons.SolutionOutlined />} />
|
||||
<antd.Steps.Step status={this.status(2)} title="Confirm" icon={<Icons.AuditOutlined />} />
|
||||
<antd.Steps.Step status={this.status(3)} title="Done" icon={<Icons.CheckCircleOutlined />} />
|
||||
</antd.Steps>
|
||||
</div>
|
||||
{this.renderStep()}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export const app_modals = {
|
||||
report_post: (post_id) => {
|
||||
antd.Modal.confirm({
|
||||
title: 'Report an post',
|
||||
icon: <Icons.FrownOutlined />,
|
||||
content: 'It seems that you want to report this post, first of all it is necessary that you take into account that this tool is only intended for serious cases and we need you to comply with some questions to be able to report this post and to guarantee the quality of service ...',
|
||||
onOk() {
|
||||
return ycore.SecondarySwap.openFragment(<__Model_postreport id={post_id} />)
|
||||
},
|
||||
onCancel() {
|
||||
return false
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
9
.prev/src/@ycore/libs/app_functions/modals.less
Normal file
9
.prev/src/@ycore/libs/app_functions/modals.less
Normal file
@ -0,0 +1,9 @@
|
||||
.post_report_main{
|
||||
padding: 0 0 0 115px;
|
||||
&.mobile{
|
||||
padding: 0 0 60px 0;
|
||||
}
|
||||
}
|
||||
.post_report_body{
|
||||
color: #2d2d2d!important;
|
||||
}
|
219
.prev/src/@ycore/libs/app_functions/pre.js
Normal file
219
.prev/src/@ycore/libs/app_functions/pre.js
Normal file
@ -0,0 +1,219 @@
|
||||
import { RenderFeed } from 'components/MainFeed'
|
||||
import { transitionToogle } from '../../../pages/login'
|
||||
import { SetControls, CloseControls } from '../../../components/Layout/Control'
|
||||
import { SwapMode } from '../../../components/Layout/Secondary'
|
||||
import umiRouter from 'umi/router'
|
||||
import * as ycore from 'ycore'
|
||||
import * as antd from 'antd'
|
||||
import * as Icons from '@ant-design/icons'
|
||||
import React from 'react'
|
||||
|
||||
export * from './modals.js'
|
||||
|
||||
|
||||
|
||||
export function QueryRuntime() {
|
||||
const validBackup = ycore.validate.backup()
|
||||
|
||||
if (!validBackup) ycore.make_data.backup()
|
||||
ycore.sync.listen((data) => {
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
export function SetupApp() {
|
||||
// TODO: Default sets
|
||||
ycore.notify.success('Authorised, please wait...')
|
||||
const resourceLoad = localStorage.getItem('resource_bundle')
|
||||
if (!resourceLoad) {
|
||||
localStorage.setItem('resource_bundle', 'light_ng')
|
||||
}
|
||||
setTimeout(() => {
|
||||
ycore.router.push('main')
|
||||
}, 500)
|
||||
}
|
||||
|
||||
export const CheckThisApp = {
|
||||
desktop_mode: () => {
|
||||
const a = localStorage.getItem('desktop_src')
|
||||
if (a == 'true') {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
}
|
||||
|
||||
export const SecondarySwap = {
|
||||
close: () => {
|
||||
SwapMode.close()
|
||||
},
|
||||
openPost: e => {
|
||||
SwapMode.openPost(e)
|
||||
},
|
||||
openSearch: e => {
|
||||
SwapMode.openSearch(e)
|
||||
},
|
||||
openFragment: e =>{
|
||||
SwapMode.openFragment(e)
|
||||
}
|
||||
}
|
||||
|
||||
export const ControlBar = {
|
||||
set: e => {
|
||||
SetControls(e)
|
||||
},
|
||||
close: () => {
|
||||
CloseControls()
|
||||
},
|
||||
}
|
||||
|
||||
export const FeedHandler = {
|
||||
refresh: () => {
|
||||
RenderFeed.RefreshFeed()
|
||||
},
|
||||
killByID: (post_id) => {
|
||||
RenderFeed.killByID(post_id)
|
||||
},
|
||||
addToRend: (payload) => {
|
||||
RenderFeed.addToRend(payload)
|
||||
},
|
||||
goToElement: post_id => {
|
||||
RenderFeed.goToElement(post_id)
|
||||
},
|
||||
sync: data => {
|
||||
RenderFeed.sync(data)
|
||||
}
|
||||
}
|
||||
|
||||
export const LoginPage = {
|
||||
transitionToogle: () => {
|
||||
transitionToogle()
|
||||
},
|
||||
}
|
||||
|
||||
export const router = {
|
||||
go: e => {
|
||||
goTo.element('primaryContent')
|
||||
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: `/@${ycore.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) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export function RefreshONCE() {
|
||||
window.location = '/'
|
||||
}
|
||||
|
||||
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 }
|
||||
ycore.__rscloud.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}
|
||||
ycore.__rscloud.sdcp_cloud.get(
|
||||
(err, res) => {
|
||||
if (err) {
|
||||
return false
|
||||
}
|
||||
|
||||
let framepayload = { token: { UserID, UserToken }, sdcp: res }
|
||||
ycore.yconsole.log('FRAME ', framepayload)
|
||||
|
||||
ycore.__CTID_GEN((err, res) => {
|
||||
if (err) {
|
||||
ycore.notify.error('Critical error, token declined!')
|
||||
return false
|
||||
}
|
||||
ycore.SetupApp()
|
||||
callback(null, '200')
|
||||
}, framepayload)
|
||||
},
|
||||
preframepayload
|
||||
)
|
||||
}
|
||||
if (identState == 400) {
|
||||
callback(null, '400')
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
callback(true, '500')
|
||||
ycore.notify.error('Server bad response')
|
||||
}
|
||||
}, containerpayload)
|
||||
},
|
||||
logout: () => {
|
||||
ycore.__rscloud.yulio_id.logout((err, res) => {
|
||||
if (err) {
|
||||
return false
|
||||
}
|
||||
console.log(res)
|
||||
const api_state = JSON.parse(res)['api_status']
|
||||
ycore.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: <Icons.WarningOutlined style={{ color: 'orange' }} />,
|
||||
})
|
||||
ycore.yconsole.log('Failed logout with YulioID™', res)
|
||||
} else {
|
||||
ycore.yconsole.log('Successful logout with YulioID™', res)
|
||||
}
|
||||
// Runtime after dispatch API
|
||||
ycore.token_data.remove()
|
||||
ycore.router.push('login')
|
||||
})
|
||||
},
|
||||
}
|
65
.prev/src/@ycore/libs/comty_ng/comty_get.js
Normal file
65
.prev/src/@ycore/libs/comty_ng/comty_get.js
Normal file
@ -0,0 +1,65 @@
|
||||
import { API_Call, endpoints, sdcp } from 'ycore'
|
||||
|
||||
export const comty_get = {
|
||||
sessions: (callback) => {
|
||||
let formdata = new FormData()
|
||||
formdata.append('type', 'get')
|
||||
|
||||
API_Call(
|
||||
(err, res) => {
|
||||
return callback(err, res)
|
||||
},
|
||||
endpoints.comty_endpoints.all_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')
|
||||
}
|
||||
},
|
||||
endpoints.comty_endpoints.get_sessions,
|
||||
formdata)
|
||||
},
|
||||
session: (callback) => {
|
||||
let formdata = new FormData()
|
||||
formdata.append('type', 'get')
|
||||
|
||||
API_Call((err,res) => {
|
||||
return callback(err, res)
|
||||
},
|
||||
endpoints.comty_endpoints.get_sessions,
|
||||
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)
|
||||
},
|
||||
endpoints.comty_endpoints.get_general_data,
|
||||
formdata, callOptions
|
||||
)
|
||||
|
||||
},
|
||||
}
|
209
.prev/src/@ycore/libs/comty_ng/comty_post.js
Normal file
209
.prev/src/@ycore/libs/comty_ng/comty_post.js
Normal file
@ -0,0 +1,209 @@
|
||||
import { API_Call, endpoints, AppSettings, yconsole } from 'ycore'
|
||||
|
||||
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)
|
||||
},
|
||||
endpoints.comty_endpoints.get_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)
|
||||
},
|
||||
endpoints.comty_endpoints.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)
|
||||
},
|
||||
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)
|
||||
},
|
||||
endpoints.comty_endpoints.action_post,
|
||||
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)
|
||||
},
|
||||
endpoints.comty_endpoints.action_post,
|
||||
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)
|
||||
},
|
||||
endpoints.comty_endpoints.action_post,
|
||||
formdata
|
||||
)
|
||||
},
|
||||
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)
|
||||
},
|
||||
endpoints.comty_endpoints.get_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)
|
||||
},
|
||||
endpoints.comty_endpoints.action_post,
|
||||
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)
|
||||
},
|
||||
endpoints.comty_endpoints.action_post,
|
||||
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)
|
||||
},
|
||||
endpoints.comty_endpoints.action_post,
|
||||
formdata
|
||||
)
|
||||
},
|
||||
}
|
41
.prev/src/@ycore/libs/comty_ng/comty_post_comment.js
Normal file
41
.prev/src/@ycore/libs/comty_ng/comty_post_comment.js
Normal file
@ -0,0 +1,41 @@
|
||||
import { API_Call, endpoints } from 'ycore'
|
||||
|
||||
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)
|
||||
},
|
||||
endpoints.comty_endpoints.comments_actions,
|
||||
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)
|
||||
},
|
||||
endpoints.comty_endpoints.action_post,
|
||||
formdata
|
||||
)
|
||||
},
|
||||
}
|
23
.prev/src/@ycore/libs/comty_ng/comty_search.js
Normal file
23
.prev/src/@ycore/libs/comty_ng/comty_search.js
Normal file
@ -0,0 +1,23 @@
|
||||
import { API_Call, endpoints } from 'ycore'
|
||||
|
||||
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)
|
||||
},
|
||||
endpoints.comty_endpoints.search_endpoint,
|
||||
formdata,
|
||||
callOptions
|
||||
)
|
||||
},
|
||||
}
|
75
.prev/src/@ycore/libs/comty_ng/comty_user.js
Normal file
75
.prev/src/@ycore/libs/comty_ng/comty_user.js
Normal file
@ -0,0 +1,75 @@
|
||||
import { API_Call, endpoints } from 'ycore'
|
||||
import { comty_rsa } from '../rs_cloud/pre'
|
||||
|
||||
export const comty_user = {
|
||||
setData: () => {},
|
||||
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)
|
||||
},
|
||||
endpoints.comty_endpoints.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)
|
||||
},
|
||||
comty_rsa.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)
|
||||
},
|
||||
endpoints.comty_endpoints.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)
|
||||
},
|
||||
endpoints.comty_endpoints.get_user_tags,
|
||||
formdata
|
||||
)
|
||||
},
|
||||
}
|
64
.prev/src/@ycore/libs/comty_ng/pre.js
Normal file
64
.prev/src/@ycore/libs/comty_ng/pre.js
Normal file
@ -0,0 +1,64 @@
|
||||
import { token_data } from 'ycore'
|
||||
import * as Icons from '@ant-design/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_get.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 <span><Icons.GlobalOutlined /> Share with everyone</span>
|
||||
case 'only_follow':
|
||||
return <span><Icons.TeamOutlined /> Share with people I follow</span>
|
||||
case 'only_followers':
|
||||
return <span><Icons.UsergroupAddOutlined /> Share with people follow me</span>
|
||||
case 'private':
|
||||
return <span><Icons.EyeInvisibleOutlined /> Dont share, only me</span>
|
||||
default:
|
||||
return <span>Unknown</span>
|
||||
}
|
||||
},
|
||||
|
||||
}
|
95
.prev/src/@ycore/libs/rs_cloud/api_call.js
Normal file
95
.prev/src/@ycore/libs/rs_cloud/api_call.js
Normal file
@ -0,0 +1,95 @@
|
||||
import jquery from 'jquery'
|
||||
import * as ycore from 'ycore'
|
||||
|
||||
export function API_Call(callback, endpoint, payload, options, __token) {
|
||||
var prefix = `[API_Call] `
|
||||
if (!endpoint) return false
|
||||
if (!payload) {
|
||||
ycore.yconsole.log(prefix, 'Calling api without Payload!!!')
|
||||
}
|
||||
let payloadContainer = payload ? payload : new FormData()
|
||||
payloadContainer.append('server_key', ycore.__server.getKey())
|
||||
|
||||
const autoIncludeToken = endpoint.includes('?access_token=')
|
||||
|
||||
const defaultOptions = {
|
||||
method: 'POST',
|
||||
timeout: 0,
|
||||
processData: false,
|
||||
includeUserID: false,
|
||||
override__token: false,
|
||||
disabledToken: autoIncludeToken ? false : true,
|
||||
}
|
||||
|
||||
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 = true) : null
|
||||
options.override__token ? (override__token = true) : null
|
||||
options.disabledToken ? (disabledToken = true) : null
|
||||
}
|
||||
|
||||
if (disabledToken) {
|
||||
ycore.yconsole.log(`${prefix} Dimmissing the token generation`)
|
||||
fendpoint = `${endpoint}`
|
||||
}
|
||||
|
||||
if (!disabledToken && !override__token) {
|
||||
fendpoint = `${endpoint}${ycore.token_data.__token()}`
|
||||
}
|
||||
|
||||
if (override__token || __token) {
|
||||
if (!__token) {
|
||||
ycore.yconsole.log(`${prefix} Missing Overriding __token`)
|
||||
return
|
||||
}
|
||||
ycore.yconsole.log(`${prefix} Overriding __token => ${__token}`)
|
||||
fendpoint = `${endpoint}${__token}`
|
||||
}
|
||||
|
||||
if (includeUserID) {
|
||||
payloadContainer.append('user_id', ycore.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') {
|
||||
ycore.Alive_API.tokenError(response)
|
||||
}
|
||||
} catch (error) {
|
||||
ycore.yconsole.log(
|
||||
'[VIOLATION] The status of the request has not been identified!'
|
||||
)
|
||||
ycore.Alive_API.violation()
|
||||
}
|
||||
ycore.yconsole.log(response)
|
||||
return callback(false, response)
|
||||
})
|
||||
.fail(error => {
|
||||
ycore.yconsole.log(`${prefix} (ERROR) `, error)
|
||||
ycore.Alive_API.fail(error)
|
||||
return callback(true, error)
|
||||
})
|
||||
}
|
101
.prev/src/@ycore/libs/rs_cloud/pre.js
Normal file
101
.prev/src/@ycore/libs/rs_cloud/pre.js
Normal file
@ -0,0 +1,101 @@
|
||||
import * as ycore from 'ycore'
|
||||
export * from './api_call.js'
|
||||
import keys from '../../../../config/keys.js'
|
||||
|
||||
export const Alive_API = {
|
||||
fail: a => {
|
||||
if (a) {
|
||||
ycore.yconsole.log(a)
|
||||
ycore.notify.error(a)
|
||||
}
|
||||
},
|
||||
tokenError: a => {
|
||||
ycore.notify.expire(
|
||||
'It seems that your token has expired or no longer exists'
|
||||
)
|
||||
ycore.router.go('login')
|
||||
},
|
||||
violation: a => {
|
||||
ycore.notify.expire(
|
||||
'It seems that there has been a problem with your token, we need you to log in again.'
|
||||
)
|
||||
ycore.router.go('login')
|
||||
},
|
||||
}
|
||||
export const __server = {
|
||||
getKey: () => {
|
||||
return keys.server_key
|
||||
},
|
||||
}
|
||||
export const __rscloud = {
|
||||
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 }
|
||||
ycore.API_Call(
|
||||
(err, res) => {
|
||||
return callback(err, res)
|
||||
},
|
||||
ycore.endpoints.comty_endpoints.auth_endpoint,
|
||||
formdata,
|
||||
callOptions
|
||||
)
|
||||
},
|
||||
logout: callback => {
|
||||
const callOptions = { includeUserID: true }
|
||||
ycore.API_Call(
|
||||
(err, res) => {
|
||||
return callback(err, res)
|
||||
},
|
||||
ycore.endpoints.comty_endpoints.removeToken,
|
||||
null,
|
||||
callOptions
|
||||
)
|
||||
},
|
||||
verify: (callback, payload) => {},
|
||||
sign: (callback, payload) => {},
|
||||
},
|
||||
sdcp_cloud: {
|
||||
get: (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 }
|
||||
ycore.API_Call(
|
||||
(err, res) => {
|
||||
try {
|
||||
let cooked = JSON.parse(res)['user_data']
|
||||
let Ensamblator = btoa(JSON.stringify(cooked))
|
||||
return callback(err, Ensamblator)
|
||||
} catch (error) {
|
||||
return callback(true, error)
|
||||
}
|
||||
},
|
||||
ycore.endpoints.comty_endpoints.get_userData_endpoint,
|
||||
formdata,
|
||||
optionCall,
|
||||
user_token
|
||||
)
|
||||
},
|
||||
set: () => {},
|
||||
},
|
||||
}
|
||||
|
||||
export const comty_rsa = {
|
||||
endpoint: (endpoint, options) => {
|
||||
let join_token = true;
|
||||
if (options) {
|
||||
join_token = options.join_token
|
||||
}
|
||||
return `${ycore.AppSettings.__global_server_prexif}${endpoint}${join_token? `?access_token=` : ``}`
|
||||
}
|
||||
}
|
67
.prev/src/@ycore/libs/ycore_sdcp/pre.js
Normal file
67
.prev/src/@ycore/libs/ycore_sdcp/pre.js
Normal file
@ -0,0 +1,67 @@
|
||||
import * as ycore from 'ycore'
|
||||
import localforage from 'localforage'
|
||||
|
||||
export const sdcp = {
|
||||
isset: (value) => {
|
||||
if (!value) return false
|
||||
ycore.sdcp.localforage.getItem(value)? true : false
|
||||
},
|
||||
set: (operator) => {
|
||||
if (!operator) return false
|
||||
try {
|
||||
let a;
|
||||
let b;
|
||||
|
||||
let { callback, model } = operator
|
||||
const {key, value} = model
|
||||
if (!typeof key === 'string' || ! a instanceof String) return false
|
||||
|
||||
a = ycore.sdcp.get(key)
|
||||
if (!a.isArray()) return false
|
||||
|
||||
b = JSON.parse(a).concat(value)
|
||||
|
||||
localforage.setItem(key, b)
|
||||
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
return false
|
||||
}
|
||||
},
|
||||
get: (key) => {
|
||||
try {
|
||||
return localforage.getItem(key)
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
export const cryptSDCP = {
|
||||
atob_parse: e => {
|
||||
if (e) {
|
||||
try {
|
||||
atob(e)
|
||||
} catch (err) {
|
||||
ycore.notify.error(err)
|
||||
ycore.router.go('login')
|
||||
return false
|
||||
}
|
||||
try {
|
||||
let decodedSDCP = atob(e)
|
||||
let parsedSDCP = JSON.parse(decodedSDCP)
|
||||
return parsedSDCP
|
||||
} catch (err) {
|
||||
ycore.notify.error(err)
|
||||
ycore.router.go('login')
|
||||
return false
|
||||
}
|
||||
}
|
||||
return false
|
||||
},
|
||||
valid: () => {
|
||||
const a = ycore.sdcp.get()
|
||||
return a ? true : false
|
||||
},
|
||||
}
|
11
.prev/src/@ycore/libs/ycore_styles/pre.js
Normal file
11
.prev/src/@ycore/libs/ycore_styles/pre.js
Normal file
@ -0,0 +1,11 @@
|
||||
import {AppSettings} from 'ycore'
|
||||
|
||||
export function CurrentTheme(){
|
||||
try {
|
||||
const bundle = localStorage.getItem('resource_bundle') || AppSettings.resource_bundle
|
||||
console.log('Loading resource Bundle =>', bundle)
|
||||
return bundle
|
||||
} catch (error) {
|
||||
return null
|
||||
}
|
||||
}
|
1488
.prev/src/@ycore/libs/ycore_styles/ycore_style.scss
Normal file
1488
.prev/src/@ycore/libs/ycore_styles/ycore_style.scss
Normal file
File diff suppressed because it is too large
Load Diff
50
.prev/src/@ycore/libs/ycore_sync/pre.js
Normal file
50
.prev/src/@ycore/libs/ycore_sync/pre.js
Normal file
@ -0,0 +1,50 @@
|
||||
import * as ycore from 'ycore'
|
||||
import * as antd from 'antd'
|
||||
import * as Icons from '@ant-design/icons'
|
||||
import io from 'socket.io-client'
|
||||
import config from 'config'
|
||||
|
||||
var endpoint = config.sync_server;
|
||||
|
||||
|
||||
export const sync = {
|
||||
listen: (callback) => {
|
||||
let conn_overrun_tick = 0;
|
||||
const socket = io(endpoint);
|
||||
|
||||
socket.on('connect_error', (error) => {
|
||||
conn_overrun_tick ++
|
||||
ycore.yconsole.log('Overrun tick => ',conn_overrun_tick)
|
||||
if (conn_overrun_tick == 1) {
|
||||
antd.notification.open({
|
||||
onClose: () => conn_overrun_tick = 0,
|
||||
duration: 15,
|
||||
message: 'Disconected from server!',
|
||||
description: 'Attempting to reconnect...',
|
||||
icon: <Icons.LoadingOutlined spin />,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
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)
|
||||
});
|
||||
|
||||
},
|
||||
FeedListen: (callback) => {
|
||||
const socket = io(endpoint);
|
||||
socket.on('pull_event', function (data) {
|
||||
callback(data)
|
||||
});
|
||||
},
|
||||
emmitPost: (last_id) => {
|
||||
const socket = io(endpoint);
|
||||
socket.emit('push_event', last_id);
|
||||
}
|
||||
}
|
32
.prev/src/@ycore/libs/yulio_id/ctid_gen.js
Normal file
32
.prev/src/@ycore/libs/yulio_id/ctid_gen.js
Normal file
@ -0,0 +1,32 @@
|
||||
import * as ycore from 'ycore'
|
||||
/**
|
||||
* Cookies Token ID Generator
|
||||
*
|
||||
* @callback {func} return with (err,res) model
|
||||
* @payload {object} Payload data
|
||||
*/
|
||||
export function __CTID_GEN(callback, payload) {
|
||||
const { token, sdcp } = payload
|
||||
|
||||
const { UserID, UserToken } = token
|
||||
const a = ycore.cryptSDCP.atob_parse(sdcp)
|
||||
|
||||
const { avatar, admin, pro, dev, is_pro, username } = a
|
||||
|
||||
const frame = {
|
||||
UserID,
|
||||
UserToken,
|
||||
avatar,
|
||||
admin,
|
||||
pro,
|
||||
dev,
|
||||
is_pro,
|
||||
username,
|
||||
exp: ycore.AppSettings.SignForNotExpire
|
||||
? 0
|
||||
: Math.floor(Date.now() / 1000) + 60 * 60,
|
||||
}
|
||||
ycore.token_data.set(frame, done => {
|
||||
done ? callback(false, true) : callback(true, false)
|
||||
})
|
||||
}
|
59
.prev/src/@ycore/libs/yulio_id/pre.js
Normal file
59
.prev/src/@ycore/libs/yulio_id/pre.js
Normal file
@ -0,0 +1,59 @@
|
||||
import * as ycore from 'ycore'
|
||||
import Cookies from 'ts-cookies'
|
||||
|
||||
// EXPORT PUBLIC WORKERS
|
||||
export * from './token_data.js'
|
||||
export * from './ctid_gen.js'
|
||||
export * from './validate.js'
|
||||
|
||||
export function userData() {
|
||||
return ycore.token_data.get()
|
||||
}
|
||||
|
||||
export const make_data = {
|
||||
backup: () => {
|
||||
localStorage.setItem('last_backup', Cookies.get('cid'))
|
||||
},
|
||||
}
|
||||
|
||||
export const IsThisUser = {
|
||||
admin: () => {
|
||||
return ycore.booleanFix(ycore.userData().admin) ? true : false
|
||||
},
|
||||
dev: () => {
|
||||
return ycore.booleanFix(ycore.userData().dev) ? true : false
|
||||
},
|
||||
pro: () => {
|
||||
return ycore.booleanFix(ycore.userData().is_pro) ? true : false
|
||||
},
|
||||
nsfw: () => {
|
||||
return ycore.booleanFix(ycore.userData().nsfw) ? true : false
|
||||
},
|
||||
same: a => {
|
||||
if (a == ycore.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 }
|
||||
ycore.API_Call(
|
||||
(err, res) => {
|
||||
return callback(err, res)
|
||||
},
|
||||
ycore.comty_rsa.endpoint('early_user', {join_token: false}),
|
||||
formdata,
|
||||
callOptions
|
||||
)
|
||||
}
|
||||
}
|
45
.prev/src/@ycore/libs/yulio_id/token_data.js
Normal file
45
.prev/src/@ycore/libs/yulio_id/token_data.js
Normal file
@ -0,0 +1,45 @@
|
||||
import * as ycore from 'ycore'
|
||||
|
||||
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
|
||||
}
|
||||
ycore.yconsole.debug(final)
|
||||
return final
|
||||
},
|
||||
remove: () => {
|
||||
Cookies.remove('cid')
|
||||
},
|
||||
__token: () => {
|
||||
return ycore.token_data.get().UserToken
|
||||
},
|
||||
__id: () => {
|
||||
return ycore.token_data.get().UserID
|
||||
},
|
||||
}
|
55
.prev/src/@ycore/libs/yulio_id/validate.js
Normal file
55
.prev/src/@ycore/libs/yulio_id/validate.js
Normal file
@ -0,0 +1,55 @@
|
||||
import * as ycore from 'ycore'
|
||||
import Cookies from 'ts-cookies'
|
||||
var jwt = require('jsonwebtoken')
|
||||
|
||||
export const validate = {
|
||||
session: callback => {
|
||||
let validtoken = false
|
||||
const a = Cookies.get('cid')
|
||||
if (a) {
|
||||
const modExp = ycore.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()
|
||||
|
||||
ycore.yconsole.log(
|
||||
`TOKEN EXP => ${tokenExp} ${
|
||||
modExp ? '( Infinite )' : `( ${tokenExpLocale} )`
|
||||
} || NOW => ${now}`
|
||||
)
|
||||
|
||||
if (modExp == false) {
|
||||
if (tokenExp < now) {
|
||||
ycore.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 = localStorage.getItem('last_backup')
|
||||
if (LastestToken) {
|
||||
let LastestTokenDC = jwt.decode(LastestToken)
|
||||
if (LastestTokenDC) {
|
||||
ValidBackupToken = true
|
||||
}
|
||||
}
|
||||
return ValidBackupToken
|
||||
},
|
||||
}
|
333
.prev/src/@ycore/ycore_worker.js
Normal file
333
.prev/src/@ycore/ycore_worker.js
Normal file
@ -0,0 +1,333 @@
|
||||
/**
|
||||
* @yCore_Worker
|
||||
*
|
||||
* @author rStudio© 2020
|
||||
* @licensed Pending...
|
||||
*/
|
||||
|
||||
import * as Endpoints from 'globals/endpoints/index.js'
|
||||
import io from 'socket.io-client'
|
||||
import * as Icons from '@ant-design/icons'
|
||||
import localforage from 'localforage'
|
||||
import { format } from 'timeago.js'
|
||||
import * as antd from 'antd'
|
||||
import moment from 'moment'
|
||||
import React from 'react'
|
||||
|
||||
import config from 'config'
|
||||
import './libs.js'
|
||||
|
||||
export * from '../../config/app.settings.js'
|
||||
export * from './libs.js'
|
||||
|
||||
export var endpoints = Endpoints
|
||||
|
||||
export const package_json = require('../../package.json')
|
||||
|
||||
export const UUAID = `${package_json.name}==${package_json.UUID}`
|
||||
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 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()
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Framework functionality for show with interface an notification
|
||||
*
|
||||
*/
|
||||
const {FieldTimeOutlined} = require('@ant-design/icons')
|
||||
export const notify = {
|
||||
expire: (...res) => {
|
||||
antd.notification.error({
|
||||
message: 'Hey ',
|
||||
icon: <FieldTimeOutlined />,
|
||||
description: res,
|
||||
placement: 'bottomLeft',
|
||||
})
|
||||
},
|
||||
info: (...res) => {
|
||||
antd.notification.info({
|
||||
message: 'Well',
|
||||
description: res.toString(),
|
||||
placement: 'bottomLeft',
|
||||
})
|
||||
},
|
||||
exception: (...res) => {
|
||||
antd.notification.error({
|
||||
message: 'WoW!',
|
||||
description: res.toString(),
|
||||
placement: 'bottomLeft',
|
||||
})
|
||||
},
|
||||
warn: (...res) => {
|
||||
antd.notification.warn({
|
||||
message: 'Hey!',
|
||||
description: res.toString(),
|
||||
placement: 'bottomLeft',
|
||||
})
|
||||
},
|
||||
success: (...res) => {
|
||||
antd.notification.success({
|
||||
message: 'Well',
|
||||
description: res.toString(),
|
||||
placement: 'bottomLeft',
|
||||
})
|
||||
},
|
||||
error: (...res) => {
|
||||
antd.notification.error({
|
||||
message: 'Wopss',
|
||||
description: (
|
||||
<div>
|
||||
<span>An wild error appear! : </span>
|
||||
<br />
|
||||
<br />
|
||||
<div
|
||||
style={{
|
||||
position: 'relative',
|
||||
width: '100%',
|
||||
backgroundColor: 'rgba(243, 19, 19, 0.329)',
|
||||
bottom: '0',
|
||||
color: 'black',
|
||||
padding: '3px',
|
||||
}}
|
||||
>
|
||||
{res.toString()}
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
placement: 'bottomLeft',
|
||||
})
|
||||
},
|
||||
proccess: (...res) => {
|
||||
antd.notification.open({
|
||||
icon: <Icons.LoadingOutlined style={{ color: '#108ee9' }} />,
|
||||
message: 'Please wait',
|
||||
description: <div>{res}</div>,
|
||||
placement: 'bottomLeft',
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* 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()
|
||||
}
|
||||
}
|
29
.prev/src/components/App_about/index.js
Normal file
29
.prev/src/components/App_about/index.js
Normal file
@ -0,0 +1,29 @@
|
||||
import React from 'react'
|
||||
import styles from './index.less'
|
||||
import * as ycore from 'ycore'
|
||||
import * as antd from 'antd'
|
||||
|
||||
export default class App_About extends React.Component {
|
||||
DetectNoNStableBuild() {
|
||||
if (ycore.package_json.DevBuild == false) {
|
||||
return <antd.Tag color="blue">Stable</antd.Tag>
|
||||
} else {
|
||||
return <antd.Tag color="orange">No Stable</antd.Tag>
|
||||
}
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<div className={styles.aboutWrapper}>
|
||||
<img src={ycore.AppInfo.logo} />
|
||||
<antd.Card>
|
||||
<h1 className={styles.appName}> {ycore.AppInfo.name} </h1>
|
||||
{ycore.UUAID}
|
||||
<br />
|
||||
<antd.Tag color="geekblue">v{ycore.AppInfo.version}</antd.Tag>
|
||||
<antd.Tag color="red">{ycore.AppInfo.stage}</antd.Tag>
|
||||
{this.DetectNoNStableBuild()}
|
||||
</antd.Card>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
18
.prev/src/components/App_about/index.less
Normal file
18
.prev/src/components/App_about/index.less
Normal file
@ -0,0 +1,18 @@
|
||||
.aboutWrapper {
|
||||
margin: auto;
|
||||
max-width: 70vw;
|
||||
width: 500px;
|
||||
vertical-align: middle;
|
||||
position: relative;
|
||||
background-color: rgba(73, 72, 72, 0.349);
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
padding: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.appName {
|
||||
font-family: "Poppins", sans-serif;
|
||||
font-size: 27px;
|
||||
}
|
11
.prev/src/components/CustomIcons/index.js
Normal file
11
.prev/src/components/CustomIcons/index.js
Normal file
@ -0,0 +1,11 @@
|
||||
const VerifiedBadge = () => (<svg xmlns="http://www.w3.org/2000/svg" fill="#55acee" width="15" height="15" viewBox="0 0 24 24"> <path d="M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12m-13 5l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z"></path></svg>)
|
||||
const CommonThings = () => (<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#ff5991" d="M15,2C16.94,2 18.59,2.7 19.95,4.05C21.3,5.41 22,7.06 22,9C22,10.56 21.5,11.96 20.58,13.2C19.64,14.43 18.44,15.27 16.97,15.7L17,15.38V15C17,12.81 16.23,10.93 14.65,9.35C13.07,7.77 11.19,7 9,7H8.63L8.3,7.03C8.73,5.56 9.57,4.36 10.8,3.42C12.04,2.5 13.44,2 15,2M9,8A7,7 0 0,1 16,15A7,7 0 0,1 9,22A7,7 0 0,1 2,15A7,7 0 0,1 9,8M9,10A5,5 0 0,0 4,15A5,5 0 0,0 9,20A5,5 0 0,0 14,15A5,5 0 0,0 9,10Z"></path></svg>)
|
||||
const SunSVG = () => (<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 21 21"><g fill="none" fillRule="evenodd"><path fill="#fff" fillRule="nonzero" d="M21 10.5l-3 3V18h-4.5l-3 3-3-3H3v-4.5l-3-3 3-3V3h4.5l3-3 3 3H18v4.5z"></path><circle stroke="#000" strokeWidth="1.5" cx="10.5" cy="10.5" r="4"></circle></g></svg>)
|
||||
const MoonSVG = () => (<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 21 21"><g fill="none" fillRule="evenodd"><circle fill="#fff" cx="10.5" cy="10.5" r="10.5"></circle><path d="M13.396 11c0-3.019-1.832-5.584-4.394-6.566A6.427 6.427 0 0111.304 4C15.002 4 18 7.135 18 11c0 3.866-2.998 7-6.698 7A6.42 6.42 0 019 17.566c2.564-.98 4.396-3.545 4.396-6.566z" fill="#2F2E30" fillRule="nonzero"></path></g></svg>)
|
||||
const RobotOutlined = () => (<svg viewBox="64 64 896 896" focusable="false" data-icon="robot" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"></path></svg>)
|
||||
const SavedPost = () => (<svg viewBox="0 0 24 24" focusable="false" width="1em" height="1em" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" ><path d="M4 3h16a2 2 0 0 1 2 2v6a10 10 0 0 1-10 10A10 10 0 0 1 2 11V5a2 2 0 0 1 2-2z"></path><polyline points="8 10 12 14 16 10"></polyline></svg>)
|
||||
const SavedPostColor = () => (<svg viewBox="0 0 24 24" focusable="false" width="1em" height="1em" fill="rgb(230, 247, 255)" stroke="rgb(24, 144, 255)" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" ><path d="M4 3h16a2 2 0 0 1 2 2v6a10 10 0 0 1-10 10A10 10 0 0 1 2 11V5a2 2 0 0 1 2-2z"></path><polyline points="8 10 12 14 16 10"></polyline></svg>)
|
||||
const SavedPostGrey = () => (<svg viewBox="0 0 24 24" focusable="false" width="1em" height="1em" fill="rgb(196, 196, 196)" stroke="rgba(133, 133, 133, 1)" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" ><path d="M4 3h16a2 2 0 0 1 2 2v6a10 10 0 0 1-10 10A10 10 0 0 1 2 11V5a2 2 0 0 1 2-2z"></path><polyline points="8 10 12 14 16 10"></polyline></svg>)
|
||||
const TrendBlue = () => (<svg width="1em" height="1em" viewBox="0 0 24 24"><path fill="currentColor" d="M16,6L18.29,8.29L13.41,13.17L9.41,9.17L2,16.59L3.41,18L9.41,12L13.41,16L19.71,9.71L22,12V6H16Z"></path></svg>)
|
||||
const CustomIcons = {SavedPostGrey, SavedPostColor, VerifiedBadge, CommonThings, SunSVG, MoonSVG, RobotOutlined, SavedPost}
|
||||
export default CustomIcons
|
83
.prev/src/components/HeaderSearch/index.js
Normal file
83
.prev/src/components/HeaderSearch/index.js
Normal file
@ -0,0 +1,83 @@
|
||||
import React, { Component } from 'react'
|
||||
import * as antd from 'antd'
|
||||
import * as ycore from 'ycore'
|
||||
import styles from './index.less'
|
||||
import classnames from 'classnames'
|
||||
import * as Icons from '@ant-design/icons'
|
||||
|
||||
export const SetHeaderSearchType = {
|
||||
disable: () => {
|
||||
window.HeaderSearchComponent.setState({ searchidden: true })
|
||||
},
|
||||
enable: () => {
|
||||
window.HeaderSearchComponent.setState({ searchidden: false })
|
||||
},
|
||||
toPrimary: () => {
|
||||
window.HeaderSearchComponent.setState({ framelocation: 'primary' })
|
||||
},
|
||||
toSecondary: () => {
|
||||
window.HeaderSearchComponent.setState({ framelocation: 'secondary' })
|
||||
},
|
||||
}
|
||||
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
|
||||
ycore.SecondarySwap.openSearch(value);
|
||||
}
|
||||
|
||||
sendToSearch = () => {
|
||||
const { value } = this.state
|
||||
ycore.router.go(`s/${value}`)
|
||||
}
|
||||
|
||||
onChange = e => {
|
||||
const { value } = e.target
|
||||
this.setState({ value: value })
|
||||
if (ycore.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
|
||||
ycore.router.go(`s/${value}`)
|
||||
}, 500)
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
const { searchidden } = this.state
|
||||
return (
|
||||
<div
|
||||
className={classnames(styles.HeaderSearchWrapper, {
|
||||
[styles.hidden]: searchidden,
|
||||
})}
|
||||
>
|
||||
<span className={styles.headerSearch}>
|
||||
<antd.Input
|
||||
id="search_input"
|
||||
prefix={<Icons.SearchOutlined />}
|
||||
placeholder=" Search on Comty..."
|
||||
onChange={this.onChange}
|
||||
onPressEnter={this.openSearcher}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
78
.prev/src/components/HeaderSearch/index.less
Normal file
78
.prev/src/components/HeaderSearch/index.less
Normal file
@ -0,0 +1,78 @@
|
||||
@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;
|
||||
}
|
||||
}
|
||||
}
|
67
.prev/src/components/Layout/Control.js
Normal file
67
.prev/src/components/Layout/Control.js
Normal file
@ -0,0 +1,67 @@
|
||||
import React from 'react'
|
||||
import * as antd from 'antd'
|
||||
import * as ycore from 'ycore'
|
||||
import styles from './Control.less'
|
||||
|
||||
import Radium, { StyleRoot } from 'radium'
|
||||
import { fadeInUp, bounceOutDown } from 'react-animations'
|
||||
const animationStyles = {
|
||||
fadeInUp: {
|
||||
animation: 'x 0.5s',
|
||||
animationName: Radium.keyframes(fadeInUp, 'fadeInUp'),
|
||||
},
|
||||
bounceOutDown: {
|
||||
animation: 'x 1s',
|
||||
animationName: Radium.keyframes(bounceOutDown, 'bounceOutDown'),
|
||||
},
|
||||
}
|
||||
|
||||
export function SetControls(e) {
|
||||
window.ControlComponent.DummySetControls(e)
|
||||
return
|
||||
}
|
||||
export function CloseControls() {
|
||||
window.ControlComponent.DummyCloseControls()
|
||||
return
|
||||
}
|
||||
|
||||
class Control extends React.Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
window.ControlComponent = this
|
||||
this.state = {
|
||||
Show: false,
|
||||
FadeIN: true,
|
||||
}
|
||||
}
|
||||
DummySetControls = e => {
|
||||
ycore.yconsole.log('Controls recived => ', e)
|
||||
if (this.state.Show == false) {
|
||||
this.setState({ FadeIN: true })
|
||||
}
|
||||
this.setState({ Show: true, RenderFragment: e })
|
||||
}
|
||||
DummyCloseControls() {
|
||||
ycore.yconsole.log('Closing Control Bar...')
|
||||
this.setState({ FadeIN: false })
|
||||
setTimeout(() => this.setState({ Show: false, RenderFragment: null }), 1000)
|
||||
}
|
||||
|
||||
render() {
|
||||
const { RenderFragment, Show, FadeIN } = this.state
|
||||
return Show ? (
|
||||
<StyleRoot>
|
||||
<div
|
||||
style={
|
||||
FadeIN ? animationStyles.fadeInUp : animationStyles.bounceOutDown
|
||||
}
|
||||
>
|
||||
<antd.Card bordered={false} className={styles.ControlCard}>
|
||||
<React.Fragment>{RenderFragment}</React.Fragment>
|
||||
</antd.Card>
|
||||
</div>
|
||||
</StyleRoot>
|
||||
) : null
|
||||
}
|
||||
}
|
||||
export default Control
|
26
.prev/src/components/Layout/Control.less
Normal file
26
.prev/src/components/Layout/Control.less
Normal file
@ -0,0 +1,26 @@
|
||||
@import '~themes/index.less';
|
||||
|
||||
.ControlCard {
|
||||
overflow: hidden;
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
width: auto;
|
||||
max-width: 60%;
|
||||
padding: 0 5px 0 5px;
|
||||
margin: 0 0 0 50%;
|
||||
height: auto;
|
||||
position: absolute;
|
||||
z-index: 10000;
|
||||
bottom: 0;
|
||||
text-align: center;
|
||||
|
||||
:global {
|
||||
.ant-card-body {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.ant-btn {
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
margin: 3px;
|
||||
}
|
||||
}
|
||||
}
|
254
.prev/src/components/Layout/Secondary/index.js
Normal file
254
.prev/src/components/Layout/Secondary/index.js
Normal file
@ -0,0 +1,254 @@
|
||||
import React from 'react'
|
||||
import * as ycore from 'ycore'
|
||||
import * as antd from 'antd'
|
||||
import * as Icons from '@ant-design/icons'
|
||||
import styles from './index.less'
|
||||
import classnames from 'classnames'
|
||||
|
||||
import { __priPost, __secComments, __priSearch, __trendings, __pro } from './renders.js'
|
||||
|
||||
export const SwapMode = {
|
||||
close: () => {
|
||||
SecondaryLayoutComponent.Swapper.close()
|
||||
},
|
||||
openPost: (a, b) => {
|
||||
SecondaryLayoutComponent.setState({
|
||||
mode: 'post',
|
||||
global_raw: a,
|
||||
})
|
||||
SecondaryLayoutComponent.Swapper.open()
|
||||
},
|
||||
openSearch: a => {
|
||||
SecondaryLayoutComponent.setState({
|
||||
mode: 'search',
|
||||
pri_raw: a,
|
||||
})
|
||||
SecondaryLayoutComponent.Swapper.half()
|
||||
},
|
||||
openFragment: fragment => {
|
||||
SecondaryLayoutComponent.setState({
|
||||
mode: 'fragment',
|
||||
global_raw: fragment,
|
||||
})
|
||||
SecondaryLayoutComponent.Swapper.unique()
|
||||
}
|
||||
}
|
||||
|
||||
export default class Secondary extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props),
|
||||
window.SecondaryLayoutComponent = this,
|
||||
this.state = {
|
||||
loading: true,
|
||||
half: false,
|
||||
swap: false,
|
||||
mode: '',
|
||||
gen_data: '',
|
||||
global_raw: '',
|
||||
pri_raw: '',
|
||||
sec_raw: '',
|
||||
}
|
||||
}
|
||||
|
||||
Swapper = {
|
||||
close: () => {
|
||||
this.setState({
|
||||
swap: false,
|
||||
half: false,
|
||||
unique: false,
|
||||
pri_raw: null,
|
||||
sec_raw: null,
|
||||
global_raw: null,
|
||||
mode: null,
|
||||
})
|
||||
},
|
||||
open: () => {
|
||||
this.setState({
|
||||
swap: true,
|
||||
half: false,
|
||||
unique: false,
|
||||
})
|
||||
},
|
||||
half : () => {
|
||||
this.setState({
|
||||
swap: false,
|
||||
half: true,
|
||||
unique: false,
|
||||
})
|
||||
},
|
||||
unique: ()=>{
|
||||
this.setState({
|
||||
swap: false,
|
||||
half: false,
|
||||
unique: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
SwapBalanceContent(container) {
|
||||
switch (container) {
|
||||
case '__pri': {
|
||||
return this.__pri()
|
||||
}
|
||||
case '__sec': {
|
||||
return this.__sec()
|
||||
}
|
||||
default:
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
__pri() {
|
||||
const dtraw = this.state.pri_raw
|
||||
switch (this.state.mode) {
|
||||
case 'post': {
|
||||
return this.renderPost(this.state.global_raw)
|
||||
}
|
||||
case 'search': {
|
||||
return this.renderSearch(dtraw)
|
||||
}
|
||||
case 'fragment': {
|
||||
return this.renderFragment()
|
||||
}
|
||||
default:
|
||||
return this.renderMain()
|
||||
}
|
||||
}
|
||||
__sec() {
|
||||
const dtraw = this.state.sec_raw
|
||||
switch (this.state.mode) {
|
||||
case 'post': {
|
||||
return this.renderComments(this.state.global_raw)
|
||||
}
|
||||
default:
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
renderSearch = key => {
|
||||
const payload = { key: key }
|
||||
ycore.comty_search.keywords((err, res) => {
|
||||
if (err) {
|
||||
ycore.notify.error(err)
|
||||
}
|
||||
ycore.yconsole.log('Founded entries => ', JSON.parse(res))
|
||||
this.setState({ global_raw: res, loading: false })
|
||||
}, payload)
|
||||
return (
|
||||
<div className={styles.renderSearch_wrapper}>
|
||||
<h2><Icons.SearchOutlined /> Results of {key || '... nothing ?'}</h2>
|
||||
<__priSearch payload={this.state.global_raw} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
renderPost = payload => {
|
||||
const post_data = JSON.parse(payload)['post_data']
|
||||
return <__priPost isMobile={this.props.isMobile} payload={post_data} />
|
||||
}
|
||||
|
||||
renderComments = payload => {
|
||||
try {
|
||||
const post_comments = JSON.parse(payload)['post_comments']
|
||||
const post_data = JSON.parse(payload)['post_data']
|
||||
return (
|
||||
<__secComments post_id={post_data.post_id} payload={post_comments} />
|
||||
)
|
||||
} catch (error) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
renderMain = payload => {
|
||||
try {
|
||||
const trending_data = JSON.parse(this.state.gen_data)['trending_hashtag']
|
||||
return(
|
||||
<div className={styles.secondary_main}>
|
||||
|
||||
{ycore.IsThisUser.pro()? <__pro /> : <__pro /> }
|
||||
<__trendings data={trending_data} />
|
||||
|
||||
|
||||
</div>
|
||||
)
|
||||
} catch (error) {
|
||||
return null
|
||||
}
|
||||
|
||||
}
|
||||
renderFragment = () => {
|
||||
try {
|
||||
const fragment = this.state.global_raw
|
||||
return <React.Fragment>{fragment}</React.Fragment>
|
||||
} catch (error) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
componentDidMount(){
|
||||
ycore.comty_get.general_data((err,res)=> {
|
||||
if (err) return false
|
||||
const notification_data = JSON.parse(res)['notifications']
|
||||
this.setState({ loading: false, gen_data: res, notification_data: notification_data })
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
const { userData, isMobile } = this.props
|
||||
if (!this.state.loading) return (
|
||||
<>
|
||||
{isMobile? null : <div className={styles.__secondary_colider}></div>}
|
||||
<div
|
||||
id="secondary_layout"
|
||||
className={classnames(styles.secondary_wrapper, {
|
||||
[styles.mobile]: isMobile,
|
||||
[styles.active]: this.state.swap,
|
||||
[styles.half]: this.state.half,
|
||||
[styles.unique]: this.state.unique,
|
||||
})}
|
||||
>
|
||||
{isMobile? null :
|
||||
<div className={styles.secondary_userholder}>
|
||||
<div className={styles.notif_box}>
|
||||
<h1>{this.state.notification_data.length}</h1>
|
||||
</div>
|
||||
<img
|
||||
onClick={() => ycore.router.go(`@${userData.username}`)}
|
||||
src={userData.avatar}
|
||||
/>
|
||||
</div>}
|
||||
|
||||
<div
|
||||
className={styles.secondary_layout_bg}
|
||||
>
|
||||
|
||||
<div className={styles.secondary_container_1}>
|
||||
{this.state.swap || this.state.half || this.state.unique ? (
|
||||
<antd.Button
|
||||
type="ghost"
|
||||
icon={<Icons.LeftOutlined />}
|
||||
onClick={() => this.Swapper.close()}
|
||||
>
|
||||
Back
|
||||
</antd.Button>
|
||||
) : null}
|
||||
{this.SwapBalanceContent('__pri')}
|
||||
</div>
|
||||
|
||||
|
||||
<div
|
||||
className={classnames(styles.secondary_container_2, {
|
||||
[styles.mobile]: isMobile,
|
||||
[styles.active]: this.state.swap,
|
||||
})}
|
||||
>
|
||||
{this.SwapBalanceContent('__sec')}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
return null
|
||||
|
||||
}
|
||||
}
|
230
.prev/src/components/Layout/Secondary/index.less
Normal file
230
.prev/src/components/Layout/Secondary/index.less
Normal file
@ -0,0 +1,230 @@
|
||||
@import '~themes/index.less';
|
||||
|
||||
.__secondary_colider{
|
||||
position: relative;
|
||||
float: right;
|
||||
width: @__secondary_colider_width;
|
||||
height: 100vh;
|
||||
background-color: @__Global_layout_backgroud;
|
||||
}
|
||||
|
||||
.secondary_wrapper {
|
||||
width: @secondary_wrapper_hidden_width;
|
||||
height: 100vh;
|
||||
|
||||
z-index: 50;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
overflow-x: hidden;
|
||||
|
||||
display: flex;
|
||||
|
||||
|
||||
|
||||
&.active {
|
||||
width: @secondary_wrapper_showFull_width;
|
||||
>.secondary_container_1 {
|
||||
padding: @secondary_container_1_padding;
|
||||
}
|
||||
//@media (min-width: 1000px) {
|
||||
// width: 95.4%
|
||||
//}
|
||||
}
|
||||
|
||||
&.mobile {
|
||||
width: 100%;
|
||||
height: 0;
|
||||
bottom: 0;
|
||||
opacity: 0;
|
||||
|
||||
top: unset;
|
||||
overflow: hidden;
|
||||
>.secondary_layout_bg{
|
||||
border-radius: 12px 12px 0 0;
|
||||
flex-direction: column;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
.secondary_container_1{
|
||||
height: 85vh;
|
||||
width: 100%;
|
||||
}
|
||||
.secondary_container_2{
|
||||
width: 100%;
|
||||
padding: 10px 10px 60px 10px;
|
||||
border-radius: 12px 12px 0 0;
|
||||
}
|
||||
:global{
|
||||
.comments_body {
|
||||
padding: 30px 10px 10px 10px;
|
||||
}
|
||||
}
|
||||
|
||||
&.active {
|
||||
opacity: 1;
|
||||
bottom: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
&.half{
|
||||
opacity: 1;
|
||||
bottom: 0;
|
||||
height: 60%;
|
||||
width: 100%;
|
||||
}
|
||||
&.unique {
|
||||
opacity: 1;
|
||||
bottom: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
>.secondary_layout_bg {
|
||||
background-color: #ffffff;
|
||||
padding: 0;
|
||||
border-radius: 12px 12px 0 0;
|
||||
flex-direction: column;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.half {
|
||||
width: @secondary_wrapper_showHalf_width;
|
||||
}
|
||||
&.unique {
|
||||
width: @secondary_wrapper_showFull_width;
|
||||
>.secondary_layout_bg {
|
||||
background-color: #ffffff;
|
||||
padding-right: 90px;
|
||||
}
|
||||
}
|
||||
transition: all @__Global_SwapAnimDuration ease-in-out;
|
||||
|
||||
}
|
||||
|
||||
.secondary_userholder {
|
||||
right: 20px;
|
||||
top: 25px;
|
||||
display: flex;
|
||||
position: absolute;
|
||||
z-index: 51;
|
||||
|
||||
img {
|
||||
border-radius: 15px;
|
||||
width: 40px;
|
||||
transition: all 150ms linear;
|
||||
box-shadow: 0px 0px 0 0px rgba(255, 255, 255, 0);
|
||||
}
|
||||
|
||||
img:hover {
|
||||
box-shadow: 0px 0px 10px 0px rgba(255, 255, 255, 0.205);
|
||||
transition: all 150ms linear;
|
||||
}
|
||||
|
||||
transition: all 150ms linear;
|
||||
|
||||
.notif_box {
|
||||
margin: 0 15px 0 5px;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 15px;
|
||||
background-color: #78CFED;
|
||||
h1{
|
||||
line-height: 40px;
|
||||
font-size: 16px;
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.secondary_layout_bg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
right: 0;
|
||||
z-index: 50;
|
||||
position: absolute;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
|
||||
transition: all @__Global_SwapAnimDuration ease-in-out;
|
||||
background-color: @secondary_container_bg_background;
|
||||
|
||||
border-radius: @__Global_layout_border-rd;
|
||||
}
|
||||
|
||||
.secondary_container_1 {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
position: relative;
|
||||
padding: 30px 30px 30px 35px;
|
||||
|
||||
color: @secondary_container_1_color;
|
||||
|
||||
:global {
|
||||
.ant-btn {
|
||||
color: @secondary_container_1_btn_color;
|
||||
background-color: @secondary_container_1_btn_backgroud;
|
||||
border-color: transparent;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.ant-btn:hover {
|
||||
box-shadow: @secondary_container_1_btn_shadow;
|
||||
transition: all @__Global_Components_transitions_dur linear;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.secondary_container_2 {
|
||||
position: relative;
|
||||
height: 100vh;
|
||||
width: 0;
|
||||
right: -500px;
|
||||
padding: @secondaty_container_2_padding;
|
||||
|
||||
opacity: 0;
|
||||
color: @secondary_container_2_color!important;
|
||||
background-color: @secondary_container_2_backgroud;
|
||||
|
||||
border-radius: 32px 0 0 32px;
|
||||
|
||||
&.active {
|
||||
width: 400px;
|
||||
opacity: 1;
|
||||
right: 0;
|
||||
@media (min-width: 1000px) {
|
||||
width: 600px
|
||||
}
|
||||
}
|
||||
|
||||
transition: all @__Global_SwapAnimDuration ease-in-out;
|
||||
|
||||
}
|
||||
|
||||
.renderSearch_wrapper {
|
||||
height: 87vh;
|
||||
overflow: hidden;
|
||||
margin: 20px 0 0 0;
|
||||
font-family: @__Global_general_font_family;
|
||||
h2 {
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.secondary_main{
|
||||
margin-top: 45px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
336
.prev/src/components/Layout/Secondary/renders.js
Normal file
336
.prev/src/components/Layout/Secondary/renders.js
Normal file
@ -0,0 +1,336 @@
|
||||
import React from 'react'
|
||||
import styles from './renders.less'
|
||||
import { SearchCard } from 'components'
|
||||
|
||||
import * as antd from 'antd'
|
||||
import * as ycore from 'ycore'
|
||||
import * as Icons from '@ant-design/icons'
|
||||
import Icon from '@ant-design/icons'
|
||||
|
||||
import { MediaPlayer, PostCard } from 'components'
|
||||
|
||||
const VerifiedBadge = () => (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="#55acee"
|
||||
width="15"
|
||||
height="15"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path d="M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12m-13 5l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z"></path>
|
||||
</svg>
|
||||
)
|
||||
|
||||
export class __priPost extends React.Component {
|
||||
renderContent(payload) {
|
||||
const { id, postText, postFile_full, post_time, publisher } = payload
|
||||
const {isMobile}= this.props
|
||||
if (!postFile_full) {
|
||||
return (
|
||||
<div className={styles.contentWrapper}>
|
||||
{postText ? (
|
||||
<div className={styles.postContent}>
|
||||
<h3 dangerouslySetInnerHTML={{ __html: postText }} />{' '}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<div className={styles.contentWrapper}>
|
||||
{postFile_full ? <MediaPlayer isMobile={isMobile} entire={true} file={postFile_full} /> : null}
|
||||
{postText ? (
|
||||
<div className={styles.postContent}>
|
||||
<h3 dangerouslySetInnerHTML={{ __html: postText }} />{' '}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
render() {
|
||||
const {payload} = this.props
|
||||
if (!payload) {
|
||||
return <h1>This post not exists!!!</h1>
|
||||
}
|
||||
const { id, postText, postFile_full, post_time, publisher } = payload
|
||||
return (
|
||||
<div className={styles.SecondaryBody}>
|
||||
<div className={styles.UserContainer}>
|
||||
<div className={styles.UserContainer_text}>
|
||||
<h4 className={styles.titleUser}>
|
||||
{publisher.username}{' '}
|
||||
{ycore.booleanFix(publisher.verified) ? (
|
||||
<Icon style={{ color: 'blue' }} component={VerifiedBadge} />
|
||||
) : null}
|
||||
</h4>
|
||||
<p>
|
||||
{' '}
|
||||
{post_time} {ycore.IsThisUser.dev() ? `| #${id}` : null}{' '}
|
||||
</p>
|
||||
</div>
|
||||
<antd.Avatar shape="square" size={50} src={publisher.avatar} />
|
||||
</div>
|
||||
{this.renderContent(payload)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export class __secComments extends React.Component {
|
||||
state = {
|
||||
comment_data: this.props.payload,
|
||||
raw_comment: '',
|
||||
loading: false,
|
||||
}
|
||||
handleDeleteComment(id) {
|
||||
ycore.yconsole.log(`Removing Comment with id => ${id}`)
|
||||
ycore.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 }
|
||||
ycore.comty_post_comment.new((err, res) => {
|
||||
if (err) {
|
||||
ycore.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 = (
|
||||
<antd.Menu>
|
||||
<antd.Menu.Item
|
||||
key="remove_comment"
|
||||
onClick={() => this.handleDeleteComment(id)}
|
||||
>
|
||||
<Icons.DeleteOutlined /> Delete
|
||||
</antd.Menu.Item>
|
||||
</antd.Menu>
|
||||
)
|
||||
return (
|
||||
<div className={styles.comment_card}>
|
||||
<div className={styles.comment_title}>
|
||||
<img src={publisher.avatar} />
|
||||
<p className={styles.comment_user_username}>
|
||||
@{publisher.username}{' '}
|
||||
{ycore.booleanFix(publisher.verified) ? (
|
||||
<Icon style={{ color: 'black' }} component={VerifiedBadge} />
|
||||
) : null}
|
||||
</p>
|
||||
<antd.Dropdown
|
||||
disabled={ycore.IsThisPost.owner(publisher.id) ? false : true}
|
||||
overlay={CommentMenu}
|
||||
trigger={['click']}
|
||||
>
|
||||
<p
|
||||
onClick={e => e.preventDefault()}
|
||||
className={styles.comment_user_ago}
|
||||
>
|
||||
{ycore.time.stmToAgo(time)}
|
||||
</p>
|
||||
</antd.Dropdown>
|
||||
</div>
|
||||
<div className={styles.comment_text}>
|
||||
<p>{Orginaltext}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
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 }
|
||||
ycore.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 (
|
||||
<div className={styles.comments_body}>
|
||||
<div className={styles.comments_body_title}>
|
||||
<h1>Comments ({comment_data.length})</h1>
|
||||
</div>
|
||||
<div className={styles.comments_cards_wrapper}>
|
||||
{loading ? (
|
||||
<antd.Skeleton active />
|
||||
) : (
|
||||
<antd.List
|
||||
itemLayout="horizontal"
|
||||
dataSource={comment_data}
|
||||
renderItem={item => this.renderComment(item)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.comment_box}>
|
||||
<div className={styles.comment_box_body}>
|
||||
<antd.Input
|
||||
value={this.state.raw_comment}
|
||||
onPressEnter={() => this.handleNewComment()}
|
||||
placeholder="Write a comment..."
|
||||
allowClear
|
||||
onChange={this.HandleCommentInput}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export class __priSearch extends React.Component {
|
||||
renderResult = source => {
|
||||
try {
|
||||
const Empty = (
|
||||
<div>
|
||||
<antd.Result
|
||||
status="404"
|
||||
title="Nothing..."
|
||||
subTitle="Sorry, this does not exist."
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
||||
// 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) {
|
||||
ycore.yconsole.log('Users => ', usersParsed)
|
||||
return this.EntryComponent('Users', usersParsed)
|
||||
}
|
||||
}
|
||||
const groups = () => {
|
||||
if (groupsParsed.length >= 1) {
|
||||
ycore.yconsole.log('Groups => ', groupsParsed)
|
||||
return this.EntryComponent('Groups', groupsParsed)
|
||||
}
|
||||
}
|
||||
const pages = () => {
|
||||
if (pagesParsed.length >= 1) {
|
||||
ycore.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 (
|
||||
<center>
|
||||
<h2>Render Error</h2>
|
||||
</center>
|
||||
)
|
||||
}
|
||||
}
|
||||
EntryComponent = (t, source) => {
|
||||
try {
|
||||
return (
|
||||
<antd.List
|
||||
dataSource={source}
|
||||
renderItem={item =>
|
||||
<div id={item.id} className={styles.search_card} onClick={() => {ycore.router.go(`@${item.username}`)}}>
|
||||
<div className={styles.search_title}>
|
||||
<img src={item.avatar} />
|
||||
<p className={styles.search_user_username}>
|
||||
@{item.username}
|
||||
{ycore.booleanFix(item.verified) ? (
|
||||
<Icon component={VerifiedBadge} />
|
||||
) : null}
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div className={styles.search_text}>
|
||||
<p>{item.about}</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
|
||||
)
|
||||
} catch (error) {
|
||||
return (
|
||||
<center>
|
||||
<h2>Render Error</h2>
|
||||
</center>
|
||||
)
|
||||
}
|
||||
}
|
||||
render(){
|
||||
return(
|
||||
<div className={styles.search_wrapper}>
|
||||
{this.renderResult(this.props.payload)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export class __trendings extends React.PureComponent {
|
||||
render(){
|
||||
if (!this.props.data) return false
|
||||
return(
|
||||
<div className={styles.secondary_hastags}>
|
||||
<div className={styles.secondary_hastags_title}> <h2>Trending now</h2> </div>
|
||||
<div className={styles.secondary_hastags_body}>
|
||||
<antd.List
|
||||
dataSource={this.props.data}
|
||||
renderItem={item=>(
|
||||
<div className={styles.hash}>
|
||||
<p>#{item.tag}</p>
|
||||
<p style={{ color: "white", fontSize: "9px" }}> {item.trend_use_num} Posts</p>
|
||||
</div>)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export class __pro extends React.PureComponent {
|
||||
render(){
|
||||
return(
|
||||
<div className={styles.secondary_adv_pro}>
|
||||
<h1>
|
||||
Go Pro!
|
||||
</h1>
|
||||
<p>Sabias que la frase de kintxi, se hace la que no me conoze se hizo mientras estaba borracho</p>
|
||||
<antd.Button>Start now <Icons.RightOutlined /></antd.Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
356
.prev/src/components/Layout/Secondary/renders.less
Normal file
356
.prev/src/components/Layout/Secondary/renders.less
Normal file
@ -0,0 +1,356 @@
|
||||
@import '~themes/index.less';
|
||||
|
||||
.SecondaryBody {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.UserContainer {
|
||||
display: flex;
|
||||
position: relative;
|
||||
float: right;
|
||||
z-index: 150;
|
||||
transform: translate(0, -40px);
|
||||
|
||||
.UserContainer_text {
|
||||
margin: 0 8px;
|
||||
|
||||
h4 {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
p {
|
||||
word-break: break-all;
|
||||
text-align: right;
|
||||
font-size: 11px;
|
||||
color: #eeeeee !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.postAvatar {
|
||||
position: absolute;
|
||||
left: -8px;
|
||||
top: -8px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.titleUser {
|
||||
display: flex;
|
||||
font-family: 'Poppins', sans-serif;
|
||||
margin: 0 0 0 50px;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.textAgo {
|
||||
display: flex;
|
||||
font-size: 10px;
|
||||
margin: 0 0 0 53px;
|
||||
}
|
||||
|
||||
.PostTags {
|
||||
float: right;
|
||||
width: 100%;
|
||||
z-index: 10;
|
||||
|
||||
:global {
|
||||
.anticon {
|
||||
color: rgb(249, 179, 64);
|
||||
float: right;
|
||||
margin: -0 6px 0 0;
|
||||
;
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.MoreMenu {
|
||||
color: #2d2d2d !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.titleWrapper {
|
||||
display: flex;
|
||||
|
||||
h4 {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
color: #ffffff !important;
|
||||
|
||||
}
|
||||
|
||||
.contentWrapper {
|
||||
margin: auto;
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
|
||||
.postContent {
|
||||
word-break: break-all;
|
||||
position: absolute;
|
||||
vertical-align: bottom;
|
||||
border-radius: 7px;
|
||||
bottom: 0;
|
||||
max-width: 50vw;
|
||||
|
||||
background-color: #2d2d2d4b;
|
||||
padding: 10px;
|
||||
|
||||
h3 {
|
||||
font-family: "Poppins", sans-serif;
|
||||
color: #ffffff;
|
||||
font-weight: 400;
|
||||
font-size: 15px;
|
||||
letter-spacing: -0.3px;
|
||||
}
|
||||
}
|
||||
|
||||
.postContent_OnlyText {
|
||||
padding: 25% 0 0 0;
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.likebtn {
|
||||
:global {
|
||||
svg {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
svg:hover {
|
||||
color: rgb(233, 35, 68);
|
||||
transition: all 0.2s linear;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.comments_body {
|
||||
height: 100%;
|
||||
font-family: "Poppins", sans-serif;
|
||||
padding: 75px 10px 10px 20px;
|
||||
|
||||
.comments_body_title {
|
||||
font-size: 12px;
|
||||
|
||||
h1 {
|
||||
font-weight: 550;
|
||||
letter-spacing: 0.01px;
|
||||
}
|
||||
}
|
||||
|
||||
.comments_cards_wrapper {
|
||||
z-index: 50;
|
||||
overflow: scroll;
|
||||
height: 84%;
|
||||
:global {
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.comment_card {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
background-color: #ffffff;
|
||||
word-break: break-all;
|
||||
|
||||
.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_text {
|
||||
margin: 10px 0 0 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.comment_box {
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
background-color: #ffffffd7;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.search_wrapper{
|
||||
color: #ffffff;
|
||||
height: 100%;
|
||||
width: 82%;
|
||||
margin: auto;
|
||||
:global{
|
||||
.ant-result-title{
|
||||
color: @secondary_container_1_color!important;
|
||||
}
|
||||
.ant-result-subtitle{
|
||||
color: @secondary_container_1_color!important;
|
||||
|
||||
}
|
||||
.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: #ffffff;
|
||||
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: #ffffff;
|
||||
line-height: 25px;
|
||||
}
|
||||
}
|
||||
|
||||
.search_text {
|
||||
margin: 10px 0 0 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.secondary_hastags {
|
||||
font-family: @__Global_general_font_family;
|
||||
color: #ffffff;
|
||||
font-size: 12px;
|
||||
|
||||
|
||||
.secondary_hastags_title{
|
||||
h2{color: #ffffff;}
|
||||
}
|
||||
|
||||
.secondary_hastags_body{
|
||||
margin: 20px 0 0 0;
|
||||
background-color: hsl(0, 0%, 21%);
|
||||
border-radius: 12px;
|
||||
word-break: break-all;
|
||||
padding: 5px 5px 5px 10px;
|
||||
height: auto;
|
||||
|
||||
.hash{
|
||||
margin: 5px 0 3px 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
p{
|
||||
margin: 0;
|
||||
color: #2196F3;
|
||||
font-size: 12px;
|
||||
max-height: 35px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.secondary_adv_pro{
|
||||
border-radius: 12px;
|
||||
// background-color: #ff4d4e;
|
||||
background: rgb(255,77,78);
|
||||
background: linear-gradient(49deg, rgba(255,77,78,1) 15%, rgba(255,87,56,1) 55%, rgba(255,97,36,1) 73%, rgba(255,105,19,1) 82%, rgba(255,114,0,1) 94%);
|
||||
|
||||
margin: 70px 0 30px 0;
|
||||
padding: 14px;
|
||||
|
||||
width: 100%;
|
||||
height: 140px;
|
||||
|
||||
h1{
|
||||
color: #ffffff;
|
||||
font-family: "Poppins", sans-serif;
|
||||
font-size: 18px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
p{
|
||||
font-size: 9px;
|
||||
|
||||
}
|
||||
|
||||
:global{
|
||||
.ant-btn{
|
||||
vertical-align: bottom;
|
||||
border: 0;
|
||||
background-color: #d24345a2;
|
||||
border-radius: 7px;
|
||||
height: 27px;
|
||||
padding: 2px 7px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
107
.prev/src/components/Layout/Sider/default.js
Normal file
107
.prev/src/components/Layout/Sider/default.js
Normal file
@ -0,0 +1,107 @@
|
||||
import React from 'react'
|
||||
import * as antd from 'antd'
|
||||
import * as Icons from '@ant-design/icons'
|
||||
import Icon from '@ant-design/icons'
|
||||
|
||||
import { withI18n, Trans } from '@lingui/react'
|
||||
import styles from './default.less'
|
||||
import * as ycore from 'ycore'
|
||||
import CustomIcons from '../../CustomIcons'
|
||||
|
||||
@withI18n()
|
||||
export default class Sider_Default extends React.PureComponent {
|
||||
render() {
|
||||
const { handleClickMenu, logo } = this.props
|
||||
return (
|
||||
<div className={styles.left_sider_wrapper}>
|
||||
<antd.Layout.Sider
|
||||
trigger={null}
|
||||
collapsed
|
||||
collapsedWidth='80'
|
||||
className={styles.left_sider_container}
|
||||
>
|
||||
<div className={styles.left_sider_brandholder}>
|
||||
<img
|
||||
onClick={() => ycore.router.go('main')}
|
||||
src={logo}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className={styles.left_sider_menuContainer}>
|
||||
|
||||
<antd.Menu
|
||||
selectable={false}
|
||||
className={styles.left_sider_menuItems}
|
||||
mode="vertical"
|
||||
onClick={handleClickMenu}
|
||||
>
|
||||
<antd.Menu.Item key="explore">
|
||||
<Icons.CompassTwoTone twoToneColor={"#28c35d"} />
|
||||
<Trans>
|
||||
<span>Explore</span>
|
||||
</Trans>
|
||||
</antd.Menu.Item>
|
||||
|
||||
<antd.Menu.Item key="saves">
|
||||
<Icon component={CustomIcons.SavedPostColor} />
|
||||
<Trans>
|
||||
<span>Saves</span>
|
||||
</Trans>
|
||||
</antd.Menu.Item>
|
||||
|
||||
|
||||
<antd.Menu.Item key="marketplace">
|
||||
<Icons.ShoppingTwoTone twoToneColor={"#ff7a45"}/>
|
||||
<Trans>
|
||||
<span>Marketplace</span>
|
||||
</Trans>
|
||||
</antd.Menu.Item>
|
||||
|
||||
|
||||
<antd.Menu.Item key="events">
|
||||
<Icons.CarryOutTwoTone twoToneColor={"#ff4d4f"}/>
|
||||
<Trans>
|
||||
<span>Events</span>
|
||||
</Trans>
|
||||
</antd.Menu.Item>
|
||||
|
||||
</antd.Menu>
|
||||
|
||||
<div className={styles.something_thats_pulling_me_down}>
|
||||
<antd.Menu
|
||||
selectable={false}
|
||||
className={styles.left_sider_menuItems}
|
||||
mode="horizontal"
|
||||
onClick={handleClickMenu}
|
||||
>
|
||||
<antd.Menu.Item key="general_settings">
|
||||
<Icons.SettingOutlined />
|
||||
<Trans>
|
||||
<span>Settings</span>
|
||||
</Trans>
|
||||
</antd.Menu.Item>
|
||||
{ycore.IsThisUser.dev() ? (
|
||||
<antd.Menu.Item key="debug_area">
|
||||
<Icons.ThunderboltOutlined />
|
||||
<span>Debug</span>
|
||||
</antd.Menu.Item>
|
||||
) : (
|
||||
undefined
|
||||
)}
|
||||
|
||||
<antd.Menu.Item key="SignOut">
|
||||
<Icons.LogoutOutlined style={{ color: 'red' }} />
|
||||
<Trans>
|
||||
<span>Logout</span>
|
||||
</Trans>
|
||||
</antd.Menu.Item>
|
||||
|
||||
</antd.Menu>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</antd.Layout.Sider>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
137
.prev/src/components/Layout/Sider/default.less
Normal file
137
.prev/src/components/Layout/Sider/default.less
Normal file
@ -0,0 +1,137 @@
|
||||
@import '~themes/index.less';
|
||||
|
||||
|
||||
.left_sider_wrapper {
|
||||
border-color: transparent;
|
||||
font-size: 13px;
|
||||
font-family: @__Global_general_font_family;
|
||||
height: 100vh;
|
||||
z-index: 40;
|
||||
float: left;
|
||||
position: relative;
|
||||
|
||||
:global {
|
||||
.ant-layout-sider {
|
||||
background-color: @left_sider_backgroud;
|
||||
|
||||
.ant-menu {
|
||||
vertical-align: middle;
|
||||
margin: 0 0 0 5px;
|
||||
}
|
||||
|
||||
.ant-menu-item {
|
||||
color: @left_sider_color;
|
||||
}
|
||||
|
||||
.anticon {
|
||||
font-size: @left_sider_sizeIcons;
|
||||
}
|
||||
|
||||
.ant-menu-inline-collapsed,
|
||||
.antd-menu-vertical-left,
|
||||
.ant-menu-vertical {
|
||||
:hover {
|
||||
background-color: @left_sider_menu__onhover_backgroud;
|
||||
color: @left_sider_menu__onhover_color;
|
||||
}
|
||||
|
||||
border-right: 0 solid transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.left_sider_brandholder {
|
||||
cursor: pointer;
|
||||
|
||||
img {
|
||||
display: flex;
|
||||
vertical-align: middle;
|
||||
padding: 5px;
|
||||
margin: 7px auto 15px auto;
|
||||
width: 100%;
|
||||
max-height: 58px;
|
||||
transform: translate(2px, 0);
|
||||
}
|
||||
}
|
||||
|
||||
.something_thats_pulling_me_down {
|
||||
margin: 0 0 12px 0;
|
||||
:global {
|
||||
text-align: center;
|
||||
bottom: 0;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
.anticon{
|
||||
font-size: 15px!important;
|
||||
}
|
||||
.ant-menu-item{
|
||||
height: 35px!important;
|
||||
line-height: 0px!important;
|
||||
padding: 0!important;
|
||||
margin: 0!important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.left_sider_container {
|
||||
border-right: transparent;
|
||||
height: 100%;
|
||||
z-index: 50;
|
||||
}
|
||||
|
||||
.left_sider_menuContainer {
|
||||
height: 100%;
|
||||
margin: 18px 0 8px 0;
|
||||
|
||||
overflow-x: hidden;
|
||||
flex: 1;
|
||||
|
||||
:global {
|
||||
.ant-layout-sider-children {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.ant-layout-sider-collapsed {
|
||||
.ant-menu-item {
|
||||
left: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.ant-menu-inline-collapsed>.ant-menu-item {
|
||||
padding: 0;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.ant-menu-inline .ant-menu-item {
|
||||
font-family: @__Global_general_font_family;
|
||||
}
|
||||
|
||||
.ant-menu-dark .ant-menu-item a {
|
||||
color: rgb(197, 197, 197);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.left_sider_menuItems {
|
||||
background-color: transparent;
|
||||
margin-bottom: 8px;
|
||||
width: 100%;
|
||||
font-weight: 500;
|
||||
|
||||
animation: fadein 0.5s;
|
||||
|
||||
:global {
|
||||
.ant-menu-item {
|
||||
padding: 0 !important;
|
||||
margin: 2px auto 2px auto;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
51
.prev/src/components/Layout/Sider/index.js
Normal file
51
.prev/src/components/Layout/Sider/index.js
Normal file
@ -0,0 +1,51 @@
|
||||
import React from 'react'
|
||||
import { config } from 'utils'
|
||||
import * as ycore from 'ycore'
|
||||
|
||||
import Sider_Mobile from './mobile.js'
|
||||
import Sider_Default from './default.js'
|
||||
|
||||
class Sider extends React.PureComponent {
|
||||
|
||||
onClickFunctions = {
|
||||
saves: (e) => {
|
||||
this.setState({selectedKey: e})
|
||||
ycore.router.go('saves')
|
||||
},
|
||||
events: (e) => {
|
||||
this.setState({selectedKey: e})
|
||||
ycore.router.go('events')
|
||||
},
|
||||
marketplace: (e) => {
|
||||
this.setState({selectedKey: e})
|
||||
ycore.router.go('marketplace')
|
||||
},
|
||||
explore: (e) => {
|
||||
this.setState({selectedKey: e})
|
||||
ycore.router.go('main')
|
||||
},
|
||||
}
|
||||
|
||||
handleClickMenu = e => {
|
||||
e.key === 'SignOut' && ycore.app_session.logout()
|
||||
e.key === 'general_settings' && ycore.router.go('settings')
|
||||
e.key === 'profile' && ycore.router.goprofile()
|
||||
e.key === 'saves' && this.onClickFunctions.saves(e.key)
|
||||
e.key === 'events' && this.onClickFunctions.events(e.key)
|
||||
e.key === 'marketplace' && this.onClickFunctions.marketplace(e.key)
|
||||
e.key === 'explore' && this.onClickFunctions.explore(e.key)
|
||||
e.key === 'debug_area' && ycore.router.go('__m')
|
||||
}
|
||||
|
||||
render() {
|
||||
const { isMobile } = this.props
|
||||
const sider_props = {handleClickMenu: this.handleClickMenu ,logo: config.LogoPath, menulist: null, userData: this.props.userData}
|
||||
|
||||
if (isMobile) {
|
||||
return <Sider_Mobile {...sider_props} />
|
||||
}
|
||||
return <Sider_Default {...sider_props} />
|
||||
}
|
||||
}
|
||||
|
||||
export default Sider
|
51
.prev/src/components/Layout/Sider/mobile.js
Normal file
51
.prev/src/components/Layout/Sider/mobile.js
Normal file
@ -0,0 +1,51 @@
|
||||
import React from 'react'
|
||||
import * as antd from 'antd'
|
||||
import * as Icons from '@ant-design/icons'
|
||||
import Icon from '@ant-design/icons'
|
||||
|
||||
import { withI18n, Trans } from '@lingui/react'
|
||||
import styles from './mobile.less'
|
||||
import * as ycore from 'ycore'
|
||||
import CustomIcons from '../../CustomIcons'
|
||||
|
||||
@withI18n()
|
||||
export default class Sider_Mobile extends React.PureComponent {
|
||||
render() {
|
||||
const { handleClickMenu, userData } = this.props
|
||||
return (
|
||||
<div className={styles.left_sider_wrapper}>
|
||||
<antd.Layout.Sider
|
||||
trigger={null}
|
||||
width='100%'
|
||||
>
|
||||
<antd.Menu
|
||||
mode="horizontal"
|
||||
onClick={handleClickMenu}
|
||||
>
|
||||
<antd.Menu.Item key="explore">
|
||||
<Icons.CompassTwoTone twoToneColor={"#28c35d"} />
|
||||
</antd.Menu.Item>
|
||||
|
||||
<antd.Menu.Item key="saves">
|
||||
<Icons.HeartTwoTone twoToneColor={"#ff4d4f"} />
|
||||
</antd.Menu.Item>
|
||||
|
||||
<antd.Menu.Item key="general_settings">
|
||||
<Icons.SettingOutlined />
|
||||
</antd.Menu.Item>
|
||||
|
||||
<antd.Menu.Item key="profile">
|
||||
<antd.Avatar size={20} shape="square" src={userData.avatar} />
|
||||
</antd.Menu.Item>
|
||||
|
||||
|
||||
</antd.Menu>
|
||||
|
||||
|
||||
|
||||
|
||||
</antd.Layout.Sider>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
50
.prev/src/components/Layout/Sider/mobile.less
Normal file
50
.prev/src/components/Layout/Sider/mobile.less
Normal file
@ -0,0 +1,50 @@
|
||||
@import '~themes/index.less';
|
||||
|
||||
|
||||
.left_sider_wrapper {
|
||||
overflow: hidden!important;
|
||||
position: absolute;
|
||||
z-index: 500;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
|
||||
height: 50px;
|
||||
width: 100%;
|
||||
|
||||
border-color: transparent;
|
||||
font-size: 13px;
|
||||
font-family: @__Global_general_font_family;
|
||||
padding: 0 27px;
|
||||
|
||||
:global {
|
||||
.ant-layout-sider {
|
||||
background-color: transparent;
|
||||
height: 100%;
|
||||
|
||||
.ant-menu-item {color: @left_sider_color;}
|
||||
.anticon {font-size: @left_sider_sizeIcons;}
|
||||
.ant-menu-item{margin: auto; padding: 0;}
|
||||
|
||||
.ant-menu {
|
||||
background-color: #2d2d2d;
|
||||
height: 100%;
|
||||
border-radius: 27px 27px 0 0;
|
||||
padding: 0 27px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.ant-menu-horizontal {
|
||||
line-height: 46px;
|
||||
white-space: nowrap;
|
||||
border: 0;
|
||||
border-bottom: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
5
.prev/src/components/Layout/index.js
Normal file
5
.prev/src/components/Layout/index.js
Normal file
@ -0,0 +1,5 @@
|
||||
import Sider from './Sider/index.js'
|
||||
import Control from './Control'
|
||||
import Secondary from './Secondary/index.js'
|
||||
|
||||
export { Sider, Control, Secondary }
|
106
.prev/src/components/Like_button/index.js
Normal file
106
.prev/src/components/Like_button/index.js
Normal file
@ -0,0 +1,106 @@
|
||||
import React from 'react'
|
||||
import styles from './index.scss'
|
||||
import * as ycore from 'ycore'
|
||||
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
|
||||
ycore.yconsole.log(`Dispatch ${type} to post id => ${e}`)
|
||||
this.setState({ clicked: true })
|
||||
setTimeout(() => {
|
||||
this.setState({ clicked: false })
|
||||
}, 500)
|
||||
const payload = { post_id: e }
|
||||
ycore.comty_post.like((err, res) => {
|
||||
if (err) {
|
||||
ycore.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) {
|
||||
ycore.yconsole.error('[LikeBTN] No post id provided!')
|
||||
return null
|
||||
}
|
||||
return (
|
||||
<div className={styles.btnWrapper}>
|
||||
<button
|
||||
onClick={() => this.dispatchLike(id)}
|
||||
className={classnames(styles.like_button, {
|
||||
[styles.clickanim]: clicked,
|
||||
})}
|
||||
>
|
||||
<div className={styles.like_wrapper}>
|
||||
<div
|
||||
className={classnames(
|
||||
styles.ripple,
|
||||
liked ? null : { [styles.clickanim]: clicked }
|
||||
)}
|
||||
></div>
|
||||
<svg
|
||||
className={classnames(
|
||||
styles.heart,
|
||||
{ [styles.empty]: !liked },
|
||||
liked ? null : { [styles.clickanim]: clicked }
|
||||
)}
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path d="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</button>
|
||||
<p
|
||||
className={classnames(styles.likeCounter, {
|
||||
[styles.active]: !clicked,
|
||||
[styles.past]: clicked,
|
||||
})}
|
||||
>
|
||||
{likes}
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Like_button
|
205
.prev/src/components/Like_button/index.scss
Normal file
205
.prev/src/components/Like_button/index.scss
Normal file
@ -0,0 +1,205 @@
|
||||
.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
28
.prev/src/components/Loader/Loader.js
Normal file
28
.prev/src/components/Loader/Loader.js
Normal file
@ -0,0 +1,28 @@
|
||||
import React from 'react'
|
||||
import classNames from 'classnames'
|
||||
import styles from './Loader.less'
|
||||
|
||||
const Loader = (loading) => {
|
||||
return (
|
||||
<div className={classNames(styles.wrapper, {[styles.end]: !loading.spinning })}>
|
||||
<span>Loading... </span>
|
||||
<div
|
||||
className={styles.newloader}
|
||||
>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
export default Loader
|
118
.prev/src/components/Loader/Loader.less
Normal file
118
.prev/src/components/Loader/Loader.less
Normal file
@ -0,0 +1,118 @@
|
||||
@import '~themes/index.less';
|
||||
|
||||
.wrapper {
|
||||
font-family: @__Global_general_font_family;
|
||||
color: white;
|
||||
line-height: 55px;
|
||||
span{
|
||||
margin: 0 10px 0 auto;
|
||||
}
|
||||
|
||||
position: absolute;
|
||||
z-index: 1000;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 140px;
|
||||
height: 55px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
background-color: #2d2d2dc2;
|
||||
border-radius: 28px;
|
||||
margin: 10px;
|
||||
|
||||
|
||||
&.end {
|
||||
animation: unshow 0.8s linear;
|
||||
.newloader>div {
|
||||
animation: loader 0.8s linear;
|
||||
}
|
||||
opacity: 0;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.newloader {
|
||||
transform: translate(21px,27px) scale(0.3);
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
margin: 0 45px 0 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.newloader>div {
|
||||
width: 6px;
|
||||
height: 20px;
|
||||
position: absolute;
|
||||
left: -10px;
|
||||
bottom: 15px;
|
||||
border-radius: 5px;
|
||||
transform-origin: 10px 35px;
|
||||
transform: rotate(0deg);
|
||||
animation: loader 0.8s infinite;
|
||||
}
|
||||
|
||||
.newloader>div:nth-child(2) {
|
||||
transform: rotate(45deg);
|
||||
animation-delay: 0.1s;
|
||||
}
|
||||
|
||||
.newloader>div:nth-child(3) {
|
||||
transform: rotate(90deg);
|
||||
animation-delay: 0.2s;
|
||||
}
|
||||
|
||||
.newloader>div:nth-child(4) {
|
||||
transform: rotate(135deg);
|
||||
animation-delay: 0.3s;
|
||||
}
|
||||
|
||||
.newloader>div:nth-child(5) {
|
||||
transform: rotate(180deg);
|
||||
animation-delay: 0.4s;
|
||||
}
|
||||
|
||||
.newloader>div:nth-child(6) {
|
||||
transform: rotate(225deg);
|
||||
animation-delay: 0.5s;
|
||||
}
|
||||
|
||||
.newloader>div:nth-child(7) {
|
||||
transform: rotate(270deg);
|
||||
animation-delay: 0.6s;
|
||||
}
|
||||
|
||||
.newloader>div:nth-child(8) {
|
||||
transform: rotate(315deg);
|
||||
animation-delay: 0.7s;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes loader {
|
||||
0% {
|
||||
background: transparent;
|
||||
left: -10px;
|
||||
transform-origin: 10px 35px;
|
||||
}
|
||||
|
||||
30% {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
100% {
|
||||
background: transparent;
|
||||
left: 10px;
|
||||
transform-origin: -10px 35px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes unshow {
|
||||
0% {
|
||||
opacity: 1;
|
||||
display: block;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
display: none;
|
||||
}
|
||||
}
|
5
.prev/src/components/MainFeed/components/index.js
Normal file
5
.prev/src/components/MainFeed/components/index.js
Normal file
@ -0,0 +1,5 @@
|
||||
import ComponentNewAV from './newav'
|
||||
import ComponentInvalid from './invalid'
|
||||
import renderFeedPosts from './renderFeedPosts'
|
||||
|
||||
export { ComponentNewAV, ComponentInvalid, renderFeedPosts }
|
24
.prev/src/components/MainFeed/components/invalid/index.js
Normal file
24
.prev/src/components/MainFeed/components/invalid/index.js
Normal file
@ -0,0 +1,24 @@
|
||||
import { Card } from 'antd'
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons'
|
||||
|
||||
const ComponentInvalid = fn => {
|
||||
return (
|
||||
<Card
|
||||
style={{
|
||||
borderRadius: '10px',
|
||||
maxWidth: '26.5vw',
|
||||
margin: 'auto',
|
||||
textAlign: 'center',
|
||||
}}
|
||||
>
|
||||
<h2>
|
||||
<ExclamationCircleOutlined /> Invalid Data
|
||||
</h2>
|
||||
<span>
|
||||
If this error has occurred several times, try restarting the app
|
||||
</span>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
export default ComponentInvalid
|
11
.prev/src/components/MainFeed/components/newav/index.js
Normal file
11
.prev/src/components/MainFeed/components/newav/index.js
Normal file
@ -0,0 +1,11 @@
|
||||
import { Button } from 'antd'
|
||||
import styles from './newav.less'
|
||||
const ComponentNewAV = fn => {
|
||||
return (
|
||||
<div className={styles.main_feed_newav}>
|
||||
<Button onClick={fn}> New posts </Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ComponentNewAV
|
@ -0,0 +1,3 @@
|
||||
.main_feed_newav{
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
import React from 'react'
|
||||
import { PostCard } from 'components'
|
||||
import { yconsole } from 'ycore'
|
||||
import { Button, List } from 'antd'
|
||||
import { DownSquareOutlined } from '@ant-design/icons'
|
||||
const renderFeedPosts = payload => {
|
||||
const { data, loading, isEnd, feedGet } = payload
|
||||
const loadMore =
|
||||
!isEnd && !loading ? (
|
||||
<div
|
||||
style={{
|
||||
textAlign: 'center',
|
||||
marginTop: 12,
|
||||
height: 32,
|
||||
lineHeight: '32px',
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
type="ghost"
|
||||
icon={<DownSquareOutlined />}
|
||||
onClick={() => feedGet.more()}
|
||||
/>
|
||||
</div>
|
||||
) : null
|
||||
try {
|
||||
yconsole.log(data)
|
||||
return (
|
||||
<List
|
||||
loadMore={loadMore}
|
||||
dataSource={data}
|
||||
renderItem={item => (
|
||||
<div id={item.id}>
|
||||
<PostCard payload={item} key={item.id} />
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export default renderFeedPosts
|
186
.prev/src/components/MainFeed/index.js
Normal file
186
.prev/src/components/MainFeed/index.js
Normal file
@ -0,0 +1,186 @@
|
||||
import React from 'react'
|
||||
import * as antd from 'antd'
|
||||
import * as ycore from 'ycore'
|
||||
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 => {
|
||||
ycore.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 = {
|
||||
NewAV: false,
|
||||
invalid: false,
|
||||
loading: false,
|
||||
disableMenu: false,
|
||||
data: [],
|
||||
fkey: 0,
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.feedGet.first()
|
||||
ycore.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 = ycore.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) {
|
||||
ycore.yconsole.error('Please, fill params with an catch type...')
|
||||
return
|
||||
}
|
||||
this.toogleLoader()
|
||||
const payload = { fkey: 0, type: get, id: uid }
|
||||
ycore.comty_post.getFeed((err, res) => {
|
||||
if (err) {
|
||||
ycore.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 < ycore.AppSettings.limit_post_catch ? true : false
|
||||
this.setState({ NewAV: false, isEnd: isEnd, data: parsed, loading: false })
|
||||
} catch (error) {
|
||||
ycore.yconsole.log(error)
|
||||
}
|
||||
}, payload)
|
||||
} catch (err) {
|
||||
ycore.notify.error('err')
|
||||
}
|
||||
},
|
||||
more(fkey){
|
||||
try {
|
||||
const { get, uid, filters } = this.props
|
||||
if (!get) {
|
||||
ycore.yconsole.error('Please, fill params with an catch type...')
|
||||
return
|
||||
}
|
||||
if (!fkey) {
|
||||
ycore.yconsole.warn(
|
||||
'Please, provide a fkey for offset the feed, default using => 0'
|
||||
)
|
||||
}
|
||||
this.toogleLoader()
|
||||
const getLastPost = ycore.objectLast(this.state.data)
|
||||
ycore.yconsole.log('LAST POST ID =>', getLastPost.id)
|
||||
|
||||
const payload = { fkey: getLastPost.id, type: get, id: uid }
|
||||
ycore.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 < ycore.AppSettings.limit_post_catch ? true : false
|
||||
this.setState({ isEnd: isEnd, data: mix, loading: false }, () =>
|
||||
ycore.goTo.element(getLastPost.id)
|
||||
)
|
||||
return true
|
||||
}, payload)
|
||||
} catch (err) {
|
||||
ycore.notify.error(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
const { data, loading, isEnd, invalid, NewAV } = this.state
|
||||
const renderFeedPosts_payload = {data: data, loading: loading, isEnd: isEnd, feedGet: this.feedGet}
|
||||
|
||||
if (invalid){
|
||||
return ComponentInvalid()
|
||||
}
|
||||
if (loading) {
|
||||
return (
|
||||
<antd.Card style={{ maxWidth: '26.5vw', margin: 'auto' }}>
|
||||
<antd.Skeleton avatar paragraph={{ rows: 4 }} active />
|
||||
</antd.Card>
|
||||
)
|
||||
}
|
||||
if (!loading) {
|
||||
return (
|
||||
<div className={styles.main_feed_wrapper} id="mainfeed">
|
||||
{NewAV? ComponentNewAV(() => this.feedGet.first()) : null}
|
||||
{renderFeedPosts(renderFeedPosts_payload)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
export default MainFeed
|
4
.prev/src/components/MainFeed/index.less
Normal file
4
.prev/src/components/MainFeed/index.less
Normal file
@ -0,0 +1,4 @@
|
||||
.main_feed_wrapper{
|
||||
scroll-behavior: smooth;
|
||||
|
||||
}
|
65
.prev/src/components/MediaPlayer/index.js
Normal file
65
.prev/src/components/MediaPlayer/index.js
Normal file
@ -0,0 +1,65 @@
|
||||
import React from 'react'
|
||||
import classnames from 'classnames'
|
||||
import styles from './index.less'
|
||||
|
||||
export default class MediaPlayer 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 (
|
||||
// <PlyrComponent styles={{ width: '100%' }} sources={payload} />
|
||||
// )
|
||||
return (
|
||||
<video id="player" playsInline controls>
|
||||
<source src={file} />
|
||||
</video>
|
||||
)
|
||||
}
|
||||
if (type == 'audio') {
|
||||
return (
|
||||
<audio id="player" controls>
|
||||
<source src={file} />
|
||||
</audio>
|
||||
)
|
||||
}
|
||||
if (type == 'image') {
|
||||
return <img src={file} />
|
||||
}
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<div
|
||||
className={classnames(styles.PlayerContainer, {
|
||||
[styles.mobile]: this.props.isMobile,
|
||||
[styles.entire]: this.props.entire,
|
||||
})}
|
||||
>
|
||||
{this.player()}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
80
.prev/src/components/MediaPlayer/index.less
Normal file
80
.prev/src/components/MediaPlayer/index.less
Normal file
@ -0,0 +1,80 @@
|
||||
.PlayerContainer {
|
||||
width: 100%;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
video {
|
||||
max-height: 600px;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
audio {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
&.entire {
|
||||
max-width: 52vw;
|
||||
max-height: 80vh;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-70%, -50%);
|
||||
|
||||
img {
|
||||
object-fit: contain;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
max-width: 52vw;
|
||||
max-height: 80vh;
|
||||
}
|
||||
|
||||
audio {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
video {
|
||||
object-fit: contain;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
max-width: 52vw;
|
||||
max-height: 80vh;
|
||||
}
|
||||
}
|
||||
|
||||
&.mobile {
|
||||
max-width: 52vw;
|
||||
max-height: 80vh;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
|
||||
img {
|
||||
object-fit: contain;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
max-width: 52vw;
|
||||
max-height: 80vh;
|
||||
}
|
||||
|
||||
audio {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
video {
|
||||
object-fit: contain;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
max-width: 52vw;
|
||||
max-height: 80vh;
|
||||
}
|
||||
}
|
||||
}
|
134
.prev/src/components/MediaPlayer/plyr.js
Normal file
134
.prev/src/components/MediaPlayer/plyr.js
Normal file
@ -0,0 +1,134 @@
|
||||
"use strict";
|
||||
|
||||
function e(e) {
|
||||
return e && "object" == typeof e && "default" in e ? e.default : e
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: !0
|
||||
});
|
||||
var t = e(require("react")),
|
||||
n = e(require("plyr"));
|
||||
|
||||
function o(e, t) {
|
||||
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
|
||||
}
|
||||
|
||||
function i(e, t) {
|
||||
for (var n = 0; n < t.length; n++) {
|
||||
var o = t[n];
|
||||
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o)
|
||||
}
|
||||
}
|
||||
|
||||
function r(e) {
|
||||
return (r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
|
||||
return typeof e
|
||||
} : function (e) {
|
||||
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
|
||||
})(e)
|
||||
}
|
||||
|
||||
function c(e) {
|
||||
return (c = "function" == typeof Symbol && "symbol" === r(Symbol.iterator) ? function (e) {
|
||||
return r(e)
|
||||
} : function (e) {
|
||||
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : r(e)
|
||||
})(e)
|
||||
}
|
||||
|
||||
function s(e, t) {
|
||||
return !t || "object" !== c(t) && "function" != typeof t ? function (e) {
|
||||
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
return e
|
||||
}(e) : t
|
||||
}
|
||||
|
||||
function a(e) {
|
||||
return (a = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
|
||||
return e.__proto__ || Object.getPrototypeOf(e)
|
||||
})(e)
|
||||
}
|
||||
|
||||
function l(e, t) {
|
||||
return (l = Object.setPrototypeOf || function (e, t) {
|
||||
return e.__proto__ = t, e
|
||||
})(e, t)
|
||||
}
|
||||
require("plyr/dist/plyr.css");
|
||||
! function (e, t) {
|
||||
void 0 === t && (t = {});
|
||||
var n = t.insertAt;
|
||||
if (e && "undefined" != typeof document) {
|
||||
var o = document.head || document.getElementsByTagName("head")[0],
|
||||
i = document.createElement("style");
|
||||
i.type = "text/css", "top" === n && o.firstChild ? o.insertBefore(i, o.firstChild) : o.appendChild(i), i.styleSheet ? i.styleSheet.cssText = e : i.appendChild(document.createTextNode(e))
|
||||
}
|
||||
}('.yjs-plyr{width: 100%!important;position:relative;background-color:#4caf50;border:none;font-size:28px;color:#fff;padding:20px;width:200px;text-align:center;-webkit-transition-duration:.4s;transition-duration:.4s;text-decoration:none;overflow:hidden;cursor:pointer;box-shadow:0 8px 16px 0 rgba(0,0,0,.2),0 6px 20px 0 rgba(0,0,0,.19)}.PlyrComponent:after{content:"";background:#f1f1f1;display:block;position:absolute;padding-top:300%;padding-left:350%;margin-left:-20px!important;margin-top:-120%;opacity:0;transition:all .8s}.PlyrComponent:active:after{padding:0;margin:0;opacity:1;transition:0s}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZUFDRSxpQkFBa0IsQ0FDbEIsd0JBQXlCLENBQ3pCLFdBQVksQ0FDWixjQUFlLENBQ2YsVUFBYyxDQUNkLFlBQWEsQ0FDYixXQUFZLENBQ1osaUJBQWtCLENBQ2xCLCtCQUFpQyxDQUNqQyx1QkFBeUIsQ0FDekIsb0JBQXFCLENBQ3JCLGVBQWdCLENBQ2hCLGNBQWUsQ0FDZixtRUFDRixDQUVBLHFCQUNFLFVBQVcsQ0FDWCxrQkFBbUIsQ0FDbkIsYUFBYyxDQUNkLGlCQUFrQixDQUNsQixnQkFBaUIsQ0FDakIsaUJBQWtCLENBQ2xCLDJCQUE2QixDQUM3QixnQkFBaUIsQ0FDakIsU0FBVSxDQUNWLGtCQUNGLENBRUEsNEJBQ0UsU0FBVSxDQUNWLFFBQVMsQ0FDVCxTQUFVLENBQ1YsYUFDRiIsImZpbGUiOiJzdHlsZXMuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLlBseXJDb21wb25lbnQge1xuICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gIGJhY2tncm91bmQtY29sb3I6ICM0Q0FGNTA7XG4gIGJvcmRlcjogbm9uZTtcbiAgZm9udC1zaXplOiAyOHB4O1xuICBjb2xvcjogI0ZGRkZGRjtcbiAgcGFkZGluZzogMjBweDtcbiAgd2lkdGg6IDIwMHB4O1xuICB0ZXh0LWFsaWduOiBjZW50ZXI7XG4gIC13ZWJraXQtdHJhbnNpdGlvbi1kdXJhdGlvbjogMC40czsgLyogU2FmYXJpICovXG4gIHRyYW5zaXRpb24tZHVyYXRpb246IDAuNHM7XG4gIHRleHQtZGVjb3JhdGlvbjogbm9uZTtcbiAgb3ZlcmZsb3c6IGhpZGRlbjtcbiAgY3Vyc29yOiBwb2ludGVyO1xuICBib3gtc2hhZG93OiAwIDhweCAxNnB4IDAgcmdiYSgwLDAsMCwwLjIpLCAwIDZweCAyMHB4IDAgcmdiYSgwLDAsMCwwLjE5KTtcbn1cblxuLlBseXJDb21wb25lbnQ6YWZ0ZXIge1xuICBjb250ZW50OiBcIlwiO1xuICBiYWNrZ3JvdW5kOiAjZjFmMWYxO1xuICBkaXNwbGF5OiBibG9jaztcbiAgcG9zaXRpb246IGFic29sdXRlO1xuICBwYWRkaW5nLXRvcDogMzAwJTtcbiAgcGFkZGluZy1sZWZ0OiAzNTAlO1xuICBtYXJnaW4tbGVmdDogLTIwcHggIWltcG9ydGFudDtcbiAgbWFyZ2luLXRvcDogLTEyMCU7XG4gIG9wYWNpdHk6IDA7XG4gIHRyYW5zaXRpb246IGFsbCAwLjhzXG59XG5cbi5QbHlyQ29tcG9uZW50OmFjdGl2ZTphZnRlciB7XG4gIHBhZGRpbmc6IDA7XG4gIG1hcmdpbjogMDtcbiAgb3BhY2l0eTogMTtcbiAgdHJhbnNpdGlvbjogMHNcbn1cbiJdfQ== */');
|
||||
var u = function (e) {
|
||||
function r() {
|
||||
return o(this, r), s(this, a(r).apply(this, arguments))
|
||||
}
|
||||
var c, u, p;
|
||||
return function (e, t) {
|
||||
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
||||
e.prototype = Object.create(t && t.prototype, {
|
||||
constructor: {
|
||||
value: e,
|
||||
writable: !0,
|
||||
configurable: !0
|
||||
}
|
||||
}), t && l(e, t)
|
||||
}(r, t.Component), c = r, (u = [{
|
||||
key: "componentDidMount",
|
||||
value: function () {
|
||||
this.player = new n(".yjs-plyr", this.props.options), this.player.source = this.props.sources
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function () {
|
||||
this.player.destroy()
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function () {
|
||||
return t.createElement("video", {
|
||||
className: "yjs-plyr plyr"
|
||||
})
|
||||
}
|
||||
}]) && i(c.prototype, u), p && i(c, p), r
|
||||
}();
|
||||
u.defaultProps = {
|
||||
options: {
|
||||
controls: ["rewind", "play", "fast-forward", "progress", "current-time", "duration", "mute", "volume", "settings", "fullscreen"],
|
||||
i18n: {
|
||||
restart: "Restart",
|
||||
rewind: "Rewind {seektime}s",
|
||||
play: "Play",
|
||||
pause: "Pause",
|
||||
fastForward: "Forward {seektime}s",
|
||||
seek: "Seek",
|
||||
seekLabel: "{currentTime} of {duration}",
|
||||
played: "Played",
|
||||
buffered: "Buffered",
|
||||
currentTime: "Current time",
|
||||
duration: "Duration",
|
||||
volume: "Volume",
|
||||
mute: "Mute",
|
||||
unmute: "Unmute",
|
||||
enableCaptions: "Enable captions",
|
||||
disableCaptions: "Disable captions",
|
||||
download: "Download",
|
||||
enterFullscreen: "Enter fullscreen",
|
||||
exitFullscreen: "Exit fullscreen",
|
||||
frameTitle: "Player for {title}",
|
||||
captions: "Captions",
|
||||
settings: "Settings",
|
||||
menuBack: "Go back to previous menu",
|
||||
speed: "Speed",
|
||||
normal: "Normal",
|
||||
quality: "Quality",
|
||||
loop: "Loop"
|
||||
}
|
||||
},
|
||||
|
||||
}, exports.PlyrComponent = u;
|
48
.prev/src/components/MobileWarning/index.js
Normal file
48
.prev/src/components/MobileWarning/index.js
Normal file
@ -0,0 +1,48 @@
|
||||
import React from 'react'
|
||||
import styles from './index.less'
|
||||
import store from 'store'
|
||||
import * as antd from 'antd'
|
||||
|
||||
export default class MobileWarning extends React.PureComponent {
|
||||
state = {
|
||||
resbypass: store.get('resbypass') || false,
|
||||
}
|
||||
|
||||
ResByPassHandler = () => {
|
||||
this.setState({ resbypass: true })
|
||||
}
|
||||
|
||||
render() {
|
||||
const { resbypass } = this.state
|
||||
|
||||
if (resbypass == false) {
|
||||
return (
|
||||
<div className={styles.mobilewarning}>
|
||||
<antd.Result
|
||||
status="warning"
|
||||
title="Low resolution warning"
|
||||
extra={
|
||||
<div style={{ color: 'white' }}>
|
||||
<h3 style={{ color: 'white' }}>
|
||||
This version of the application is not fully compatible with
|
||||
the resolution of this screen, a higher resolution is
|
||||
recommended for an optimal experience
|
||||
</h3>
|
||||
<span>Please choose an option to continue</span>
|
||||
<br />
|
||||
<br />
|
||||
<antd.Button
|
||||
type="dashed"
|
||||
onClick={() => this.ResByPassHandler()}
|
||||
>
|
||||
Continue
|
||||
</antd.Button>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
18
.prev/src/components/MobileWarning/index.less
Normal file
18
.prev/src/components/MobileWarning/index.less
Normal file
@ -0,0 +1,18 @@
|
||||
.mobilewarning {
|
||||
background-color: rgba(0, 0, 0, 0.975);
|
||||
color: white;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 100000;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
|
||||
:global {
|
||||
.ant-result-title {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
780
.prev/src/components/PageTransition/animations.js
Normal file
780
.prev/src/components/PageTransition/animations.js
Normal file
@ -0,0 +1,780 @@
|
||||
import { keyframes } from 'styled-components'
|
||||
|
||||
export default {
|
||||
moveToLeft: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { transform: translateX(-100%); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
moveFromLeft: {
|
||||
keyframes: keyframes`
|
||||
from { transform: translateX(-100%) };
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
moveToRight: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { transform: translateX(100%); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
moveFromRight: {
|
||||
keyframes: keyframes`
|
||||
from { transform: translateX(100%); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
moveToTop: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { transform: translateY(-100%); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
moveFromTop: {
|
||||
keyframes: keyframes`
|
||||
from { transform: translateY(-100%); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
moveToBottom: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { transform: translateY(100%); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
moveFromBottom: {
|
||||
keyframes: keyframes`
|
||||
from { transform: translateY(100%); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
fade: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0.3; }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
moveToLeftFade: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0.3; transform: translateX(-100%); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
moveFromLeftFade: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0.3; transform: translateX(-100%); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
moveToRightFade: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0.3; transform: translateX(100%); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
moveFromRightFade: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0.3; transform: translateX(100%); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
moveToTopFade: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0.3; transform: translateY(-100%); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
moveFromTopFade: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0.3; transform: translateY(-100%); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
moveToBottomFade: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0.3; transform: translateY(100%); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
moveFromBottomFade: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0.3; transform: translateY(100%); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
scaleDown: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0; transform: scale(0.8); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
scaleUp: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0; transform: scale(0.8); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
scaleUpDown: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0; transform: scale(1.2); }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
scaleDownUp: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0; transform: scale(1.2); }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
scaleDownCenter: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0; transform: scale(0.7); }
|
||||
`,
|
||||
duration: 400,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
scaleUpCenter: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0; transform: scale(0.7); }
|
||||
`,
|
||||
duration: 400,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
rotateRightSideFirst: {
|
||||
keyframes: keyframes`
|
||||
0% { }
|
||||
40% { transform: rotateY(15deg); opacity: 0.8; animation-timing-function: ease-out; }
|
||||
100% { transform: scale(0.8) translateZ(-200px); opacity:0; }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '0% 50%',
|
||||
},
|
||||
rotateLeftSideFirst: {
|
||||
keyframes: keyframes`
|
||||
0% { }
|
||||
40% { transform: rotateY(-15deg); opacity: 0.8; animation-timing-function: ease-out; }
|
||||
100% { transform: scale(0.8) translateZ(-200px); opacity:0; }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '0% 50%',
|
||||
},
|
||||
rotateTopSideFirst: {
|
||||
keyframes: keyframes`
|
||||
0% { }
|
||||
40% { transform: rotateX(15deg); opacity: 0.8; animation-timing-function: ease-out; }
|
||||
100% { transform: scale(0.8) translateZ(-200px); opacity:0; }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '0% 50%',
|
||||
},
|
||||
rotateBottomSideFirst: {
|
||||
keyframes: keyframes`
|
||||
0% { }
|
||||
40% { transform: rotateX(-15deg); opacity: 0.8; animation-timing-function: ease-out; }
|
||||
100% {transform: scale(0.8) translateZ(-200px); opacity:0; }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '0% 50%',
|
||||
},
|
||||
flipOutRight: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { transform: translateZ(-1000px) rotateY(90deg); opacity: 0.2; }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '50% 50%',
|
||||
},
|
||||
flipInLeft: {
|
||||
keyframes: keyframes`
|
||||
from { transform: translateZ(-1000px) rotateY(-90deg); opacity: 0.2; }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease-out',
|
||||
fill: 'both',
|
||||
origin: '50% 50%',
|
||||
},
|
||||
flipOutLeft: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { transform: translateZ(-1000px) rotateY(-90deg); opacity: 0.2; }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '50% 50%',
|
||||
},
|
||||
flipInRight: {
|
||||
keyframes: keyframes`
|
||||
from { transform: translateZ(-1000px) rotateY(90deg); opacity: 0.2; }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease-out',
|
||||
fill: 'both',
|
||||
origin: '50% 50%',
|
||||
},
|
||||
flipOutTop: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { transform: translateZ(-1000px) rotateX(90deg); opacity: 0.2; }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '50% 50%',
|
||||
},
|
||||
flipInBottom: {
|
||||
keyframes: keyframes`
|
||||
from { transform: translateZ(-1000px) rotateX(-90deg); opacity: 0.2; }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease-out',
|
||||
fill: 'both',
|
||||
origin: '50% 50%',
|
||||
},
|
||||
flipOutBottom: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { transform: translateZ(-1000px) rotateX(-90deg); opacity: 0.2; }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '50% 50%',
|
||||
},
|
||||
flipInTop: {
|
||||
keyframes: keyframes`
|
||||
from { transform: translateZ(-1000px) rotateX(90deg); opacity: 0.2; }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease-out',
|
||||
fill: 'both',
|
||||
origin: '50% 50%',
|
||||
},
|
||||
rotateFall: {
|
||||
keyframes: keyframes`
|
||||
0% { transform: rotateZ(0deg); }
|
||||
20% { transform: rotateZ(10deg); animation-timing-function: ease-out; }
|
||||
40% { transform: rotateZ(17deg); }
|
||||
60% { transform: rotateZ(16deg); }
|
||||
100% { transform: translateY(100%) rotateZ(17deg); }
|
||||
`,
|
||||
duration: 1000,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '0% 0%',
|
||||
},
|
||||
rotateOutNewspaper: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { transform: translateZ(-3000px) rotateZ(360deg); opacity: 0; }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '50% 50%',
|
||||
},
|
||||
rotateInNewspaper: {
|
||||
keyframes: keyframes`
|
||||
from { transform: translateZ(-3000px) rotateZ(-360deg); opacity: 0; }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease-out',
|
||||
fill: 'both',
|
||||
origin: '50% 50%',
|
||||
},
|
||||
rotatePushLeft: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0; transform: rotateY(90deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '0% 50%',
|
||||
},
|
||||
rotatePushRight: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0; transform: rotateY(-90deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '100% 50%',
|
||||
},
|
||||
rotatePushTop: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0; transform: rotateX(-90deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 0%',
|
||||
},
|
||||
rotatePushBottom: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0; transform: rotateX(90deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 100%',
|
||||
},
|
||||
rotatePullRight: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0; transform: rotateY(-90deg); }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '100% 50%',
|
||||
},
|
||||
rotatePullLeft: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0; transform: rotateY(90deg); }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '0% 50%',
|
||||
},
|
||||
rotatePullTop: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0; transform: rotateX(-90deg); }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 0%',
|
||||
},
|
||||
rotatePullBottom: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0; transform: rotateX(90deg); }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 100%',
|
||||
},
|
||||
rotateFoldRight: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0; transform: translateX(100%) rotateY(90deg); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '0% 50%',
|
||||
},
|
||||
rotateFoldLeft: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0; transform: translateX(-100%) rotateY(-90deg); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '100% 50%',
|
||||
},
|
||||
rotateFoldTop: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0; transform: translateY(-100%) rotateX(90deg); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 100%',
|
||||
},
|
||||
rotateFoldBottom: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0; transform: translateY(100%) rotateX(-90deg); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 0%',
|
||||
},
|
||||
rotateUnfoldLeft: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0; transform: translateX(-100%) rotateY(-90deg); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '100% 50%',
|
||||
},
|
||||
rotateUnfoldRight: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0; transform: translateX(100%) rotateY(90deg); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '0% 50%',
|
||||
},
|
||||
rotateUnfoldTop: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0; transform: translateY(-100%) rotateX(90deg); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 100%',
|
||||
},
|
||||
rotateUnfoldBottom: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0; transform: translateY(100%) rotateX(-90deg); }
|
||||
`,
|
||||
duration: 700,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 0%',
|
||||
},
|
||||
rotateRoomLeftOut: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0.3; transform: translateX(-100%) rotateY(90deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '100% 50%',
|
||||
},
|
||||
rotateRoomLeftIn: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0.3; transform: translateX(100%) rotateY(-90deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '0% 50%',
|
||||
},
|
||||
rotateRoomRightOut: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0.3; transform: translateX(100%) rotateY(-90deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '0% 50%',
|
||||
},
|
||||
rotateRoomRightIn: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0.3; transform: translateX(-100%) rotateY(90deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '100% 50%',
|
||||
},
|
||||
rotateRoomTopOut: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0.3; transform: translateY(-100%) rotateX(-90deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 100%',
|
||||
},
|
||||
rotateRoomTopIn: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0.3; transform: translateY(100%) rotateX(90deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 0%',
|
||||
},
|
||||
rotateRoomBottomOut: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0.3; transform: translateY(100%) rotateX(90deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 0%',
|
||||
},
|
||||
rotateRoomBottomIn: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0.3; transform: translateY(-100%) rotateX(-90deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 100%',
|
||||
},
|
||||
rotateCubeLeftOut: {
|
||||
keyframes: keyframes`
|
||||
0% { }
|
||||
50% { animation-timing-function: ease-out; transform: translateX(-50%) translateZ(-200px) rotateY(-45deg); }
|
||||
100% { opacity: 0.3; transform: translateX(-100%) rotateY(-90deg); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '100% 50%',
|
||||
},
|
||||
rotateCubeLeftIn: {
|
||||
keyframes: keyframes`
|
||||
0% { opacity: 0.3; transform: translateX(100%) rotateY(90deg); }
|
||||
50% { animation-timing-function: ease-out; transform: translateX(50%) translateZ(-200px) rotateY(45deg); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '0% 50%',
|
||||
},
|
||||
rotateCubeRightOut: {
|
||||
keyframes: keyframes`
|
||||
0% { }
|
||||
50% { animation-timing-function: ease-out; transform: translateX(50%) translateZ(-200px) rotateY(45deg); }
|
||||
100% { opacity: 0.3; transform: translateX(100%) rotateY(90deg); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '0% 50%',
|
||||
},
|
||||
rotateCubeRightIn: {
|
||||
keyframes: keyframes`
|
||||
0% { opacity: 0.3; transform: translateX(-100%) rotateY(-90deg); }
|
||||
50% { animation-timing-function: ease-out; transform: translateX(-50%) translateZ(-200px) rotateY(-45deg); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '100% 50%',
|
||||
},
|
||||
rotateCubeTopOut: {
|
||||
keyframes: keyframes`
|
||||
0% {}
|
||||
50% { animation-timing-function: ease-out; transform: translateY(-50%) translateZ(-200px) rotateX(45deg); }
|
||||
100% { opacity: 0.3; transform: translateY(-100%) rotateX(90deg); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '50% 100%',
|
||||
},
|
||||
rotateCubeTopIn: {
|
||||
keyframes: keyframes`
|
||||
0% { opacity: 0.3; transform: translateY(100%) rotateX(-90deg); }
|
||||
50% { animation-timing-function: ease-out; transform: translateY(50%) translateZ(-200px) rotateX(-45deg); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '50% 0%',
|
||||
},
|
||||
rotateCubeBottomOut: {
|
||||
keyframes: keyframes`
|
||||
0% { }
|
||||
50% { animation-timing-function: ease-out; transform: translateY(50%) translateZ(-200px) rotateX(-45deg); }
|
||||
100% { opacity: 0.3; -webkit-transform: translateY(100%) rotateX(-90deg); transform: translateY(100%) rotateX(-90deg); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '50% 0%',
|
||||
},
|
||||
rotateCubeBottomIn: {
|
||||
keyframes: keyframes`
|
||||
0% { opacity: 0.3; -webkit-transform: translateY(-100%) rotateX(90deg); transform: translateY(-100%) rotateX(90deg); }
|
||||
50% { animation-timing-function: ease-out; transform: translateY(-50%) translateZ(-200px) rotateX(45deg); }
|
||||
`,
|
||||
duration: 600,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '50% 100%',
|
||||
},
|
||||
rotateCarouselLeftOut: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0.3; transform: translateX(-150%) scale(0.4) rotateY(-65deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '100% 50%',
|
||||
},
|
||||
rotateCarouselLeftIn: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0.3; transform: translateX(200%) scale(0.4) rotateY(65deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '0% 50%',
|
||||
},
|
||||
rotateCarouselRightOut: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0.3; transform: translateX(200%) scale(0.4) rotateY(65deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '0% 50%',
|
||||
},
|
||||
rotateCarouselRightIn: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0.3; transform: translateX(-200%) scale(0.4) rotateY(-65deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '100% 50%',
|
||||
},
|
||||
rotateCarouselTopOut: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0.3; transform: translateY(-200%) scale(0.4) rotateX(65deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 100%',
|
||||
},
|
||||
rotateCarouselTopIn: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0.3; transform: translateY(200%) scale(0.4) rotateX(-65deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 0%',
|
||||
},
|
||||
rotateCarouselBottomOut: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0.3; transform: translateY(200%) scale(0.4) rotateX(-65deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 0%',
|
||||
},
|
||||
rotateCarouselBottomIn: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0.3; transform: translateY(-200%) scale(0.4) rotateX(65deg); }
|
||||
`,
|
||||
duration: 800,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
origin: '50% 100%',
|
||||
},
|
||||
rotateSidesOut: {
|
||||
keyframes: keyframes`
|
||||
from { }
|
||||
to { opacity: 0; transform: translateZ(-500px) rotateY(90deg); }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '-50% 50%',
|
||||
},
|
||||
rotateSidesIn: {
|
||||
keyframes: keyframes`
|
||||
from { opacity: 0; transform: translateZ(-500px) rotateY(-90deg); }
|
||||
`,
|
||||
duration: 500,
|
||||
timing: 'ease-in',
|
||||
fill: 'both',
|
||||
origin: '150% 50%',
|
||||
},
|
||||
rotateSlideOut: {
|
||||
keyframes: keyframes`
|
||||
0% { }
|
||||
25% { opacity: 0.5; transform: translateZ(-500px); }
|
||||
75% { opacity: 0.5; transform: translateZ(-500px) translateX(-200%); }
|
||||
100% { opacity: 0.5; transform: translateZ(-500px) translateX(-200%); }
|
||||
`,
|
||||
duration: 1000,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
rotateSlideIn: {
|
||||
keyframes: keyframes`
|
||||
0%, 25% { opacity: 0.5; transform: translateZ(-500px) translateX(200%); }
|
||||
75% { opacity: 0.5; transform: translateZ(-500px); }
|
||||
100% { opacity: 1; transform: translateZ(0) translateX(0); }
|
||||
`,
|
||||
duration: 1000,
|
||||
timing: 'ease',
|
||||
fill: 'both',
|
||||
},
|
||||
}
|
80
.prev/src/components/PageTransition/index.js
Normal file
80
.prev/src/components/PageTransition/index.js
Normal file
@ -0,0 +1,80 @@
|
||||
import React, { memo } from 'react'
|
||||
import { Transition, TransitionGroup } from 'react-transition-group'
|
||||
import animations from './animations'
|
||||
import presets from './presets'
|
||||
import * as Styles from './styles'
|
||||
|
||||
function PageTransition({
|
||||
children,
|
||||
enterAnimation: enterAnimationOverride,
|
||||
exitAnimation: exitAnimationOverride,
|
||||
preset,
|
||||
transitionKey,
|
||||
...rest
|
||||
}) {
|
||||
const selectEnterAnimation = () => {
|
||||
if (enterAnimationOverride) {
|
||||
if (typeof enterAnimationOverride === 'string') {
|
||||
return animations[enterAnimationOverride]
|
||||
}
|
||||
return {
|
||||
...animations[enterAnimationOverride.name],
|
||||
delay: enterAnimationOverride.delay,
|
||||
onTop: enterAnimationOverride.onTop,
|
||||
}
|
||||
}
|
||||
if (preset) {
|
||||
return {
|
||||
...animations[presets[preset].enter.name],
|
||||
delay: presets[preset].enter.delay,
|
||||
onTop: presets[preset].enter.onTop,
|
||||
}
|
||||
}
|
||||
return 'rotateSlideIn'
|
||||
}
|
||||
|
||||
const selectExitAnimation = () => {
|
||||
if (exitAnimationOverride) {
|
||||
if (typeof exitAnimationOverride === 'string') {
|
||||
return animations[exitAnimationOverride]
|
||||
}
|
||||
return {
|
||||
...animations[exitAnimationOverride.name],
|
||||
delay: exitAnimationOverride.delay,
|
||||
onTop: exitAnimationOverride.onTop,
|
||||
}
|
||||
}
|
||||
if (preset) {
|
||||
return {
|
||||
...animations[presets[preset].exit.name],
|
||||
delay: presets[preset].exit.delay,
|
||||
onTop: presets[preset].exit.onTop,
|
||||
}
|
||||
}
|
||||
return 'rotateSlideIn'
|
||||
}
|
||||
|
||||
const enterAnimation = selectEnterAnimation()
|
||||
const exitAnimation = selectExitAnimation()
|
||||
const timeout = Math.max(enterAnimation.duration, exitAnimation.duration)
|
||||
|
||||
return (
|
||||
<Styles.PageTransitionGroup {...rest}>
|
||||
<TransitionGroup component={null}>
|
||||
<Transition key={transitionKey} timeout={timeout}>
|
||||
{state => (
|
||||
<Styles.PageTransition
|
||||
enterAnimation={enterAnimation}
|
||||
exitAnimation={exitAnimation}
|
||||
state={state}
|
||||
>
|
||||
{children}
|
||||
</Styles.PageTransition>
|
||||
)}
|
||||
</Transition>
|
||||
</TransitionGroup>
|
||||
</Styles.PageTransitionGroup>
|
||||
)
|
||||
}
|
||||
|
||||
export default memo(PageTransition)
|
552
.prev/src/components/PageTransition/presets.js
Normal file
552
.prev/src/components/PageTransition/presets.js
Normal file
@ -0,0 +1,552 @@
|
||||
export default {
|
||||
moveToLeftFromRight: {
|
||||
exit: {
|
||||
name: 'moveToLeft',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromRight',
|
||||
},
|
||||
},
|
||||
moveToRightFromLeft: {
|
||||
exit: {
|
||||
name: 'moveToRight',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromLeft',
|
||||
},
|
||||
},
|
||||
moveToTopFromBottom: {
|
||||
exit: {
|
||||
name: 'moveToTop',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromBottom',
|
||||
},
|
||||
},
|
||||
moveToBottomFromTop: {
|
||||
exit: {
|
||||
name: 'moveToBottom',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromTop',
|
||||
},
|
||||
},
|
||||
fadeFromRight: {
|
||||
exit: {
|
||||
name: 'fade',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromRight',
|
||||
onTop: true,
|
||||
},
|
||||
},
|
||||
fadeFromLeft: {
|
||||
exit: {
|
||||
name: 'fade',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromLeft',
|
||||
onTop: true,
|
||||
},
|
||||
},
|
||||
fadeFromBottom: {
|
||||
exit: {
|
||||
name: 'fade',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromBottom',
|
||||
onTop: true,
|
||||
},
|
||||
},
|
||||
fadeFromTop: {
|
||||
exit: {
|
||||
name: 'fade',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromTop',
|
||||
onTop: true,
|
||||
},
|
||||
},
|
||||
fadeLeftFadeRight: {
|
||||
exit: {
|
||||
name: 'moveToLeftFade',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromRightFade',
|
||||
},
|
||||
},
|
||||
fadeRightFadeLeft: {
|
||||
exit: {
|
||||
name: 'moveToRightFade',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromLeftFade',
|
||||
},
|
||||
},
|
||||
fadeTopFadeBottom: {
|
||||
exit: {
|
||||
name: 'moveToTopFade',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromBottomFade',
|
||||
},
|
||||
},
|
||||
fadeBottomFadeTop: {
|
||||
exit: {
|
||||
name: 'moveToBottomFade',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromTopFade',
|
||||
},
|
||||
},
|
||||
scaleDownFromRight: {
|
||||
exit: {
|
||||
name: 'scaleDown',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromRight',
|
||||
onTop: true,
|
||||
},
|
||||
},
|
||||
scaleDownFromLeft: {
|
||||
exit: {
|
||||
name: 'scaleDown',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromLeft',
|
||||
onTop: true,
|
||||
},
|
||||
},
|
||||
scaleDownFromBottom: {
|
||||
exit: {
|
||||
name: 'scaleDown',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromBottom',
|
||||
onTop: true,
|
||||
},
|
||||
},
|
||||
scaleDownFromTop: {
|
||||
exit: {
|
||||
name: 'scaleDown',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromTop',
|
||||
onTop: true,
|
||||
},
|
||||
},
|
||||
scaleDownScaleDown: {
|
||||
exit: {
|
||||
name: 'scaleDown',
|
||||
},
|
||||
enter: {
|
||||
name: 'scaleUpDown',
|
||||
delay: 300,
|
||||
},
|
||||
},
|
||||
scaleUpScaleUp: {
|
||||
exit: {
|
||||
name: 'scaleDownUp',
|
||||
},
|
||||
enter: {
|
||||
name: 'scaleUp',
|
||||
delay: 300,
|
||||
},
|
||||
},
|
||||
moveToLeftScaleUp: {
|
||||
exit: {
|
||||
name: 'moveToLeft',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'scaleUp',
|
||||
},
|
||||
},
|
||||
moveToRightScaleUp: {
|
||||
exit: {
|
||||
name: 'moveToRight',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'scaleUp',
|
||||
},
|
||||
},
|
||||
moveToTopScaleUp: {
|
||||
exit: {
|
||||
name: 'moveToTop',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'scaleUp',
|
||||
},
|
||||
},
|
||||
moveToBottomScaleUp: {
|
||||
exit: {
|
||||
name: 'moveToBottom',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'scaleUp',
|
||||
},
|
||||
},
|
||||
scaleDownScaleUp: {
|
||||
exit: {
|
||||
name: 'scaleDownCenter',
|
||||
},
|
||||
enter: {
|
||||
name: 'scaleUpCenter',
|
||||
delay: 400,
|
||||
},
|
||||
},
|
||||
glueLeftFromRight: {
|
||||
exit: {
|
||||
name: 'rotateRightSideFirst',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromRight',
|
||||
delay: 200,
|
||||
onTop: true,
|
||||
},
|
||||
},
|
||||
glueRightFromLeft: {
|
||||
exit: {
|
||||
name: 'rotateLeftSideFirst',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromLeft',
|
||||
delay: 200,
|
||||
onTop: true,
|
||||
},
|
||||
},
|
||||
glueBottomFromTop: {
|
||||
exit: {
|
||||
name: 'rotateTopSideFirst',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromTop',
|
||||
delay: 200,
|
||||
onTop: true,
|
||||
},
|
||||
},
|
||||
glueTopFromBottom: {
|
||||
exit: {
|
||||
name: 'rotateBottomSideFirst',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromBottom',
|
||||
delay: 200,
|
||||
onTop: true,
|
||||
},
|
||||
},
|
||||
flipRight: {
|
||||
exit: {
|
||||
name: 'flipOutRight',
|
||||
},
|
||||
enter: {
|
||||
name: 'flipInLeft',
|
||||
delay: 500,
|
||||
},
|
||||
},
|
||||
flipLeft: {
|
||||
exit: {
|
||||
name: 'flipOutLeft',
|
||||
},
|
||||
enter: {
|
||||
name: 'flipInRight',
|
||||
delay: 500,
|
||||
},
|
||||
},
|
||||
flipTop: {
|
||||
exit: {
|
||||
name: 'flipOutTop',
|
||||
},
|
||||
enter: {
|
||||
name: 'flipInBottom',
|
||||
delay: 500,
|
||||
},
|
||||
},
|
||||
flipBottom: {
|
||||
exit: {
|
||||
name: 'flipOutBottom',
|
||||
},
|
||||
enter: {
|
||||
name: 'flipInTop',
|
||||
delay: 500,
|
||||
},
|
||||
},
|
||||
fall: {
|
||||
exit: {
|
||||
name: 'rotateFall',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'scaleUp',
|
||||
},
|
||||
},
|
||||
newspaper: {
|
||||
exit: {
|
||||
name: 'rotateOutNewspaper',
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateInNewspaper',
|
||||
delay: 500,
|
||||
},
|
||||
},
|
||||
pushLeftFromRight: {
|
||||
exit: {
|
||||
name: 'rotatePushLeft',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromRight',
|
||||
},
|
||||
},
|
||||
pushRightFromLeft: {
|
||||
exit: {
|
||||
name: 'rotatePushRight',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromLeft',
|
||||
},
|
||||
},
|
||||
pushTopFromBottom: {
|
||||
exit: {
|
||||
name: 'rotatePushTop',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromBottom',
|
||||
},
|
||||
},
|
||||
pushBottomFromTop: {
|
||||
exit: {
|
||||
name: 'rotatePushBottom',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromTop',
|
||||
},
|
||||
},
|
||||
pushLeftPullRight: {
|
||||
exit: {
|
||||
name: 'rotatePushLeft',
|
||||
},
|
||||
enter: {
|
||||
name: 'rotatePullRight',
|
||||
delay: 180,
|
||||
},
|
||||
},
|
||||
pushRightPullLeft: {
|
||||
exit: {
|
||||
name: 'rotatePushRight',
|
||||
},
|
||||
enter: {
|
||||
name: 'rotatePullLeft',
|
||||
delay: 180,
|
||||
},
|
||||
},
|
||||
pushTopPullBottom: {
|
||||
exit: {
|
||||
name: 'rotatePushTop',
|
||||
},
|
||||
enter: {
|
||||
name: 'rotatePullBottom',
|
||||
delay: 180,
|
||||
},
|
||||
},
|
||||
pushBottomPullTop: {
|
||||
exit: {
|
||||
name: 'rotatePushBottom',
|
||||
},
|
||||
enter: {
|
||||
name: 'rotatePullTop',
|
||||
delay: 180,
|
||||
},
|
||||
},
|
||||
foldLeftFromRight: {
|
||||
exit: {
|
||||
name: 'rotateFoldLeft',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromRightFade',
|
||||
},
|
||||
},
|
||||
foldRightFromLeft: {
|
||||
exit: {
|
||||
name: 'rotateFoldRight',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromLeftFade',
|
||||
},
|
||||
},
|
||||
foldTopFromBottom: {
|
||||
exit: {
|
||||
name: 'rotateFoldTop',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromBottomFade',
|
||||
},
|
||||
},
|
||||
foldBottomFromTop: {
|
||||
exit: {
|
||||
name: 'rotateFoldBottom',
|
||||
},
|
||||
enter: {
|
||||
name: 'moveFromTopFade',
|
||||
},
|
||||
},
|
||||
moveToRightUnfoldLeft: {
|
||||
exit: {
|
||||
name: 'moveToRightFade',
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateUnfoldLeft',
|
||||
},
|
||||
},
|
||||
moveToLeftUnfoldRight: {
|
||||
exit: {
|
||||
name: 'moveToLeftFade',
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateUnfoldRight',
|
||||
},
|
||||
},
|
||||
moveToBottomUnfoldTop: {
|
||||
exit: {
|
||||
name: 'moveToBottomFade',
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateUnfoldTop',
|
||||
},
|
||||
},
|
||||
moveToTopUnfoldBottom: {
|
||||
exit: {
|
||||
name: 'moveToTopFade',
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateUnfoldBottom',
|
||||
},
|
||||
},
|
||||
roomToLeft: {
|
||||
exit: {
|
||||
name: 'rotateRoomLeftOut',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateRoomLeftIn',
|
||||
},
|
||||
},
|
||||
roomToRight: {
|
||||
exit: {
|
||||
name: 'rotateRoomRightOut',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateRoomRightIn',
|
||||
},
|
||||
},
|
||||
roomToTop: {
|
||||
exit: {
|
||||
name: 'rotateRoomTopOut',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateRoomTopIn',
|
||||
},
|
||||
},
|
||||
roomToBottom: {
|
||||
exit: {
|
||||
name: 'rotateRoomBottomOut',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateRoomBottomIn',
|
||||
},
|
||||
},
|
||||
cubeToLeft: {
|
||||
exit: {
|
||||
name: 'rotateCubeLeftOut',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateCubeLeftIn',
|
||||
},
|
||||
},
|
||||
cubeToRight: {
|
||||
exit: {
|
||||
name: 'rotateCubeRightOut',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateCubeRightIn',
|
||||
},
|
||||
},
|
||||
cubeToTop: {
|
||||
exit: {
|
||||
name: 'rotateCubeTopOut',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateCubeTopIn',
|
||||
},
|
||||
},
|
||||
cubeToBottom: {
|
||||
exit: {
|
||||
name: 'rotateCubeBottomOut',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateCubeBottomIn',
|
||||
},
|
||||
},
|
||||
carouselToLeft: {
|
||||
exit: {
|
||||
name: 'rotateCarouselLeftOut',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateCarouselLeftIn',
|
||||
},
|
||||
},
|
||||
carouselToRight: {
|
||||
exit: {
|
||||
name: 'rotateCarouselRightOut',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateCarouselRightIn',
|
||||
},
|
||||
},
|
||||
carouselToTop: {
|
||||
exit: {
|
||||
name: 'rotateCarouselTopOut',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateCarouselTopIn',
|
||||
},
|
||||
},
|
||||
carouselToBottom: {
|
||||
exit: {
|
||||
name: 'rotateCarouselBottomOut',
|
||||
onTop: true,
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateCarouselBottomIn',
|
||||
},
|
||||
},
|
||||
slides: {
|
||||
exit: {
|
||||
name: 'rotateSidesOut',
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateSidesIn',
|
||||
delay: 200,
|
||||
},
|
||||
},
|
||||
slide: {
|
||||
exit: {
|
||||
name: 'rotateSlideOut',
|
||||
},
|
||||
enter: {
|
||||
name: 'rotateSlideIn',
|
||||
},
|
||||
},
|
||||
}
|
54
.prev/src/components/PageTransition/styles.js
Normal file
54
.prev/src/components/PageTransition/styles.js
Normal file
@ -0,0 +1,54 @@
|
||||
import styled, { css } from 'styled-components'
|
||||
|
||||
const createAnimationStyles = ({
|
||||
keyframes,
|
||||
delay,
|
||||
duration,
|
||||
timing,
|
||||
fill,
|
||||
origin,
|
||||
onTop,
|
||||
}) => css`
|
||||
animation-name: ${keyframes};
|
||||
animation-delay: ${delay};
|
||||
animation-duration: ${duration}ms;
|
||||
animation-timing-function: ${timing};
|
||||
animation-fill-mode: ${fill};
|
||||
transform-origin: ${origin || '50% 50%'};
|
||||
${onTop &&
|
||||
css`
|
||||
z-index: 1;
|
||||
`}
|
||||
`
|
||||
|
||||
const stateMap = {
|
||||
entering: ({ enterAnimation }) => {
|
||||
return css`
|
||||
${createAnimationStyles(enterAnimation)};
|
||||
`
|
||||
},
|
||||
exiting: ({ exitAnimation }) => {
|
||||
return css`
|
||||
${createAnimationStyles(exitAnimation)};
|
||||
`
|
||||
},
|
||||
}
|
||||
|
||||
export const PageTransitionGroup = styled.div`
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
perspective: 1200px;
|
||||
`
|
||||
|
||||
export const PageTransition = styled.div`
|
||||
backface-visibility: hidden;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
transform-style: preserve-3d;
|
||||
transform: translate3d(0, 0, 0);
|
||||
width: 100%;
|
||||
${({ state }) => stateMap[state]};
|
||||
`
|
272
.prev/src/components/PostCard/index.js
Normal file
272
.prev/src/components/PostCard/index.js
Normal file
@ -0,0 +1,272 @@
|
||||
import React from 'react'
|
||||
import * as antd from 'antd'
|
||||
import styles from './index.less'
|
||||
import { CustomIcons, Like_button, MediaPlayer } from 'components'
|
||||
import * as ycore from 'ycore'
|
||||
import * as Icons from '@ant-design/icons'
|
||||
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 emptyPayload = {
|
||||
user: 'Post Empty',
|
||||
ago: 'This Post is empty',
|
||||
avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png',
|
||||
content: 'Empty',
|
||||
}
|
||||
|
||||
class PostCard extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props),
|
||||
this.state = {
|
||||
visibleMoreMenu: false,
|
||||
postPinned: this.props.payload.is_post_pinned,
|
||||
postSaved: this.props.payload.is_post_saved,
|
||||
postReported: this.props.payload.is_post_reported,
|
||||
postBoosted: this.props.payload.is_post_boosted,
|
||||
ReportIgnore: false,
|
||||
}
|
||||
}
|
||||
handleVisibleChange = flag => {
|
||||
this.setState({ visibleMoreMenu: flag });
|
||||
};
|
||||
|
||||
toogleMoreMenu(){
|
||||
this.setState({visibleMoreMenu: !this.state.visibleMoreMenu})
|
||||
}
|
||||
|
||||
goToPost(postID) {
|
||||
localStorage.setItem('p_back_uid', postID)
|
||||
const payload = { post_id: postID }
|
||||
ycore.comty_post.get((err, res) => {
|
||||
if (err) {
|
||||
return false
|
||||
}
|
||||
ycore.SecondarySwap.openPost(res)
|
||||
}, payload)
|
||||
}
|
||||
|
||||
render() {
|
||||
const { payload, customActions } = this.props
|
||||
const ActShowMode = ycore.AppSettings.auto_hide_postbar
|
||||
const {
|
||||
id,
|
||||
post_time,
|
||||
postText,
|
||||
postFile,
|
||||
publisher,
|
||||
post_likes,
|
||||
is_post_pinned,
|
||||
is_liked,
|
||||
post_comments,
|
||||
} = payload || emptyPayload
|
||||
const handlePostActions = {
|
||||
delete: post_id => {
|
||||
const payload = { post_id: post_id }
|
||||
ycore.comty_post.delete((err, res) => {
|
||||
if (err) {
|
||||
return false
|
||||
}
|
||||
ycore.FeedHandler.killByID(post_id)
|
||||
}, payload)
|
||||
},
|
||||
save: post_id => {
|
||||
const payload = { post_id: post_id }
|
||||
ycore.comty_post.save((err, res) => {
|
||||
if (err) {
|
||||
return false
|
||||
}
|
||||
if (this.state.postSaved == false) {
|
||||
ycore.notify.success('Post Saved')
|
||||
this.setState({ postSaved: true })
|
||||
return
|
||||
} else {
|
||||
ycore.notify.info('Removed from Saved')
|
||||
this.setState({ postSaved: false })
|
||||
}
|
||||
}, payload)
|
||||
},
|
||||
report: post_id => {
|
||||
ycore.app_modals.report_post(post_id)
|
||||
},
|
||||
boost: post_id => {
|
||||
const payload = { post_id: post_id }
|
||||
ycore.comty_post.__boost((err, res) => {
|
||||
if (err) {
|
||||
return false
|
||||
}
|
||||
if (this.state.postBoosted == false) {
|
||||
ycore.notify.success('Post Boosted')
|
||||
this.setState({ postBoosted: true })
|
||||
return
|
||||
} else {
|
||||
ycore.notify.info('Post Unboosted')
|
||||
this.setState({ postBoosted: false })
|
||||
}
|
||||
}, payload)
|
||||
},
|
||||
}
|
||||
const defaultActions = [
|
||||
<div>
|
||||
<Like_button
|
||||
count={post_likes}
|
||||
id={id}
|
||||
liked={ycore.booleanFix(is_liked) ? true : false}
|
||||
key="like"
|
||||
/>
|
||||
</div>,
|
||||
<antd.Badge dot={post_comments > 0 ? true : false}>
|
||||
<MICON.InsertComment key="comments" onClick={() => this.goToPost(id)} />
|
||||
</antd.Badge>,
|
||||
]
|
||||
const actions = customActions || defaultActions
|
||||
|
||||
const MoreMenu = (
|
||||
<antd.Menu >
|
||||
{ycore.IsThisPost.owner(publisher.id) ? (
|
||||
<antd.Menu.Item
|
||||
key="remove_post"
|
||||
>
|
||||
<antd.Popconfirm
|
||||
title="Are you sure delete this post?"
|
||||
onConfirm={() => handlePostActions.delete(id) & this.toogleMoreMenu()}
|
||||
okText="Yes"
|
||||
cancelText="No"
|
||||
>
|
||||
<Icons.DeleteOutlined /> Remove post
|
||||
</antd.Popconfirm>
|
||||
|
||||
</antd.Menu.Item>
|
||||
) : null}
|
||||
{ycore.IsThisPost.owner(publisher.id) ? (
|
||||
ycore.IsThisUser.pro(publisher.id) ? (
|
||||
<antd.Menu.Item
|
||||
onClick={() => handlePostActions.boost(id) & this.toogleMoreMenu()}
|
||||
key="boost_post"
|
||||
>
|
||||
<Icons.RocketOutlined />{' '}
|
||||
{this.state.postBoosted ? 'Unboost' : 'Boost'}
|
||||
</antd.Menu.Item>
|
||||
) : null
|
||||
) : null}
|
||||
{ycore.IsThisPost.owner(publisher.id) ? <hr /> : null}
|
||||
<antd.Menu.Item
|
||||
onClick={() => handlePostActions.save(id) & this.toogleMoreMenu()}
|
||||
key="save_post"
|
||||
>
|
||||
<Icons.SaveOutlined />{' '}
|
||||
{this.state.postSaved ? 'Unsave post' : 'Save Post'}
|
||||
</antd.Menu.Item>
|
||||
{this.state.postReported? null:
|
||||
<antd.Menu.Item
|
||||
onClick={() => handlePostActions.report(id) & this.toogleMoreMenu() }
|
||||
key="report_post"
|
||||
>
|
||||
<Icons.FlagOutlined /> Report post
|
||||
</antd.Menu.Item>
|
||||
}
|
||||
</antd.Menu>
|
||||
)
|
||||
|
||||
return (
|
||||
<div className={styles.post_card_wrapper}>
|
||||
<antd.Card
|
||||
onDoubleClick={() => this.goToPost(id)}
|
||||
hoverable
|
||||
className={ActShowMode ? null : styles.showMode}
|
||||
actions={actions}
|
||||
>
|
||||
{this.state.ReportIgnore ? null : this.state.postReported ? (
|
||||
<div className={styles.post_card_flaggedWarning}>
|
||||
<Icons.FlagOutlined />
|
||||
<h3>It seems that this post has been reported</h3>
|
||||
<p>The content may be inappropriate or compromising</p>
|
||||
<antd.Button
|
||||
onClick={() => {
|
||||
this.setState({ ReportIgnore: true })
|
||||
}}
|
||||
>
|
||||
Ignore
|
||||
</antd.Button>
|
||||
</div>
|
||||
) : null}
|
||||
<div
|
||||
className={classnames(styles.post_include, {
|
||||
[styles.blur]: this.state.ReportIgnore
|
||||
? false
|
||||
: this.state.postReported,
|
||||
})}
|
||||
>
|
||||
<Meta
|
||||
avatar={
|
||||
<div className={styles.postAvatar}>
|
||||
<antd.Avatar
|
||||
shape="square"
|
||||
size={50}
|
||||
src={publisher.avatar}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
title={
|
||||
<div className={styles.post_card_title}>
|
||||
<h4
|
||||
onClick={() =>
|
||||
ycore.router.go(`@${publisher.username}`)
|
||||
}
|
||||
className={styles.titleUser}
|
||||
>
|
||||
@{publisher.username}
|
||||
{ycore.booleanFix(publisher.verified) ? (
|
||||
<Icon
|
||||
style={{ color: 'blue' }}
|
||||
component={CustomIcons.VerifiedBadge}
|
||||
/>
|
||||
) : null}
|
||||
{ycore.booleanFix(publisher.nsfw_flag) ? (
|
||||
<antd.Tag
|
||||
style={{ margin: '0 0 0 13px' }}
|
||||
color="volcano"
|
||||
>
|
||||
NSFW
|
||||
</antd.Tag>
|
||||
) : null}{' '}
|
||||
</h4>
|
||||
<div className={styles.PostTags}>
|
||||
<div className={styles.MoreMenu}>
|
||||
<antd.Dropdown onVisibleChange={this.handleVisibleChange} visible={this.state.visibleMoreMenu} overlay={MoreMenu} trigger={['click']}>
|
||||
<Icons.MoreOutlined key="actionMenu" />
|
||||
</antd.Dropdown>
|
||||
</div>
|
||||
{ycore.booleanFix(is_post_pinned) ? (
|
||||
<Icons.PushpinFilled />
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
description={<span className={styles.textAgo}>{post_time}</span>}
|
||||
bordered="false"
|
||||
/>
|
||||
{postText ? (
|
||||
<div className={styles.post_card_content}>
|
||||
{' '}
|
||||
<h3 dangerouslySetInnerHTML={{ __html: postText }} />{' '}
|
||||
</div>
|
||||
) : null}
|
||||
{postFile ? (
|
||||
<div className={styles.post_card_file}>
|
||||
<MediaPlayer file={postFile} />
|
||||
</div>
|
||||
) : null}
|
||||
<div className={styles.ellipsisIcon}>
|
||||
<Icons.EllipsisOutlined />
|
||||
</div>
|
||||
</div>
|
||||
</antd.Card>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default PostCard
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user