Skip to content

Commit 96e0dee

Browse files
committed
v0.9.0
1 parent 0153db1 commit 96e0dee

File tree

79 files changed

+24047
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+24047
-0
lines changed

Diff for: README.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2+
3+
## Available Scripts
4+
5+
In the project directory, you can run:
6+
7+
### `npm start`
8+
9+
Runs the app in the development mode.<br>
10+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11+
12+
The page will reload if you make edits.<br>
13+
You will also see any lint errors in the console.
14+
15+
### `npm test`
16+
17+
Launches the test runner in the interactive watch mode.<br>
18+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19+
20+
### `npm run build`
21+
22+
Builds the app for production to the `build` folder.<br>
23+
It correctly bundles React in production mode and optimizes the build for the best performance.
24+
25+
The build is minified and the filenames include the hashes.<br>
26+
Your app is ready to be deployed!
27+
28+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29+
30+
### `npm run eject`
31+
32+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33+
34+
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.
35+
36+
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.
37+
38+
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.
39+
40+
## Learn More
41+
42+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43+
44+
To learn React, check out the [React documentation](https://reactjs.org/).

Diff for: package.json

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "gitcom-front",
3+
"version": "0.9.0",
4+
"private": true,
5+
"dependencies": {
6+
"@azure/ms-rest-js": "^2.0.1",
7+
"@types/jest": "24.0.15",
8+
"@types/node": "12.0.8",
9+
"@types/react": "16.8.20",
10+
"@types/react-dom": "16.8.4",
11+
"@types/react-facebook-login": "^4.1.0",
12+
"@types/react-router-dom": "^4.3.4",
13+
"antd": "^3.19.5",
14+
"autorest": "^2.0.4283",
15+
"copy-to-clipboard": "^3.2.0",
16+
"moment": "^2.24.0",
17+
"query-string": "^6.8.3",
18+
"react": "^16.12.0",
19+
"react-dom": "^16.12.0",
20+
"react-facebook-login": "^4.1.1",
21+
"react-google-login": "^5.0.7",
22+
"react-router-dom": "^5.0.1",
23+
"react-scripts": "3.0.1",
24+
"sentry": "^0.1.2",
25+
"typescript": "3.5.2"
26+
},
27+
"scripts": {
28+
"start": "react-scripts start",
29+
"build": "react-scripts build",
30+
"test": "react-scripts test",
31+
"eject": "react-scripts eject",
32+
"gen-swagger-docs": "autorest --typescript --input-file=swagger.json --output-folder=src --source-code-folder-path=client --override-client-name=SupportHubApi"
33+
},
34+
"eslintConfig": {
35+
"extends": "react-app"
36+
},
37+
"browserslist": {
38+
"production": [
39+
">0.2%",
40+
"not dead",
41+
"not op_mini all"
42+
],
43+
"development": [
44+
"last 1 chrome version",
45+
"last 1 firefox version",
46+
"last 1 safari version"
47+
]
48+
}
49+
}

Diff for: scripts/deploy/prod/copy_build.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
scp -r build "$1":/usr/local/gitcom/frontend/app/tmp
3+
echo "Build was copied to production!"

Diff for: scripts/deploy/prod/deploy.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
rm -rf /usr/local/gitcom/frontend/app/build/*
3+
cp -avr /usr/local/gitcom/frontend/app/tmp/build /usr/local/gitcom/frontend/app/

Diff for: src/AppRoot.tsx

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React from 'react';
2+
import { BrowserRouter as Router } from 'react-router-dom';
3+
import 'antd/dist/antd.css';
4+
import './app.css';
5+
import Routes from "./Routes";
6+
import App from "./classes/dataStore/app";
7+
import config from './config/config';
8+
import IAppConfig from "./intarface/AppConfig";
9+
10+
declare global {
11+
interface Window {
12+
App: App;
13+
AppConfig: IAppConfig;
14+
}
15+
}
16+
17+
window.AppConfig = config;
18+
19+
// @ts-ignore
20+
window.App = new App();
21+
22+
function AppRoot() {
23+
return (
24+
<div className="app">
25+
<Router>
26+
<Routes/>
27+
</Router>
28+
</div>
29+
);
30+
}
31+
32+
export default AppRoot;

Diff for: src/Routes.tsx

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import React from "react";
2+
import { Route, Switch } from 'react-router-dom';
3+
import IndexLayout from "./layouts/index/IndexLayout";
4+
import LoginLayout from "./layouts/auth/login/LoginLayout";
5+
import HomeMainLayout from "./layouts/home/main/HomeMainLayout";
6+
import AccountLayout from "./layouts/account/account/AccountLayout";
7+
import BillingLayout from "./layouts/account/billing/BillingLayout";
8+
import SettingsLayout from "./layouts/account/settings/SettingsLayout";
9+
import HomeIntegrationsLayout from "./layouts/home/integrations/HomeIntegrationsLayout";
10+
import LoginWithGitLabLayout from "./layouts/auth/external/gitlab/logInWith/LoginWithGitLabLayout";
11+
import LoginWithGitHubLayout from "./layouts/auth/external/github/loginWith/LoginWithGitHubLayout";
12+
import ExternalRepoLayout from "./layouts/repos/external/default/ExternalRepoLayout";
13+
import ProjectImportLayout from "./layouts/import/project/ProjectImportLayout";
14+
import ProjectPage from "./layouts/entity/project/page/ProjectPage";
15+
import BoardPage from "./layouts/entity/board/page/BoardPage";
16+
import SubscriptionLayout from "./layouts/account/subscription/SubscriptionLayout";
17+
import LibraryLayout from "./layouts/account/library/LibraryLayout";
18+
import EditProjectLayout from "./layouts/entity/project/edit/EditProjectLayout";
19+
20+
class Routes extends React.Component {
21+
render() {
22+
return (
23+
<div>
24+
<Switch>
25+
<Route path="/" exact component={IndexLayout}/>
26+
<Route path="/login" exact component={LoginLayout}/>
27+
<Route path="/home" exact component={HomeMainLayout}/>
28+
<Route path="/home/integrations" exact component={HomeIntegrationsLayout}/>
29+
30+
<Route path="/account" exact component={AccountLayout}/>
31+
<Route path="/account/billing" exact component={BillingLayout}/>
32+
<Route path="/account/settings" exact component={SettingsLayout}/>
33+
<Route path="/account/subscription" exact component={SubscriptionLayout}/>
34+
<Route path="/account/library" exact component={LibraryLayout}/>
35+
36+
<Route path="/external/:serviceType/repositories" exact component={ExternalRepoLayout}/>
37+
38+
{/* External auth routes */}
39+
40+
<Route path="/auth/external/github/login" exact component={LoginWithGitHubLayout}/>
41+
<Route path="/auth/external/gitlab/login" exact component={LoginWithGitLabLayout}/>
42+
43+
{/* External import routes */}
44+
45+
<Route path="/user/repository/import" exact component={ProjectImportLayout}/>
46+
47+
{/* Project */}
48+
49+
<Route path="/:owner/:alias" exact component={ProjectPage}/>
50+
<Route path="/:owner/:alias/edit" exact component={EditProjectLayout}/>
51+
52+
<Route path="/:owner/:alias/board/:boardGuid" exact component={BoardPage}/>
53+
</Switch>
54+
</div>
55+
);
56+
}
57+
}
58+
59+
export default Routes;

Diff for: src/app.css

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
html {
2+
height: 100%;
3+
}
4+
5+
body {
6+
margin: 0 !important;
7+
height: 100%;
8+
overflow-x: hidden;
9+
}
10+
11+
p, b {
12+
font-size: 1.15em;
13+
}
14+
15+
#root {
16+
height: 100%;
17+
}
18+
19+
.full-width {
20+
width: 100% !important;
21+
}
22+
23+
.full-height {
24+
height: 100% !important;
25+
}
26+
27+
.inline {
28+
display: inline !important;
29+
}
30+
31+
.app {
32+
height: 100%;
33+
text-align: center;
34+
}
35+
36+
.no-padding {
37+
padding: 0 !important;
38+
}
39+
40+
.flex-center {
41+
display: flex !important;
42+
justify-content: center !important;
43+
}
44+
45+
.text-left {
46+
text-align: left !important;
47+
}
48+
49+
.text-center {
50+
text-align: center !important;
51+
}
52+
53+
.margin-sm-top {
54+
margin-top: 10px;
55+
}
56+
57+
.margin-lg-top {
58+
margin-top: 40px !important;
59+
}
60+
61+
.margin-md-top {
62+
margin-top: 25px !important;
63+
}
64+
65+
.margin-md-left {
66+
margin-top: 25px;
67+
}
68+
69+
.margin-sm-vertical {
70+
margin: 10px 0;
71+
}
72+
73+
.margin-md-vertical {
74+
margin: 25px 0;
75+
}
76+
77+
.margin-sm-sides {
78+
margin: 0 10px;
79+
}
80+
81+
.margin-lg-top {
82+
margin-top: 40px;
83+
}
84+
85+
.margin-sm {
86+
margin: 10px !important;
87+
}
88+
89+
.margin-xs {
90+
margin: 5px !important;
91+
}
92+
93+
.padding-sm {
94+
padding: 10px !important;
95+
}
96+
97+
.padding-md {
98+
padding: 25px !important;
99+
}
100+
101+
.zero-height {
102+
height: 0;
103+
}
104+
105+
.small-card .ant-card-body {
106+
padding: 10px !important;
107+
}
108+
.small-card .ant-card-head-title {
109+
padding: 10px !important;
110+
}
111+
112+
.display-flex {
113+
display: flex !important;
114+
}
115+
116+
.flex-1 {
117+
flex: 1;
118+
}
119+
120+
.material-shadow-hover-1:hover {
121+
box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
122+
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
123+
}
124+
125+
.hover-pointer:hover {
126+
cursor: pointer;
127+
}
128+
129+
@media only screen and (min-width: 767px) {
130+
.desktop-zero-height {
131+
height: 0;
132+
}
133+
.sm-desktop-horizontal-margin {
134+
margin: 0 10px;
135+
}
136+
}

Diff for: src/classes/dataStore/app.tsx

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import {SupportHubApi} from "../../client/supportHubApi";
2+
import {UserModel} from "../../client/bindings";
3+
import {handleApiError} from "../notification/errorHandler/errorHandler";
4+
5+
class App {
6+
apiClient: SupportHubApi;
7+
8+
apiToken: string = "";
9+
10+
authorizedUser: UserModel|null = null;
11+
12+
constructor(props: any) {
13+
this.apiClient = new SupportHubApi({
14+
baseUri: window.AppConfig.api_url
15+
});
16+
17+
let token = localStorage.getItem("api_token");
18+
if (token) {
19+
this.apiToken = token;
20+
}
21+
22+
if (!this.authorizedUser && this.apiToken) {
23+
this.updateAuthorizedUser().then(() => {});
24+
}
25+
}
26+
27+
async updateAuthorizedUser() {
28+
this.apiClient.getMe(this.apiToken)
29+
.then((result) =>
30+
this.processUser(result._response))
31+
.catch((error) => handleApiError(error.response));
32+
}
33+
34+
processUser(response: any) {
35+
let json = JSON.parse(response.bodyAsText);
36+
37+
if (!json.data.me) {
38+
return;
39+
}
40+
41+
this.authorizedUser = json.data.me;
42+
}
43+
44+
isAuthorized() : boolean {
45+
return this.apiToken !== "";
46+
}
47+
48+
setApiToken(token: string) {
49+
this.apiToken = token;
50+
this.updateAuthorizedUser().then(() => {});
51+
localStorage.setItem("api_token", token);
52+
}
53+
54+
logout() {
55+
localStorage.clear();
56+
this.apiToken = "";
57+
this.authorizedUser = null;
58+
}
59+
}
60+
61+
export default App;

0 commit comments

Comments
 (0)