Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_API_URL=http://localhost:8000
45 changes: 2 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,3 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
# Gitcom frontend

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br>
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License</a>.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gitcom-front",
"version": "0.9.0",
"version": "0.10.0",
"private": true,
"dependencies": {
"@azure/ms-rest-js": "^2.0.1",
Expand Down
2 changes: 2 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Support open source and earn rewards, it's a new way to look at open source">
<meta name="keywords" content="open source, rewards, growth">
<meta name="theme-color" content="#000000" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<script src="https://momentjs.com/downloads/moment.min.js"></script>
Expand Down
3 changes: 2 additions & 1 deletion public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
User-agent: *
Allow: /
Allow: /
SITEMAP: https://gitcom.org/sitemap.xml
20 changes: 20 additions & 0 deletions public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">

<url>
<loc>https://gitcom.org/</loc>
<lastmod>2019-12-02T01:47:20+00:00</lastmod>
<priority>1.00</priority>
</url>
<url>
<loc>https://gitcom.org/login</loc>
<lastmod>2019-12-02T01:47:20+00:00</lastmod>
<priority>0.80</priority>
</url>


</urlset>
24 changes: 23 additions & 1 deletion src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,43 @@ import LoginWithGitLabLayout from "./layouts/auth/external/gitlab/logInWith/Logi
import LoginWithGitHubLayout from "./layouts/auth/external/github/loginWith/LoginWithGitHubLayout";
import ExternalRepoLayout from "./layouts/repos/external/default/ExternalRepoLayout";
import ProjectImportLayout from "./layouts/import/project/ProjectImportLayout";
import ProjectPage from "./layouts/entity/project/page/ProjectPage";
import ProjectPage from "./layouts/entity/project/view/ProjectPage";
import BoardPage from "./layouts/entity/board/page/BoardPage";
import SubscriptionLayout from "./layouts/account/subscription/SubscriptionLayout";
import LibraryLayout from "./layouts/account/library/LibraryLayout";
import EditProjectLayout from "./layouts/entity/project/edit/EditProjectLayout";
import ProjectPricingLayout from "./layouts/entity/project/pricing/view/ProjectPricingLayout";
import RegisterLayout from "./layouts/auth/register/RegisterLayout";
import ConfirmEmailLayout from "./layouts/auth/confirmEmail/ConfirmEmailLayout";
import NotFoundLayout from "./layouts/404/NotFoundLayout";
import HelpLayout from "./layouts/help/HelpLayout";
import EditProjectPricingLayout from "./layouts/entity/project/pricing/edit/EditProjectPricingLayout";
import WithdrawalsLayout from "./layouts/account/withdrawals/WithdrawalsLayout";

class Routes extends React.Component {
render() {
return (
<div>
<Switch>
<Route path="/" exact component={IndexLayout}/>

{/* Auth */}
<Route path="/login" exact component={LoginLayout}/>
<Route path="/register" exact component={RegisterLayout}/>
<Route path="/register/confirm-email" exact component={ConfirmEmailLayout}/>

<Route path="/help" exact component={HelpLayout}/>

{/* Home */}

<Route path="/home" exact component={HomeMainLayout}/>
<Route path="/home/integrations" exact component={HomeIntegrationsLayout}/>

<Route path="/account" exact component={AccountLayout}/>
<Route path="/account/billing" exact component={BillingLayout}/>
<Route path="/account/settings" exact component={SettingsLayout}/>
<Route path="/account/subscription" exact component={SubscriptionLayout}/>
<Route path="/account/withdrawals" exact component={WithdrawalsLayout}/>
<Route path="/account/library" exact component={LibraryLayout}/>

<Route path="/external/:serviceType/repositories" exact component={ExternalRepoLayout}/>
Expand All @@ -49,7 +66,12 @@ class Routes extends React.Component {
<Route path="/:owner/:alias" exact component={ProjectPage}/>
<Route path="/:owner/:alias/edit" exact component={EditProjectLayout}/>

<Route path="/:owner/:alias/pricing" exact component={ProjectPricingLayout}/>
<Route path="/:owner/:alias/pricing/edit" exact component={EditProjectPricingLayout}/>

<Route path="/:owner/:alias/board/:boardGuid" exact component={BoardPage}/>

<Route component={NotFoundLayout}/>
</Switch>
</div>
);
Expand Down
4 changes: 4 additions & 0 deletions src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ p, b {
cursor: pointer;
}

.select-padding > div {
padding: 0 25px;
}

@media only screen and (min-width: 767px) {
.desktop-zero-height {
height: 0;
Expand Down
2 changes: 1 addition & 1 deletion src/classes/dataStore/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class App {
authorizedUser: UserModel|null = null;

constructor(props: any) {
this.apiClient = new SupportHubApi({
this.apiClient = new SupportHubApi('Card', {
baseUri: window.AppConfig.api_url
});

Expand Down
31 changes: 26 additions & 5 deletions src/classes/notification/errorHandler/errorHandler.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,45 @@
import {notification} from "antd";

export function handleApiError(response: any): void {
// TODO: only in dev mode
console.error('RAW error response:');
console.error(response);
if (process.env.NODE_ENV === "development") {
console.error('RAW error response:');
console.error(response);
}
if (!response) {
showUnknownError();
return;
}
let json: any;
try {
if (response.status === 401) {
notification['error']({
message: 'Unauthorized, please log in again',
description: ''
});
return;
}
if (response.status === 404) {
notification['error']({
message: 'Not found',
description: ''
});
return;
}
json = JSON.parse(response);
json = JSON.parse(response.body);
if (response.status === 403) {
notification['error']({
message: 'Not allowed',
description: json.errors[0].message
});
return;
}
if (response.status === 422) {
notification['error']({
message: 'Submitted form is invalid, please try again',
description: json.errors[0].message
});
return;
}
} catch (e) {
showUnknownError(e);
return;
Expand All @@ -32,7 +54,6 @@ export function handleApiError(response: any): void {

export function showUnknownError(err: any = null) {
if (err) {
// TODO: only in dev mode
console.error(err);
}
console.error('Unknown error, we\'re already working on it :)');
Expand Down
18 changes: 18 additions & 0 deletions src/classes/utils/http/retryRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export function retryRequest(funcToExec: any, getTargetRef: any, targetValue: any, retryCount: number = 7) {
let execCount = 0;
executeFunc(funcToExec, execCount, getTargetRef, targetValue, retryCount);
}

function executeFunc(funcToExec: any, execCount: number, getTargetRef: any, targetValue: any, retryCount: number) {
try {
if (execCount < retryCount && getTargetRef() !== targetValue) {
setTimeout(() => {
funcToExec();
executeFunc(funcToExec, execCount, getTargetRef, targetValue, retryCount);
}, 500 + (500 * execCount));
execCount++;
}
} catch (e) {
// ignored
}
}
29 changes: 27 additions & 2 deletions src/client/bindings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {CurrencyType, CurrencyType1, CurrencyType3, EntityType, EntityType1, UserBalance} from "./models";
import {CurrencyType, CurrencyType1, CurrencyType3, EntityType} from "./models";

export class ProjectModel {
guid?: string;
Expand All @@ -7,6 +7,7 @@ export class ProjectModel {
repository_guid?: string;
creator_guid?: string;
base_uri?: string;
stars_count?: number;
created_at?: string;
updated_at?: string;
}
Expand Down Expand Up @@ -82,7 +83,7 @@ export class InvoiceModel {
* Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', 'BacklogItem',
* 'UserBalance'
*/
entity_type?: EntityType1;
entity_type?: EntityType;
amount?: number;
status?: string;
/**
Expand Down Expand Up @@ -131,3 +132,27 @@ export class LibraryItem {
created_at?: string;
}

export class ProjectProduct {
guid?: string;
name?: string;
description?: string;
/**
* url to view product info (optional)
*/
url?: string;
project_guid?: string;
usd_price?: number;
duration_hours?: number;
users_count?: number;
created_at?: string;
updated_at?: string;
}

export interface WithdrawalRequest {
guid?: string;
user_guid?: string;
amount?: number;
address?: string;
paid?: boolean;
created_at?: string;
}
Loading