Merge remote-tracking branch 'Superalgos/develop' into develop

This commit is contained in:
nikolabjelo committed 2019-05-15 16:29:37 +02:00
commit 5bd7f6167d
110 files changed
+9912 -6322

No files matched your search

+1 -1
View File
@@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at feedback at advancedalgos dot org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team using the online form in the contacts page of the superalgos.org website. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
+4 -46
View File
@@ -1,51 +1,9 @@
# Contributing
We are thrilled you are interested in contributing to the this module. Your help may be essential to the project's success and we want you in!
We are thrilled you are interested in contributing to this repository. Your help may be essential to the project's success and we want you in!
Advanced Algos LTD is a startup, currently at a very early stage. Although this module is not open source software yet, we do welcome contributions from the community.
Superalgos is a collective project, currently at a very early stage. We not only welcome contributions but may even choose to incentivize relevant contributions via the project's native crypto token.
Contributions are deemed _work for hire_ and --as such-- are compensated on a case by case basis, with ALGO tokens. Contributors agree to provide an express grant of patent rights for their contributions. Our Balanced Contributor Intellectual Property Agreement is a direct implementation of GitHub's [Balanced Employee Intellectual Property Agreement 1.0.1](https://github.com/github/balanced-employee-ip-agreement/blob/master/Balanced_Employee_IP_Agreement.md).
# Balanced Contributor Intellectual Property Agreement 1.0.1
This BALANCED CONTRIBUTOR INTELLECTUAL PROPERTY AGREEMENT is between person named below and Advanced Algos ("Company").
**What is this?** This is the Company's Intellectual Property Agreement ("Agreement"). If you've worked in the technology space before, there's a good chance that you've run across one or more of these in the past. This document is the official, entire and exclusive agreement on what intellectual property ("IP") is yours, and what belongs to the Company.
**Why is this?** The Company needs to be clear on what IP it owns and has rights to. Its customers, contributors, and investors depend on the Company having the legal rights to the products and services it is providing so that the Company can continue operating and doing business.
The Company also believes that it's important to be clear on what it doesn't own. The Company doesn't want you looking over your shoulder every time you work on something personal or worrying that the Company will someday seize your open source non-lethal mousetrap simulation software. In other words, the Company isn't interested in appropriating your personal projects.
**Read this.** Please read this document and be sure you understand it before you sign it. Due to legal risk and corporate obligations, the Company cannot, by and large, negotiate its terms. If you feel you have a particular circumstance that keeps you from signing, please let the Company's legal department ("Legal") know. And, of course, you're always free and encouraged to get your own legal counsel to explain anything you're not clear on.
Cool? Then, by signing this Agreement, and as a condition of your contribution, you agree to the following:
1. **What the Company owns.** The Company owns any IP ("Company IP") that you create, or help create _as its contributor or contractor_, but only if it meets one or more of these additional conditions: The IP was (i) related to an existing or prospective Company product or service at the time you developed, invented, or created it, (ii) developed for use by the Company, or (iii) developed or promoted with existing Company IP or with the Company's endorsement. You hereby grant and assign, and will grant and assign, to the Company all rights and interests in all Company IP.
"Company IP" includes concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, and works of authorship.
2. **What the Company doesn't own.** If you create IP that doesn't fit into one of the categories listed above, the Company doesn't own it. In other words, the Company doesn't own concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, or works of authorship that you develop, invent, or create that do not meet any of the conditions in Section 1. This is true regardless of the computer you use to develop your IP, including the one furnished to you by the Company.
3. **Contribution of your IP to Company projects.** If you include your own IP – such as IP you created prior to working for the Company – into a Company product or service, it's still yours, of course, but you grant the Company a non-exclusive, irrevocable, fully paid-up, royalty-free, perpetual, sublicensable, transferable, worldwide license to use it without restriction in any way or implementation, in modified form, or as is, by itself, or incorporated into another product or service ("License"). If you include your name in any project over which the Company would have rights under this Agreement, such as in a copyright notice or a comment in code or documentation, then the License covers the rights associated with that use of your name as well.
4. **Your contributions to non-Company projects.** The Company recognizes that you may be engaged in work that requires you to submit IP to entities other than the Company, such as open source projects used by the Company. Please make sure that Legal is aware of what you're working on so that Legal can help with any licensing issues. If any project asks you to sign a contribution agreement, you should check with Legal before doing so. These agreements may be legally binding on the Company and so should be run through Legal first.
5. **Works made for hire.** All Company IP that you are involved with or create as part of your work for the Company is [work made for hire](http://www.copyright.gov/circs/circ09.pdf) under copyright law and compensated by your regular salary or pay.
6. **No conflicts.** You agree that you don't have any outstanding agreements or obligations that conflict with those in this Agreement, and that you won't enter into conflicting agreements in the future.
7. **IP protection.** The Company might someday need to show the work that went into the development of IP that it uses or has used, or to make government filings to establish that it owns the IP or has rights over it. To help in those situations, you agree not to destroy any records you maintain relating to the development of any Company IP or IP under License (together, "All IP"), and, if the Company asks, to provide those records to the Company. You agree to help the Company secure and defend its rights in All IP, including after you leave the Company. For your help the Company will compensate you at a reasonable rate. If the Company is unable to secure your help, you authorize the Company to act on your behalf (as your agent and attorney-in-fact) in securing all rights related to All IP.
8. **Confidentiality.** As an contributor or contractor of the Company, you will have access to sensitive confidential information that is important to the Company's business. You are responsible for keeping this information confidential, including after you end your work for the Company.
"Confidential Information" includes non-public technical details about our products or services, financial information, business strategies and forecasts, customer data, or any other information, data or know-how that is valuable to the Company because it is not publicly known.
The Company's Confidential Information is sensitive and we expect that you'll treat it as such. You agree to only use the Company's Confidential Information for the purpose of performing your job and for the benefit of the Company. You will do your best to keep Confidential Information secret. If you are not sure if something is Confidential Information, you should assume that it is, until you can confirm otherwise.
Print Name: _____________
Sign: ________________
Date: ________________
Please read the [Join the Dev Team]( https://superalgos.org/developers-join-dev-team.shtml) page in our website to learn more about how you may become a relevant member of the Community and even make a living out of contributing code to the project.
Contributions are deemed _voluntary work_, irrespective of the incentives that may be in place, and are subject to the conditions described in the LICENSE
+185 -27
View File
@@ -1,43 +1,201 @@
COPYRIGHT NOTICE
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
© Copyright 2018 Advanced Algos LTD.
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
LICENSE NOTICE
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
Advanced Algos LTD. is a startup, currently at a very early stage. Because certain aspects of
the business are still not clearly defined, we have chosen to --temporarily-- grant a
restrictive license for the use of this module, until those business aspects are clarified
and a proper open source license can be granted.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
Advanced Algos LTD. is publishing the code of this software for several reasons. However,
it shall not be considered free software yet. Advanced Algos LTD. is a for-profit company
in the crypto space and this module is still proprietary software.
"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.
The reasons for opening up the code of this module at this stage are the following:
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
* We believe that transparency is paramount to achieving our goals, so we want everyone
to be able to understand what this module does and how. Opening up the code of this module
allows anyone to take a close look.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
* We welcome contributions from the community. Contributions may be compensated on a case
by case basis with ALGO tokens. Contributors agree to provide an express grant of patent
rights for their contributions.
"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).
LICENSE WORDING
"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.
Advanced Algos LTD. grants a limited license for the following uses:
"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."
1. CODE REVIEW AND AUDITS. You are granted permission to clone this repository to analyze,
review or audit the code.
"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. COLLABORATING WITH ADVANCED ALGOS LTD. You are granted permission to fork the this repository
with the sole purpose of correcting bugs and developing functionality in agreement with
Advanced Algos LTD. By contributing to this repository you explicitely agree to the terms
detailed in CONTRIBUTING.MD.
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.
PLEASE SEE CONTRIBUTING.MD FOR MORE DETAILS ON THE IMPLICATIONS SURROUNDING YOUR CONTRIBUTIONS
TO THIS REPOSITORY.
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.
+4 -4
View File
@@ -1,11 +1,11 @@
# Advanced Algos Team Module
[![npm client version](https://badge.fury.io/js/%40advancedalgos%2Fteams-client.svg)](https://badge.fury.io/js/%40advancedalgos%2Fteams-client)
# Superalgos Team Module
[![npm client version](https://badge.fury.io/js/%40superalgos%2Fteams-client.svg)](https://badge.fury.io/js/%40superalgos%2Fteams-client)
## Introduction
The general purpose of the team module is
This module explores crafting a strategic development pattern that upholds the Advanced Algos principles of rapid-evolution and automation built upon the values of collaboration, permissionless innovation, and accessibility.
This module explores crafting a strategic development pattern that upholds the Superalgos principles of rapid-evolution and automation built upon the values of collaboration, permissionless innovation, and accessibility.
#### This is a monorepo containing the Team GraphQL API server, Team Client, and Team Prisma Schema
@@ -17,7 +17,7 @@ Requirements:
- NPM (comes installed with NodeJS)
- [Github authorization via SSH](https://help.github.com/articles/connecting-to-github-with-ssh/): *optional* - removes need to authenticate every push or pull from GitHub especially as this is a private repo.
1. Clone this repository `git clone https://github.com/Algoteers/aa-team-module.git`
1. Clone this repository `git clone https://github.com/Superalgos/TeamsModule.git`
2. `cd aa-team-module`
5. Navigate to desired package in /packages and look at its README.md for further instructions.
+2 -1
View File
@@ -2,6 +2,7 @@
"presets": ["@babel/preset-env"],
"plugins": [
"@babel/plugin-proposal-throw-expressions",
["@babel/plugin-proposal-class-properties", { "loose": true }]
["@babel/plugin-proposal-class-properties", { "loose": true }],
["@babel/plugin-transform-runtime", { "regenerator": true }]
]
}
+16
View File
@@ -0,0 +1,16 @@
# Ignore files to be uploaded to the image
.env
.env.dev
.env.prod
.git
.gitignore
Dockerfile
Dockerfile.prod
README.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
/coverage
/.nyc_output
/prod
/database
+16
View File
@@ -0,0 +1,16 @@
NODE_ENV=production
PORT=4001
PRESHARED_GATEWAY_KEY=teams_key
PRISMA_SECRET=prisma_secret
PRISMA_ENDPOINT=http://prisma:4466
GENERATE_SOURCEMAP=true
SCHEMA_PATH=dist/generated/prisma.graphql
PLATFORM_API_URL=http://localhost:4100/graphql
CHARTS_URL=http://saweb:4101
-14
View File
@@ -1,14 +0,0 @@
PRISMA_SECRET=prisma-secret
PRISMA_ENDPOINT=http://localhost:4466
AUTH0_DOMAIN=auth0-domain
AUTH0_AUDIENCE=auth0-audience
AUTH0_ISSUER=auth0-issuer
NODE_ENV=development
GENERATE_SOURCEMAP=false
COMPOSE_HTTP_TIMEOUT=2000
VIRTUAL_HOST=teams.advancedalgos.net
LETSENCRYPT_HOST=teams.advancedalgos.net
LETSENCRYPT_EMAIL=support@advancedalgos.net
VIRTUAL_PORT=4000
+2
View File
@@ -2,6 +2,8 @@
/.env.prod
/database/.env
/database/docker-compose.prisma.prod.yml
/database/*.zip
/database/data-archive
/docker-compose.prisma.prod.yml
/docker-compose.prod.yml
.graphqlconfig.prod.yml
+21 -27
View File
@@ -1,51 +1,45 @@
# Contributing
We are thrilled you are interested in contributing to the this module. Your help may be essential to the project's success and we want you in!
We are thrilled you are interested in contributing to this repository. Your help may be essential to the project's success and we want you in!
Advanced Algos LTD is a startup, currently at a very early stage. Although this module is not open source software yet, we do welcome contributions from the community.
Superalgos is a collective project, currently at a very early stage. Although this repository is not open source software yet, we do welcome contributions from the community.
Contributions are deemed _work for hire_ and --as such-- are compensated on a case by case basis, with ALGO tokens. Contributors agree to provide an express grant of patent rights for their contributions. Our Balanced Contributor Intellectual Property Agreement is a direct implementation of GitHub's [Balanced Employee Intellectual Property Agreement 1.0.1](https://github.com/github/balanced-employee-ip-agreement/blob/master/Balanced_Employee_IP_Agreement.md).
Contributions are deemed _voluntary work_. There might be incentives in place for certain kinds of contributions. Contact us for more information in this regard.
In any case, contributors agree to provide an express grant of patent rights for their contributions. Submitting Pull Requests to this repository represents an express agreement with the terms of our Balanced Contributor Intellectual Property Agreement. This agreement is a direct implementation of GitHub's [Balanced Employee Intellectual Property Agreement 1.0.1](https://github.com/github/balanced-employee-ip-agreement/blob/master/Balanced_Employee_IP_Agreement.md).
# Balanced Contributor Intellectual Property Agreement 1.0.1
This BALANCED CONTRIBUTOR INTELLECTUAL PROPERTY AGREEMENT is between person named below and Advanced Algos ("Company").
This BALANCED CONTRIBUTOR INTELLECTUAL PROPERTY AGREEMENT is between person or team submitting Pull Requests to this repository and Superalgos.org ("Project").
**What is this?** This is the Company's Intellectual Property Agreement ("Agreement"). If you've worked in the technology space before, there's a good chance that you've run across one or more of these in the past. This document is the official, entire and exclusive agreement on what intellectual property ("IP") is yours, and what belongs to the Company.
**What is this?** This is the Project's Intellectual Property Agreement ("Agreement"). If you've worked in the technology space before, there's a good chance that you've run across one or more of these in the past. This document is the official, entire and exclusive agreement on what intellectual property ("IP") is yours, and what belongs to the Project.
**Why is this?** The Company needs to be clear on what IP it owns and has rights to. Its customers, contributors, and investors depend on the Company having the legal rights to the products and services it is providing so that the Company can continue operating and doing business.
**Why is this?** The Project needs to be clear on what IP it owns and has rights to. Its customers, contributors, and investors depend on the Project having the legal rights to the products and services it is providing so that the Project can continue operating and doing business.
The Company also believes that it's important to be clear on what it doesn't own. The Company doesn't want you looking over your shoulder every time you work on something personal or worrying that the Company will someday seize your open source non-lethal mousetrap simulation software. In other words, the Company isn't interested in appropriating your personal projects.
The Project also believes that it's important to be clear on what it doesn't own. The Project doesn't want you looking over your shoulder every time you work on something personal or worrying that the Project will someday seize your open source non-lethal mousetrap simulation software. In other words, the Project isn't interested in appropriating your personal projects.
**Read this.** Please read this document and be sure you understand it before you sign it. Due to legal risk and corporate obligations, the Company cannot, by and large, negotiate its terms. If you feel you have a particular circumstance that keeps you from signing, please let the Company's legal department ("Legal") know. And, of course, you're always free and encouraged to get your own legal counsel to explain anything you're not clear on.
**Read this.** Please read this document and be sure you understand it before you submit any Pull Requests. Due to legal risk and corporate obligations, the Project cannot, by and large, negotiate its terms. If you feel you have a particular circumstance that keeps you from signing, please let the Project's legal department ("Legal") know. And, of course, you're always free and encouraged to get your own legal counsel to explain anything you're not clear on.
Cool? Then, by signing this Agreement, and as a condition of your contribution, you agree to the following:
Cool? Then, by submitting your first Pull Request, and as a condition of your contribution, you agree to the following:
1. **What the Company owns.** The Company owns any IP ("Company IP") that you create, or help create _as its contributor or contractor_, but only if it meets one or more of these additional conditions: The IP was (i) related to an existing or prospective Company product or service at the time you developed, invented, or created it, (ii) developed for use by the Company, or (iii) developed or promoted with existing Company IP or with the Company's endorsement. You hereby grant and assign, and will grant and assign, to the Company all rights and interests in all Company IP.
1. **What the Project owns.** The Project owns any IP ("Project IP") that you create, or help create _as its contributor_, but only if it meets one or more of these additional conditions: The IP was (i) related to an existing or prospective Project product or service at the time you developed, invented, or created it, (ii) developed for use by the Project, or (iii) developed or promoted with existing Project IP or with the Project's endorsement. You hereby grant and assign, and will grant and assign, to the Project all rights and interests in all Project IP.
"Company IP" includes concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, and works of authorship.
"Project IP" includes concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, and works of authorship.
2. **What the Company doesn't own.** If you create IP that doesn't fit into one of the categories listed above, the Company doesn't own it. In other words, the Company doesn't own concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, or works of authorship that you develop, invent, or create that do not meet any of the conditions in Section 1. This is true regardless of the computer you use to develop your IP, including the one furnished to you by the Company.
2. **What the Project doesn't own.** If you create IP that doesn't fit into one of the categories listed above, the Project doesn't own it. In other words, the Project doesn't own concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, or works of authorship that you develop, invent, or create that do not meet any of the conditions in Section 1.
3. **Contribution of your IP to Company projects.** If you include your own IP – such as IP you created prior to working for the Company – into a Company product or service, it's still yours, of course, but you grant the Company a non-exclusive, irrevocable, fully paid-up, royalty-free, perpetual, sublicensable, transferable, worldwide license to use it without restriction in any way or implementation, in modified form, or as is, by itself, or incorporated into another product or service ("License"). If you include your name in any project over which the Company would have rights under this Agreement, such as in a copyright notice or a comment in code or documentation, then the License covers the rights associated with that use of your name as well.
3. **Contribution of your IP to Project projects.** If you include your own IP � such as IP you created prior to working for the Project � into a Project product or service, it's still yours, of course, but you grant the Project a non-exclusive, irrevocable, fully paid-up, royalty-free, perpetual, sub-licensable, transferable, worldwide license to use it without restriction in any way or implementation, in modified form, or as is, by itself, or incorporated into another product or service ("License"). If you include your name in any project over which the Project would have rights under this Agreement, such as in a copyright notice or a comment in code or documentation, then the License covers the rights associated with that use of your name as well.
4. **Your contributions to non-Company projects.** The Company recognizes that you may be engaged in work that requires you to submit IP to entities other than the Company, such as open source projects used by the Company. Please make sure that Legal is aware of what you're working on so that Legal can help with any licensing issues. If any project asks you to sign a contribution agreement, you should check with Legal before doing so. These agreements may be legally binding on the Company and so should be run through Legal first.
4. **Your contributions to non-Project projects.** The Project recognizes that you may be engaged in work that requires you to submit IP to entities other than the Project, such as open source projects used by the Project. Please make sure that Legal is aware of what you're working on so that Legal can help with any licensing issues. If any project asks you to sign a contribution agreement, you should check with Legal before doing so. These agreements may be legally binding on the Project and so should be run through Legal first.
5. **Works made for hire.** All Company IP that you are involved with or create as part of your work for the Company is [work made for hire](http://www.copyright.gov/circs/circ09.pdf) under copyright law and compensated by your regular salary or pay.
5. **Voluntary Works** All Project IP that you are involved with or create as part of your work for the Project is voluntary work which does not require compensation. There might be incentives in place for certain kinds of contributions. Feel free to contact the Project to learn more.
6. **No conflicts.** You agree that you don't have any outstanding agreements or obligations that conflict with those in this Agreement, and that you won't enter into conflicting agreements in the future.
7. **IP protection.** The Company might someday need to show the work that went into the development of IP that it uses or has used, or to make government filings to establish that it owns the IP or has rights over it. To help in those situations, you agree not to destroy any records you maintain relating to the development of any Company IP or IP under License (together, "All IP"), and, if the Company asks, to provide those records to the Company. You agree to help the Company secure and defend its rights in All IP, including after you leave the Company. For your help the Company will compensate you at a reasonable rate. If the Company is unable to secure your help, you authorize the Company to act on your behalf (as your agent and attorney-in-fact) in securing all rights related to All IP.
7. **IP protection.** The Project might someday need to show the work that went into the development of IP that it uses or has used, or to make government filings to establish that it owns the IP or has rights over it. To help in those situations, you agree not to destroy any records you maintain relating to the development of any Project IP or IP under License (together, "All IP"), and, if the Project asks, to provide those records to the Project. You agree to help the Project secure and defend its rights in All IP. For your help the Project will compensate you at a reasonable rate. If the Project is unable to secure your help, you authorize the Project to act on your behalf (as your agent and attorney-in-fact) in securing all rights related to All IP.
8. **Confidentiality.** As an contributor or contractor of the Company, you will have access to sensitive confidential information that is important to the Company's business. You are responsible for keeping this information confidential, including after you end your work for the Company.
8. **Confidentiality.** As an contributor or contractor of the Project, you will have access to sensitive confidential information that is important to the Project's business. You are responsible for keeping this information confidential, including after you end your work for the Project.
"Confidential Information" includes non-public technical details about our products or services, financial information, business strategies and forecasts, customer data, or any other information, data or know-how that is valuable to the Company because it is not publicly known.
The Company's Confidential Information is sensitive and we expect that you'll treat it as such. You agree to only use the Company's Confidential Information for the purpose of performing your job and for the benefit of the Company. You will do your best to keep Confidential Information secret. If you are not sure if something is Confidential Information, you should assume that it is, until you can confirm otherwise.
Print Name: _____________
Sign: ________________
Date: ________________
"Confidential Information" includes non-public technical details about our products or services, financial information, business strategies and forecasts, customer data, or any other information, data or know-how that is valuable to the Project because it is not publicly known.
The Project's Confidential Information is sensitive and we expect that you'll treat it as such. You agree to only use the Project's Confidential Information for the purpose of performing your contribution and for the benefit of the Project. You will do your best to keep Confidential Information secret. If you are not sure if something is Confidential Information, you should assume that it is, until you can confirm otherwise.
+9 -13
View File
@@ -1,23 +1,19 @@
FROM mhart/alpine-node:8
FROM mhart/alpine-node:12
ENV PORT=4001
# Directory where the service will be installed
ARG API_DIR=/usr/src/teams-api
RUN mkdir -p /var/www/app && \
mkdir -p /var/www/app/node_modules
# Prepare required directories
RUN mkdir -p ${API_DIR}
# Use app directory as current workdir
WORKDIR /var/www/app
ENV PATH /var/www/app/node_modules/.bin:$PATH
WORKDIR ${API_DIR}
# Copy package.json to workdir
COPY package.json /var/www/app/package.json
COPY . ${API_DIR}/
# Install dependencies
RUN npm install
RUN npm audit fix
# Copy application code
COPY . /var/www/app
RUN npm install --production
# Expose Port
EXPOSE $PORT
+23
View File
@@ -0,0 +1,23 @@
FROM mhart/alpine-node:8
ENV PORT=4001
RUN mkdir -p /var/www/app && \
mkdir -p /var/www/app/node_modules
# Use app directory as current workdir
WORKDIR /var/www/app
ENV PATH /var/www/app/node_modules/.bin:$PATH
# Copy package.json to workdir
COPY package.json /var/www/app/package.json
# Install dependencies
RUN npm install
# RUN npm audit fix
# Copy application code
COPY . /var/www/app
# Expose Port
EXPOSE $PORT
+185 -27
View File
@@ -1,43 +1,201 @@
COPYRIGHT NOTICE
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
© Copyright 2018 Advanced Algos LTD.
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
LICENSE NOTICE
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
Advanced Algos LTD. is a startup, currently at a very early stage. Because certain aspects of
the business are still not clearly defined, we have chosen to --temporarily-- grant a
restrictive license for the use of this module, until those business aspects are clarified
and a proper open source license can be granted.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
Advanced Algos LTD. is publishing the code of this software for several reasons. However,
it shall not be considered free software yet. Advanced Algos LTD. is a for-profit company
in the crypto space and this module is still proprietary software.
"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.
The reasons for opening up the code of this module at this stage are the following:
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
* We believe that transparency is paramount to achieving our goals, so we want everyone
to be able to understand what this module does and how. Opening up the code of this module
allows anyone to take a close look.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
* We welcome contributions from the community. Contributions may be compensated on a case
by case basis with ALGO tokens. Contributors agree to provide an express grant of patent
rights for their contributions.
"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).
LICENSE WORDING
"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.
Advanced Algos LTD. grants a limited license for the following uses:
"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."
1. CODE REVIEW AND AUDITS. You are granted permission to clone this repository to analyze,
review or audit the code.
"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. COLLABORATING WITH ADVANCED ALGOS LTD. You are granted permission to fork the this repository
with the sole purpose of correcting bugs and developing functionality in agreement with
Advanced Algos LTD. By contributing to this repository you explicitely agree to the terms
detailed in CONTRIBUTING.MD.
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.
PLEASE SEE CONTRIBUTING.MD FOR MORE DETAILS ON THE IMPLICATIONS SURROUNDING YOUR CONTRIBUTIONS
TO THIS REPOSITORY.
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.
+17 -86
View File
@@ -1,10 +1,8 @@
# Advance Algos Team GraphQL API Server
# Superalgos Team GraphQL API Server
This is the Advanced Algos Team Module server-side GraphQL API server. We use Webpack 4 + Docker to develop locally, then build to a distribution bundle that can then be uploaded via FTP, git or used with a continuous integration workflow.
This is the Superalgos Team Module server-side GraphQL API server. We use Webpack 4 + Docker to develop locally, then build to a distribution bundle that can then be uploaded via FTP, git or used with a continuous integration workflow.
This modules client-side component is the [aateam-client package](../aateam-client#README).
For more information on the general architecture and related technology of this module, please visit this repos [main documenation](../../docs#README).
This modules client-side frontend is in the [client directory](../client#README).
## Getting Started
@@ -17,98 +15,31 @@ then
npm run dev
```
### Using Docker
Get latest Docker and Docker Compose: [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/)
#### Using Docker container for Development
To run starter kit in development mode with hot code reload execute:
Run docker container in background:
```
docker-compose up -d
```
If image issues, try running:
```
docker-compose up --build
```
then run
```
docker-compose up -d
```
To view logs
```
docker-compose logs -f -t
```
Hit Ctrl + c to exit logs without stopping service
To stop service
```
docker-compose down
```
## Overview
The development architecture of the Algobots Community site is to allow both rapid initial development and ongoing rapid-evolution. As with any opinionated workflow, there's a learning curve, but the libraries and architecture of this application have been chosen to maximize collaboration, flexibility, and extensibility.
The Superalgos/TeamModule API is a GraphQL server that serves the necessary queries and mutations for Superalgos teams to browser clients and the Superalgos platform.
### Main Libraries
- [*Webpack 4*](https://webpack.js.org/):web application bundler. Allows us to us latest newer JS ECMA features that increase productivity and code clarity. Also allows additional libraries such as modular and programmable CSS via SASS/SCSS/LESS. Provides webserver for local development.
- [*Bulma CSS Framework*](https://bulma.io/documentation/): Bulma is a highly-customizable CSS-only framework allowing us to quickly prototype the layout of a webapp without being complicated by opinionated functionality represented in libraries such as Bootstrap or Material UI. Grants us the flexibility to create a custom look at top speed whilst minimizing baggage.
- [*HyperApp*](https://github.com/hyperapp/hyperapp): Allows a controlled Flux-styled approach to state-management and data-flow through components like React minus the excess boilerplate and learning curve.
- [*Prisma*](https://www.prisma.io/): GraphQL ORM for Postgres.
- [*Graphql*](https://graphql.org/): GraphQL is a query language for APIs and a runtime for fulfilling those queries.
- [*Apollo Server*](https://www.apollographql.com/docs/apollo-server/): Apollo Server is the best way to quickly build a production-ready, self-documenting API for GraphQL clients, using data from any source.
- [*Docker*](https://www.docker.com/what-docker)
### File organization
```
. # Top level directory located at your choice
├── database # Database files for local Prisma development
├── src
│ ├── actions # Actions are functions that change the app state
│ ├── assets # images, logos and other static assets
│ ├── state # Schema of state — the single source of truth concerning app state.
│ ├── styles # SASS/SCSS styles
│ ├── utils # Local storage and other utils
│ └── views # Main folder for editing site content
│ ├─ nav # Nav components — header, footer, etc.
│ ├─ pages # Nav components — header, footer, etc.
│ │ ├─ landing # Homepage
│ │ │ ├─ sections # Homepage sections. Collated in its own index.js
│ │ │ └─ index.js # Main homepage component. Pulls in sections
│ │ └─ ... # Other page/component folders
│ └─ index.js # Main view container. Main router
├── html
│ └── index.html # index.html template pulled in by Webpack to attach transpiled bundles
├── index.js # JS entry point to website
│ ├── directives # Directives for role permissions
│ ├── errors # error handling
│ ├── generated # Auto-compile GraphQl schema from Prisma endpoint
│ ├── graphql # GraphQL API schema + resolvers
│ ├── logger # Utils for logging
│ ├── middleware # Server middleware
│ └── storage # Azure storage service
├── ApolloServer.js # Main Apollo Server setup
│
├── tools # utility scripts, mostly for webpack configuration
│
├── node_modules # created by running `npm install` in this packages root dir
├── dist # created by `npm run develop` - a cache of bundled files served by Webpack for local development
└── build # created by `npm run build` - location of deployable production bundle
└── index.js # Server API entrypoint
```
## Deployment
The simplest deployment is compiling/transpiling the site to a distribution bundle and then uploading the files in the bundle to a web-accessible folder or storage.
For this application we use Webpack to transpile the application which combines and minimizes all code and assets into an optimized bundle without and of the development code and resources.
To build, run:
```
npm run build
```
Looking in this packages directory, there should be a ./build directory with the final built files that can be uploaded.
### Create Docker image
```
docker build -t aateamapi/prod .
```
### Deployment instructions
Coming soon...
+12 -5
View File
@@ -23,6 +23,11 @@ enum FBKind {
INDICATOR
EXTRACTOR
PLOTTER
Trader
Trading
Indicator
Sensor
Plotter
}
type Team {
@@ -39,15 +44,17 @@ type Team {
}
type TeamProfile {
id: ID! @unique
description: String
motto: String
avatar: String
banner: String
updatedAt: DateTime!
createdAt: DateTime!
updatedAt: DateTime!
}
type TeamStatus {
id: ID! @unique
status: Status @Default(value: inactive)
reason: String
createdAt: DateTime!
@@ -61,7 +68,6 @@ type TeamMembers {
status: [TeamMemberStatus!]!
email: String @unique
createdAt: DateTime!
updatedAt: DateTime!
}
type TeamMemberStatus {
@@ -82,14 +88,16 @@ type Member {
}
type MemberStatus {
id: ID! @unique
status: Status @Default(value: INACTIVE)
reason: String
createdAt: DateTime!
}
type Wallet {
id: ID! @unique
balance: Float
updatedAt: DateTime!
createdAt: DateTime!
}
type FinancialBeings {
@@ -101,11 +109,10 @@ type FinancialBeings {
avatar: String
team: Team @relation (name: "TeamFinancialBeing", onDelete: SET_NULL)
status: [FBStatus!]!
updatedAt: DateTime!
createdAt: DateTime!
}
type FBStatus {
id: ID! @unique
status: Status @Default(value: inactive)
reason: String
createdAt: DateTime!
+13 -11
View File
@@ -1,21 +1,23 @@
version: '3'
services:
node:
image: advancedalgosteamsmodule/teammodule-api:v9
build:
context: .
dockerfile: ./prod/Dockerfile.prod
env_file: ./.env.prod
container_name: aateamapi
container_name: sateamapi
tty: true
stdin_open: true
volumes:
- ./:/var/www/app
- /var/www/app/node_modules
working_dir: /var/www/app
- ./dist:/usr/src/app
- /usr/src/app/node_modules
working_dir: /usr/src/app
restart: always
command: node -r dotenv/config src/index.js
command: node -r dotenv/config index.js
expose:
- 4001
network_mode: webproxy
networks:
default:
external:
name: webproxy
# network_mode: webproxy
# networks:
# default:
# external:
# name: webproxy
-16
View File
@@ -1,16 +0,0 @@
version: '3'
services:
api:
image: advancedalgosteamsmodule/teammodule-api:v9
env_file: ./.env.prod
container_name: aateamapi-imagetest
tty: true
stdin_open: true
volumes:
- ./:/var/www/app
- /var/www/app/node_modules
working_dir: /var/www/app
restart: always
command: node --require @babel/register --require dotenv/config src/index.js
ports:
- "4001:4001"
+1 -1
View File
@@ -1,7 +1,7 @@
version: '3'
services:
prisma:
image: prismagraphql/prisma:1.15.1
image: prismagraphql/prisma:1.20
restart: always
ports:
- "4466:4466"
+4011 -3947
View File
File diff suppressed because it is too large. Load diff
+41 -29
View File
@@ -1,48 +1,60 @@
{
"name": "aa-team-api",
"name": "@superalgos/teams-api",
"version": "0.1.0",
"description": "Superalgos Teams backend API",
"author": "Superalgos, ltd.",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/Superalgos/TeamsModule.git"
},
"main": "src/index.js",
"scripts": {
"start": "NODE_ENV=production nodemon -e js,graphql -x node -r dotenv/config src/index.js",
"start": "node -r dotenv/config dist/index.js",
"debug": "nodemon src/index.js --watch ./src --exec \"node --require @babel/register --require dotenv/config\"",
"playground": "graphql playground --dotenv dotenv/config",
"dev": "npm-run-all --parallel debug playground"
"dev": "npm-run-all --parallel debug playground",
"build": "npx babel src --out-dir ../dist --relative -D --presets=@babel/env --plugins=@babel/plugin-proposal-throw-expressions,@babel/plugin-proposal-class-properties"
},
"dependencies": {
"@azure/storage-blob": "^10.0.0-preview",
"@babel/cli": "^7.1.2",
"@babel/core": "^7.1.2",
"@babel/node": "^7.0.0",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@azure/storage-blob": "^10.3.0",
"@babel/polyfill": "^7.2.5",
"@babel/register": "^7.0.0",
"@babel/runtime": "^7.3.1",
"apollo-errors": "^1.9.0",
"apollo-server-express": "^2.1.0",
"apollo-server-express": "^2.4.0",
"axios": "^0.18.0",
"cors": "^2.8.4",
"debug": "^4.1.0",
"dotenv": "^6.1.0",
"cors": "^2.8.5",
"dotenv": "^6.2.0",
"express": "^4.16.4",
"express-jwt": "^5.3.1",
"fast-xml-parser": "^3.12.5",
"fast-xml-parser": "^3.12.12",
"graphql": "^14.1.1",
"graphql-import": "^0.7.1",
"graphql-middleware": "^1.7.7",
"graphql-middleware": "^1.7.8",
"graphql-subscriptions": "^1.0.0",
"graphql-tag": "^2.10.0",
"graphql-tools": "^4.0.1",
"jsonwebtoken": "^8.3.0",
"jwks-rsa": "^1.3.0",
"lodash.get": "^4.4.2",
"nodemon": "^1.18.4",
"prisma-binding": "^2.1.6",
"graphql-tag": "^2.10.1",
"graphql-tools": "^4.0.4",
"jsonwebtoken": "^8.4.0",
"jwks-rsa": "^1.4.0",
"lodash": "^4.17.11",
"prisma-binding": "^2.3.2",
"request": "^2.88.0",
"request-promise-native": "^1.0.5",
"winston": "^3.1.0"
"winston": "^3.2.1"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"graphql-cli": "^2.16.5",
"lodash.merge": "^4.6.1",
"npm-run-all": "4.1.3",
"prisma": "^1.18.1"
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/node": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.3.0",
"@babel/plugin-proposal-throw-expressions": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.3.1",
"debug": "^4.1.1",
"graphql-cli": "^3.0.9",
"nodemon": "^1.18.10",
"npm-run-all": "4.1.5",
"prisma": "^1.26.4"
}
}
+28
View File
@@ -0,0 +1,28 @@
# ---- Base Node ----
FROM node:carbon AS base
# Create app directory
WORKDIR /usr/src/app
# ---- Dependencies ----
FROM base AS dependencies
WORKDIR /usr/src/app
# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json ./
# install app dependencies including 'devDependencies'
RUN npm install --only=production
# ---- Copy Files/Build ----
FROM dependencies AS build
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN npm run build
# --- Release with Alpine ----
FROM mhart/alpine-node:8 AS release
# Create app directory
WORKDIR /usr/src/app
COPY --from=build /usr/src/app/dist ./
COPY --from=build /usr/src/app/node_modules ./node_modules
#CMD ["serve", "-s", "dist", "-p", "8080"]
CMD ["node", "dist/index.js"]
+3 -7
View File
@@ -1,15 +1,9 @@
import http from 'http'
import { ApolloServer, makeExecutableSchema } from 'apollo-server-express'
import { applyMiddleware as applyGraphQLMiddleware } from 'graphql-middleware'
import { moduleAuth } from './middleware'
import { logger } from './logger'
/**
*
* @description Creates an Apollo Server. Setup based on `vue-cli-plugin-apollo`.
* @param {Object} app Express application
* @param {Object} options Apollo options
* @returns {Object} HTTP Server
*/
export default function createApolloServer(
app,
{
@@ -53,6 +47,7 @@ export default function createApolloServer(
tracing: true,
cacheControl: true,
introspection: true,
playground: true,
engine: engineKey ? { apiKey: engineKey } : false,
dataSources,
// Resolvers context in POST requests
@@ -110,6 +105,7 @@ export default function createApolloServer(
// Express middleware
server.applyMiddleware({
moduleAuth,
app,
cors,
path: graphqlEndpoint,
+1 -1
View File
@@ -1,5 +1,5 @@
import { SchemaDirectiveVisitor } from 'apollo-server-express'
import _get from 'lodash.get'
import _get from 'lodash/get'
import { logger, AuthenticationError, DatabaseError } from '../logger'
const memberLocationOnContext = 'request.user'
-153
View File
@@ -1,153 +0,0 @@
var jwt = require('jsonwebtoken')
var axios = require('axios')
import { logger } from '../logger'
const sendTeamMemberInvite = function(email, team) {
const dev = process.env.NODE_ENV === 'development' ? true : false
logger.info(`sendTeamMemberInvite email|team: ${email} | ${team}`)
const API_KEY = process.env.SG_APIKEY
const token = jwt.sign({ email: email, team: team.slug }, API_KEY, { expiresIn: '7d' })
let origin = 'https://teams.advancedalgos.net'
const params = '/activate-team-membership/'
if (dev){
origin = 'http://localhost:3001'
}
const headers = {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin' : origin,
'Access-Control-Allow-Credentials': 'true'
};
const data = JSON.stringify({
"personalizations": [
{
"to": [
{
"email": email
}
],
dynamic_template_data: {
"aateaminvitelink": origin + params + token,
"aateamname": team.name,
"subject": "INVITATION: Join team " + team.name
},
"subject": "INVITATION: Join team " + team.name
}
],
"from": {
"email": "noreply@advancedalgos.net",
"name": "Advanced Algos Teams"
},
"reply_to": {
"email": "feedback@advancedalgos.net",
"name": "Advanced Algos Teams"
},
"template_id": process.env.SG_INVITE_EMAILID
})
let sendVerify = axios({
method: 'post',
url: 'https://api.sendgrid.com/v3/mail/send',
data: data,
headers:{
'content-type': 'application/json',
'authorization': 'Bearer ' + API_KEY
}
})
.then(function (response) {
if (response.status >= 200 && response.status < 300) {
return 'Success'
} else {
throw response.data.errors[0].message
}
})
.catch(function (error) {
return `${error.status}-${error.response.data.errors[0].message}`
})
return sendVerify
}
const sendTeamCreateConfirmation = function(email, teamName, botName) {
const dev = process.env.NODE_ENV === 'development' ? true : false
logger.info(`sendTeamCreateConfirmation email|teamName|botName: ${email} | ${teamName} | ${botName}`)
const API_KEY = process.env.SG_APIKEY
let origin = 'https://teams.advancedalgos.net'
if (dev){
origin = 'http://localhost:3001'
}
const headers = {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin' : origin,
'Access-Control-Allow-Credentials': 'true'
};
const data = JSON.stringify({
"personalizations": [
{
"to": [
{
"email": email
}
],
dynamic_template_data: {
"aadeveloplink": "https://develop.advancedalgos.net/index.html",
"aateamname": teamName,
"aabotname": botName,
"subject": "Team " + teamName + " has been created!"
},
"subject": "Team " + teamName + " has been created!"
}
],
"from": {
"email": "noreply@advancedalgos.net",
"name": "Advanced Algos Teams"
},
"reply_to": {
"email": "feedback@advancedalgos.net",
"name": "Advanced Algos Teams"
},
"template_id": process.env.SG_TEAMCREATE_EMAILID
})
let sendTeamCreation = axios({
method: 'post',
url: 'https://api.sendgrid.com/v3/mail/send',
data: data,
headers:{
'content-type': 'application/json',
'authorization': 'Bearer ' + API_KEY
}
})
.then(function (response) {
if (response.status >= 200 && response.status < 300) {
return 'Success'
} else {
throw response.data.errors[0].message
}
})
.catch(function (error) {
return `${error.status}-${error.response.data.errors[0].message}`
})
return sendTeamCreation
}
const verifyInviteToken = async function(token) {
const API_KEY = process.env.SG_APIKEY
let verifiedToken
try {
verifiedToken = await jwt.verify(token, API_KEY, {maxAge: '7d'})
} catch(err) {
if (err.name === "TokenExpiredError"){
throw new Error ("Error: Token Expired. Please request new invitation or apply to the team again")
} else {
throw new Error (`Error: Token error - ${err.message}`)
}
}
logger.info(`verifyInviteToken: ${verifiedToken}`)
return verifiedToken
}
module.exports = { sendTeamMemberInvite, sendTeamCreateConfirmation, verifyInviteToken }
+8
View File
@@ -0,0 +1,8 @@
{
"errors": [
{
"code": 401,
"message": "Wait, you're not supposed to be here, go through the gate as everyone else"
}
]
}
+436 -31
View File
@@ -1,5 +1,5 @@
# source: http://localhost:4466
# timestamp: Fri Oct 05 2018 13:16:40 GMT-0700 (Pacific Daylight Time)
# timestamp: Tue Nov 20 2018 09:55:31 GMT-0800 (Pacific Standard Time)
type AggregateFBStatus {
count: Int!
@@ -53,9 +53,15 @@ enum FBKind {
INDICATOR
EXTRACTOR
PLOTTER
Trader
Trading
Indicator
Sensor
Plotter
}
type FBStatus {
type FBStatus implements Node {
id: ID!
status: Status
reason: String
createdAt: DateTime!
@@ -78,6 +84,7 @@ input FBStatusCreateInput {
input FBStatusCreateManyInput {
create: [FBStatusCreateInput!]
connect: [FBStatusWhereUniqueInput!]
}
"""An edge in a connection."""
@@ -90,19 +97,20 @@ type FBStatusEdge {
}
enum FBStatusOrderByInput {
id_ASC
id_DESC
status_ASC
status_DESC
reason_ASC
reason_DESC
createdAt_ASC
createdAt_DESC
id_ASC
id_DESC
updatedAt_ASC
updatedAt_DESC
}
type FBStatusPreviousValues {
id: ID!
status: Status
reason: String
createdAt: DateTime!
@@ -147,6 +155,11 @@ input FBStatusSubscriptionWhereInput {
node: FBStatusWhereInput
}
input FBStatusUpdateDataInput {
status: Status
reason: String
}
input FBStatusUpdateInput {
status: Status
reason: String
@@ -154,6 +167,27 @@ input FBStatusUpdateInput {
input FBStatusUpdateManyInput {
create: [FBStatusCreateInput!]
connect: [FBStatusWhereUniqueInput!]
disconnect: [FBStatusWhereUniqueInput!]
delete: [FBStatusWhereUniqueInput!]
update: [FBStatusUpdateWithWhereUniqueNestedInput!]
upsert: [FBStatusUpsertWithWhereUniqueNestedInput!]
}
input FBStatusUpdateManyMutationInput {
status: Status
reason: String
}
input FBStatusUpdateWithWhereUniqueNestedInput {
where: FBStatusWhereUniqueInput!
data: FBStatusUpdateDataInput!
}
input FBStatusUpsertWithWhereUniqueNestedInput {
where: FBStatusWhereUniqueInput!
update: FBStatusUpdateDataInput!
create: FBStatusCreateInput!
}
input FBStatusWhereInput {
@@ -165,6 +199,46 @@ input FBStatusWhereInput {
"""Logical NOT on all given filters combined by AND."""
NOT: [FBStatusWhereInput!]
id: ID
"""All values that are not equal to given value."""
id_not: ID
"""All values that are contained in given list."""
id_in: [ID!]
"""All values that are not contained in given list."""
id_not_in: [ID!]
"""All values less than the given value."""
id_lt: ID
"""All values less than or equal the given value."""
id_lte: ID
"""All values greater than the given value."""
id_gt: ID
"""All values greater than or equal the given value."""
id_gte: ID
"""All values containing the given string."""
id_contains: ID
"""All values not containing the given string."""
id_not_contains: ID
"""All values starting with the given string."""
id_starts_with: ID
"""All values not starting with the given string."""
id_not_starts_with: ID
"""All values ending with the given string."""
id_ends_with: ID
"""All values not ending with the given string."""
id_not_ends_with: ID
status: Status
"""All values that are not equal to given value."""
@@ -239,6 +313,10 @@ input FBStatusWhereInput {
createdAt_gte: DateTime
}
input FBStatusWhereUniqueInput {
id: ID
}
enum FBType {
BOT
NET
@@ -252,7 +330,7 @@ type FinancialBeings implements Node {
name: String!
slug: String!
avatar: String
team(where: TeamWhereInput): Team
team: Team
status(where: FBStatusWhereInput, orderBy: FBStatusOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [FBStatus!]
updatedAt: DateTime!
createdAt: DateTime!
@@ -380,6 +458,14 @@ input FinancialBeingsUpdateInput {
status: FBStatusUpdateManyInput
}
input FinancialBeingsUpdateManyMutationInput {
type: FBType
kind: FBKind
name: String
slug: String
avatar: String
}
input FinancialBeingsUpdateManyWithoutTeamInput {
create: [FinancialBeingsCreateWithoutTeamInput!]
connect: [FinancialBeingsWhereUniqueInput!]
@@ -730,7 +816,8 @@ type MemberPreviousValues {
createdAt: DateTime!
}
type MemberStatus {
type MemberStatus implements Node {
id: ID!
status: Status
reason: String
createdAt: DateTime!
@@ -753,6 +840,7 @@ input MemberStatusCreateInput {
input MemberStatusCreateManyInput {
create: [MemberStatusCreateInput!]
connect: [MemberStatusWhereUniqueInput!]
}
"""An edge in a connection."""
@@ -765,19 +853,20 @@ type MemberStatusEdge {
}
enum MemberStatusOrderByInput {
id_ASC
id_DESC
status_ASC
status_DESC
reason_ASC
reason_DESC
createdAt_ASC
createdAt_DESC
id_ASC
id_DESC
updatedAt_ASC
updatedAt_DESC
}
type MemberStatusPreviousValues {
id: ID!
status: Status
reason: String
createdAt: DateTime!
@@ -822,6 +911,11 @@ input MemberStatusSubscriptionWhereInput {
node: MemberStatusWhereInput
}
input MemberStatusUpdateDataInput {
status: Status
reason: String
}
input MemberStatusUpdateInput {
status: Status
reason: String
@@ -829,6 +923,27 @@ input MemberStatusUpdateInput {
input MemberStatusUpdateManyInput {
create: [MemberStatusCreateInput!]
connect: [MemberStatusWhereUniqueInput!]
disconnect: [MemberStatusWhereUniqueInput!]
delete: [MemberStatusWhereUniqueInput!]
update: [MemberStatusUpdateWithWhereUniqueNestedInput!]
upsert: [MemberStatusUpsertWithWhereUniqueNestedInput!]
}
input MemberStatusUpdateManyMutationInput {
status: Status
reason: String
}
input MemberStatusUpdateWithWhereUniqueNestedInput {
where: MemberStatusWhereUniqueInput!
data: MemberStatusUpdateDataInput!
}
input MemberStatusUpsertWithWhereUniqueNestedInput {
where: MemberStatusWhereUniqueInput!
update: MemberStatusUpdateDataInput!
create: MemberStatusCreateInput!
}
input MemberStatusWhereInput {
@@ -840,6 +955,46 @@ input MemberStatusWhereInput {
"""Logical NOT on all given filters combined by AND."""
NOT: [MemberStatusWhereInput!]
id: ID
"""All values that are not equal to given value."""
id_not: ID
"""All values that are contained in given list."""
id_in: [ID!]
"""All values that are not contained in given list."""
id_not_in: [ID!]
"""All values less than the given value."""
id_lt: ID
"""All values less than or equal the given value."""
id_lte: ID
"""All values greater than the given value."""
id_gt: ID
"""All values greater than or equal the given value."""
id_gte: ID
"""All values containing the given string."""
id_contains: ID
"""All values not containing the given string."""
id_not_contains: ID
"""All values starting with the given string."""
id_starts_with: ID
"""All values not starting with the given string."""
id_not_starts_with: ID
"""All values ending with the given string."""
id_ends_with: ID
"""All values not ending with the given string."""
id_not_ends_with: ID
status: Status
"""All values that are not equal to given value."""
@@ -914,6 +1069,10 @@ input MemberStatusWhereInput {
createdAt_gte: DateTime
}
input MemberStatusWhereUniqueInput {
id: ID
}
type MemberSubscriptionPayload {
mutation: MutationType!
node: Member
@@ -961,6 +1120,12 @@ input MemberUpdateInput {
status: MemberStatusUpdateManyInput
}
input MemberUpdateManyMutationInput {
alias: String
authId: String
visible: Boolean
}
input MemberUpdateOneWithoutTeamsInput {
create: MemberCreateWithoutTeamsInput
connect: MemberWhereUniqueInput
@@ -1165,27 +1330,42 @@ type Mutation {
updateTeamMembers(data: TeamMembersUpdateInput!, where: TeamMembersWhereUniqueInput!): TeamMembers
updateMember(data: MemberUpdateInput!, where: MemberWhereUniqueInput!): Member
updateFinancialBeings(data: FinancialBeingsUpdateInput!, where: FinancialBeingsWhereUniqueInput!): FinancialBeings
updateTeamProfile(data: TeamProfileUpdateInput!, where: TeamProfileWhereUniqueInput!): TeamProfile
updateWallet(data: WalletUpdateInput!, where: WalletWhereUniqueInput!): Wallet
updateMemberStatus(data: MemberStatusUpdateInput!, where: MemberStatusWhereUniqueInput!): MemberStatus
updateFBStatus(data: FBStatusUpdateInput!, where: FBStatusWhereUniqueInput!): FBStatus
updateTeamMemberStatus(data: TeamMemberStatusUpdateInput!, where: TeamMemberStatusWhereUniqueInput!): TeamMemberStatus
updateTeamStatus(data: TeamStatusUpdateInput!, where: TeamStatusWhereUniqueInput!): TeamStatus
deleteTeam(where: TeamWhereUniqueInput!): Team
deleteTeamMembers(where: TeamMembersWhereUniqueInput!): TeamMembers
deleteMember(where: MemberWhereUniqueInput!): Member
deleteFinancialBeings(where: FinancialBeingsWhereUniqueInput!): FinancialBeings
deleteTeamProfile(where: TeamProfileWhereUniqueInput!): TeamProfile
deleteWallet(where: WalletWhereUniqueInput!): Wallet
deleteMemberStatus(where: MemberStatusWhereUniqueInput!): MemberStatus
deleteFBStatus(where: FBStatusWhereUniqueInput!): FBStatus
deleteTeamMemberStatus(where: TeamMemberStatusWhereUniqueInput!): TeamMemberStatus
deleteTeamStatus(where: TeamStatusWhereUniqueInput!): TeamStatus
upsertTeam(where: TeamWhereUniqueInput!, create: TeamCreateInput!, update: TeamUpdateInput!): Team!
upsertTeamMembers(where: TeamMembersWhereUniqueInput!, create: TeamMembersCreateInput!, update: TeamMembersUpdateInput!): TeamMembers!
upsertMember(where: MemberWhereUniqueInput!, create: MemberCreateInput!, update: MemberUpdateInput!): Member!
upsertFinancialBeings(where: FinancialBeingsWhereUniqueInput!, create: FinancialBeingsCreateInput!, update: FinancialBeingsUpdateInput!): FinancialBeings!
upsertTeamProfile(where: TeamProfileWhereUniqueInput!, create: TeamProfileCreateInput!, update: TeamProfileUpdateInput!): TeamProfile!
upsertWallet(where: WalletWhereUniqueInput!, create: WalletCreateInput!, update: WalletUpdateInput!): Wallet!
upsertMemberStatus(where: MemberStatusWhereUniqueInput!, create: MemberStatusCreateInput!, update: MemberStatusUpdateInput!): MemberStatus!
upsertFBStatus(where: FBStatusWhereUniqueInput!, create: FBStatusCreateInput!, update: FBStatusUpdateInput!): FBStatus!
upsertTeamMemberStatus(where: TeamMemberStatusWhereUniqueInput!, create: TeamMemberStatusCreateInput!, update: TeamMemberStatusUpdateInput!): TeamMemberStatus!
updateManyTeams(data: TeamUpdateInput!, where: TeamWhereInput): BatchPayload!
updateManyTeamMemberses(data: TeamMembersUpdateInput!, where: TeamMembersWhereInput): BatchPayload!
updateManyMembers(data: MemberUpdateInput!, where: MemberWhereInput): BatchPayload!
updateManyFinancialBeingses(data: FinancialBeingsUpdateInput!, where: FinancialBeingsWhereInput): BatchPayload!
updateManyTeamProfiles(data: TeamProfileUpdateInput!, where: TeamProfileWhereInput): BatchPayload!
updateManyWallets(data: WalletUpdateInput!, where: WalletWhereInput): BatchPayload!
updateManyMemberStatuses(data: MemberStatusUpdateInput!, where: MemberStatusWhereInput): BatchPayload!
updateManyFBStatuses(data: FBStatusUpdateInput!, where: FBStatusWhereInput): BatchPayload!
updateManyTeamMemberStatuses(data: TeamMemberStatusUpdateInput!, where: TeamMemberStatusWhereInput): BatchPayload!
updateManyTeamStatuses(data: TeamStatusUpdateInput!, where: TeamStatusWhereInput): BatchPayload!
upsertTeamStatus(where: TeamStatusWhereUniqueInput!, create: TeamStatusCreateInput!, update: TeamStatusUpdateInput!): TeamStatus!
updateManyTeams(data: TeamUpdateManyMutationInput!, where: TeamWhereInput): BatchPayload!
updateManyTeamMemberses(data: TeamMembersUpdateManyMutationInput!, where: TeamMembersWhereInput): BatchPayload!
updateManyMembers(data: MemberUpdateManyMutationInput!, where: MemberWhereInput): BatchPayload!
updateManyFinancialBeingses(data: FinancialBeingsUpdateManyMutationInput!, where: FinancialBeingsWhereInput): BatchPayload!
updateManyTeamProfiles(data: TeamProfileUpdateManyMutationInput!, where: TeamProfileWhereInput): BatchPayload!
updateManyWallets(data: WalletUpdateManyMutationInput!, where: WalletWhereInput): BatchPayload!
updateManyMemberStatuses(data: MemberStatusUpdateManyMutationInput!, where: MemberStatusWhereInput): BatchPayload!
updateManyFBStatuses(data: FBStatusUpdateManyMutationInput!, where: FBStatusWhereInput): BatchPayload!
updateManyTeamMemberStatuses(data: TeamMemberStatusUpdateManyMutationInput!, where: TeamMemberStatusWhereInput): BatchPayload!
updateManyTeamStatuses(data: TeamStatusUpdateManyMutationInput!, where: TeamStatusWhereInput): BatchPayload!
deleteManyTeams(where: TeamWhereInput): BatchPayload!
deleteManyTeamMemberses(where: TeamMembersWhereInput): BatchPayload!
deleteManyMembers(where: MemberWhereInput): BatchPayload!
@@ -1240,7 +1420,12 @@ type Query {
teamMembers(where: TeamMembersWhereUniqueInput!): TeamMembers
member(where: MemberWhereUniqueInput!): Member
financialBeings(where: FinancialBeingsWhereUniqueInput!): FinancialBeings
teamProfile(where: TeamProfileWhereUniqueInput!): TeamProfile
wallet(where: WalletWhereUniqueInput!): Wallet
memberStatus(where: MemberStatusWhereUniqueInput!): MemberStatus
fBStatus(where: FBStatusWhereUniqueInput!): FBStatus
teamMemberStatus(where: TeamMemberStatusWhereUniqueInput!): TeamMemberStatus
teamStatus(where: TeamStatusWhereUniqueInput!): TeamStatus
teamsConnection(where: TeamWhereInput, orderBy: TeamOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): TeamConnection!
teamMembersesConnection(where: TeamMembersWhereInput, orderBy: TeamMembersOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): TeamMembersConnection!
membersConnection(where: MemberWhereInput, orderBy: MemberOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): MemberConnection!
@@ -1290,13 +1475,14 @@ type Team implements Node {
id: ID!
name: String!
slug: String!
profile(where: TeamProfileWhereInput): TeamProfile
profile: TeamProfile
members(where: TeamMembersWhereInput, orderBy: TeamMembersOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [TeamMembers!]
owner: String!
wallet(where: WalletWhereInput): Wallet
wallet: Wallet
fb(where: FinancialBeingsWhereInput, orderBy: FinancialBeingsOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [FinancialBeings!]
status(where: TeamStatusWhereInput, orderBy: TeamStatusOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [TeamStatus!]
createdAt: DateTime!
updatedAt: DateTime!
}
"""A connection to a list of items."""
@@ -1361,8 +1547,8 @@ type TeamEdge {
type TeamMembers implements Node {
id: ID!
member(where: MemberWhereInput): Member
team(where: TeamWhereInput): Team
member: Member
team: Team
role: Role
status(where: TeamMemberStatusWhereInput, orderBy: TeamMemberStatusOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [TeamMemberStatus!]
email: String
@@ -1595,6 +1781,11 @@ input TeamMemberStatusUpdateManyInput {
upsert: [TeamMemberStatusUpsertWithWhereUniqueNestedInput!]
}
input TeamMemberStatusUpdateManyMutationInput {
status: Status
reason: String
}
input TeamMemberStatusUpdateWithWhereUniqueNestedInput {
where: TeamMemberStatusWhereUniqueInput!
data: TeamMemberStatusUpdateDataInput!
@@ -1741,6 +1932,11 @@ input TeamMembersUpdateInput {
status: TeamMemberStatusUpdateManyInput
}
input TeamMembersUpdateManyMutationInput {
role: Role
email: String
}
input TeamMembersUpdateManyWithoutMemberInput {
create: [TeamMembersCreateWithoutMemberInput!]
connect: [TeamMembersWhereUniqueInput!]
@@ -1971,9 +2167,11 @@ type TeamPreviousValues {
slug: String!
owner: String!
createdAt: DateTime!
updatedAt: DateTime!
}
type TeamProfile {
type TeamProfile implements Node {
id: ID!
description: String
motto: String
avatar: String
@@ -2001,6 +2199,7 @@ input TeamProfileCreateInput {
input TeamProfileCreateOneInput {
create: TeamProfileCreateInput
connect: TeamProfileWhereUniqueInput
}
"""An edge in a connection."""
@@ -2013,6 +2212,8 @@ type TeamProfileEdge {
}
enum TeamProfileOrderByInput {
id_ASC
id_DESC
description_ASC
description_DESC
motto_ASC
@@ -2025,11 +2226,10 @@ enum TeamProfileOrderByInput {
updatedAt_DESC
createdAt_ASC
createdAt_DESC
id_ASC
id_DESC
}
type TeamProfilePreviousValues {
id: ID!
description: String
motto: String
avatar: String
@@ -2091,8 +2291,16 @@ input TeamProfileUpdateInput {
banner: String
}
input TeamProfileUpdateManyMutationInput {
description: String
motto: String
avatar: String
banner: String
}
input TeamProfileUpdateOneInput {
create: TeamProfileCreateInput
connect: TeamProfileWhereUniqueInput
disconnect: Boolean
delete: Boolean
update: TeamProfileUpdateDataInput
@@ -2113,6 +2321,46 @@ input TeamProfileWhereInput {
"""Logical NOT on all given filters combined by AND."""
NOT: [TeamProfileWhereInput!]
id: ID
"""All values that are not equal to given value."""
id_not: ID
"""All values that are contained in given list."""
id_in: [ID!]
"""All values that are not contained in given list."""
id_not_in: [ID!]
"""All values less than the given value."""
id_lt: ID
"""All values less than or equal the given value."""
id_lte: ID
"""All values greater than the given value."""
id_gt: ID
"""All values greater than or equal the given value."""
id_gte: ID
"""All values containing the given string."""
id_contains: ID
"""All values not containing the given string."""
id_not_contains: ID
"""All values starting with the given string."""
id_starts_with: ID
"""All values not starting with the given string."""
id_not_starts_with: ID
"""All values ending with the given string."""
id_ends_with: ID
"""All values not ending with the given string."""
id_not_ends_with: ID
description: String
"""All values that are not equal to given value."""
@@ -2319,7 +2567,12 @@ input TeamProfileWhereInput {
createdAt_gte: DateTime
}
type TeamStatus {
input TeamProfileWhereUniqueInput {
id: ID
}
type TeamStatus implements Node {
id: ID!
status: Status
reason: String
createdAt: DateTime!
@@ -2342,6 +2595,7 @@ input TeamStatusCreateInput {
input TeamStatusCreateManyInput {
create: [TeamStatusCreateInput!]
connect: [TeamStatusWhereUniqueInput!]
}
"""An edge in a connection."""
@@ -2354,19 +2608,20 @@ type TeamStatusEdge {
}
enum TeamStatusOrderByInput {
id_ASC
id_DESC
status_ASC
status_DESC
reason_ASC
reason_DESC
createdAt_ASC
createdAt_DESC
id_ASC
id_DESC
updatedAt_ASC
updatedAt_DESC
}
type TeamStatusPreviousValues {
id: ID!
status: Status
reason: String
createdAt: DateTime!
@@ -2411,6 +2666,11 @@ input TeamStatusSubscriptionWhereInput {
node: TeamStatusWhereInput
}
input TeamStatusUpdateDataInput {
status: Status
reason: String
}
input TeamStatusUpdateInput {
status: Status
reason: String
@@ -2418,6 +2678,27 @@ input TeamStatusUpdateInput {
input TeamStatusUpdateManyInput {
create: [TeamStatusCreateInput!]
connect: [TeamStatusWhereUniqueInput!]
disconnect: [TeamStatusWhereUniqueInput!]
delete: [TeamStatusWhereUniqueInput!]
update: [TeamStatusUpdateWithWhereUniqueNestedInput!]
upsert: [TeamStatusUpsertWithWhereUniqueNestedInput!]
}
input TeamStatusUpdateManyMutationInput {
status: Status
reason: String
}
input TeamStatusUpdateWithWhereUniqueNestedInput {
where: TeamStatusWhereUniqueInput!
data: TeamStatusUpdateDataInput!
}
input TeamStatusUpsertWithWhereUniqueNestedInput {
where: TeamStatusWhereUniqueInput!
update: TeamStatusUpdateDataInput!
create: TeamStatusCreateInput!
}
input TeamStatusWhereInput {
@@ -2429,6 +2710,46 @@ input TeamStatusWhereInput {
"""Logical NOT on all given filters combined by AND."""
NOT: [TeamStatusWhereInput!]
id: ID
"""All values that are not equal to given value."""
id_not: ID
"""All values that are contained in given list."""
id_in: [ID!]
"""All values that are not contained in given list."""
id_not_in: [ID!]
"""All values less than the given value."""
id_lt: ID
"""All values less than or equal the given value."""
id_lte: ID
"""All values greater than the given value."""
id_gt: ID
"""All values greater than or equal the given value."""
id_gte: ID
"""All values containing the given string."""
id_contains: ID
"""All values not containing the given string."""
id_not_contains: ID
"""All values starting with the given string."""
id_starts_with: ID
"""All values not starting with the given string."""
id_not_starts_with: ID
"""All values ending with the given string."""
id_ends_with: ID
"""All values not ending with the given string."""
id_not_ends_with: ID
status: Status
"""All values that are not equal to given value."""
@@ -2503,6 +2824,10 @@ input TeamStatusWhereInput {
createdAt_gte: DateTime
}
input TeamStatusWhereUniqueInput {
id: ID
}
type TeamSubscriptionPayload {
mutation: MutationType!
node: Team
@@ -2553,6 +2878,12 @@ input TeamUpdateInput {
status: TeamStatusUpdateManyInput
}
input TeamUpdateManyMutationInput {
name: String
slug: String
owner: String
}
input TeamUpdateOneWithoutFbInput {
create: TeamCreateWithoutFbInput
connect: TeamWhereUniqueInput
@@ -2792,6 +3123,28 @@ input TeamWhereInput {
"""All values greater than or equal the given value."""
createdAt_gte: DateTime
updatedAt: DateTime
"""All values that are not equal to given value."""
updatedAt_not: DateTime
"""All values that are contained in given list."""
updatedAt_in: [DateTime!]
"""All values that are not contained in given list."""
updatedAt_not_in: [DateTime!]
"""All values less than the given value."""
updatedAt_lt: DateTime
"""All values less than or equal the given value."""
updatedAt_lte: DateTime
"""All values greater than the given value."""
updatedAt_gt: DateTime
"""All values greater than or equal the given value."""
updatedAt_gte: DateTime
profile: TeamProfileWhereInput
members_every: TeamMembersWhereInput
members_some: TeamMembersWhereInput
@@ -2811,7 +3164,8 @@ input TeamWhereUniqueInput {
slug: String
}
type Wallet {
type Wallet implements Node {
id: ID!
balance: Float
updatedAt: DateTime!
}
@@ -2832,6 +3186,7 @@ input WalletCreateInput {
input WalletCreateOneInput {
create: WalletCreateInput
connect: WalletWhereUniqueInput
}
"""An edge in a connection."""
@@ -2844,17 +3199,18 @@ type WalletEdge {
}
enum WalletOrderByInput {
id_ASC
id_DESC
balance_ASC
balance_DESC
updatedAt_ASC
updatedAt_DESC
id_ASC
id_DESC
createdAt_ASC
createdAt_DESC
}
type WalletPreviousValues {
id: ID!
balance: Float
updatedAt: DateTime!
}
@@ -2906,8 +3262,13 @@ input WalletUpdateInput {
balance: Float
}
input WalletUpdateManyMutationInput {
balance: Float
}
input WalletUpdateOneInput {
create: WalletCreateInput
connect: WalletWhereUniqueInput
disconnect: Boolean
delete: Boolean
update: WalletUpdateDataInput
@@ -2928,6 +3289,46 @@ input WalletWhereInput {
"""Logical NOT on all given filters combined by AND."""
NOT: [WalletWhereInput!]
id: ID
"""All values that are not equal to given value."""
id_not: ID
"""All values that are contained in given list."""
id_in: [ID!]
"""All values that are not contained in given list."""
id_not_in: [ID!]
"""All values less than the given value."""
id_lt: ID
"""All values less than or equal the given value."""
id_lte: ID
"""All values greater than the given value."""
id_gt: ID
"""All values greater than or equal the given value."""
id_gte: ID
"""All values containing the given string."""
id_contains: ID
"""All values not containing the given string."""
id_not_contains: ID
"""All values starting with the given string."""
id_starts_with: ID
"""All values not starting with the given string."""
id_not_starts_with: ID
"""All values ending with the given string."""
id_ends_with: ID
"""All values not ending with the given string."""
id_not_ends_with: ID
balance: Float
"""All values that are not equal to given value."""
@@ -2973,3 +3374,7 @@ input WalletWhereInput {
"""All values greater than or equal the given value."""
updatedAt_gte: DateTime
}
input WalletWhereUniqueInput {
id: ID
}
+16
View File
@@ -0,0 +1,16 @@
import gql from 'graphql-tag'
const FB_FRAGMENT = gql`{
id
name
slug
avatar
kind
status {
status
reason
createdAt
}
}`
module.exports = FB_FRAGMENT
@@ -0,0 +1,40 @@
import gql from 'graphql-tag'
const FB_TEAM_FRAGMENT = gql`{
edges{
node{
id
name
slug
avatar
kind
status {
status
reason
createdAt
}
team {
id
name
slug
owner
profile {
avatar
banner
description
motto
updatedAt
}
members {
role
email
member {
alias
}
}
}
}
}
}`
module.exports = FB_TEAM_FRAGMENT
@@ -0,0 +1,40 @@
import axios from 'axios'
import { logger, DatabaseError } from '../../../logger'
export const createStrategy = fbSlug => {
logger.info('createStrategy')
logger.info(fbSlug)
return new Promise((resolve, reject) => {
try {
return axios.post(process.env.PLATFORM_API_URL, {
query: `mutation strategizer_CreateStrategy($fbSlug: String!) {
strategizer_CreateStrategy(fbSlug: $fbSlug){
id
}
}`,
variables: {
fbSlug: fbSlug
}
}, {
headers: {
'Content-Type': 'application/json'
}
})
.then(res => {
logger.info('createStrategy result')
logger.info(res.data)
resolve(res.data)
})
.catch(err => {
logger.error('createStrategy err')
logger.error(err)
reject(err)
})
} catch (error) {
reject(error)
}
})
}
export default createStrategy
+52 -19
View File
@@ -2,12 +2,13 @@ import axios from 'axios'
import { ApolloError } from 'apollo-server-express'
import { getUser } from '../../../middleware/getMember'
import { createStrategy } from './createStrategy'
import { sendTeamMemberInvite, sendTeamCreateConfirmation, verifyInviteToken } from '../../../email/sendgrid'
import { notifications_sendTeamCreateConfirmation, notifications_sendTeamMemberInvite, notifications_VerifyTeamMemberInviteToken } from '../notifications/sendgrid'
import TEAMS_CONNECTIONS_FRAGMENT from '../../fragments/TeamsConnectionsFragment'
import TEAMS_FRAGMENT from '../../fragments/TeamsFragment'
import TEAM_FB_FRAGMENT from '../../fragments/TeamFBFragment'
import FB_FRAGMENT from '../../fragments/FBFragment'
import { logger, AuthenticationError, ServiceUnavailableError, DatabaseError, ConflictError } from '../../../logger'
@@ -20,14 +21,14 @@ export const resolvers = {
create:{role:'MEMBER', email:email, team: {connect: {id: teamId}}, status:{create:{status: 'INVITED', reason: `Invited by ${team.members[0].member.alias}`}}},
update:{role: 'MEMBER', email: email, team: {connect: {id: teamId}}, status:{create:{status: 'INVITED', reason: `Invite resent by ${team.members[0].member.alias}`}}}},
`{ id }`)
const sendInvite = await sendTeamMemberInvite(email, team)
const sendInvite = await notifications_sendTeamMemberInvite(email, team)
return sendInvite
},
async verifyTeamInvite(parent, { token }, ctx, info) {
let verifiedToken = null
let team = null
try {
verifiedToken = await verifyInviteToken(token)
verifiedToken = await notifications_VerifyTeamMemberInviteToken(token)
team = {
email: verifiedToken.email,
team: {
@@ -53,18 +54,17 @@ export const resolvers = {
logger.info(JSON.stringify(await userData))
const alias = await userData.data.users_User.alias
const email = await userData.data.users_User.email
const avatar = 'https://aadevelop.blob.core.windows.net/module-teams/module-default/aa-avatar-default.png'
const banner = 'https://aadevelop.blob.core.windows.net/module-teams/module-default/aa-banner-default.png'
const avatar = process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
const banner = process.env.STORAGE_URL + '/module-teams/module-default/aa-banner-default.png'
const createTeamUrl = encodeURI(`${slug}/${name}/${alias}/${botSlug}/${botName}`)
logger.info('createTeamUrl:')
logger.info(JSON.stringify(await createTeamUrl))
const platformUrl = 'https://develop.advancedalgos.net/AABrowserAPI/newTeam/'
// const platformUrl = 'http://localhost:1337/AABrowserAPI/teamSetup/'
const chartsUrl = process.env.CHARTS_URL + '/AABrowserAPI/newTeam/'
logger.info(`${platformUrl}${createTeamUrl}/${authId}`)
const createPlatformTeam = await axios.get(`${platformUrl}${createTeamUrl}/${authId}`)
logger.info(`${chartsUrl}${createTeamUrl}/${authId}`)
const createPlatformTeam = await axios.get(`${chartsUrl}${createTeamUrl}/${authId}/${process.env.AAWEB_TEAM_SHARED_SECRET}`)
.then((result) => {
console.log('createPlatformTeam result:', result.data)
if(result.data.message === 'Team Name already taken'){
@@ -78,7 +78,9 @@ export const resolvers = {
logger.info('createPlatformTeam')
logger.info(await createPlatformTeam)
logger.info('createPlatformTeam Error')
logger.error(await createPlatformTeam.error)
logger.info('createPlatformTeam Code')
logger.error(await createPlatformTeam.code)
// if (await createPlatformTeam.error && await createPlatformTeam.code === 404) throw new ApolloError(await createPlatformTeam.error, 404)
@@ -96,22 +98,54 @@ export const resolvers = {
let createTeam
if(existingMember !== null && existingMember.id !== null){
logger.info('createTeam with existingMember:')
createTeam = await ctx.db.mutation.createTeam({ data: {name: name, slug: slug, owner: authId, members: {create: {member: {connect: {authId: authId}}, role: 'OWNER', status: { create: { status: 'ACTIVE', reason: `Connected to Team ${name}`}}}}, profile: {create: {avatar: avatar, banner: banner}}, fb: {create: {name: botName, slug: botSlug, kind:'TRADER', avatar: avatar, status: {create: {status: 'ACTIVE', reason: "Cloned on team creation"}}}}, status: {create: {status: 'ACTIVE', reason:"Team created"}}} }, TEAMS_FRAGMENT)
createTeam = await ctx.db.mutation.createTeam({ data: {name: name, slug: slug, owner: authId, members: {create: {member: {connect: {authId: authId}}, role: 'OWNER', status: { create: { status: 'ACTIVE', reason: `Connected to Team ${name}`}}}}, profile: {create: {avatar: avatar, banner: banner}}, fb: {create: {name: botName, slug: botSlug, kind:'Trading', avatar: avatar, status: {create: {status: 'ACTIVE', reason: "Cloned on team creation"}}}}, status: {create: {status: 'ACTIVE', reason:"Team created"}}} }, TEAMS_FRAGMENT)
.catch((err) => {
logger.debug(err, 'createTeamMutation error: ')
return new DatabaseError(err)
})
} else {
logger.info('createTeam without existingMember:')
createTeam = await ctx.db.mutation.createTeam({ data: {name: name, slug: slug, owner: authId, members: {create: {member: {create: {authId: authId, alias: alias, visible:'true', status: { create: { status: 'ACTIVE', reason: `Created team ${name}`}}}}, role: 'OWNER', status: { create: { status: 'ACTIVE', reason: `Created with Team ${name}`}}}}, profile: {create: {avatar: avatar, banner: banner}}, fb: {create: {name: botName, slug: botSlug, kind:'TRADER', avatar: avatar, status: {create: {status: 'ACTIVE', reason: "Cloned on team creation"}}}}, status: {create: {status: 'ACTIVE', reason:"Team created"}}} }, TEAMS_FRAGMENT)
createTeam = await ctx.db.mutation.createTeam({ data: {name: name, slug: slug, owner: authId, members: {create: {member: {create: {authId: authId, alias: alias, visible: true, status: { create: { status: 'ACTIVE', reason: `Created team ${name}`}}}}, role: 'OWNER', status: { create: { status: 'ACTIVE', reason: `Created with Team ${name}`}}}}, profile: {create: {avatar: avatar, banner: banner}}, fb: {create: {name: botName, slug: botSlug, kind:'Trading', avatar: avatar, status: {create: {status: 'ACTIVE', reason: "Cloned on team creation"}}}}, status: {create: {status: 'ACTIVE', reason:"Team created"}}} }, TEAMS_FRAGMENT)
.catch((err) => {
logger.debug(err, 'createTeamMutation error: ')
return new DatabaseError(err)
})
}
// sendTeamCreateConfirmation(email, name, botName)
let createFB;
if(createTeam){
createFB = await ctx.db.mutation.createFinancialBeings({ data:{
type:'BOT',
kind:'Indicator',
name:'Simulator ' + botName,
slug:'simulator-' + botSlug,
avatar:avatar,
team: {
connect:{
id:createTeam.id
}
}
}
}, FB_FRAGMENT)
.catch((err) => {
logger.debug(err, 'Error creating the simulator: ')
return new DatabaseError(err)
})
logger.info('createTeam creating simulator success')
logger.info(JSON.stringify(await createFB))
let createdStrategy
if(await createFB){
logger.info('createStrategy:' + 'simulator-' + botSlug)
createdStrategy = await createStrategy('simulator-' + botSlug)
logger.info('createStrategy:')
logger.info(JSON.stringify(await createStrategy))
}
}
/* **temporarily disable team creation confirmation
if(await createTeam && await createFB && await createStrategy){
notifications_sendTeamCreateConfirmation(email, name, botName)
}
*/
return createTeam
},
async updateTeamProfile(parent, { slug, owner, description, motto, avatar, banner }, ctx, info) {
@@ -150,11 +184,10 @@ export const resolvers = {
logger.info('deleteTeamUrl:')
logger.info(JSON.stringify(await deleteTeamUrl))
const platformUrl = 'https://develop.advancedalgos.net/AABrowserAPI/deleteTeam/'
// const platformUrl = 'http://localhost:1337/AABrowserAPI/teamSetup/'
const chartsUrl = process.env.CHARTS_URL + '/AABrowserAPI/deleteTeam/'
logger.info(`${platformUrl}${deleteTeamUrl}/${authId}`)
const deletePlatformTeam = await axios.get(`${platformUrl}${deleteTeamUrl}/${authId}`)
logger.info(`${chartsUrl}${deleteTeamUrl}/${authId}`)
const deletePlatformTeam = await axios.get(`${chartsUrl}${deleteTeamUrl}/${authId}/${process.env.AAWEB_DELETE_TEAM_SHARED_SECRET}`)
.then((result) => {
console.log('deletePlatformTeam result:', result.data)
if(result.data.result === 'Fail'){
@@ -0,0 +1,34 @@
import { logger } from '../../../logger'
import FB_FRAGMENT from '../../fragments/FBFragment'
import FB_TEAM_FRAGMENT from '../../fragments/FBTeamFragment'
import { isDefined, isNull } from '../../../utils'
export const fbByFbId = async (parent, { fbId }, ctx, info) => {
logger.info(`fbByFbId: ${fbId}`)
let FB = await ctx.db.query.financialBeings({where: {id: fbId}}, FB_FRAGMENT)
logger.info(`fbByFbId response: ${JSON.stringify(await FB)}`)
return FB
}
export const fbByFbSlug = async (parent, { fbSlug }, ctx, info) => {
logger.info(`fbByFbSlug: ${fbSlug}`)
let FB = await ctx.db.query.financialBeingses({where: {slug: fbSlug}, first:1}, FB_FRAGMENT)
logger.info(`fbByFbSlug response: ${JSON.stringify(await FB)}`)
return FB[0]
}
export const fbByOwner = async (parent, { fbId, fbSlug }, ctx, info) => {
logger.info('teamsByOwner')
const authId = ctx.request.headers.userid
if (!authId) {
throw new AuthenticationError()
return
}
if ((isDefined(fbId) && !isNull(fbId)) || (isDefined(fbSlug) && !isNull(fbSlug))){
return ctx.db.query.financialBeingsesConnection({where: {AND:[{team:{members_every:{member:{authId: authId}}}},{OR:[{slug:fbSlug},{id:fbId}]}]}}, FB_TEAM_FRAGMENT)
} else {
return ctx.db.query.financialBeingsesConnection({where: {team:{members_every:{member:{authId: authId}}}}}, FB_TEAM_FRAGMENT)
}
}
+28 -4
View File
@@ -5,24 +5,48 @@ import TEAMS_FRAGMENT from '../../fragments/TeamsFragment'
export const teams = async (parent, args, ctx, info) => {
logger.info('teams')
console.log('teams')
return ctx.db.query.teamsConnection({}, TEAMS_CONNECTIONS_FRAGMENT)
}
export const teamsByIds = async (parent, { teamIds }, ctx, info) => {
logger.info('teamsByIds')
logger.info(teamIds)
return ctx.db.query.teams({where: { id_in: teamIds } }, TEAMS_FRAGMENT)
}
export const teamById = async (parent, { teamId }, ctx, info) => {
logger.info('teamById')
logger.info(teamId)
return ctx.db.query.team({ where: { id: teamId } }, info)
return ctx.db.query.team({ where: { id: teamId } }, TEAMS_FRAGMENT)
}
export const teamByName = async (parent, { name }, ctx, info) => {
return ctx.db.query.team({ where: { name: name } }, `{ name }`)
return ctx.db.query.team({ where: { name: name } }, TEAMS_FRAGMENT)
}
export const teamBySlug= async (parent, { slug }, ctx, info) => {
logger.info('teamsBySlug')
logger.info(`slug: ${slug}`)
return ctx.db.query.team({ where: { slug: slug } }, TEAMS_FRAGMENT)
}
export const teamWithRole = async (parent, { teamId, role }, ctx, info) => {
return ctx.db.query.teamsConnection({where: {AND: [{id: teamId},{members_some:{role: role}}]}, first:1}, info)
}
export const teamAuthorization = async (parent, { teamId, role }, ctx, info) => {
const authId = ctx.request.headers.userid
if (!authId) {
throw new AuthenticationError()
return
}
if(role == undefined || role == null){
return ctx.db.query.teamsConnection({where:{ AND:{id:teamId,members_some:{member:{authId:authId}, role_in:['OWNER','ADMIN']}}}, first:1}, info)
} else {
return ctx.db.query.teamsConnection({where:{ AND:{id:teamId,members_some:{member:{authId:authId}, role:role}}}, first:1}, info)
}
}
export const teamsByOwner = async (parent, args, ctx, info) => {
logger.info('teamsByOwner')
const authId = ctx.request.headers.userid
@@ -30,7 +54,7 @@ export const teamsByOwner = async (parent, args, ctx, info) => {
throw new AuthenticationError()
return
}
return ctx.db.query.teams({where: { owner: authId }, orderBy:'updatedAt_DESC'}, TEAMS_FRAGMENT)
return ctx.db.query.teams({where: { owner: authId }, orderBy:'createdAt_DESC'}, TEAMS_FRAGMENT)
}
export const teamsByRole = async (parent, args, ctx, info) => {
@@ -8,7 +8,7 @@ export const fbByTeamMember = async (parent, args, ctx, info) => {
if (!authId) {
throw new AuthenticationError()
}
let teamMemberFB = await ctx.db.query.teams({where: {members_some: {AND: [{member: {authId: authId}}]}}, orderBy: 'updatedAt_DESC'}, TEAM_FB_FRAGMENT)
let teamMemberFB = await ctx.db.query.teams({where: {members_some: {AND: [{member: {authId: authId}}]}}, orderBy: 'createdAt_DESC'}, TEAM_FB_FRAGMENT)
logger.info('fbByTeamMember response: ', await teamMemberFB[0])
return teamMemberFB[0]
}
+9 -2
View File
@@ -1,19 +1,26 @@
import { logger } from '../../../logger'
import { member, owner } from './Member'
import { teams, teamById, teamByName, teamWithRole, teamsByOwner, teamsByRole } from './Team'
import { teams, teamById, teamsByIds, teamByName, teamBySlug, teamWithRole, teamAuthorization, teamsByOwner, teamsByRole } from './Team'
import{ fbByTeamMember } from './TeamMember'
import{ fbByFbId, fbByFbSlug, fbByOwner } from './FinancialBeing'
export const resolvers = {
Query: {
member: (parent, arg, ctx, info) => member(parent, arg, ctx, info),
teams: (parent, arg, ctx, info) => teams(parent, arg, ctx, info),
teamById: (parent, arg, ctx, info) => teamById(parent, arg, ctx, info),
teamsByIds: (parent, arg, ctx, info) => teamsByIds(parent, arg, ctx, info),
teamByName: (parent, arg, ctx, info) => teamByName(parent, arg, ctx, info),
teamBySlug: (parent, arg, ctx, info) => teamBySlug(parent, arg, ctx, info),
teamWithRole: (parent, arg, ctx, info) => teamWithRole(parent, arg, ctx, info),
teamAuthorization: (parent, arg, ctx, info) => teamAuthorization(parent, arg, ctx, info),
teamsByOwner: (parent, arg, ctx, info) => teamsByOwner(parent, arg, ctx, info),
teamsByRole: (parent, arg, ctx, info) => teamsByRole(parent, arg, ctx, info),
owner: (parent, arg, ctx, info) => owner(parent, arg, ctx, info),
fbByTeamMember: (parent, arg, ctx, info) => fbByTeamMember(parent, arg, ctx, info)
fbByTeamMember: (parent, arg, ctx, info) => fbByTeamMember(parent, arg, ctx, info),
fbByOwner: (parent, arg, ctx, info) => fbByOwner(parent, arg, ctx, info),
fbByFbId: (parent, arg, ctx, info) => fbByFbId(parent, arg, ctx, info),
fbByFbSlug: (parent, arg, ctx, info) => fbByFbSlug(parent, arg, ctx, info)
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
import merge from 'lodash.merge'
import merge from 'lodash/merge'
import { resolvers as queryResolvers } from './Query'
import { resolvers as mutationResolvers } from './Mutation'
@@ -0,0 +1,125 @@
var jwt = require('jsonwebtoken')
var axios = require('axios')
import { logger } from '../../../logger'
export const notifications_sendTeamMemberInvite = (email, team) => {
logger.info('notifications_sendTeamMemberInvite')
logger.info(email)
logger.info(teamName)
return new Promise((resolve, reject) => {
try {
return axios.post(process.env.PLATFORM_API_URL, {
query: `mutation notifications_Teams_SendTeamMemberInvite($email:String!, $teamName:String!){
notifications_Teams_SendTeamMemberInvite(email:$email, teamName:$teamName)
}`,
variables: {
email: email,
teamName: team.name
}
}, {
headers: {
'Content-Type': 'application/json'
}
})
.then(res => {
logger.info('sendTeamMemberInvite result')
logger.info(res.data)
resolve(res.data)
})
.catch(err => {
logger.info('sendTeamMemberInvite err')
logger.info(err)
reject(err)
})
} catch (error) {
reject(error)
}
})
}
export const notifications_sendTeamCreateConfirmation = (email, teamName, botName) => {
logger.info('notifications_sendTeamCreateConfirmation')
logger.info(email)
logger.info(teamName)
logger.info(botName)
return new Promise((resolve, reject) => {
try {
return axios.post(process.env.PLATFORM_API_URL, {
query: `mutation notifications_sendTeamCreateConfirmation($email: String!, $teamName: String!, $botName: String!){
notifications_Teams_SendTeamCreateConfirmation(email: $email, teamName: $teamName, botName: $botName)
}`,
variables: {
email: email,
teamName: teamName,
botName: botName
}
}, {
headers: {
'Content-Type': 'application/json'
}
})
.then(res => {
logger.info('sendTeamCreateConfirmation result')
logger.info(res.data)
resolve(res.data)
})
.catch(err => {
logger.info('sendTeamCreateConfirmation err')
logger.info(err)
reject(err)
})
} catch (error) {
reject(error)
}
})
}
export const notifications_VerifyTeamMemberInviteToken = (token) => {
logger.info('notifications_VerifyTeamMemberInviteToken')
logger.info(token)
return new Promise((resolve, reject) => {
try {
return axios.post(process.env.PLATFORM_API_URL, {
query: `mutation notifications_VerifyTeamMemberInviteToken($token: String!){
notifications_Teams_VerifyTeamMemberInviteToken(token: $token)
}`,
variables: {
token: token
}
}, {
headers: {
'Content-Type': 'application/json'
}
})
.then(res => {
logger.info('VerifyTeamMemberInviteToken result')
logger.info(res.data)
resolve(res.data)
})
.catch(err => {
logger.info('VerifyTeamMemberInviteToken err')
logger.info(err)
reject(err)
})
} catch (error) {
reject(error)
}
})
}
const verifyInviteToken = async function(token) {
const API_KEY = process.env.SG_APIKEY
let verifiedToken
try {
verifiedToken = await jwt.verify(token, API_KEY, {maxAge: '7d'})
} catch(err) {
if (err.name === "TokenExpiredError"){
throw new Error ("Error: Token Expired. Please request new invitation or apply to the team again")
} else {
throw new Error (`Error: Token error - ${err.message}`)
}
}
logger.info(`verifyInviteToken: ${verifiedToken}`)
return verifiedToken
}
+11 -5
View File
@@ -1,19 +1,25 @@
# import Query.TeamConnection, Team from "../generated/prisma.graphql"
# import Query.TeamConnection, Query.FinancialBeingsConnection, Team, FinancialBeings from "../generated/prisma.graphql"
directive @isAuthenticated on QUERY | FIELD | MUTATION
directive @hasRole(roles: [String]) on QUERY | FIELD | MUTATION
directive @isOwner(type: String) on QUERY | MUTATION
directive @isOwnerOrHasRole(type: String, roles: [String]) on QUERY | MUTATION
directive @isAuthenticated on QUERY | FIELD | MUTATION | FIELD_DEFINITION
directive @hasRole(roles: [String]) on QUERY | FIELD | MUTATION | FIELD_DEFINITION
directive @isOwner(type: String) on QUERY | MUTATION | FIELD_DEFINITION
directive @isOwnerOrHasRole(type: String, roles: [String]) on QUERY | MUTATION | FIELD_DEFINITION
type Query {
teams: TeamConnection
teamDetails: [Team!]! @isAuthenticated
teamByName(name: String!): Team
teamBySlug(slug: String!): Team
teamById(teamId: String!): Team
teamsByIds(teamIds: [ID!]): [Team]
teamWithRole(teamId: String!, role: String!): Team
teamAuthorization(teamId: String!, role: String): Team
teamsByOwner: [Team!]! @isAuthenticated
teamsByRole: [Team!]! @isAuthenticated
fbByTeamMember: Team @isAuthenticated
fbByOwner(fbId: String, fbSlug: String): FinancialBeingsConnection @isAuthenticated
fbByFbId(fbId: String!): FinancialBeings
fbByFbSlug(fbSlug: String!): FinancialBeings
owner: Member @isAuthenticated
member: Member @isAuthenticated
}
+17 -6
View File
@@ -1,5 +1,5 @@
import '@babel/polyfill'
require('dotenv').config();
require("@babel/register");
require("@babel/polyfill");
import express from 'express'
import createApolloServer from './ApolloServer'
import { formatError } from './errors'
@@ -20,21 +20,32 @@ import { schemaDirectives } from './directives'
import pubsub from './pubsub'
import { logger } from './logger'
import wrongPreshared from './errors/notAllowed.json'
const GRAPHQL_ENDPOINT = '/graphql'
const GRAPHQL_SUBSCRIPTIONS = '/graphql'
const PORT = 4001
const NODE_ENV = 'development'
const PORT = process.env.PORT
const NODE_ENV = process.env.NODE_ENV
const SCHEMA_PATH = process.env.SCHEMA_PATH
const db = new Prisma({
fragmentReplacements: extractFragmentReplacements(resolvers),
typeDefs: 'src/generated/prisma.graphql',
typeDefs: importSchema(SCHEMA_PATH),
endpoint: process.env.PRISMA_ENDPOINT,
secret: process.env.PRISMA_SECRET,
debug: true
debug: false
})
const app = express()
app.post(GRAPHQL_ENDPOINT, (req, res, next) => {
if (req.headers.preshared === process.env.PRESHARED_GATEWAY_KEY) {
next();
} else {
res.send(wrongPreshared);
}
});
app.post(GRAPHQL_ENDPOINT)
const corsOptions = {
+3 -4
View File
@@ -19,10 +19,9 @@ export const getMember = async (req, res, next, db) => {
export const getUser = authId => {
logger.info('getUser MiddleWare')
logger.info(authId)
const API_URL = 'https://app-api.advancedalgos.net/graphql'
return new Promise((resolve, reject) => {
try {
return axios.post(API_URL, {
return axios.post(process.env.PLATFORM_API_URL, {
query: `query users_User($userId: ID!) {
users_User(id: $userId){
id
@@ -46,10 +45,10 @@ export const getUser = authId => {
.catch(err => {
logger.info('getUser err')
logger.info(err)
reject(new DatabaseError(err))
reject(err)
})
} catch (error) {
reject(new DatabaseError(error))
reject(error)
}
})
}
+3
View File
@@ -0,0 +1,3 @@
import moduleAuth from './moduleAuth'
export { moduleAuth }
+13
View File
@@ -0,0 +1,13 @@
import { logger } from '../logger'
export const moduleAuth = async (req, res, next, db) => {
if (req.headers.preshared === process.env.PRESHARED_GATEWAY_KEY) {
logger.info('Module authenticated')
next();
} else {
logger.error('Module authentication error')
res.send(wrongPreshared);
}
}
export default moduleAuth
+69
View File
@@ -0,0 +1,69 @@
export const toLocalTime = (epoch) => {
const localDate = new Date(0);
localDate.setUTCSeconds(epoch);
const options = { year: 'numeric', month: 'long', day: '2-digit' };
return (
`${localDate.toLocaleDateString(options)
} at ${
localDate.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' })}`
);
};
export const temporaryFunction = input => input;
export function isDefined (d) {
return d !== null && typeof d !== 'undefined'
}
export function isNull (d) {
return d === null
}
export const isArray = Array.isArray
export function isObject (d) {
return isDefined(d) && typeof d === 'object' && !Array.isArray(d)
}
export function isEmpty (obj) {
for (var key in obj) {
if (obj.hasOwnProperty(key)) return false
}
return true
}
export function validObject (object, ...keys) {
return keys.reduce((a, b) => (a || { })[b], object) !== undefined
}
export function mergeDeep (target, ...sources) {
if (!sources.length) return target
const source = sources.shift()
if (isObject(target) && isObject(source)) {
for (const key in source) {
if (isObject(source[key])) {
if (!target[key]) Object.assign(target, { [key]: {} })
mergeDeep(target[key], source[key])
} else {
Object.assign(target, { [key]: source[key] })
}
}
}
return mergeDeep(target, ...sources)
}
export function slugify (string) {
const a = 'àáäâãåèéëêìíïîòóöôùúüûñçßÿœæŕśńṕẃǵǹḿǘẍźḧ·/_,:;'
const b = 'aaaaaaeeeeiiiioooouuuuncsyoarsnpwgnmuxzh------'
const p = new RegExp(a.split('').join('|'), 'g')
return string.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w-]+/g, '') // Remove all non-word characters
.replace(/--+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, '') // Trim - from end of text
}
+46
View File
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at feedback at advancedalgos dot org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
+45
View File
@@ -0,0 +1,45 @@
# Contributing
We are thrilled you are interested in contributing to this repository. Your help may be essential to the project's success and we want you in!
Advanced Algos LTD is a startup, currently at a very early stage. Although this repository is not open source software yet, we do welcome contributions from the community.
Contributions are deemed _voluntary work_. There might be incentives in place for certain kinds of contributions. Contact us for more information in this regards.
In any case, contributors agree to provide an express grant of patent rights for their contributions. Submitting Pull Requests to this repository represents an express agreement with the terms of our Balanced Contributor Intellectual Property Agreement. This agreement is a direct implementation of GitHub's [Balanced Employee Intellectual Property Agreement 1.0.1](https://github.com/github/balanced-employee-ip-agreement/blob/master/Balanced_Employee_IP_Agreement.md).
# Balanced Contributor Intellectual Property Agreement 1.0.1
This BALANCED CONTRIBUTOR INTELLECTUAL PROPERTY AGREEMENT is between person or team submitting Pull Requests to this repository and Advanced Algos LTD ("Company").
**What is this?** This is the Company's Intellectual Property Agreement ("Agreement"). If you've worked in the technology space before, there's a good chance that you've run across one or more of these in the past. This document is the official, entire and exclusive agreement on what intellectual property ("IP") is yours, and what belongs to the Company.
**Why is this?** The Company needs to be clear on what IP it owns and has rights to. Its customers, contributors, and investors depend on the Company having the legal rights to the products and services it is providing so that the Company can continue operating and doing business.
The Company also believes that it's important to be clear on what it doesn't own. The Company doesn't want you looking over your shoulder every time you work on something personal or worrying that the Company will someday seize your open source non-lethal mousetrap simulation software. In other words, the Company isn't interested in appropriating your personal projects.
**Read this.** Please read this document and be sure you understand it before you submit any Pull Requests. Due to legal risk and corporate obligations, the Company cannot, by and large, negotiate its terms. If you feel you have a particular circumstance that keeps you from signing, please let the Company's legal department ("Legal") know. And, of course, you're always free and encouraged to get your own legal counsel to explain anything you're not clear on.
Cool? Then, by submitting your first Pull Request, and as a condition of your contribution, you agree to the following:
1. **What the Company owns.** The Company owns any IP ("Company IP") that you create, or help create _as its contributor_, but only if it meets one or more of these additional conditions: The IP was (i) related to an existing or prospective Company product or service at the time you developed, invented, or created it, (ii) developed for use by the Company, or (iii) developed or promoted with existing Company IP or with the Company's endorsement. You hereby grant and assign, and will grant and assign, to the Company all rights and interests in all Company IP.
"Company IP" includes concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, and works of authorship.
2. **What the Company doesn't own.** If you create IP that doesn't fit into one of the categories listed above, the Company doesn't own it. In other words, the Company doesn't own concepts, designs, developments, discoveries, ideas, improvements, inventions, trade secrets, trademarks, or works of authorship that you develop, invent, or create that do not meet any of the conditions in Section 1.
3. **Contribution of your IP to Company projects.** If you include your own IP – such as IP you created prior to working for the Company – into a Company product or service, it's still yours, of course, but you grant the Company a non-exclusive, irrevocable, fully paid-up, royalty-free, perpetual, sublicensable, transferable, worldwide license to use it without restriction in any way or implementation, in modified form, or as is, by itself, or incorporated into another product or service ("License"). If you include your name in any project over which the Company would have rights under this Agreement, such as in a copyright notice or a comment in code or documentation, then the License covers the rights associated with that use of your name as well.
4. **Your contributions to non-Company projects.** The Company recognizes that you may be engaged in work that requires you to submit IP to entities other than the Company, such as open source projects used by the Company. Please make sure that Legal is aware of what you're working on so that Legal can help with any licensing issues. If any project asks you to sign a contribution agreement, you should check with Legal before doing so. These agreements may be legally binding on the Company and so should be run through Legal first.
5. **Voluntary Works** All Company IP that you are involved with or create as part of your work for the Company is voluntary work which does not require compensation. There might be incentives in place for certain kinds of contributions. Feel free to contact the Company to learn more.
6. **No conflicts.** You agree that you don't have any outstanding agreements or obligations that conflict with those in this Agreement, and that you won't enter into conflicting agreements in the future.
7. **IP protection.** The Company might someday need to show the work that went into the development of IP that it uses or has used, or to make government filings to establish that it owns the IP or has rights over it. To help in those situations, you agree not to destroy any records you maintain relating to the development of any Company IP or IP under License (together, "All IP"), and, if the Company asks, to provide those records to the Company. You agree to help the Company secure and defend its rights in All IP. For your help the Company will compensate you at a reasonable rate. If the Company is unable to secure your help, you authorize the Company to act on your behalf (as your agent and attorney-in-fact) in securing all rights related to All IP.
8. **Confidentiality.** As an contributor or contractor of the Company, you will have access to sensitive confidential information that is important to the Company's business. You are responsible for keeping this information confidential, including after you end your work for the Company.
"Confidential Information" includes non-public technical details about our products or services, financial information, business strategies and forecasts, customer data, or any other information, data or know-how that is valuable to the Company because it is not publicly known.
The Company's Confidential Information is sensitive and we expect that you'll treat it as such. You agree to only use the Company's Confidential Information for the purpose of performing your contribution and for the benefit of the Company. You will do your best to keep Confidential Information secret. If you are not sure if something is Confidential Information, you should assume that it is, until you can confirm otherwise.
+201
View 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.
+5 -56
View File
@@ -1,10 +1,8 @@
# Advance Algos Team Client-side Application
# Superalgos Team Client-side Application
This is the Advanced Algos Team Module client-side web app a.k.a. single-page-application (SPA). We use Webpack 4 + Docker to develop locally, then build to a distribution bundle that can then be uploaded via FTP, git or used with a continuous integration workflow.
This is the Superalgos Team Module client-side web app a.k.a. single-page-application (SPA). We use Webpack 4 + Docker to develop locally, then build to a distribution bundle that can then be uploaded via FTP, git or used with a continuous integration workflow.
This webapp's server-side component is the [aateam-api package](../aateam-api#README).
For more information on the general architecture and related technology of this module, please visit this repos [main documenation](../../docs#README).
This webapp's server-side component is the [apit directory](../api#README).
## Getting Started
@@ -51,58 +49,9 @@ To stop service
docker-compose down
```
## Overview
The development architecture of the Algobots Community site is to allow both rapid initial development and ongoing rapid-evolution. As with any opinionated workflow, there's a learning curve, but the libraries and architecture of this application have been chosen to maximize collaboration, flexibility, and extensibility.
### Main Libraries
- [*Webpack 4*](https://webpack.js.org/):web application bundler. Allows us to us latest newer JS ECMA features that increase productivity and code clarity. Also allows additional libraries such as modular and programmable CSS via SASS/SCSS/LESS. Provides webserver for local development.
- [*Bulma CSS Framework*](https://bulma.io/documentation/): Bulma is a highly-customizable CSS-only framework allowing us to quickly prototype the layout of a webapp without being complicated by opinionated functionality represented in libraries such as Bootstrap or Material UI. Grants us the flexibility to create a custom look at top speed whilst minimizing baggage.
- [*HyperApp*](https://github.com/hyperapp/hyperapp): Allows a controlled Flux-styled approach to state-management and data-flow through components like React minus the excess boilerplate and learning curve.
- [*React*](https://reactjs.org/): A JavaScript library for building user interfaces.
- [*Material UI*](https://material-ui.com/): React components that implement Google's Material Design.
- [*Docker*](https://www.docker.com/what-docker)
### File organization
```
. # Top level directory located at your choice
├── src
│ ├── actions # Actions are functions that change the app state
│ ├── assets # images, logos and other static assets
│ ├── state # Schema of state — the single source of truth concerning app state.
│ ├── styles # SASS/SCSS styles
│ ├── utils # Local storage and other utils
│ └── views # Main folder for editing site content
│ ├─ nav # Nav components — header, footer, etc.
│ ├─ pages # Nav components — header, footer, etc.
│ │ ├─ landing # Homepage
│ │ │ ├─ sections # Homepage sections. Collated in its own index.js
│ │ │ └─ index.js # Main homepage component. Pulls in sections
│ │ └─ ... # Other page/component folders
│ └─ index.js # Main view container. Main router
├── html
│ └── index.html # index.html template pulled in by Webpack to attach transpiled bundles
├── index.js # JS entry point to website
│
├── tools # utility scripts, mostly for webpack configuration
│
├── node_modules # created by running `npm install` in this packages root dir
├── dist # created by `npm run develop` - a cache of bundled files served by Webpack for local development
└── build # created by `npm run build` - location of deployable production bundle
```
## Deployment
The simplest deployment is compiling/transpiling the site to a distribution bundle and then uploading the files in the bundle to a web-accessible folder or storage.
For this application we use Webpack to transpile the application which combines and minimizes all code and assets into an optimized bundle without and of the development code and resources.
To build, run:
```
npm run build
```
Looking in this packages directory, there should be a ./build directory with the final built files that can be uploaded.
### Deployment instructions
Coming soon...
+1841 -1345
View File
File diff suppressed because it is too large. Load diff
+19 -18
View File
@@ -1,7 +1,10 @@
{
"name": "@advancedalgos/teams-client",
"version": "0.0.24",
"description": "Advanced Algos Team client-side web app",
"name": "@superalgos/teams-client",
"version": "0.0.37",
"description": "Superalgos Project Team client-side web app",
"author": "Barry Low <bearcanrun@gmail.com>",
"license": "Apache-2.0",
"repository": "https://github.com/Superalgos/TeamsModule.git",
"main": "src/index.js",
"scripts": {
"dev": "NODE_ENV=development PORT=3001 webpack-serve --config ./webpack.config.js",
@@ -14,15 +17,12 @@
"apollo",
"graphql"
],
"repository": "",
"author": "Barry Low <bearcanrun@gmail.com>",
"license": "AGPL-3.0",
"devDependencies": {
"@babel/cli": "^7.1.2",
"@babel/core": "^7.1.2",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/core": "^7.4.0",
"@babel/plugin-proposal-class-properties": "^7.4.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-env": "^7.4.2",
"@babel/preset-react": "^7.0.0",
"autoprefixer": "^8.6.5",
"babel-core": "^7.0.0-bridge.0",
@@ -34,7 +34,7 @@
"babel-plugin-transform-react-jsx": "^6.24.1",
"connect-history-api-fallback": "^1.5.0",
"css-loader": "^0.28.11",
"eslint": "^5.6.1",
"eslint": "^5.15.3",
"eslint-config-prettier": "^3.1.0",
"eslint-config-standard": "^12.0.0",
"eslint-config-standard-react": "^7.0.2",
@@ -49,7 +49,7 @@
"html-webpack-plugin": "^3.2.0",
"koa-connect": "^2.0.1",
"mini-css-extract-plugin": "^0.4.4",
"node-sass": "^4.9.3",
"node-sass": "^4.12.0",
"optimize-css-assets-webpack-plugin": "^4.0.3",
"postcss-loader": "^2.1.6",
"prettier": "^1.14.3",
@@ -60,7 +60,7 @@
"style-loader": "^0.21.0",
"uglifyjs-webpack-plugin": "^1.3.0",
"webpack": "^4.20.2",
"webpack-bundle-analyzer": "^3.0.2",
"webpack-bundle-analyzer": "^3.3.2",
"webpack-cli": "^3.1.2",
"webpack-hot-client": "^4.1.1",
"webpack-merge": "^4.1.4",
@@ -69,8 +69,8 @@
"workbox-cli": "^3.6.2"
},
"dependencies": {
"@advancedalgos/web-components": "0.0.13",
"@azure/storage-blob": "^10.0.0-preview",
"@superalgos/web-components": "0.0.20",
"apollo-cache-inmemory": "^1.3.5",
"apollo-client": "^2.4.2",
"apollo-link": "^1.2.3",
@@ -85,21 +85,22 @@
"classnames": "^2.2.6",
"cross-fetch": "^2.2.2",
"dotenv-webpack": "^1.5.7",
"graphql": "^14.0.2",
"graphql": "^14.2.1",
"graphql-tag": "^2.10.0",
"minilog": "^3.1.0",
"prop-types": "^15.6.2",
"query-string": "^6.2.0",
"react": "^16.5.2",
"react": "^16.8.4",
"react-apollo": "^2.2.4",
"react-dom": "^16.5.2",
"react-dom": "^16.8.4",
"react-router-dom": "^4.3.1",
"recompose": "^0.30.0",
"subscriptions-transport-ws": "^0.9.15"
},
"peerDependencies": {
"@material-ui/core": "^3.2.0",
"@material-ui/icons": "^3.0.1"
"@material-ui/core": "^3.6.2",
"@material-ui/icons": "^3.0.1",
"ajv": "^6.10.0"
},
"standard": {
"parser": "babel-eslint",
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 96"><defs><style>.cls-1{fill:#fff;}.cls-2{fill:#e3493c;}</style></defs><title>Superalgos-logo-horz-dark</title><g id="Layer_4" data-name="Layer 4"><path class="cls-1" d="M105.33,66.86a30.85,30.85,0,0,1-3.58-.6V61.84a49.59,49.59,0,0,0,5.92.42,11.06,11.06,0,0,0,2.47-.21,2.63,2.63,0,0,0,1.37-.78,3.4,3.4,0,0,0,.65-1.64,17.68,17.68,0,0,0,.18-2.83,24.15,24.15,0,0,0-.18-3.61,2.16,2.16,0,0,0-.8-1.45,6.77,6.77,0,0,0-2.24-.81l-4.41-.88a3.53,3.53,0,0,1-2.78-2.62,23,23,0,0,1-.7-6.57,16.26,16.26,0,0,1,1-6.24,6,6,0,0,1,2.86-3.17,11.16,11.16,0,0,1,4.91-.93,25.48,25.48,0,0,1,4,.28c1.19.2,2,.36,2.57.5v4.46a17,17,0,0,0-2.08-.28c-1-.09-2-.13-3-.13a11.47,11.47,0,0,0-2.78.26,2.19,2.19,0,0,0-1.37.93,3.69,3.69,0,0,0-.63,1.59,17.44,17.44,0,0,0-.15,2.57,20.72,20.72,0,0,0,.15,3,2.29,2.29,0,0,0,.6,1.3,3.23,3.23,0,0,0,1.48.59l3.9.83a7.33,7.33,0,0,1,2.78,1.15,4.9,4.9,0,0,1,1.63,2.59,19.4,19.4,0,0,1,.57,5.77,21.38,21.38,0,0,1-.85,6.83,5.84,5.84,0,0,1-2.68,3.38,10.64,10.64,0,0,1-4.93,1A36.1,36.1,0,0,1,105.33,66.86Z"/><path class="cls-1" d="M143.91,30.93V51a72.1,72.1,0,0,1-.5,10.12,6.77,6.77,0,0,1-2.31,4.52q-1.82,1.41-6,1.41t-6-1.41a6.68,6.68,0,0,1-2.29-4.49A77.15,77.15,0,0,1,126.3,51V30.93h5.3V53.27c0,2.91.06,4.93.18,6.08a3.46,3.46,0,0,0,.88,2.31,3.76,3.76,0,0,0,2.42.6,3.83,3.83,0,0,0,2.46-.6,3.51,3.51,0,0,0,.89-2.31c.12-1.15.18-3.17.18-6.08V30.93Z"/><path class="cls-1" d="M153.51,30.93h9.19a8.12,8.12,0,0,1,5.15,1.38,6.6,6.6,0,0,1,2.26,3.82,31.56,31.56,0,0,1,.54,6.54,31.4,31.4,0,0,1-.52,6.39,6.7,6.7,0,0,1-2.26,3.9,7.89,7.89,0,0,1-5.17,1.45h-3.89V66.67h-5.3Zm8.36,18.71a3.57,3.57,0,0,0,2.32-.6,3.32,3.32,0,0,0,.93-2,28.88,28.88,0,0,0,.23-4.37,28.19,28.19,0,0,0-.23-4.33,3.29,3.29,0,0,0-.93-2,3.63,3.63,0,0,0-2.32-.6h-3.06V49.64Z"/><path class="cls-1" d="M179.28,66.67V30.93h14.07v4.83h-8.73V46.21h7.64V51h-7.64v10.8h8.73v4.83Z"/><path class="cls-1" d="M214.78,66.67l-3.27-13.29h-4V66.67h-5.29V30.93h9.4a8.5,8.5,0,0,1,5.14,1.3A6.17,6.17,0,0,1,219,35.89a29.17,29.17,0,0,1,.55,6.27,26.68,26.68,0,0,1-.63,6.44,5.71,5.71,0,0,1-2.59,3.63l3.89,14.44Zm-1.69-18.54a3,3,0,0,0,.93-1.87,24.61,24.61,0,0,0,.24-4,24.07,24.07,0,0,0-.24-4,2.87,2.87,0,0,0-1-1.87,3.67,3.67,0,0,0-2.28-.58H207.5V48.7h3.28A3.69,3.69,0,0,0,213.09,48.13Z"/><path class="cls-2" d="M243.19,66.67l-1.51-8.57h-7l-1.46,8.57H228l6.44-35.74h7.68l6.45,35.74Zm-4.84-29.92H238l-2.75,16.63h5.82Z"/><path class="cls-2" d="M257,66.67V30.93h5.35V61.79h7.84v4.88Z"/><path class="cls-2" d="M286.87,51.4V46.73H295V66.05a22.89,22.89,0,0,1-3.64.75,30.25,30.25,0,0,1-4,.29q-4.05,0-6-1.43t-2.76-5.25a63.23,63.23,0,0,1-.77-11.61,60.57,60.57,0,0,1,.8-11.58q.81-3.8,2.88-5.25c1.39-1,3.5-1.45,6.34-1.45a26,26,0,0,1,3.66.28,27.48,27.48,0,0,1,3.46.71V36c-1-.17-2.05-.32-3.12-.44a23.88,23.88,0,0,0-2.44-.18,9.28,9.28,0,0,0-4.24.68c-.77.44-1.32,1.56-1.63,3.35A63.63,63.63,0,0,0,283,48.8q0,6.35.29,9a6.46,6.46,0,0,0,1.17,3.64,3.93,3.93,0,0,0,3,.93,10.23,10.23,0,0,0,2.7-.31V51.4Z"/><path class="cls-2" d="M306.66,65.58q-1.91-1.5-2.39-5a95.6,95.6,0,0,1-.5-11.74,95.52,95.52,0,0,1,.5-11.73,7.43,7.43,0,0,1,2.39-5q1.89-1.5,6.26-1.5t6.31,1.5a7.52,7.52,0,0,1,2.39,5,98.19,98.19,0,0,1,.49,11.73,98.27,98.27,0,0,1-.49,11.74q-.5,3.54-2.39,5t-6.31,1.51Q308.55,67.09,306.66,65.58Zm8.9-4c.49-.45.82-1.56,1-3.32s.26-4.92.26-9.46-.09-7.69-.26-9.45-.5-2.88-1-3.32a3.9,3.9,0,0,0-2.64-.68,3.83,3.83,0,0,0-2.63.68c-.47.44-.79,1.55-1,3.32s-.26,4.92-.26,9.45.09,7.69.26,9.46.49,2.87,1,3.32a3.83,3.83,0,0,0,2.63.68A3.9,3.9,0,0,0,315.56,61.58Z"/><path class="cls-2" d="M334.69,66.86a30.48,30.48,0,0,1-3.58-.6V61.84a49.59,49.59,0,0,0,5.92.42,11,11,0,0,0,2.46-.21,2.66,2.66,0,0,0,1.38-.78,3.5,3.5,0,0,0,.65-1.64,17.68,17.68,0,0,0,.18-2.83,24.15,24.15,0,0,0-.18-3.61,2.13,2.13,0,0,0-.81-1.45,6.69,6.69,0,0,0-2.23-.81l-4.41-.88a3.51,3.51,0,0,1-2.78-2.62,23,23,0,0,1-.7-6.57,16.26,16.26,0,0,1,1-6.24,6,6,0,0,1,2.85-3.17,11.19,11.19,0,0,1,4.91-.93,25.52,25.52,0,0,1,4,.28c1.19.2,2,.36,2.57.5v4.46a17,17,0,0,0-2.08-.28c-1-.09-2-.13-3-.13a11.47,11.47,0,0,0-2.78.26,2.24,2.24,0,0,0-1.38.93,3.56,3.56,0,0,0-.62,1.59,17.23,17.23,0,0,0-.16,2.57,20.35,20.35,0,0,0,.16,3,2.17,2.17,0,0,0,.6,1.3,3.19,3.19,0,0,0,1.48.59l3.89.83a7.26,7.26,0,0,1,2.78,1.15,4.91,4.91,0,0,1,1.64,2.59,19.4,19.4,0,0,1,.57,5.77,21.33,21.33,0,0,1-.86,6.83,5.79,5.79,0,0,1-2.67,3.38,10.66,10.66,0,0,1-4.94,1A35.92,35.92,0,0,1,334.69,66.86Z"/><path class="cls-2" d="M46.72,59c1.23-.38,9.08.88,10.13,1.62,3.3,2.33,8.14,3.58,10.08,1.2s-.09-6.47-3.19-9.59c-.92-.94-3.89-8.18-3.75-9.47.44-4.09-.9-9-3.94-9.46s-5.91,3.86-6.64,7.56c-.25,1.29-5.32,7.5-6.48,8-3.67,1.7-7.14,5.24-6,8.11S43.15,60.05,46.72,59Z"/><path class="cls-2" d="M60.38,16.76c4.93.21,7,10.25,6.21,18.12-.25,2.5,5.56,16.57,6.58,18.88A7.82,7.82,0,0,0,76.37,57C72.61,46.77,72.28,38.6,73,36.69c3.21-8.85,1.8-20.77-3-23.53-3.25-1.87-10.33-2.62-14.85,4.8A7.33,7.33,0,0,1,60.38,16.76Z"/><path class="cls-2" d="M20.91,59.57c-2.28-4.39,5.38-11.2,12.6-14.45C35.8,44.09,45.07,32,46.57,30a7.77,7.77,0,0,0,1.17-4.37c-7,8.35-13.86,Line truncated

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 96"><defs><style>.cls-1{fill:#4d4d4d;}.cls-2{fill:#e3493c;}</style></defs><title>Superalgos-logo-horz</title><g id="Layer_4" data-name="Layer 4"><path class="cls-1" d="M105.33,66.86a30.85,30.85,0,0,1-3.58-.6V61.84a49.59,49.59,0,0,0,5.92.42,11.06,11.06,0,0,0,2.47-.21,2.63,2.63,0,0,0,1.37-.78,3.4,3.4,0,0,0,.65-1.64,17.68,17.68,0,0,0,.18-2.83,24.15,24.15,0,0,0-.18-3.61,2.16,2.16,0,0,0-.8-1.45,6.77,6.77,0,0,0-2.24-.81l-4.41-.88a3.53,3.53,0,0,1-2.78-2.62,23,23,0,0,1-.7-6.57,16.26,16.26,0,0,1,1-6.24,6,6,0,0,1,2.86-3.17,11.16,11.16,0,0,1,4.91-.93,25.48,25.48,0,0,1,4,.28c1.19.2,2,.36,2.57.5v4.46a17,17,0,0,0-2.08-.28c-1-.09-2-.13-3-.13a11.47,11.47,0,0,0-2.78.26,2.19,2.19,0,0,0-1.37.93,3.69,3.69,0,0,0-.63,1.59,17.44,17.44,0,0,0-.15,2.57,20.72,20.72,0,0,0,.15,3,2.29,2.29,0,0,0,.6,1.3,3.23,3.23,0,0,0,1.48.59l3.9.83a7.33,7.33,0,0,1,2.78,1.15,4.9,4.9,0,0,1,1.63,2.59,19.4,19.4,0,0,1,.57,5.77,21.38,21.38,0,0,1-.85,6.83,5.84,5.84,0,0,1-2.68,3.38,10.64,10.64,0,0,1-4.93,1A36.1,36.1,0,0,1,105.33,66.86Z"/><path class="cls-1" d="M143.91,30.93V51a72.1,72.1,0,0,1-.5,10.12,6.77,6.77,0,0,1-2.31,4.52q-1.82,1.41-6,1.41t-6-1.41a6.68,6.68,0,0,1-2.29-4.49A77.15,77.15,0,0,1,126.3,51V30.93h5.3V53.27c0,2.91.06,4.93.18,6.08a3.46,3.46,0,0,0,.88,2.31,3.76,3.76,0,0,0,2.42.6,3.83,3.83,0,0,0,2.46-.6,3.51,3.51,0,0,0,.89-2.31c.12-1.15.18-3.17.18-6.08V30.93Z"/><path class="cls-1" d="M153.51,30.93h9.19a8.12,8.12,0,0,1,5.15,1.38,6.6,6.6,0,0,1,2.26,3.82,31.56,31.56,0,0,1,.54,6.54,31.4,31.4,0,0,1-.52,6.39,6.7,6.7,0,0,1-2.26,3.9,7.89,7.89,0,0,1-5.17,1.45h-3.89V66.67h-5.3Zm8.36,18.71a3.57,3.57,0,0,0,2.32-.6,3.32,3.32,0,0,0,.93-2,28.88,28.88,0,0,0,.23-4.37,28.19,28.19,0,0,0-.23-4.33,3.29,3.29,0,0,0-.93-2,3.63,3.63,0,0,0-2.32-.6h-3.06V49.64Z"/><path class="cls-1" d="M179.28,66.67V30.93h14.07v4.83h-8.73V46.21h7.64V51h-7.64v10.8h8.73v4.83Z"/><path class="cls-1" d="M214.78,66.67l-3.27-13.29h-4V66.67h-5.29V30.93h9.4a8.5,8.5,0,0,1,5.14,1.3A6.17,6.17,0,0,1,219,35.89a29.17,29.17,0,0,1,.55,6.27,26.68,26.68,0,0,1-.63,6.44,5.71,5.71,0,0,1-2.59,3.63l3.89,14.44Zm-1.69-18.54a3,3,0,0,0,.93-1.87,24.61,24.61,0,0,0,.24-4,24.07,24.07,0,0,0-.24-4,2.87,2.87,0,0,0-1-1.87,3.67,3.67,0,0,0-2.28-.58H207.5V48.7h3.28A3.69,3.69,0,0,0,213.09,48.13Z"/><path class="cls-2" d="M243.19,66.67l-1.51-8.57h-7l-1.46,8.57H228l6.44-35.74h7.68l6.45,35.74Zm-4.84-29.92H238l-2.75,16.63h5.82Z"/><path class="cls-2" d="M257,66.67V30.93h5.35V61.79h7.84v4.88Z"/><path class="cls-2" d="M286.87,51.4V46.73H295V66.05a22.89,22.89,0,0,1-3.64.75,30.25,30.25,0,0,1-4,.29q-4.05,0-6-1.43t-2.76-5.25a63.23,63.23,0,0,1-.77-11.61,60.57,60.57,0,0,1,.8-11.58q.81-3.8,2.88-5.25c1.39-1,3.5-1.45,6.34-1.45a26,26,0,0,1,3.66.28,27.48,27.48,0,0,1,3.46.71V36c-1-.17-2.05-.32-3.12-.44a23.88,23.88,0,0,0-2.44-.18,9.28,9.28,0,0,0-4.24.68c-.77.44-1.32,1.56-1.63,3.35A63.63,63.63,0,0,0,283,48.8q0,6.35.29,9a6.46,6.46,0,0,0,1.17,3.64,3.93,3.93,0,0,0,3,.93,10.23,10.23,0,0,0,2.7-.31V51.4Z"/><path class="cls-2" d="M306.66,65.58q-1.91-1.5-2.39-5a95.6,95.6,0,0,1-.5-11.74,95.52,95.52,0,0,1,.5-11.73,7.43,7.43,0,0,1,2.39-5q1.89-1.5,6.26-1.5t6.31,1.5a7.52,7.52,0,0,1,2.39,5,98.19,98.19,0,0,1,.49,11.73,98.27,98.27,0,0,1-.49,11.74q-.5,3.54-2.39,5t-6.31,1.51Q308.55,67.09,306.66,65.58Zm8.9-4c.49-.45.82-1.56,1-3.32s.26-4.92.26-9.46-.09-7.69-.26-9.45-.5-2.88-1-3.32a3.9,3.9,0,0,0-2.64-.68,3.83,3.83,0,0,0-2.63.68c-.47.44-.79,1.55-1,3.32s-.26,4.92-.26,9.45.09,7.69.26,9.46.49,2.87,1,3.32a3.83,3.83,0,0,0,2.63.68A3.9,3.9,0,0,0,315.56,61.58Z"/><path class="cls-2" d="M334.69,66.86a30.48,30.48,0,0,1-3.58-.6V61.84a49.59,49.59,0,0,0,5.92.42,11,11,0,0,0,2.46-.21,2.66,2.66,0,0,0,1.38-.78,3.5,3.5,0,0,0,.65-1.64,17.68,17.68,0,0,0,.18-2.83,24.15,24.15,0,0,0-.18-3.61,2.13,2.13,0,0,0-.81-1.45,6.69,6.69,0,0,0-2.23-.81l-4.41-.88a3.51,3.51,0,0,1-2.78-2.62,23,23,0,0,1-.7-6.57,16.26,16.26,0,0,1,1-6.24,6,6,0,0,1,2.85-3.17,11.19,11.19,0,0,1,4.91-.93,25.52,25.52,0,0,1,4,.28c1.19.2,2,.36,2.57.5v4.46a17,17,0,0,0-2.08-.28c-1-.09-2-.13-3-.13a11.47,11.47,0,0,0-2.78.26,2.24,2.24,0,0,0-1.38.93,3.56,3.56,0,0,0-.62,1.59,17.23,17.23,0,0,0-.16,2.57,20.35,20.35,0,0,0,.16,3,2.17,2.17,0,0,0,.6,1.3,3.19,3.19,0,0,0,1.48.59l3.89.83a7.26,7.26,0,0,1,2.78,1.15,4.91,4.91,0,0,1,1.64,2.59,19.4,19.4,0,0,1,.57,5.77,21.33,21.33,0,0,1-.86,6.83,5.79,5.79,0,0,1-2.67,3.38,10.66,10.66,0,0,1-4.94,1A35.92,35.92,0,0,1,334.69,66.86Z"/><path class="cls-2" d="M46.72,59c1.23-.38,9.08.88,10.13,1.62,3.3,2.33,8.14,3.58,10.08,1.2s-.09-6.47-3.19-9.59c-.92-.94-3.89-8.18-3.75-9.47.44-4.09-.9-9-3.94-9.46s-5.91,3.86-6.64,7.56c-.25,1.29-5.32,7.5-6.48,8-3.67,1.7-7.14,5.24-6,8.11S43.15,60.05,46.72,59Z"/><path class="cls-2" d="M60.38,16.76c4.93.21,7,10.25,6.21,18.12-.25,2.5,5.56,16.57,6.58,18.88A7.82,7.82,0,0,0,76.37,57C72.61,46.77,72.28,38.6,73,36.69c3.21-8.85,1.8-20.77-3-23.53-3.25-1.87-10.33-2.62-14.85,4.8A7.33,7.33,0,0,1,60.38,16.76Z"/><path class="cls-2" d="M20.91,59.57c-2.28-4.39,5.38-11.2,12.6-14.45C35.8,44.09,45.07,32,46.57,30a7.77,7.77,0,0,0,1.17-4.37c-7,8.35-13.86,12Line truncated

After

Width:  |  Height:  |  Size: 5.2 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 216"><defs><style>.cls-1{fill:#fff;}.cls-2{fill:#e3493c;}</style></defs><title>Superalgos-logo-vert-dark</title><g id="Layer_4" data-name="Layer 4"><path class="cls-1" d="M13.23,207.58A28.44,28.44,0,0,1,10,207v-4a44.92,44.92,0,0,0,5.33.37,10.47,10.47,0,0,0,2.22-.18,2.42,2.42,0,0,0,1.23-.7,3.21,3.21,0,0,0,.59-1.48,15.56,15.56,0,0,0,.16-2.54,21.51,21.51,0,0,0-.16-3.25,1.91,1.91,0,0,0-.73-1.3,5.88,5.88,0,0,0-2-.73l-4-.79a3.17,3.17,0,0,1-2.5-2.36,20.78,20.78,0,0,1-.63-5.91,14.52,14.52,0,0,1,.86-5.6A5.4,5.4,0,0,1,13,175.75a10,10,0,0,1,4.41-.84,22.82,22.82,0,0,1,3.57.26c1.08.17,1.85.32,2.32.44v4a14.8,14.8,0,0,0-1.87-.26c-.88-.08-1.76-.12-2.66-.12a9.88,9.88,0,0,0-2.5.24,2,2,0,0,0-1.24.84,3.14,3.14,0,0,0-.56,1.42,15.61,15.61,0,0,0-.14,2.31,18.37,18.37,0,0,0,.14,2.69,1.94,1.94,0,0,0,.54,1.17,2.83,2.83,0,0,0,1.33.53l3.5.75a6.46,6.46,0,0,1,2.5,1,4.4,4.4,0,0,1,1.47,2.33,17.51,17.51,0,0,1,.51,5.18,19,19,0,0,1-.77,6.15,5.21,5.21,0,0,1-2.4,3,9.52,9.52,0,0,1-4.44.86A33.32,33.32,0,0,1,13.23,207.58Z"/><path class="cls-1" d="M47.9,175.29v18.07a66.38,66.38,0,0,1-.44,9.1,6.09,6.09,0,0,1-2.08,4.06q-1.64,1.26-5.42,1.26t-5.41-1.26a6,6,0,0,1-2.06-4,69.05,69.05,0,0,1-.42-9.13V175.29h4.76v20.07c0,2.62.06,4.44.17,5.47a3.11,3.11,0,0,0,.79,2.07,3.38,3.38,0,0,0,2.17.54,3.46,3.46,0,0,0,2.22-.54,3.11,3.11,0,0,0,.79-2.07c.11-1,.17-2.85.17-5.47V175.29Z"/><path class="cls-1" d="M56.53,175.29H64.8a7.32,7.32,0,0,1,4.62,1.23,5.85,5.85,0,0,1,2,3.43,28,28,0,0,1,.49,5.89,28.72,28.72,0,0,1-.46,5.74,6,6,0,0,1-2,3.5,7,7,0,0,1-4.64,1.31H61.3v11H56.53Zm7.52,16.81a3.2,3.2,0,0,0,2.08-.54,2.93,2.93,0,0,0,.84-1.8,26.3,26.3,0,0,0,.21-3.92,25.81,25.81,0,0,0-.21-3.9,2.86,2.86,0,0,0-.84-1.77,3.2,3.2,0,0,0-2.08-.54H61.3V192.1Z"/><path class="cls-1" d="M79.69,207.41V175.29H92.35v4.34H84.5V189h6.87v4.35H84.5v9.71h7.85v4.34Z"/><path class="cls-1" d="M111.61,207.41l-2.94-11.95h-3.6v11.95h-4.76V175.29h8.45a7.6,7.6,0,0,1,4.62,1.16,5.5,5.5,0,0,1,2,3.29,25.84,25.84,0,0,1,.49,5.63,23.83,23.83,0,0,1-.56,5.79,5.11,5.11,0,0,1-2.33,3.27l3.5,13Zm-1.52-16.67a2.69,2.69,0,0,0,.84-1.68,22.64,22.64,0,0,0,.21-3.64,22.33,22.33,0,0,0-.21-3.6,2.7,2.7,0,0,0-.86-1.68,3.35,3.35,0,0,0-2.06-.51h-2.94v11.63H108A3.25,3.25,0,0,0,110.09,190.74Z"/><path class="cls-2" d="M137.14,207.41l-1.35-7.7h-6.26l-1.31,7.7h-4.76l5.79-32.12h6.91L142,207.41Zm-4.34-26.9h-.28l-2.47,15h5.23Z"/><path class="cls-2" d="M149.53,207.41V175.29h4.8V203h7.06v4.39Z"/><path class="cls-2" d="M176.41,193.68v-4.2h7.28v17.37a20,20,0,0,1-3.27.68,27.12,27.12,0,0,1-3.59.25,9.24,9.24,0,0,1-5.42-1.28c-1.18-.86-2-2.43-2.47-4.72a56.38,56.38,0,0,1-.7-10.43,54.83,54.83,0,0,1,.72-10.41c.48-2.28,1.35-3.85,2.59-4.72a10,10,0,0,1,5.7-1.31,23.71,23.71,0,0,1,3.29.26,23,23,0,0,1,3.1.63v4c-.9-.15-1.83-.28-2.8-.39a21.18,21.18,0,0,0-2.19-.17,8.38,8.38,0,0,0-3.81.61c-.7.41-1.19,1.41-1.47,3a57.35,57.35,0,0,0-.42,8.48c0,3.8.09,6.5.26,8.12a5.8,5.8,0,0,0,1,3.27,3.55,3.55,0,0,0,2.66.84,9.17,9.17,0,0,0,2.43-.28v-9.62Z"/><path class="cls-2" d="M194.2,206.43a6.66,6.66,0,0,1-2.15-4.53,85.84,85.84,0,0,1-.44-10.55,85.73,85.73,0,0,1,.44-10.55,6.66,6.66,0,0,1,2.15-4.53c1.13-.91,3-1.36,5.62-1.36s4.54.45,5.68,1.36a6.75,6.75,0,0,1,2.15,4.53,87.83,87.83,0,0,1,.44,10.55,88,88,0,0,1-.44,10.55,6.75,6.75,0,0,1-2.15,4.53q-1.71,1.35-5.68,1.35C197.21,207.78,195.33,207.33,194.2,206.43Zm8-3.59a5.19,5.19,0,0,0,.88-3q.24-2.39.24-8.5t-.24-8.5a5.16,5.16,0,0,0-.88-3,3.58,3.58,0,0,0-2.39-.61,3.44,3.44,0,0,0-2.35.61,5.34,5.34,0,0,0-.87,3q-.22,2.39-.23,8.5t.23,8.5a5.37,5.37,0,0,0,.87,3,3.44,3.44,0,0,0,2.35.6A3.59,3.59,0,0,0,202.21,202.84Z"/><path class="cls-2" d="M219.4,207.58a27.86,27.86,0,0,1-3.22-.54v-4a44.63,44.63,0,0,0,5.32.37,10.47,10.47,0,0,0,2.22-.18,2.42,2.42,0,0,0,1.23-.7,3.21,3.21,0,0,0,.59-1.48,15.56,15.56,0,0,0,.16-2.54,21.51,21.51,0,0,0-.16-3.25,1.91,1.91,0,0,0-.73-1.3,5.89,5.89,0,0,0-2-.73l-4-.79a3.17,3.17,0,0,1-2.5-2.36,20.78,20.78,0,0,1-.63-5.91,14.71,14.71,0,0,1,.86-5.6,5.4,5.4,0,0,1,2.57-2.85,10,10,0,0,1,4.41-.84,23.05,23.05,0,0,1,3.58.26c1.07.17,1.84.32,2.31.44v4a14.8,14.8,0,0,0-1.87-.26c-.87-.08-1.76-.12-2.66-.12a9.88,9.88,0,0,0-2.5.24,2,2,0,0,0-1.24.84,3.14,3.14,0,0,0-.56,1.42,15.61,15.61,0,0,0-.14,2.31,18.37,18.37,0,0,0,.14,2.69,1.94,1.94,0,0,0,.54,1.17,2.88,2.88,0,0,0,1.33.53l3.5.75a6.46,6.46,0,0,1,2.5,1,4.4,4.4,0,0,1,1.47,2.33,17.51,17.51,0,0,1,.51,5.18,19,19,0,0,1-.77,6.15,5.21,5.21,0,0,1-2.4,3,9.52,9.52,0,0,1-4.44.86A33.32,33.32,0,0,1,219.4,207.58Z"/><path class="cls-2" d="M115.74,91.81c2.19-.67,16.14,1.56,18,2.88,5.86,4.13,14.45,6.37,17.9,2.14s-.16-11.49-5.67-17c-1.64-1.65-6.92-14.51-6.66-16.82.79-7.26-1.6-15.93-7-16.79S121.82,53,120.52,59.59c-.45,2.29-9.45,13.32-11.51,14.28-6.52,3-12.68,9.31-10.73,14.41S109.4,93.75,115.74,91.81Z"/><path class="cls-2" d="M140,16.85c8.77.37,12.46,18.21,11,32.2-.45,4.44,9.88,29.43,11.69,33.54,1.64,3.72,5.35,5.34,5.68,5.68-6.67-18.1-7.26-32.62-6-36,5.7-15.73,3.2-36.89-5.33-41.81C151.27,7.13,138.68,5.8,130.67,19,134.45,16.5,136.88,16.71,140,16.85Z"/><path class="clsLine truncated

After

Width:  |  Height:  |  Size: 5.4 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 216"><defs><style>.cls-1{fill:#4d4d4d;}.cls-2{fill:#e3493c;}</style></defs><title>Superalgos-logo-vert_1</title><g id="Layer_4" data-name="Layer 4"><path class="cls-1" d="M13.23,207.58A28.44,28.44,0,0,1,10,207v-4a44.92,44.92,0,0,0,5.33.37,10.47,10.47,0,0,0,2.22-.18,2.42,2.42,0,0,0,1.23-.7,3.21,3.21,0,0,0,.59-1.48,15.56,15.56,0,0,0,.16-2.54,21.51,21.51,0,0,0-.16-3.25,1.91,1.91,0,0,0-.73-1.3,5.88,5.88,0,0,0-2-.73l-4-.79a3.17,3.17,0,0,1-2.5-2.36,20.78,20.78,0,0,1-.63-5.91,14.52,14.52,0,0,1,.86-5.6A5.4,5.4,0,0,1,13,175.75a10,10,0,0,1,4.41-.84,22.82,22.82,0,0,1,3.57.26c1.08.17,1.85.32,2.32.44v4a14.8,14.8,0,0,0-1.87-.26c-.88-.08-1.76-.12-2.66-.12a9.88,9.88,0,0,0-2.5.24,2,2,0,0,0-1.24.84,3.14,3.14,0,0,0-.56,1.42,15.61,15.61,0,0,0-.14,2.31,18.37,18.37,0,0,0,.14,2.69,1.94,1.94,0,0,0,.54,1.17,2.83,2.83,0,0,0,1.33.53l3.5.75a6.46,6.46,0,0,1,2.5,1,4.4,4.4,0,0,1,1.47,2.33,17.51,17.51,0,0,1,.51,5.18,19,19,0,0,1-.77,6.15,5.21,5.21,0,0,1-2.4,3,9.52,9.52,0,0,1-4.44.86A33.32,33.32,0,0,1,13.23,207.58Z"/><path class="cls-1" d="M47.9,175.29v18.07a66.38,66.38,0,0,1-.44,9.1,6.09,6.09,0,0,1-2.08,4.06q-1.64,1.26-5.42,1.26t-5.41-1.26a6,6,0,0,1-2.06-4,69.05,69.05,0,0,1-.42-9.13V175.29h4.76v20.07c0,2.62.06,4.44.17,5.47a3.11,3.11,0,0,0,.79,2.07,3.38,3.38,0,0,0,2.17.54,3.46,3.46,0,0,0,2.22-.54,3.11,3.11,0,0,0,.79-2.07c.11-1,.17-2.85.17-5.47V175.29Z"/><path class="cls-1" d="M56.53,175.29H64.8a7.32,7.32,0,0,1,4.62,1.23,5.85,5.85,0,0,1,2,3.43,28,28,0,0,1,.49,5.89,28.72,28.72,0,0,1-.46,5.74,6,6,0,0,1-2,3.5,7,7,0,0,1-4.64,1.31H61.3v11H56.53Zm7.52,16.81a3.2,3.2,0,0,0,2.08-.54,2.93,2.93,0,0,0,.84-1.8,26.3,26.3,0,0,0,.21-3.92,25.81,25.81,0,0,0-.21-3.9,2.86,2.86,0,0,0-.84-1.77,3.2,3.2,0,0,0-2.08-.54H61.3V192.1Z"/><path class="cls-1" d="M79.69,207.41V175.29H92.35v4.34H84.5V189h6.87v4.35H84.5v9.71h7.85v4.34Z"/><path class="cls-1" d="M111.61,207.41l-2.94-11.95h-3.6v11.95h-4.76V175.29h8.45a7.6,7.6,0,0,1,4.62,1.16,5.5,5.5,0,0,1,2,3.29,25.84,25.84,0,0,1,.49,5.63,23.83,23.83,0,0,1-.56,5.79,5.11,5.11,0,0,1-2.33,3.27l3.5,13Zm-1.52-16.67a2.69,2.69,0,0,0,.84-1.68,22.64,22.64,0,0,0,.21-3.64,22.33,22.33,0,0,0-.21-3.6,2.7,2.7,0,0,0-.86-1.68,3.35,3.35,0,0,0-2.06-.51h-2.94v11.63H108A3.25,3.25,0,0,0,110.09,190.74Z"/><path class="cls-2" d="M137.14,207.41l-1.35-7.7h-6.26l-1.31,7.7h-4.76l5.79-32.12h6.91L142,207.41Zm-4.34-26.9h-.28l-2.47,15h5.23Z"/><path class="cls-2" d="M149.53,207.41V175.29h4.8V203h7.06v4.39Z"/><path class="cls-2" d="M176.41,193.68v-4.2h7.28v17.37a20,20,0,0,1-3.27.68,27.12,27.12,0,0,1-3.59.25,9.24,9.24,0,0,1-5.42-1.28c-1.18-.86-2-2.43-2.47-4.72a56.38,56.38,0,0,1-.7-10.43,54.83,54.83,0,0,1,.72-10.41c.48-2.28,1.35-3.85,2.59-4.72a10,10,0,0,1,5.7-1.31,23.71,23.71,0,0,1,3.29.26,23,23,0,0,1,3.1.63v4c-.9-.15-1.83-.28-2.8-.39a21.18,21.18,0,0,0-2.19-.17,8.38,8.38,0,0,0-3.81.61c-.7.41-1.19,1.41-1.47,3a57.35,57.35,0,0,0-.42,8.48c0,3.8.09,6.5.26,8.12a5.8,5.8,0,0,0,1,3.27,3.55,3.55,0,0,0,2.66.84,9.17,9.17,0,0,0,2.43-.28v-9.62Z"/><path class="cls-2" d="M194.2,206.43a6.66,6.66,0,0,1-2.15-4.53,85.84,85.84,0,0,1-.44-10.55,85.73,85.73,0,0,1,.44-10.55,6.66,6.66,0,0,1,2.15-4.53c1.13-.91,3-1.36,5.62-1.36s4.54.45,5.68,1.36a6.75,6.75,0,0,1,2.15,4.53,87.83,87.83,0,0,1,.44,10.55,88,88,0,0,1-.44,10.55,6.75,6.75,0,0,1-2.15,4.53q-1.71,1.35-5.68,1.35C197.21,207.78,195.33,207.33,194.2,206.43Zm8-3.59a5.19,5.19,0,0,0,.88-3q.24-2.39.24-8.5t-.24-8.5a5.16,5.16,0,0,0-.88-3,3.58,3.58,0,0,0-2.39-.61,3.44,3.44,0,0,0-2.35.61,5.34,5.34,0,0,0-.87,3q-.22,2.39-.23,8.5t.23,8.5a5.37,5.37,0,0,0,.87,3,3.44,3.44,0,0,0,2.35.6A3.59,3.59,0,0,0,202.21,202.84Z"/><path class="cls-2" d="M219.4,207.58a27.86,27.86,0,0,1-3.22-.54v-4a44.63,44.63,0,0,0,5.32.37,10.47,10.47,0,0,0,2.22-.18,2.42,2.42,0,0,0,1.23-.7,3.21,3.21,0,0,0,.59-1.48,15.56,15.56,0,0,0,.16-2.54,21.51,21.51,0,0,0-.16-3.25,1.91,1.91,0,0,0-.73-1.3,5.89,5.89,0,0,0-2-.73l-4-.79a3.17,3.17,0,0,1-2.5-2.36,20.78,20.78,0,0,1-.63-5.91,14.71,14.71,0,0,1,.86-5.6,5.4,5.4,0,0,1,2.57-2.85,10,10,0,0,1,4.41-.84,23.05,23.05,0,0,1,3.58.26c1.07.17,1.84.32,2.31.44v4a14.8,14.8,0,0,0-1.87-.26c-.87-.08-1.76-.12-2.66-.12a9.88,9.88,0,0,0-2.5.24,2,2,0,0,0-1.24.84,3.14,3.14,0,0,0-.56,1.42,15.61,15.61,0,0,0-.14,2.31,18.37,18.37,0,0,0,.14,2.69,1.94,1.94,0,0,0,.54,1.17,2.88,2.88,0,0,0,1.33.53l3.5.75a6.46,6.46,0,0,1,2.5,1,4.4,4.4,0,0,1,1.47,2.33,17.51,17.51,0,0,1,.51,5.18,19,19,0,0,1-.77,6.15,5.21,5.21,0,0,1-2.4,3,9.52,9.52,0,0,1-4.44.86A33.32,33.32,0,0,1,219.4,207.58Z"/><path class="cls-2" d="M115.74,91.81c2.19-.67,16.14,1.56,18,2.88,5.86,4.13,14.45,6.37,17.9,2.14s-.16-11.49-5.67-17c-1.64-1.65-6.92-14.51-6.66-16.82.79-7.26-1.6-15.93-7-16.79S121.82,53,120.52,59.59c-.45,2.29-9.45,13.32-11.51,14.28-6.52,3-12.68,9.31-10.73,14.41S109.4,93.75,115.74,91.81Z"/><path class="cls-2" d="M140,16.85c8.77.37,12.46,18.21,11,32.2-.45,4.44,9.88,29.43,11.69,33.54,1.64,3.72,5.35,5.34,5.68,5.68-6.67-18.1-7.26-32.62-6-36,5.7-15.73,3.2-36.89-5.33-41.81C151.27,7.13,138.68,5.8,130.67,19,134.45,16.5,136.88,16.71,140,16.85Z"/><path class="clsLine truncated

After

Width:  |  Height:  |  Size: 5.4 KiB

+34 -44
View File
@@ -1,6 +1,6 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Route, BrowserRouter, Switch } from 'react-router-dom'
import { Route, Switch } from 'react-router-dom'
import { hot } from 'react-hot-loader'
import { withStyles } from '@material-ui/core/styles'
@@ -8,10 +8,9 @@ import {
AcceptTeamInvite,
ManageTeams,
TeamMembers,
FinancialBeings,
Settings,
Teams,
TeamBar,
Landing,
globalStyles
} from './views'
@@ -35,48 +34,39 @@ class App extends Component {
}
render () {
const { match } = this.props
let loggedIn
if (this.state.user !== null) {
loggedIn = (<TeamBar match={match} user={this.state.user} />)
} else {
loggedIn = ''
}
return (
<BrowserRouter>
<div className='App'>
{loggedIn}
<Switch>
<Route exact path={`${match.path}`} component={Teams} />
<Route
exact
path={`${match.path}/manage-teams`}
render={props => <ManageTeams {...props} auth={this.props.auth} />}
/>
<Route
exact
path={`${match.path}/team-members`}
render={props => <TeamMembers {...props} auth={this.props.auth} />}
/>
<Route
exact
path={`${match.path}/financial-beings`}
render={props => <FinancialBeings {...props} auth={this.props.auth} />}
/>
<Route
exact
path={`${match.path}/financial-beings`}
render={props => <Settings {...props} auth={this.props.auth} />}
/>
<Route
exact
path={`${match.path}/activate-team-membership`}
render={props => <AcceptTeamInvite {...props} auth={this.props.auth} />}
/>
<Route path='/teams/:slug' component={Teams} />
</Switch>
</div>
</BrowserRouter>
<div className='App'>
<Switch>
<Route exact path={`/teams`} component={Landing} />
<Route exact path={`/teams/explore`} component={Teams} />
<Route
exact
path={`/teams/manage-teams`}
render={props => <ManageTeams {...props} auth={this.props.auth} />}
/>
<Route
exact
path={`/teams/manage-teams/:slug`}
render={props => <ManageTeams {...props} auth={this.props.auth} user={this.state.user} />}
/>
<Route
exact
path={`/teams/team-members`}
render={props => <TeamMembers {...props} auth={this.props.auth} />}
/>
<Route
exact
path={`/teams/settings`}
render={props => <Settings {...props} auth={this.props.auth} />}
/>
<Route
exact
path={`/teams/activate-team-membership`}
render={props => <AcceptTeamInvite {...props} auth={this.props.auth} />}
/>
<Route exact path='/teams/:slug' component={Teams} />
</Switch>
</div>
)
}
}
+5 -1
View File
@@ -5,11 +5,15 @@ const ErrorResponse = {
}
export const checkGraphQLError = error => {
log.debug('checkGraphQLError ', ErrorResponse)
log.debug('checkGraphQLError ', ErrorResponse, error)
const errorString = JSON.stringify(error)
/*
if (error.search(/unique constraint/)) {
const field = error.substring(error.indexOf('=') + 1)
log.debug('unique constraint', field.replace(/ +/g, ''))
}
*/
return errorString
}
export default checkGraphQLError
@@ -0,0 +1,26 @@
import React from 'react'
import PropTypes from 'prop-types'
import Typography from '@material-ui/core/Typography'
const BannerTopBar = ({
size,
backgroundUrl,
title,
text
}) => (
<div className={`bannerTopBar ${size}`} style={backgroundUrl ? { backgroundImage: `url(${backgroundUrl})` } : {}}>
<div className='caption'>
<Typography className='title' variant='h1' align='center'>{title}</Typography>
<Typography className='text' variant='h2' align='center'>{text}</Typography>
</div>
</div>
)
BannerTopBar.propTypes = {
backgroundUrl: PropTypes.string,
size: PropTypes.string,
title: PropTypes.string,
text: PropTypes.string
}
export default BannerTopBar
@@ -130,7 +130,8 @@ class TeamBar extends Component {
size='small'
className={classNames(classes.button, classes.cssRoot)}
title='Report a Teams Module bug'
to='https://github.com/AdvancedAlgos/TeamsModule/issues'
href='https://github.com/AdvancedAlgos/TeamsModule/issues/new'
target='_blank'
>
<BugReportIcon className={classNames(classes.leftIcon, classes.iconSmall)} />
Report
@@ -0,0 +1,39 @@
const styles = () => ({
rootBig: {
backgroundImage: 'url(https://aacorporatesitedevelop.azurewebsites.net/img/photos/connect.jpg)',
width: '100%',
height: '100vh'
},
rootMedium: {
backgroundImage: 'url(https://aacorporatesitedevelop.azurewebsites.net/img/photos/connect.jpg)',
width: '100%',
height: '50vh'
},
rootSmall: {
backgroundImage: 'url(https://aacorporatesitedevelop.azurewebsites.net/img/photos/connect.jpg)',
width: '100%',
height: '220px'
},
captions: {
position: 'relative',
top: '50%',
transform: 'translateY(-50%)'
},
title: {
fontFamily: 'Saira',
color: 'white',
fontSize: '64px',
lineHeight: '78px',
fontWeight: 100
},
text: {
fontFamily: 'Saira',
color: 'white',
fontSize: '20px',
lineHeight: '30px',
fontWeight: 600,
padding: '20px 0 0.5em 0'
}
})
export default styles
+2 -1
View File
@@ -1,3 +1,4 @@
import TeamBar from './components/TeamBar'
import BannerTopBar from './components/BannerTopBar'
export { TeamBar }
export { TeamBar, BannerTopBar }
+1 -1
View File
@@ -5,7 +5,7 @@ import Typography from '@material-ui/core/Typography'
import { withStyles } from '@material-ui/core/styles'
// import ManageTeamMembersList from './components/ManageTeamMembersList'
import { MessageCard } from '@advancedalgos/web-components'
import { MessageCard } from '@superalgos/web-components'
const styles = theme => ({
tableContainer: {
@@ -11,7 +11,7 @@ import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import DashTeamItem from './DashTeamItem'
import CreateTeamDialog from './CreateTeamDialog'
import { MessageCard } from '@advancedalgos/web-components'
import { MessageCard } from '@superalgos/web-components'
import { isDefined, isString } from '../../../utils/js-helpers'
import { getItem } from '../../../utils/local-storage'
@@ -1,83 +0,0 @@
import React from 'react'
import { Link } from 'react-router-dom'
import ListItem from '@material-ui/core/ListItem'
import ListItemIcon from '@material-ui/core/ListItemIcon'
import ListItemText from '@material-ui/core/ListItemText'
import GroupIcon from '@material-ui/icons/Group'
import DashboardIcon from '@material-ui/icons/Dashboard'
import SettingsIcon from '@material-ui/icons/Settings'
import SupervisedUserCircleIcon from '@material-ui/icons/SupervisedUserCircle'
import LibraryBooksIcon from '@material-ui/icons/LibraryBooks'
import SentimentSatisfiedAltIcon from '@material-ui/icons/SentimentSatisfiedAlt'
import AndroidIcon from '@material-ui/icons/Android'
const DashboardLink = props => <Link to='/dashboard' {...props} />
const TeamsLink = props => <Link to='/manage-teams' {...props} />
const MembersLink = props => <Link to='/team-members' {...props} />
const SettingsLink = props => <Link to='/settings' {...props} />
const FBLink = props => <Link to='/financial-beings' {...props} />
const DocumentationLink = props => (
<a
href='https://advancedalgos.net/documentation-quick-start.shtml'
target='_blank'
{...props}
/>
)
const SupportLink = props => (
<a href='https://t.me/advancedalgoscommunity' target='_blank' {...props} />
)
export const MainDrawerItems = (
<div>
<ListItem button component={DashboardLink}>
<ListItemIcon>
<DashboardIcon />
</ListItemIcon>
<ListItemText primary='Dashboard' />
</ListItem>
<ListItem button component={TeamsLink}>
<ListItemIcon>
<GroupIcon />
</ListItemIcon>
<ListItemText primary='Teams' />
</ListItem>
<ListItem button component={MembersLink}>
<ListItemIcon>
<SupervisedUserCircleIcon />
</ListItemIcon>
<ListItemText primary='Team Members' />
</ListItem>
<ListItem button component={FBLink}>
<ListItemIcon>
<AndroidIcon />
</ListItemIcon>
<ListItemText primary='Financial Beings' />
</ListItem>
<ListItem button component={SettingsLink}>
<ListItemIcon>
<SettingsIcon />
</ListItemIcon>
<ListItemText primary='Settings' />
</ListItem>
</div>
)
export const SecondaryDrawerItems = (
<div>
<ListItem button component={DocumentationLink}>
<ListItemIcon>
<LibraryBooksIcon />
</ListItemIcon>
<ListItemText primary='Documentation' />
</ListItem>
<ListItem button component={SupportLink}>
<ListItemIcon>
<SentimentSatisfiedAltIcon />
</ListItemIcon>
<ListItemText primary='Support' />
</ListItem>
</div>
)
export default MainDrawerItems
@@ -13,7 +13,7 @@ import DialogContentText from '@material-ui/core/DialogContentText'
import DialogTitle from '@material-ui/core/DialogTitle'
import Typography from '@material-ui/core/Typography'
import { MessageCard, ImageUpload } from '@advancedalgos/web-components'
import { MessageCard, ImageUpload } from '@superalgos/web-components'
import UPDATE_FB from '../../../graphql/teams/UpdateFBMutation'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
@@ -120,7 +120,7 @@ export class ManageFBEdit extends Component {
let avatar = null
if (fb.avatar !== undefined && fb.avatar !== null) avatar = fb.avatar
if (this.state.avatar !== null) avatar = this.state.avatar
if (this.state.avatar === null && fb.avatar === undefined) avatar = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-avatar-default.png'
if (this.state.avatar === null && fb.avatar === undefined) avatar = process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
if (loading || data === undefined) {
return (<MessageCard message='Loading...' />)
@@ -18,7 +18,7 @@ export const ManageFBItem = ({ classes, team, authId }) => {
if (team.fb[0].avatar !== undefined && team.fb[0].avatar !== 'a') {
avatar = team.fb[0].avatar
} else {
avatar = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-avatar-default.png'
avatar = process.env.STORAGE_URL+'/module-teams/module-default/aa-avatar-default.png'
}
return (
<Grid item xs={12}>
@@ -4,7 +4,7 @@ import { Query } from 'react-apollo'
import { withStateHandlers, lifecycle, compose } from 'recompose'
import Grid from '@material-ui/core/Grid'
import { MessageCard } from '@advancedalgos/web-components'
import { MessageCard } from '@superalgos/web-components'
import { withStyles } from '@material-ui/core/styles'
import { isDefined, isString } from '../../../utils/js-helpers'
@@ -7,7 +7,7 @@ import Typography from '@material-ui/core/Typography'
import ManageMemberDelete from './ManageMemberDelete'
import ManageMemberRole from './ManageMemberRole'
import ManageMemberStatus from './ManageMemberStatus'
import { MessageCard } from '@advancedalgos/web-components'
import { MessageCard } from '@superalgos/web-components'
import log from '../../../utils/log'
@@ -32,7 +32,7 @@ export const ManageMembersItem = ({ classes, member, teamId, authId }) => {
</Typography>
</Grid>
<Grid item xs={4}>
<Typography color='textSecondary' variant='body2' component='h4' align='left' >
<Typography color='textSecondary' variant='body1' component='h4' align='left' >
{email !== null ? `${memberStatus[memberStatus.length - 1].status} | Sent: ${memberStatus[memberStatus.length - 1].createdAt}` : `${member.role} | Member since: `}
</Typography>
</Grid>
@@ -10,7 +10,7 @@ import Typography from '@material-ui/core/Typography'
import InviteMemberDialog from './InviteMemberDialog'
import ManageMembersItem from './ManageMembersItem'
import { MessageCard } from '@advancedalgos/web-components'
import { MessageCard } from '@superalgos/web-components'
import log from '../../../utils/log'
@@ -63,7 +63,7 @@ export const ManageMembersTeamItem = ({ classes, team, authId }) => {
if (team.profile.avatar !== undefined && team.profile.avatar !== 'a') {
avatar = team.profile.avatar
} else {
avatar = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-avatar-default.png'
avatar = process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
}
if (team.members.length > 0) {
return (
@@ -72,12 +72,12 @@ export class ManageTeamDetails extends Component {
if (profile.avatar !== undefined && profile.avatar !== null) {
avatar = profile.avatar
} else {
avatar = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-avatar-default.png'
avatar = process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
}
if (profile.banner !== undefined && profile.banner !== null) {
banner = profile.banner
} else {
banner = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-banner-default.png'
banner = process.env.STORAGE_URL + '/module-teams/module-default/aa-banner-default.png'
}
return (
<div>
@@ -13,7 +13,7 @@ import DialogContentText from '@material-ui/core/DialogContentText'
import DialogTitle from '@material-ui/core/DialogTitle'
import Typography from '@material-ui/core/Typography'
import { MessageCard, ImageUpload } from '@advancedalgos/web-components'
import { MessageCard, ImageUpload } from '@superalgos/web-components'
import log from '../../../utils/log'
@@ -129,11 +129,11 @@ export class ManageTeamEdit extends Component {
let avatar = null
if (team.profile !== null && team.profile.avatar !== undefined && team.profile.avatar !== null) avatar = team.profile.avatar
if (this.state.avatar !== null) avatar = this.state.avatar
if (this.state.avatar === null && team.profile !== null && team.profile.avatar === undefined) avatar = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-avatar-default.png'
if (this.state.avatar === null && team.profile !== null && team.profile.avatar === undefined) avatar = process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
let banner = null
if (team.profile !== null && team.profile.banner !== undefined && team.profile.banner !== null) banner = team.profile.banner
if (this.state.banner !== null) banner = this.state.banner
if (this.state.banner === null && team.profile !== null && team.profile.banner === undefined) banner = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-banner-default.png'
if (this.state.banner === null && team.profile !== null && team.profile.banner === undefined) banner = process.env.STORAGE_URL + '/module-teams/module-default/aa-banner-default.png'
log.debug('team images: ', avatar, banner)
if (loading || data === undefined) {
@@ -12,7 +12,7 @@ import { getItem } from '../../../utils/local-storage'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import ManageMembersTeamItem from './ManageMembersTeamItem'
import { MessageCard } from '@advancedalgos/web-components'
import { MessageCard } from '@superalgos/web-components'
import log from '../../../utils/log'
@@ -20,7 +20,7 @@ export const ManageTeamsItem = ({ classes, team, authId }) => {
if (team.profile.avatar !== undefined && team.profile.avatar !== 'a') {
avatar = team.profile.avatar
} else {
avatar = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-avatar-default.png'
avatar = process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
}
return (
<Grid item xs={12}>
@@ -4,7 +4,7 @@ import { Query } from 'react-apollo'
import { withStateHandlers, lifecycle, compose } from 'recompose'
import Grid from '@material-ui/core/Grid'
import { MessageCard } from '@advancedalgos/web-components'
import { MessageCard } from '@superalgos/web-components'
import { withStyles } from '@material-ui/core/styles'
import { isDefined, isString } from '../../../utils/js-helpers'
+1 -1
View File
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types'
import Typography from '@material-ui/core/Typography'
import { withStyles } from '@material-ui/core/styles'
import { MessageCard } from '@advancedalgos/web-components'
import { MessageCard } from '@superalgos/web-components'
const styles = theme => ({
tableContainer: {
@@ -13,7 +13,7 @@ import DialogContentText from '@material-ui/core/DialogContentText'
import DialogTitle from '@material-ui/core/DialogTitle'
import Typography from '@material-ui/core/Typography'
import { ImageUpload } from '@advancedalgos/web-components'
import { ImageUpload } from '@superalgos/web-components'
import UPDATE_FB from '../../../graphql/teams/UpdateFBMutation'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
@@ -68,7 +68,7 @@ export class ManageFBEdit extends Component {
const containerName = slug
let avatar = null
if (this.state.avatar === null && fb.avatar === undefined) avatar = 'https://aadevelop.blob.core.windows.net/module-teams/module-default/aa-avatar-default.png'
if (this.state.avatar === null && fb.avatar === undefined) avatar = process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
if (fb.avatar !== undefined && fb.avatar !== null) avatar = fb.avatar
if (this.state.avatar !== null) avatar = this.state.avatar
@@ -18,7 +18,7 @@ export const ManageFBItem = ({ classes, team }) => {
if (team.fb[0].avatar !== undefined && team.fb[0].avatar !== 'a') {
avatar = team.fb[0].avatar
} else {
avatar = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-avatar-default.png'
avatar = process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
}
return (
<Grid item xs={12}>
@@ -3,7 +3,9 @@ import PropTypes from 'prop-types'
import { Query } from 'react-apollo'
import Grid from '@material-ui/core/Grid'
import { MessageCard } from '@advancedalgos/web-components'
import Paper from '@material-ui/core/Paper'
import Typography from '@material-ui/core/Typography'
import { MessageCard } from '@superalgos/web-components'
import { withStyles } from '@material-ui/core/styles'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
@@ -13,10 +15,13 @@ import log from '../../../utils/log'
import ManageFBItem from './ManageFBItem'
const styles = theme => ({
root: {
flexGrow: 1
},
heroContent: {
maxWidth: 600,
margin: '0 auto',
padding: `${theme.spacing.unit * 8}px 0 ${theme.spacing.unit * 6}px`
maxWidth: 800,
margin: `${theme.spacing.unit * 4}px auto`,
padding: 0
},
cardGrid: {
padding: `${theme.spacing.unit * 8}px 0`
@@ -61,36 +66,53 @@ export const ManageFBList = ({ classes }) => (
if (!loading && !error) {
if (data.teams_TeamsByOwner.length > 0) {
return (
<React.Fragment>
<Grid container spacing={40}>
{!loading &&
data.teams_TeamsByOwner.map(team => (
<ManageFBItem
key={team.id}
team={team}
classes={classes}
/>
))}
{errors}
</Grid>
</React.Fragment>
<div className={classes.root}>
<div className={classes.heroContent}>
<Grid container spacing={8} direction='column' alignItems='stretch'>
{!loading &&
data.teams_TeamsByOwner.map(team => (
<ManageFBItem
key={team.id}
team={team}
classes={classes}
/>
))}
{errors}
</Grid>
</div>
</div>
)
} else {
return (
<Grid container spacing={40}>
<Grid item xs={12}>
<MessageCard message='No financial beings yet — Create a team first!' />
{errors !== null && <MessageCard message={errors} />}
<Paper>
<Grid container spacing={0} direction='column' justify='center' alignItems='center' className={classes.container}>
<Grid item xs={10}>
<Typography variant='h5' align='center'>
You don&rsquo;t have any financial being. To create one, create a team first!
</Typography>
<Typography variant='body1' align='center' gutterBottom>
After you create a team, a default trading algobot will be cloned and added to your team so
that you can begin experimenting right away.
</Typography>
</Grid>
</Grid>
</Grid>
</Paper>
)
}
} else {
return (
<Grid container spacing={40}>
<Grid spacing={0} direction='column' justify='center' alignItems='center'>
<Grid item xs={12}>
<MessageCard message='Loading...' />
{errors !== null && <MessageCard message={errors} />}
{errors === null &&
<Typography variant='h5' align='center' gutterBottom>
Loading...
</Typography>
}
{errors !== null &&
<Typography variant='h5' align='center' gutterBottom>
{errors}
</Typography>
}
</Grid>
</Grid>
)
+2 -4
View File
@@ -1,9 +1,9 @@
import React from 'react'
import PropTypes from 'prop-types'
import Typography from '@material-ui/core/Typography'
import { withStyles } from '@material-ui/core/styles'
import { BannerTopBar } from '../common'
import ManageFBList from './components/ManageFBList'
const styles = theme => ({
@@ -14,9 +14,7 @@ const styles = theme => ({
const FinancialBeings = ({ classes }) => (
<div>
<Typography variant='h4' gutterBottom>
Financial Beings
</Typography>
<BannerTopBar size='medium' title='Manage Your Financial Beings' text='Manage your Superalgos Financial Beings' backgroundUrl='https://superalgos.org/img/photos/teams.jpg' />
<ManageFBList />
</div>
)
+2
View File
@@ -4,6 +4,7 @@ import FinancialBeings from './financial-beings'
import Settings from './settings'
import Teams from './teams'
import AcceptTeamInvite from './teams/AcceptTeamInvite'
import Landing from './landing'
import { TeamBar } from './common'
@@ -17,6 +18,7 @@ export {
Settings,
Teams,
TeamBar,
Landing,
theme,
globalStyles
}
+55
View File
@@ -0,0 +1,55 @@
import React from 'react'
import PropTypes from 'prop-types'
import Typography from '@material-ui/core/Typography'
import { withStyles } from '@material-ui/core/styles'
import { BannerTopBar } from '../common'
const styles = theme => ({
container: {
width: 'auto',
marginTop: theme.spacing.unit * 3,
marginLeft: theme.spacing.unit * 3,
marginRight: theme.spacing.unit * 3,
marginBottom: theme.spacing.unit * 6,
[theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: {
width: 800,
marginLeft: 'auto',
marginRight: 'auto'
}
}
})
const Landing = ({ classes, ...props }) => (
<React.Fragment>
<BannerTopBar size='big' title='Teams Module' text='Responsible for all teams at Advanced Algos.' backgroundUrl='https://superalgos.org/img/photos/teams.jpg' />
<div className='homePage container'>
<Typography variant='h1' align='center' className='title'>
Welcome to the Teams Module!
</Typography>
<Typography variant='h2' align='center' className='subtitle'>
Multidisciplinary groups of humans joining forces to breed financial beings and compete.
</Typography>
<div className='column'>
<Typography align='justify'>
One of the core propositions of the Superalgos projects revolves around people teaming up to breed financial beings and compete in algorithmic trading competitions. Both developing and competing are team activities.
</Typography>
</div>
<div className='column'>
<Typography align='justify'>
You may join and participate in as many teams as you wish.
</Typography>
<Typography align='justify'>
When you create your own team, you become the team’s owner and may allow more people in the team at your sole discretion. It has been shown that larger teams tend to become more intelligent.
</Typography>
</div>
</div>
</React.Fragment>
)
Landing.propTypes = {
classes: PropTypes.object.isRequired
}
export default withStyles(styles)(Landing)
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types'
import { Mutation } from 'react-apollo'
import { withStyles } from '@material-ui/core/styles'
import Grid from '@material-ui/core/Grid'
import Button from '@material-ui/core/Button'
import AddIcon from '@material-ui/icons/Add'
import TextField from '@material-ui/core/TextField'
@@ -34,14 +35,8 @@ const styles = theme => ({
marginLeft: '20%',
marginBottom: 10
},
buttonRight: {
// position: 'absolute',
// right: '3em'
marginTop: '1em',
marginRight: 'auto',
marginLeft: 'auto',
display: 'block',
lineHeight: '1em'
buttonFab: {
backgroundColor: '#CCCCCC'
}
})
@@ -93,12 +88,12 @@ export class CreateTeamDialog extends Component {
})
}
return (
<div>
<Grid container justify='center'>
<Button
variant='fab'
color='primary'
aria-label='Add'
className={classes.buttonRight}
className={classes.buttonFab}
onClick={this.handleClickOpen}
>
<AddIcon />
@@ -172,7 +167,7 @@ export class CreateTeamDialog extends Component {
</DialogActions>
</div>
</Dialog>
</div>
</Grid>
)
}}
</Mutation>
@@ -0,0 +1,238 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Mutation } from 'react-apollo'
import { withStyles } from '@material-ui/core/styles'
import Button from '@material-ui/core/Button'
import TextField from '@material-ui/core/TextField'
import FormControl from '@material-ui/core/FormControl'
import FormHelperText from '@material-ui/core/FormHelperText'
import Typography from '@material-ui/core/Typography'
import Grid from '@material-ui/core/Grid'
import { isEmpty } from '../../../utils/js-helpers'
import CREATE_TEAM from '../../../graphql/teams/CreateTeamMutation'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import log from '../../../utils/log'
const styles = theme => ({
formContainer: {
width: '100%',
margin: '3em 0 1em'
},
typography: {
width: '80%',
marginLeft: '10%',
marginTop: 40
},
dialogStyle: {
padding: '3em'
},
textField: {
width: '80%',
marginLeft: '10%',
marginTop: 25
},
submitButton: {
margin: theme.spacing.unit,
marginTop: theme.spacing.unit * 3
}
})
export class CreateTeamForm extends Component {
constructor (props) {
super(props)
this.handleClickOpen = this.handleClickOpen.bind(this)
this.handleClose = this.handleClose.bind(this)
this.handleChange = this.handleChange.bind(this)
this.handleSubmit = this.handleSubmit.bind(this)
this.validate = this.validate.bind(this)
this.slugify = this.slugify.bind(this)
this.state = {
open: false,
name: '',
botName: '',
nameError: '',
botNameError: ''
}
}
render () {
const { classes } = this.props
return (
<Mutation
mutation={CREATE_TEAM}
refetchQueries={[{
query: GET_TEAMS_BY_OWNER
}]}
>
{(createTeam, { loading, error, data }) => {
let errors
let loader = null
if (loading) {
loader = (
<Typography variant='subtitle1'>Submitting team...</Typography>
)
}
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
// const displayMessage = checkGraphQLError(message)
return (
<Typography key={i} variant='caption'>
{message}
</Typography>
)
})
}
return (
<FormControl
required
error={this.state.nameError !== '' || this.state.botNameError !== '' || error !== null}
className={classes.formContainer}
>
<Typography className={classes.typography} variant='body1' gutterBottom align='left'>
Give a nice and memorable name to your team.
</Typography>
<TextField
autoFocus
id='name'
label='Team Name'
type='text'
fullWidth
className={classes.textField}
value={this.state.name}
onChange={this.handleChange}
error={this.state.nameError !== ''}
/>
{this.state.nameError !== '' && (
<FormHelperText>{this.state.nameError}</FormHelperText>
)}
<Typography className={classes.typography} variant='body1' gutterBottom align='left'>
Give a name for to the bot you are forking.
</Typography>
<TextField
autoFocus
id='botName'
label='Team Bot Name'
type='text'
fullWidth
className={classes.textField}
value={this.state.botName}
onChange={this.handleChange}
error={this.state.botNameError !== ''}
/>
<Grid container justify='center' >
<Grid item>
{this.state.botNameError !== '' && (
<FormHelperText>{this.state.botNameError}</FormHelperText>
)}
{error && <FormHelperText>{errors}</FormHelperText>}
{loader}
</Grid>
<Grid item>
<Button
onClick={e => {
this.handleSubmit(e, createTeam, this.state.name, this.state.botName)
}}
variant='contained'
color='secondary'
className={classes.submitButton}
>
Create Team
</Button>
</Grid>
</Grid>
</FormControl>
)
}}
</Mutation>
)
}
handleClickOpen () {
this.setState({ open: true })
}
handleClose () {
this.setState({ open: false })
}
handleChange (e) {
let id = e.target.id
let value = e.target.value
let error = this.validate({ id, value })
switch (id) {
case 'name':
if (!isEmpty(error)) this.setState({ nameError: error })
this.setState({ name: value })
break
case 'botName':
if (!isEmpty(error)) this.setState({ botNameError: error })
this.setState({ botName: value })
break
default:
}
}
async handleSubmit (e, createTeam, name, botName) {
e.preventDefault()
log.debug('createTeam submit: ', name, botName)
const slug = this.slugify(name)
const botSlug = this.slugify(botName)
await createTeam({ variables: { name, slug, botName, botSlug } })
window.canvasApp.eventHandler.raiseEvent('User Profile Changed')
this.setState({ name: '', open: false })
}
validate (data) {
const errors = {}
switch (data.id) {
case 'name':
if (data.value === '') {
this.setState({ nameError: 'Please enter a team name' })
} else {
this.setState({ nameError: '' })
}
break
case 'botName':
if (data.value === '') {
this.setState({ botNameError: 'Please enter a bot name' })
} else {
this.setState({ botNameError: '' })
}
break
default:
}
return errors
}
slugify (string) {
const a = 'àáäâãåèéëêìíïîòóöôùúüûñçßÿœæŕśńṕẃǵǹḿǘẍźḧ·/_,:;'
const b = 'aaaaaaeeeeiiiioooouuuuncsyoarsnpwgnmuxzh------'
const p = new RegExp(a.split('').join('|'), 'g')
return string
.toString()
.toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w-]+/g, '') // Remove all non-word characters
.replace(/--+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, '') // Trim - from end of text
}
}
CreateTeamForm.propTypes = {
classes: PropTypes.object.isRequired
}
export default withStyles(styles)(CreateTeamForm)
@@ -71,13 +71,12 @@ export class ManageTeamDelete extends Component {
let loader
if (loading) {
loader = (
<Typography variant='caption'>Submitting team...</Typography>
<Typography variant='caption'>Deleting team and financial being...</Typography>
)
}
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
const displayMessage = checkGraphQLError(message)
log.debug('createTeam error:', displayMessage)
log.debug('deleteTeam error:', message)
return (
<Typography key={i} variant='caption'>
{message}
@@ -72,12 +72,12 @@ export class ManageTeamDetails extends Component {
if (profile.avatar !== undefined && profile.avatar !== null) {
avatar = profile.avatar
} else {
avatar = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-avatar-default.png'
avatar = process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
}
if (profile.banner !== undefined && profile.banner !== null) {
banner = profile.banner
} else {
banner = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-banner-default.png'
banner = process.env.STORAGE_URL + '/module-teams/module-default/aa-banner-default.png'
}
return (
<div>
@@ -13,7 +13,7 @@ import DialogContentText from '@material-ui/core/DialogContentText'
import DialogTitle from '@material-ui/core/DialogTitle'
import Typography from '@material-ui/core/Typography'
import { ImageUpload } from '@advancedalgos/web-components'
import { ImageUpload } from '@superalgos/web-components'
import UPDATE_TEAM_PROFILE from '../../../graphql/teams/UpdateTeamProfileMutation'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
@@ -75,12 +75,12 @@ export class ManageTeamEdit extends Component {
const AzureStorageSAS = process.env.AZURE_STORAGE_SAS_TEAMS
const containerName = team.slug
let avatar = null
if (this.state.avatar === null && team.profile !== null && (team.profile.avatar === undefined || team.profile.avatar === null)) avatar = 'https://aadevelop.blob.core.windows.net/module-teams/module-default/aa-avatar-default.png'
if (this.state.avatar === null && team.profile !== null && (team.profile.avatar === undefined || team.profile.avatar === null)) avatar = process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
if (team.profile !== null && team.profile.avatar !== undefined && team.profile.avatar !== null) avatar = team.profile.avatar
if (this.state.avatar !== null) avatar = this.state.avatar
let banner = null
if (this.state.banner === null && team.profile !== null && (team.profile.banner === undefined || team.profile.banner === null)) banner = 'https://aadevelop.blob.core.windows.net/module-teams/module-default/aa-banner-default.png'
if (this.state.banner === null && team.profile !== null && (team.profile.banner === undefined || team.profile.banner === null)) banner = process.env.STORAGE_URL + '/module-teams/module-default/aa-banner-default.png'
if (team.profile !== null && team.profile.banner !== undefined && team.profile.banner !== null) banner = team.profile.banner
if (this.state.banner !== null) banner = this.state.banner
log.debug('team images: ', avatar, banner)
@@ -12,7 +12,7 @@ import { getItem } from '../../../utils/local-storage'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import ManageMembersTeamItem from './ManageMembersTeamItem'
import { MessageCard } from '@advancedalgos/web-components'
import { MessageCard } from '@superalgos/web-components'
import log from '../../../utils/log'
@@ -0,0 +1,180 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Paper from '@material-ui/core/Paper'
import Grid from '@material-ui/core/Grid'
import Button from '@material-ui/core/Button'
import { withStyles } from '@material-ui/core/styles'
import { Link } from 'react-router-dom'
import ManageTeamProfileView from './ManageTeamProfileView'
import ManageTeamProfileEdit from './ManageTeamProfileEdit'
import log from '../../../utils/log'
const styles = theme => ({
root: {
flexGrow: 1
},
'@global': {
body: {
backgroundColor: theme.palette.common.white
}
},
layout: {
width: 'auto',
marginLeft: theme.spacing.unit * 3,
marginRight: theme.spacing.unit * 3,
marginBottom: theme.spacing.unit * 6,
[theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: {
width: 800,
marginLeft: 'auto',
marginRight: 'auto'
}
},
paper: {
marginTop: 0,
marginBottom: theme.spacing.unit * 1,
padding: 0,
[theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: {
marginTop: theme.spacing.unit * 3,
marginBottom: theme.spacing.unit * 2,
padding: `0 0 ${theme.spacing.unit * 2}px`
}
},
heroContent: {
maxWidth: 800,
margin: '0 auto',
padding: 0
},
teamContent: {
margin: `${theme.spacing.unit * 1}px ${theme.spacing.unit * 3}px 0 0`
},
banner: {
maxWidth: '100%',
height: 'auto'
},
avatar: {
maxWidth: 100,
height: 100,
margin: `${theme.spacing.unit * 1}px 0 0 ${theme.spacing.unit * 3}px `
},
profileButtons: {
width: '90%',
margin: `${theme.spacing.unit * 3}px auto 0`,
padding: `${theme.spacing.unit * 2}px ${theme.spacing.unit * 2}px 0`,
borderTop: '1px solid #CCCCCC'
}
})
export class ManageTeamProfile extends Component {
constructor (props) {
super(props)
this.toggleEdit = this.toggleEdit.bind(this)
this.handleSave = this.handleSave.bind(this)
this.handleUpdate = this.handleUpdate.bind(this)
this.state = {
edit: false,
save: false
}
}
render () {
const { classes, team, slug, match } = this.props
log.debug('ManageTeamProfile render', this.state)
return (
<div className='container'>
<main className={classes.layout}>
<Paper className={classes.paper}>
<div className={classes.heroContent}>
{!this.state.edit && <ManageTeamProfileView team={team} />}
{this.state.edit &&
<ManageTeamProfileEdit
team={team}
slug={slug}
match={match}
save={this.state.save}
handleUpdate={this.handleUpdate}
/>
}
<Grid container justify='flex-end' direction='row' spacing={24} className={classes.profileButtons}>
{!this.state.edit &&
<React.Fragment>
<Grid item>
<Button
component={Link}
to='/teams/manage-teams'
color='primary'
variant='contained'
>
Back to all teams
</Button>
</Grid>
<Grid item>
<Button
onClick={e => this.toggleEdit()}
color='secondary'
variant='contained'
>
Edit Profile
</Button>
</Grid>
</React.Fragment>
}
{this.state.edit &&
<React.Fragment>
<Grid item>
<Button
onClick={e => this.toggleEdit()}
variant='contained'
color='primary'
>
Cancel
</Button>
</Grid>
<Grid item>
<Button
onClick={e => this.handleSave(e)}
variant='contained'
color='secondary'
>
Save Changes
</Button>
</Grid>
</React.Fragment>
}
</Grid>
</div>
</Paper>
</main>
</div>
)
}
toggleEdit () {
this.setState({ edit: !this.state.edit })
}
handleSave (e) {
e.preventDefault()
log.debug('handleSave')
this.setState({ save: true })
}
handleUpdate () {
log.debug('handleUpdate')
this.setState({ edit: false, save: false })
}
}
ManageTeamProfile.propTypes = {
classes: PropTypes.object.isRequired,
team: PropTypes.object.isRequired,
match: PropTypes.object.isRequired,
slug: PropTypes.string.isRequired
}
export default withStyles(styles)(ManageTeamProfile)
@@ -0,0 +1,379 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Mutation } from 'react-apollo'
import { withStyles } from '@material-ui/core/styles'
import Grid from '@material-ui/core/Grid'
import TextField from '@material-ui/core/TextField'
import Typography from '@material-ui/core/Typography'
import { ImageUpload } from '@superalgos/web-components'
import UPDATE_TEAM_PROFILE from '../../../graphql/teams/UpdateTeamProfileMutation'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import { checkGraphQLError } from '../../../utils/graphql-errors'
import log from '../../../utils/log'
const styles = theme => ({
root: {
flexGrow: 1
},
'@global': {
body: {
backgroundColor: theme.palette.common.white
}
},
layout: {
width: '100%',
marginBottom: theme.spacing.unit * 6,
[theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: {
width: 800,
marginLeft: 'auto',
marginRight: 'auto'
}
},
paper: {
marginTop: 0,
marginBottom: theme.spacing.unit * 3,
padding: 0,
[theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: {
marginTop: theme.spacing.unit * 3,
marginBottom: theme.spacing.unit * 6,
padding: `0 0 ${theme.spacing.unit * 2}px`
}
},
heroContent: {
maxWidth: 800,
margin: '0 auto',
padding: `0 0 ${theme.spacing.unit * 2}px`
},
editContentContainer: {
marginBottom: `${theme.spacing.unit * 3}px`
},
metaContainer: {
marginTop: `${theme.spacing.unit * 1}px`,
alignSelf: 'stretch',
borderRight: '1px solid #CCCCCC'
},
teamMeta: {
margin: `${theme.spacing.unit * 3}px 0 0`,
paddingLeft: `${theme.spacing.unit * 2}px`,
textAlign: 'center',
height: '100%'
},
teamContent: {
'& h2': {
padding: `${theme.spacing.unit * 4}px ${theme.spacing.unit * 3}px 0`
},
'& h4': {
padding: `0 ${theme.spacing.unit * 3}px 0`
},
'& h6': {
padding: `0 ${theme.spacing.unit * 3}px 0`
}
},
editInput: {
padding: `0 ${theme.spacing.unit * 3}px ${theme.spacing.unit * 2}px`,
'& label': {
display: 'none',
padding: `0 ${theme.spacing.unit * 4}px 0`
}
},
banner: {
maxWidth: '100%',
height: 'auto',
width: '100%'
},
avatar: {
maxWidth: 125,
height: 125,
margin: `0 auto ${theme.spacing.unit * 2}px`,
verticalAlign: 'middle',
borderRadius: '50%'
}
})
export class ManageTeamProfileEdit extends Component {
constructor (props) {
super(props)
this.handleClickOpen = this.handleClickOpen.bind(this)
this.handleClose = this.handleClose.bind(this)
this.handleChange = this.handleChange.bind(this)
this.handleSubmit = this.handleSubmit.bind(this)
this.handleAvatar = this.handleAvatar.bind(this)
this.handleBanner = this.handleBanner.bind(this)
this.startSave = this.startSave.bind(this)
log.debug('ManageTeamProfileEdit constructor', props.team)
const motto = props.team.profile.motto || ''
const description = props.team.profile.description || ''
const avatar = props.team.profile.avatar || null
const banner = props.team.profile.banner || null
this.state = {
open: false,
motto: motto,
description: description,
avatar: avatar,
banner: banner,
save: false
}
}
render () {
const { classes, team, match, save, handleUpdate } = this.props
log.debug('ManageTeamProfileEdit render', this.props, this.props.slug, this.props.team, match)
const created = new Date(team.createdAt)
return (
<Mutation
mutation={UPDATE_TEAM_PROFILE}
refetchQueries={[
{
query: GET_TEAMS_BY_OWNER
}
]}
>
{(updateTeamProfile, { loading, error, data }) => {
const AzureStorageUrl = process.env.AZURE_STORAGE_URL_TEAMS
const AzureStorageSAS = process.env.AZURE_STORAGE_SAS_TEAMS
const containerName = team.slug
let avatar = null
if (this.state.avatar === null && team.profile !== null && (team.profile.avatar === undefined || team.profile.avatar === null)) avatar = process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
if (team.profile !== null && team.profile.avatar !== undefined && team.profile.avatar !== null) avatar = team.profile.avatar
if (this.state.avatar !== null) avatar = this.state.avatar
let banner = null
if (this.state.banner === null && team.profile !== null && (team.profile.banner === undefined || team.profile.banner === null)) banner = process.env.STORAGE_URL + '/module-teams/module-default/aa-banner-default.png'
if (team.profile !== null && team.profile.banner !== undefined && team.profile.banner !== null) banner = team.profile.banner
if (this.state.banner !== null) banner = this.state.banner
log.debug('team images: ', avatar, banner)
log.debug('saving profile status: ', save)
if (save && !this.state.save) {
log.debug('saving profile: ', save)
this.startSave(updateTeamProfile, team.slug, handleUpdate)
}
let errors
let loader
if (loading) {
loader = (
<Typography variant='caption'>Updating profile...</Typography>
)
}
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
const displayMessage = checkGraphQLError(message)
log.debug('updateTeamProfile error:', displayMessage)
return (
<Typography key={i} variant='caption'>
{message}
</Typography>
)
})
}
return (
<React.Fragment>
<ImageUpload
key='banner'
handleUrl={this.handleBanner}
fileName={`${team.slug}-banner.jpg`}
containerName={containerName}
existingImage={banner}
imagePreviewConfig={{
width: '800px',
height: '200px',
title: 'Change Banner',
fontSize: '1.5em'
}}
cropContainerConfig={{ x: 10, y: 10, width: 800, height: 200 }}
cropPreviewBox={{ width: 650, height: 200 }}
saveImageConfig={{
quality: 0.6,
maxWidth: 800,
maxHeight: 200,
autoRotate: true,
mimeType: 'image/jpeg'
}}
containerStyle={{
display: 'block',
margin: 0,
height: '200px',
width: '800px',
overflow: 'visible'
}}
AzureStorageUrl={AzureStorageUrl}
AzureSASURL={AzureStorageSAS}
cropRatio={4}
/>
<Grid container className={classes.editContentContainer}>
<Grid item md={3} className={classes.metaContainer}>
<Grid container className={classes.teamMeta} direction='column' justify='flex-start'>
<Grid item>
<ImageUpload
key='avatar1'
handleUrl={this.handleAvatar}
fileName={`${team.slug}-avatar.jpg`}
containerName={containerName}
existingImage={avatar}
imagePreviewConfig={{
width: '125px',
height: '125px',
title: 'Change Avatar',
fontSize: '1.5em'
}}
cropContainerConfig={{ x: 10, y: 10, width: 200, height: 200 }}
cropPreviewBox={{ width: 350, height: 350 }}
saveImageConfig={{
quality: 0.6,
maxWidth: 200,
maxHeight: 200,
autoRotate: true,
mimeType: 'image/jpeg'
}}
containerStyle={{
display: 'block',
margin: '0 auto 12px',
height: '125px',
width: '125px',
overflow: 'visible'
}}
dropzoneStyle={{
height: 125,
title: 'Drop new image or click to select'
}}
AzureStorageUrl={AzureStorageUrl}
AzureSASURL={AzureStorageSAS}
cropRatio={1}
/>
</Grid>
<Typography variant='subtitle1' paragraph gutterBottom>
Members: {team.members.length}
</Typography>
<Typography variant='subtitle1' paragraph gutterBottom>
Financial Beings: 1
</Typography>
<Typography variant='subtitle1' paragraph gutterBottom>
Created: {created.toLocaleDateString()}
</Typography>
</Grid>
</Grid>
<Grid item md={9}>
<Grid container className={classes.teamContent} direction='column'>
<Typography
variant='h2'
color='textPrimary'
gutterBottom
>
{team.name}
</Typography>
<Typography
variant='h4'
color='textSecondary'
>
Motto:
</Typography>
<TextField
autoFocus
margin='dense'
id='motto'
type='text'
fullWidth
value={this.state.motto}
onChange={this.handleChange}
className={classes.editInput}
/>
<Typography variant='h6' color='textPrimary'>
Description:
</Typography>
<TextField
margin='dense'
id='description'
type='text'
rows={4}
multiline
fullWidth
value={this.state.description}
onChange={this.handleChange}
className={classes.editInput}
/>
<Typography variant='h6' color='secondary'>
{loader}
{errors}
</Typography>
</Grid>
</Grid>
</Grid>
</React.Fragment>
)
}}
</Mutation>
)
}
handleClickOpen () {
this.setState({ open: true })
}
handleClose () {
this.setState({ open: false })
}
handleChange (e) {
log.debug('handleChange: ', e.target.id, e.target.value)
switch (e.target.id) {
case 'motto':
this.setState({ motto: e.target.value })
break
case 'description':
this.setState({ description: e.target.value })
break
default:
}
}
handleAvatar (avatarUrl) {
log.debug('handleAvatar: ', avatarUrl)
this.setState({ avatar: `${avatarUrl}?${Math.random()}` })
}
handleBanner (bannerUrl) {
log.debug('handleBanner: ', bannerUrl)
this.setState({ banner: `${bannerUrl}?${Math.random()}` })
}
startSave (updateTeamProfile, slug, handleUpdate) {
this.setState({ save: 'done' })
this.handleSubmit(updateTeamProfile, slug, handleUpdate)
}
async handleSubmit (updateTeamProfile, slug, handleUpdate) {
log.debug('updateTeamProfile, handleSubmit: ', this.state)
await updateTeamProfile({
variables: {
slug,
owner: this.authId,
description: this.state.description,
motto: this.state.motto,
avatar: this.state.avatar,
banner: this.state.banner
}
})
window.canvasApp.eventHandler.raiseEvent('User Profile Changed')
handleUpdate()
}
}
ManageTeamProfileEdit.propTypes = {
classes: PropTypes.object.isRequired,
slug: PropTypes.string.isRequired,
team: PropTypes.object,
match: PropTypes.object,
save: PropTypes.bool,
handleUpdate: PropTypes.func
}
export default withStyles(styles)(ManageTeamProfileEdit)
@@ -0,0 +1,210 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Mutation } from 'react-apollo'
import { withStyles } from '@material-ui/core/styles'
import Grid from '@material-ui/core/Grid'
import Button from '@material-ui/core/Button'
import EditIcon from '@material-ui/icons/Edit'
import Dialog from '@material-ui/core/Dialog'
import DialogContent from '@material-ui/core/DialogContent'
import Typography from '@material-ui/core/Typography'
import { ImageUpload } from '@superalgos/web-components'
import UPDATE_FB from '../../../graphql/teams/UpdateFBMutation'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import { checkGraphQLError } from '../../../utils/graphql-errors'
import log from '../../../utils/log'
const styles = theme => ({
dialogTitle: {
textAlign: 'center',
paddingBottom: `${theme.spacing.unit * 2}px`
},
buttonRight: {
justifyContent: 'flex-end'
}
})
export class ManageTeamProfileFBEdit extends Component {
constructor (props) {
super(props)
this.handleClickOpen = this.handleClickOpen.bind(this)
this.handleClose = this.handleClose.bind(this)
this.handleSubmit = this.handleSubmit.bind(this)
this.handleAvatar = this.handleAvatar.bind(this)
const avatar = props.fb.avatar || ''
this.state = {
open: false,
avatar: avatar
}
}
render () {
log.debug('ManageTeamProfileFBEdit ', this.props, this.props.slug, this.props.fb)
const { classes, fb, slug } = this.props
return (
<Mutation
mutation={UPDATE_FB}
refetchQueries={[
{
query: GET_TEAMS_BY_OWNER
}
]}
>
{(updateFB, { loading, error, data }) => {
const AzureStorageUrl = process.env.AZURE_STORAGE_URL_TEAMS
const AzureStorageSAS = process.env.AZURE_STORAGE_SAS_TEAMS
const containerName = slug
let avatar = null
if (this.state.avatar === null && fb.avatar === undefined) avatar = process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
if (fb.avatar !== undefined && fb.avatar !== null) avatar = fb.avatar
if (this.state.avatar !== null) avatar = this.state.avatar
let errors
let loader
if (loading) {
loader = (
<Typography variant='caption'>Updating avatar...</Typography>
)
}
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
const displayMessage = checkGraphQLError(message)
log.debug('updateTeamProfile error:', displayMessage)
return (
<Typography key={i} variant='caption'>
{message}
</Typography>
)
})
}
log.debug('ManageTeamProfileFBEdit mutation:', classes)
return (
<div>
<Button
size='small'
color='primary'
className={classes.buttonRight}
onClick={this.handleClickOpen}
>
<EditIcon /> Edit
</Button>
<Dialog
open={this.state.open}
onClose={this.handleClose}
aria-labelledby='form-dialog-title'
>
<DialogContent>
<Grid container justify='center' direction='column'>
<Grid item className={classes.dialogTitle}>
<Typography variant='h4'>
Edit Financial Being
</Typography>
</Grid>
<ImageUpload
key='avatar'
handleUrl={this.handleAvatar}
fileName={`${fb.slug}-fb-avatar.jpg`}
containerName={containerName}
existingImage={avatar}
imagePreviewConfig={{
width: '125px',
height: '125px',
title: 'Change FB Avatar',
fontSize: '1.5em'
}}
cropContainerConfig={{ x: 10, y: 10, width: 200, height: 200 }}
cropPreviewBox={{ width: 350, height: 350 }}
saveImageConfig={{
quality: 0.6,
maxWidth: 200,
maxHeight: 200,
autoRotate: true,
mimeType: 'image/jpeg'
}}
containerStyle={{
display: 'block',
margin: '0 auto 3em',
height: '125px',
width: '125px',
overflow: 'visible'
}}
dropzoneStyle={{
height: 125,
title: 'Drop new image or click to select'
}}
AzureStorageUrl={AzureStorageUrl}
AzureSASURL={AzureStorageSAS}
cropRatio={1}
debug
/>
{loader}
{errors}
<Grid container justify='center' alignItems='center' direction='column'>
<Button
onClick={e => {
this.handleSubmit(e, updateFB, fb.id, slug)
}}
color='secondary'
variant='contained'
size='small'
>
Update Financial Being
</Button>
<Button onClick={this.handleClose} color='primary'>
Cancel
</Button>
</Grid>
</Grid>
</DialogContent>
</Dialog>
</div>
)
}}
</Mutation>
)
}
handleClickOpen () {
this.setState({ open: true })
}
handleClose () {
this.setState({ open: false })
}
handleAvatar (avatarUrl) {
log.debug('handleAvatar: ', avatarUrl)
this.setState({ avatar: `${avatarUrl}?${Math.random()}` })
}
async handleSubmit (e, updateFB, fbId, slug) {
log.debug('handleSubmit: ', this.state)
e.preventDefault()
await updateFB({
variables: {
fbId,
avatar: this.state.avatar
}
})
window.canvasApp.eventHandler.raiseEvent('User Profile Changed')
this.setState({ open: false })
}
}
ManageTeamProfileFBEdit.propTypes = {
classes: PropTypes.object.isRequired,
slug: PropTypes.string.isRequired,
fb: PropTypes.object
}
export default withStyles(styles)(ManageTeamProfileFBEdit)
@@ -0,0 +1,78 @@
import React from 'react'
import PropTypes from 'prop-types'
import Grid from '@material-ui/core/Grid'
import Card from '@material-ui/core/Card'
import CardContent from '@material-ui/core/CardContent'
import CardActions from '@material-ui/core/CardActions'
import CardMedia from '@material-ui/core/CardMedia'
import Typography from '@material-ui/core/Typography'
import { withStyles } from '@material-ui/core/styles'
import ManageTeamProfileFBEdit from './ManageTeamProfileFBEdit'
import log from '../../../utils/log'
const styles = theme => ({
fbContainer: {
margin: `0 0 ${theme.spacing.unit * 2}px`
},
card: {
display: 'flex',
width: '100%'
},
cardDetails: {
display: 'flex',
flex: 1
},
cardContent: {
flex: 1
},
cardMedia: {
flex: 1,
width: 100,
height: 100,
maxWidth: 100,
justifyContent: 'flex-start'
}
})
export const ManageTeamProvileFBView = ({ classes, team }) => {
log.debug('ManageTeamProvileFBView', team, team.fb[0], team.fb[0].avatar)
let fbs = team.fb;
return fbs.map((fb, index) => {
let avatar = (fb.avatar !== undefined && fb.avatar !== null) ? fb.avatar : process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
return (
<Grid item xs={12} className={classes.fbContainer} key={`fb-${index}`}>
<Card className={classes.card}>
<div className={classes.cardDetails}>
<CardMedia
className={classes.cardMedia}
image={avatar}
title={fb.name}
/>
<CardContent className={classes.cardContent}>
<Typography gutterBottom variant='h5' component='h2'>
{fb.name}
</Typography>
<Typography variant='caption' color='textSecondary'>
{fb.kind}
</Typography>
</CardContent>
<CardActions>
<ManageTeamProfileFBEdit slug={team.slug} fb={fb} />
</CardActions>
</div>
</Card>
</Grid>
)
})
}
ManageTeamProvileFBView.propTypes = {
classes: PropTypes.object.isRequired,
team: PropTypes.object.isRequired
}
export default withStyles(styles)(ManageTeamProvileFBView)
@@ -0,0 +1,155 @@
import React from 'react'
import PropTypes from 'prop-types'
import Typography from '@material-ui/core/Typography'
import Grid from '@material-ui/core/Grid'
import { withStyles } from '@material-ui/core/styles'
import ManageTeamProfileFBView from './ManageTeamProfileFBView'
const styles = theme => ({
root: {
flexGrow: 1
},
'@global': {
body: {
backgroundColor: theme.palette.common.white
}
},
layout: {
width: '100%',
marginBottom: theme.spacing.unit * 6,
[theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: {
width: 800,
marginLeft: 'auto',
marginRight: 'auto'
}
},
paper: {
marginTop: 0,
marginBottom: theme.spacing.unit * 3,
padding: 0,
[theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: {
marginTop: theme.spacing.unit * 3,
marginBottom: theme.spacing.unit * 6,
padding: `0 0 ${theme.spacing.unit * 2}px`
}
},
heroContent: {
maxWidth: 800,
margin: '0 auto',
padding: `0 0 ${theme.spacing.unit * 2}px`
},
metaContainer: {
marginTop: `${theme.spacing.unit * 1}px`,
alignSelf: 'stretch',
borderRight: '1px solid #CCCCCC'
},
teamMeta: {
margin: `${theme.spacing.unit * 3}px 0 0`,
paddingLeft: `${theme.spacing.unit * 2}px`,
textAlign: 'center'
},
teamContent: {
'& h2': {
padding: `${theme.spacing.unit * 4}px ${theme.spacing.unit * 3}px 0`
},
'& h4': {
padding: `0 ${theme.spacing.unit * 3}px ${theme.spacing.unit * 1}px`
},
'& h6': {
padding: `0 ${theme.spacing.unit * 3}px 0`
}
},
fbContent: {
borderTop: '1px solid #CCCCCC',
width: '90%',
margin: `${theme.spacing.unit * 3}px auto`,
paddingTop: `${theme.spacing.unit * 3}px`
},
banner: {
maxWidth: '100%',
height: 'auto',
width: '100%'
},
avatar: {
maxWidth: 125,
height: 125,
margin: `0 auto ${theme.spacing.unit * 2}px`,
verticalAlign: 'middle',
borderRadius: '50%'
},
backLink: {
display: 'block',
textDecoration: 'none',
margin: `${theme.spacing.unit * 3}px 0 0`,
color: theme.palette.secondary.main
}
})
const ManageTeamProfileView = ({ classes, team }) => {
let avatar = team.profile.avatar || process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
let banner = team.profile.banner || process.env.STORAGE_URL + '/module-teams/module-default/aa-banner-default.png'
const created = new Date(team.createdAt)
return (
<React.Fragment>
<img src={banner} alt={team.name} className={classes.banner} />
<Grid container>
<Grid item md={3} className={classes.metaContainer}>
<Grid container className={classes.teamMeta} direction='column' justify='center'>
<img src={avatar} alt={team.name} className={classes.avatar} />
<Typography variant='subtitle1' paragraph gutterBottom>
Members: {team.members.length}
</Typography>
<Typography variant='subtitle1' paragraph gutterBottom>
Financial Beings: 1
</Typography>
<Typography variant='subtitle1' paragraph gutterBottom>
Created: {created.toLocaleDateString()}
</Typography>
</Grid>
</Grid>
<Grid item md={9}>
<Grid container className={classes.teamContent} direction='column'>
<Typography
variant='h2'
color='textPrimary'
gutterBottom
>
{team.name}
</Typography>
<Typography
variant='h4'
color='textSecondary'
gutterBottom
>
Motto: {team.profile.motto}
</Typography>
<Typography variant='h6' color='textPrimary' gutterBottom>
Description: {team.profile.description}
</Typography>
</Grid>
<Grid container className={classes.fbContent} direction='column'>
<Typography
variant='h4'
color='textSecondary'
gutterBottom
>
Financial Beings
</Typography>
<ManageTeamProfileFBView team={team} />
</Grid>
</Grid>
</Grid>
</React.Fragment>
)
}
ManageTeamProfileView.propTypes = {
classes: PropTypes.object.isRequired,
team: PropTypes.object.isRequired
}
export default withStyles(styles)(ManageTeamProfileView)
@@ -0,0 +1,121 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Paper from '@material-ui/core/Paper'
import Grid from '@material-ui/core/Grid'
import Button from '@material-ui/core/Button'
import { withStyles } from '@material-ui/core/styles'
import { Link } from 'react-router-dom'
import CreateTeamForm from './CreateTeamForm'
const styles = theme => ({
root: {
flexGrow: 1
},
'@global': {
body: {
backgroundColor: theme.palette.common.white
}
},
layout: {
width: 'auto',
marginLeft: theme.spacing.unit * 3,
marginRight: theme.spacing.unit * 3,
marginBottom: theme.spacing.unit * 6,
[theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: {
width: 800,
marginLeft: 'auto',
marginRight: 'auto'
}
},
paper: {
marginTop: 0,
marginBottom: theme.spacing.unit * 3,
padding: 0,
[theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: {
marginTop: theme.spacing.unit * 3,
marginBottom: theme.spacing.unit * 6,
padding: `0 0 ${theme.spacing.unit * 6}px`
}
},
heroContent: {
maxWidth: 800,
margin: '0 auto',
padding: 0
},
teamContent: {
margin: `${theme.spacing.unit * 1}px ${theme.spacing.unit * 3}px 0 0`
},
banner: {
maxWidth: '100%',
height: 'auto'
},
avatar: {
maxWidth: 100,
height: 100,
margin: `${theme.spacing.unit * 1}px 0 0 ${theme.spacing.unit * 3}px `
},
backLink: {
display: 'block',
textDecoration: 'none',
margin: `${theme.spacing.unit * 3}px 0 0`,
color: theme.palette.secondary.main
}
})
export class ManageTeamProfile extends Component {
constructor (props) {
super(props)
this.toggleEdit = this.toggleEdit.bind(this)
this.handleSave = this.handleSave.bind(this)
this.state = {
edit: false,
save: false
}
}
render () {
const { classes, team, slug, match } = this.props
return (
<div className='container'>
<Paper>
<Grid container spacing={0} direction='column' justify='stretch' alignItems='center'>
<Grid item xs={10}>
<Typography variant='h5' align='center'>
You don&rsquo;t have any teams. Create one!
</Typography>
<Typography variant='body1' align='center' gutterBottom>
To begin developing on the Superalgos platform, as well as participate in Algobot competitions,
you'll need to create a team. A default trading algobot will be cloned and added to your team so
that you can begin experimenting right away.
</Typography>
<CreateTeamForm />
</Grid>
</Grid>
</Paper>
</div>
)
}
toggleEdit () {
this.setState({ edit: !this.state.edit })
}
handleSave () {
this.setState({ save: !this.state.edit })
}
}
ManageTeamProfile.propTypes = {
classes: PropTypes.object.isRequired,
team: PropTypes.object.isRequired,
match: PropTypes.object.isRequired,
slug: PropTypes.string.isRequired
}
export default withStyles(styles)(ManageTeamProfile)
@@ -7,20 +7,22 @@ import CardActions from '@material-ui/core/CardActions'
import CardContent from '@material-ui/core/CardContent'
import CardMedia from '@material-ui/core/CardMedia'
import Typography from '@material-ui/core/Typography'
import Button from '@material-ui/core/Button'
import EditIcon from '@material-ui/icons/Edit'
import { Link } from 'react-router-dom'
import ManageTeamDetails from './ManageTeamDetails'
import ManageTeamDelete from './ManageTeamDelete'
import ManageTeamEdit from './ManageTeamEdit'
import log from '../../../utils/log'
export const ManageTeamsItem = ({ classes, team, ...props }) => {
export const ManageTeamsItem = ({ classes, team, match, ...props }) => {
log.debug('ManageTeamsItem', team, team.profile, team.profile.avatar)
let avatar
if (team.profile.avatar !== undefined && team.profile.avatar !== 'a') {
avatar = team.profile.avatar
} else {
avatar = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-avatar-default.png'
avatar = process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
}
return (
<Grid item xs={12}>
@@ -36,13 +38,22 @@ export const ManageTeamsItem = ({ classes, team, ...props }) => {
{team.name}
</Typography>
<Typography variant='caption' color='textSecondary'>
{team.createdAt} | Members: {team.members.length}
Members: {team.members.length} | Financial Beings: {1}
</Typography>
</CardContent>
<CardActions>
<ManageTeamDetails team={team} />
<ManageTeamEdit slug={team.slug} team={team} {...props} />
<ManageTeamDelete slug={team.slug} botSlug={team.fb[0].slug} />
<Grid container direction='row' justify='flex-end'>
<Button
size='small'
color='primary'
className={classes.buttonRight}
component={Link}
to={`${match.url}/${team.slug}`}
>
<EditIcon /> Manage Profile
</Button>
<ManageTeamDelete slug={team.slug} botSlug={team.fb[0].slug} />
</Grid>
</CardActions>
</div>
</Card>
@@ -52,7 +63,8 @@ export const ManageTeamsItem = ({ classes, team, ...props }) => {
ManageTeamsItem.propTypes = {
classes: PropTypes.object.isRequired,
team: PropTypes.object.isRequired
team: PropTypes.object.isRequired,
match: PropTypes.object
}
export default ManageTeamsItem
@@ -3,21 +3,37 @@ import PropTypes from 'prop-types'
import { Query } from 'react-apollo'
import Grid from '@material-ui/core/Grid'
import { MessageCard } from '@advancedalgos/web-components'
import Paper from '@material-ui/core/Paper'
import Typography from '@material-ui/core/Typography'
import { MessageCard } from '@superalgos/web-components'
import { withStyles } from '@material-ui/core/styles'
import { isEmpty } from '../../../utils/js-helpers'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import ManageTeamsItem from './ManageTeamsItem'
import CreateTeamDialog from './CreateTeamDialog'
import ManageTeamProfile from './ManageTeamProfile'
import CreateTeamForm from './CreateTeamForm'
import log from '../../../utils/log'
const styles = theme => ({
root: {
flexGrow: 1
},
typography: {
width: '80%',
marginLeft: '10%',
marginTop: 40
},
heroContent: {
maxWidth: 600,
margin: '0 auto',
padding: `${theme.spacing.unit * 8}px 0 ${theme.spacing.unit * 6}px`
maxWidth: 800,
margin: `${theme.spacing.unit * 4}px auto`,
padding: 0
},
newTeamContainer: {
padding: `${theme.spacing.unit * 4}px 0`
},
cardGrid: {
padding: `${theme.spacing.unit * 8}px 0`
@@ -42,16 +58,25 @@ const styles = theme => ({
height: 100,
maxWidth: 100,
justifyContent: 'flex-start'
},
paper: {
width: '100%',
flexGrow: 1,
padding: 10,
marginTop: '5%',
marginBottom: '10%'
}
})
export const ManageTeamsList = ({ classes, user = null, ...props }) => (
export const ManageTeamsList = ({ classes, match, ...props }) => (
<Query
query={GET_TEAMS_BY_OWNER}
fetchPolicy='network-only'
>
{({ loading, error, data }) => {
log.debug('GET_TEAMS_BY_OWNER: ', loading, error, data)
let slug = null
if (!isEmpty(match.params) && match.params.slug) slug = match.params.slug
let errors = null
if (error) {
@@ -62,40 +87,78 @@ export const ManageTeamsList = ({ classes, user = null, ...props }) => (
if (!loading && !error) {
if (data.teams_TeamsByOwner.length > 0) {
return (
<React.Fragment>
<Grid container spacing={40}>
{!loading &&
data.teams_TeamsByOwner.map(team => (
<ManageTeamsItem
key={team.id}
team={team}
classes={classes}
{...props}
/>
))}
{errors}
</Grid>
</React.Fragment>
<div className={classes.root}>
<div className={slug === null ? classes.heroContent : ''}>
<Grid container spacing={8} direction='column' alignItems='stretch'>
{!loading &&
data.teams_TeamsByOwner.map(team => {
if (slug === team.slug) {
return (
<ManageTeamProfile
key={`team-profile-${team.id}`}
team={team}
slug={team.slug}
match={match}
{...props}
/>
)
} else {
return (
<ManageTeamsItem
key={`team-list-${team.id}`}
team={team}
classes={classes}
match={match}
{...props}
/>
)
}
})}
{errors}
</Grid>
</div>
</div>
)
} else {
return (
<Grid container spacing={40}>
<Grid item xs={10}>
<MessageCard message='You don&rsquo;t have any teams. Create one!'>
<CreateTeamDialog />
</MessageCard>
</Grid>
</Grid>
<div className='container'>
<Paper className={classes.paper} >
<Typography className={classes.typography} variant='h5' gutterBottom>
Your First Team
</Typography>
<Typography className={classes.typography} variant='body1' gutterBottom align='left'>
Whether you are a trader willing to try out the Strategizer or a developer with more complex aspirations, the first thing you will need is to create a Team.
</Typography>
<Typography className={classes.typography} variant='body1' gutterBottom align='left'>
At the time of Team creation, the platform will fork two template Finacial Beings to get you started.
</Typography>
<CreateTeamForm />
</Paper>
</div>
)
}
} else {
return (
<Grid container spacing={40}>
<Grid item xs={12}>
<MessageCard message='Loading...' />
{errors !== null && <MessageCard message={errors} />}
<div className={classes.root} >
<Grid container spacing={0} direction='column' justify='center' alignItems='center'>
<Grid item xs={12}>
{errors === null &&
<Typography variant='h5' align='center' gutterBottom>
Loading...
</Typography>
}
{errors !== null &&
<Typography variant='h5' align='center' gutterBottom>
{errors}
</Typography>
}
</Grid>
</Grid>
</Grid>
</div>
)
}
}}
@@ -104,7 +167,8 @@ export const ManageTeamsList = ({ classes, user = null, ...props }) => (
ManageTeamsList.propTypes = {
user: PropTypes.any,
classes: PropTypes.object.isRequired
classes: PropTypes.object.isRequired,
match: PropTypes.object
}
export default withStyles(styles)(ManageTeamsList)
+13 -16
View File
@@ -1,28 +1,25 @@
import React from 'react'
import PropTypes from 'prop-types'
import Typography from '@material-ui/core/Typography'
import { withStyles } from '@material-ui/core/styles'
import { BannerTopBar } from '../common'
import ManageTeamsList from './components/ManageTeamsList'
const styles = theme => ({
tableContainer: {
height: 320
}
})
const ManageTeams = ({ classes, ...props }) => (
const ManageTeams = ({ match, ...props }) => (
<div>
<Typography variant='h4' gutterBottom>
Manage Your Teams
</Typography>
<ManageTeamsList {...props} />
<BannerTopBar
size={match.params.slug !== undefined ? 'small' : 'medium'}
title='Your Teams'
text='Create and manage your teams here.'
backgroundUrl='https://superalgos.org/img/photos/teams.jpg'
/>
<div className='container'>
<ManageTeamsList {...props} match={match} />
</div>
</div>
)
ManageTeams.propTypes = {
classes: PropTypes.object.isRequired
match: PropTypes.object
}
export default withStyles(styles)(ManageTeams)
export default ManageTeams
+1 -1
View File
@@ -5,7 +5,7 @@ import Typography from '@material-ui/core/Typography'
import { withStyles } from '@material-ui/core/styles'
import Grid from '@material-ui/core/Grid'
import { MessageCard } from '@advancedalgos/web-components'
import { MessageCard } from '@superalgos/web-components'
const styles = theme => ({
heroContent: {
@@ -0,0 +1,207 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Mutation } from 'react-apollo'
import { withStyles } from '@material-ui/core/styles'
import Button from '@material-ui/core/Button'
import AddIcon from '@material-ui/icons/Add'
import TextField from '@material-ui/core/TextField'
import FormControl from '@material-ui/core/FormControl'
import FormHelperText from '@material-ui/core/FormHelperText'
import Dialog from '@material-ui/core/Dialog'
import DialogActions from '@material-ui/core/DialogActions'
import DialogContent from '@material-ui/core/DialogContent'
import DialogTitle from '@material-ui/core/DialogTitle'
import Typography from '@material-ui/core/Typography'
import { isEmpty } from '../../../utils/js-helpers'
import SEND_MEMBER_INVITE from '../../../graphql/teams/SendMemberInvite'
// import { checkGraphQLError } from '../../../utils/graphql-errors'
const styles = theme => ({
dialogStyle: {
padding: '3em'
},
buttonRight: {
// position: 'absolute',
// right: '3em'
marginTop: '1em',
marginRight: 'auto',
marginLeft: 'auto',
display: 'block',
lineHeight: '1em'
}
})
export class InviteMemberDialog extends Component {
constructor (props) {
super(props)
this.handleClickOpen = this.handleClickOpen.bind(this)
this.handleClose = this.handleClose.bind(this)
this.handleChange = this.handleChange.bind(this)
this.handleSubmit = this.handleSubmit.bind(this)
this.validate = this.validate.bind(this)
this.state = {
open: false,
email: '',
errors: {
email: ''
}
}
}
render () {
const { classes, teamId } = this.props
if (this.state.open) {
return (
<Mutation mutation={SEND_MEMBER_INVITE} >
{(sendMemberInvite, { loading, error, data }) => {
console.log('sendMemberInvite: ', data)
let errors
let loader = null
if (loading) {
loader = (
<Typography variant='subtitle1'>Submitting invitation...</Typography>
)
}
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
// const displayMessage = checkGraphQLError(message)
return (
<Typography key={i} variant='caption'>
{message}
</Typography>
)
})
}
return (
<div>
<Button
variant='fab'
color='primary'
aria-label='Add'
className={classes.buttonRight}
onClick={this.handleClickOpen}
>
<AddIcon />
</Button>
<Dialog
open={this.state.open}
onClose={this.handleClose}
aria-labelledby='form-dialog-title'
>
<DialogTitle id='form-dialog-title'>Invite a New Team Member</DialogTitle>
<DialogContent>
{(data === undefined || data.sendMemberInviteSG !== 'Success') && (
<FormControl
required
error={this.state.errors.email !== '' || (error !== undefined || error !== null)}
>
<TextField
autoFocus
margin='dense'
id='email'
label='Email Address'
type='text'
fullWidth
value={this.state.email}
onChange={e => this.handleChange(e)}
error={this.state.errors.email !== ''}
/>
{this.state.errors.email !== '' && (
<FormHelperText>{this.state.errors.email}</FormHelperText>
)}
{error && <FormHelperText>{errors}</FormHelperText>}
{loader}
</FormControl>
)}
{data !== undefined && data.sendMemberInviteSG === 'Success' && (
<Typography variant='subtitle1'>Invitation successfully sent!</Typography>
)}
</DialogContent>
<DialogActions>
{(data === undefined || data.sendMemberInviteSG !== 'Success') && (
<React.Fragment>
<Button onClick={this.handleClose} color='primary'>
Cancel
</Button>
<Button
onClick={e => {
this.handleSubmit(e, sendMemberInvite, this.state.email, teamId)
}}
color='primary'
>
Send Invitation
</Button>
</React.Fragment>
)}
{data !== undefined && data.sendMemberInviteSG === 'Success' && (
<Button onClick={this.handleClose} color='primary'>
Close
</Button>
)}
</DialogActions>
</Dialog>
</div>
)
}}
</Mutation>
)
} else {
return (
<Button
variant='fab'
color='primary'
aria-label='Add'
className={classes.buttonRight}
onClick={this.handleClickOpen}
>
<AddIcon />
</Button>
)
}
}
handleClickOpen () {
this.setState({ open: true })
}
handleClose () {
this.setState({ open: false })
}
handleChange (e) {
const errors = this.validate(e.target.value)
if (isEmpty(errors)) {
this.setState({ errors: { email: '' } })
this.setState({ email: e.target.value })
} else {
this.setState({ errors: errors })
this.setState({ email: e.target.value })
}
}
async handleSubmit (e, sendMemberInvite, email, teamId) {
e.preventDefault()
console.log('sendMemberInvite submit: ', email, teamId)
await sendMemberInvite({ variables: { email, teamId } })
this.setState({ email: '' })
}
validate (data) {
const errors = {}
if (data === '') errors.email = 'Please enter an email address'
return errors
}
}
InviteMemberDialog.propTypes = {
classes: PropTypes.object.isRequired,
teamId: PropTypes.string
}
export default withStyles(styles)(InviteMemberDialog)
@@ -7,7 +7,7 @@ import Typography from '@material-ui/core/Typography'
import ManageMemberDelete from './ManageMemberDelete'
import ManageMemberRole from './ManageMemberRole'
import ManageMemberStatus from './ManageMemberStatus'
import { MessageCard } from '@advancedalgos/web-components'
import { MessageCard } from '@superalgos/web-components'
import log from '../../../utils/log'
@@ -32,7 +32,7 @@ export const ManageMembersItem = ({ classes, member, teamId, authId }) => {
</Typography>
</Grid>
<Grid item xs={4}>
<Typography color='textSecondary' variant='body2' component='h4' align='left' >
<Typography color='textSecondary' variant='body1' component='h4' align='left' >
{email !== null ? `${memberStatus[memberStatus.length - 1].status} | Sent: ${memberStatus[memberStatus.length - 1].createdAt}` : `${member.role} | Member since: `}
</Typography>
</Grid>
@@ -10,7 +10,7 @@ import Typography from '@material-ui/core/Typography'
import InviteMemberDialog from './InviteMemberDialog'
import ManageMembersItem from './ManageMembersItem'
import { MessageCard } from '@advancedalgos/web-components'
import { MessageCard } from '@superalgos/web-components'
import log from '../../../utils/log'
@@ -63,7 +63,7 @@ export const ManageMembersTeamItem = ({ classes, team, authId }) => {
if (team.profile.avatar !== undefined && team.profile.avatar !== 'a') {
avatar = team.profile.avatar
} else {
avatar = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-avatar-default.png'
avatar = process.env.STORAGE_URL + '/module-teams/module-default/aa-avatar-default.png'
}
if (team.members.length > 0) {
return (
+2 -7
View File
@@ -1,11 +1,10 @@
import React from 'react'
import PropTypes from 'prop-types'
import Typography from '@material-ui/core/Typography'
import { withStyles } from '@material-ui/core/styles'
// import ManageTeamMembersList from './components/ManageTeamMembersList'
import { MessageCard } from '@advancedalgos/web-components'
import { BannerTopBar } from '../common'
const styles = theme => ({
tableContainer: {
@@ -15,11 +14,7 @@ const styles = theme => ({
const TeamMembers = ({ classes }) => (
<div>
<Typography variant='h4' gutterBottom>
Team Members
<MessageCard message='Coming soon. Invite and manage team members.' />
</Typography>
<BannerTopBar size='big' title='Team Members' text='Coming soon. Invite and manage team members.' backgroundUrl='https://superalgos.org/img/photos/teams.jpg' />
</div>
)
+1 -1
View File
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types'
import { parse } from '../../utils/js-helpers'
import log from '../../utils/log'
import { MessageCard } from '@advancedalgos/web-components'
import { MessageCard } from '@superalgos/web-components'
class AcceptTeamInvite extends Component {
render () {
Loaded 100 of 110 files, more files were not shown because too many files have changed in this diff. Show more