Skip to content

Commit 9eadf12

Browse files
authored
Merge pull request #6 from Mrcel97/workspace-sync
Workspace sync
2 parents dfc2243 + b35c8cd commit 9eadf12

33 files changed

+880
-22
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<div class="background" style="overflow: auto">
2+
<div class="bloquer"></div>
3+
<div class="content website-info d-flex justify-content-start align-content-top flex-wrap animated zoomIn">
4+
<div class="basic-bubble bubble1">
5+
<h1 class="inline">What's Team<p class="inline title-highlight">Code</p>?</h1>
6+
<br/>
7+
<p>TeamCode is an onlide coding tool centerd in provide an in-real-time comunication between a team conformed by an Owner, a Writer and Auditors.</p>
8+
<p style="transform: scale(2); margin: 1.6em auto 1.6em auto">👾</p>
9+
<p>TeamCode provides you the tools to upload your projects and share or discuss changes while you are live sharing this modifications with you teammates.</p>
10+
</div>
11+
</div>
12+
13+
<div class="content website-info d-flex justify-content-end align-content-top flex-wrap animated zoomIn">
14+
<div class="basic-bubble bubble2">
15+
<h1 class="inline">How to use it?</h1>
16+
<br/>
17+
<p>TeamCode only have one requeriment to start using it. You need to login using your GitHub account. This requeriment exists for two main reasons:</p>
18+
<br/>
19+
<ul>
20+
<li><p>Bring the maximum seccurity to our users relying in GitHub.</p></li>
21+
<li><p>Provide an integrated GitHub toolbox to interact with some advanced actions introduced in the "Advanced level tutorial".</p></li>
22+
</ul>
23+
</div>
24+
</div>
25+
26+
<div class="content website-info d-flex justify-content-start align-content-top flex-wrap animated zoomIn">
27+
<div class="basic-bubble bubble3">
28+
<h1 class="inline">Open Source!</h1>
29+
<br/>
30+
<p>TeamCode will remain as OpenSource to ensure we will reach an awesome project!</p>
31+
<img class="github-icon" src="../../assets/media/github-brands.svg" alt="github-project" style="width: 60px; height: 60px;"
32+
(click)="navigateToGithubProject()">
33+
</div>
34+
</div>
35+
</div>
36+
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
@import "../../assets/themes/dark.scss";
2+
3+
.highlight {
4+
color: $accent-color;
5+
}
6+
7+
.main-title {
8+
color: $text-color;
9+
margin-left: 2em;
10+
margin-top: -1em;
11+
h1 {
12+
font-size: 40px;
13+
}
14+
}
15+
16+
.title-highlight {
17+
color: $accent-color;
18+
font-weight: 400;
19+
}
20+
21+
.content {
22+
width: 100%;
23+
}
24+
25+
.bloquer {
26+
min-height: 5em;
27+
}
28+
29+
.welcome-text {
30+
position: absolute;
31+
}
32+
33+
.background {
34+
background-image: url("../../assets/media/home.jpg");
35+
background-attachment: fixed;
36+
background-position: center;
37+
background-repeat: no-repeat;
38+
background-size: cover;
39+
40+
height: 100vh;
41+
min-width: 944px;
42+
43+
padding-top: 1em;
44+
}
45+
46+
.website-info {
47+
background-color: transparent;
48+
top: 30vh;
49+
user-select: none;
50+
51+
color: $text-color;
52+
text-align: center;
53+
}
54+
55+
.website-subinfo {
56+
margin-top: 2em;
57+
user-select: none;
58+
59+
color: $text-color;
60+
text-align: center;
61+
}
62+
63+
h1, .h1 {
64+
font-size: 6vh;
65+
}
66+
67+
.hidden {
68+
display: none;
69+
}
70+
71+
.basic-bubble {
72+
padding: 1.5em;
73+
border: solid $primary-color-variant 2px;
74+
border-radius: 50%;
75+
height: 30em;
76+
width: 30em;
77+
background-color: rgba($primary-color, .85);
78+
transition: .2s;
79+
text-align: center;
80+
}
81+
82+
.bubble1 {
83+
margin-left: 15vw;
84+
85+
h1 {
86+
font-size: 40px;
87+
margin-top: 1.5em;
88+
}
89+
}
90+
91+
.bubble2 {
92+
margin-top: -5em;
93+
margin-right: 15vw;
94+
95+
h1 {
96+
font-size: 40px;
97+
margin-top: 1em;
98+
margin-bottom: 0.5em;
99+
}
100+
}
101+
102+
.bubble1:hover, .bubble2:hover, .bubble3:hover {
103+
background-color: rgba($primary-color, .95);
104+
border: solid #777777 2px;
105+
transform: scale(1.05);
106+
}
107+
108+
.inline {
109+
display: inline-block;
110+
}
111+
112+
.bubble3 {
113+
height: 20em;
114+
width: 20em;
115+
margin-top: -15em;
116+
margin-left: 10vw;
117+
118+
h1 {
119+
font-size: 40px;
120+
margin-top: 1em;
121+
margin-bottom: 0.5em;
122+
}
123+
}
124+
125+
.github-icon:hover {
126+
cursor: pointer;
127+
}
128+
129+
@media (max-width: 1108px) {
130+
.bubble1 {
131+
margin-left: 10vw;
132+
}
133+
.bubble2 {
134+
margin-right: 10vw;
135+
}
136+
.bubble3 {
137+
margin-left: 5vw;
138+
}
139+
}
140+
141+
@media (max-width: 975px) {
142+
.bubble1 {
143+
margin-left: 5vw;
144+
}
145+
.bubble2 {
146+
margin-right: 5vw;
147+
}
148+
.bubble3 {
149+
margin-left: 2.5vw;
150+
}
151+
}
152+
153+
@media (max-width: 944px) {
154+
.bubble1 {
155+
margin-left: 5em;
156+
}
157+
.bubble2 {
158+
margin-right: 5em;
159+
}
160+
.bubble3 {
161+
margin-left: 2.5em;
162+
}
163+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { AboutUsComponent } from './about-us.component';
4+
5+
describe('AboutUsComponent', () => {
6+
let component: AboutUsComponent;
7+
let fixture: ComponentFixture<AboutUsComponent>;
8+
9+
beforeEach(async(() => {
10+
TestBed.configureTestingModule({
11+
declarations: [ AboutUsComponent ]
12+
})
13+
.compileComponents();
14+
}));
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(AboutUsComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Component, OnInit } from '@angular/core';
2+
import { Router } from '@angular/router';
3+
import { routerNgProbeToken } from '@angular/router/src/router_module';
4+
5+
@Component({
6+
selector: 'app-about-us',
7+
templateUrl: './about-us.component.html',
8+
styleUrls: ['./about-us.component.scss']
9+
})
10+
export class AboutUsComponent implements OnInit {
11+
12+
constructor(
13+
public router: Router
14+
) { }
15+
16+
ngOnInit() {
17+
}
18+
19+
navigateToGithubProject() {
20+
window.open("https://github.com/Mrcel97/teamCode", "_blank");
21+
}
22+
23+
}

src/app/app-routing.module.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ import { Routes, RouterModule } from '@angular/router';
66
import { HomepageComponent } from './homepage/homepage.component';
77
import { InterfaceComponent } from './interface/interface.component';
88
import { IdeComponent } from './ide/ide.component';
9+
import { ProjectsListComponent } from './projects-list/projects-list.component';
10+
import { AboutUsComponent } from './about-us/about-us.component';
911

1012
const routes: Routes = [
1113
{path: '', component: HomepageComponent},
12-
{path: 'collaborators', component: HomepageComponent},
13-
{path: 'public-projects', component: HomepageComponent},
14+
{path: 'about-us', component: AboutUsComponent},
15+
{path: 'public-projects', component: ProjectsListComponent},
16+
{path: 'public-projects/:project_name', component: ProjectsListComponent},
1417
{path: 'interface', component: InterfaceComponent},
1518
{path: 'workspace/:workspace_id', component: IdeComponent},
1619
];

src/app/app.module.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ import { TooltipModule, ButtonsModule, WavesModule } from 'angular-bootstrap-md'
3434
// Configs
3535
import { firebaseConfig } from '../assets/configs/firebaseConfig';
3636
import { toasterConfig } from './../assets/configs/toasterConfig';
37+
import { IdeChatComponent } from './ide/ide-chat/ide-chat.component';
38+
import { ProjectsListComponent } from './projects-list/projects-list.component';
39+
import { AboutUsComponent } from './about-us/about-us.component';
3740

3841
@NgModule({
3942
declarations: [
@@ -53,6 +56,9 @@ import { toasterConfig } from './../assets/configs/toasterConfig';
5356
AuthWorkspaceComponent,
5457
AuthAddCollaboratorModalComponent,
5558
AuthCollaboratorsModalComponent,
59+
IdeChatComponent,
60+
ProjectsListComponent,
61+
AboutUsComponent,
5662
],
5763
imports: [
5864
AngularFireModule.initializeApp(firebaseConfig),

src/app/auth/auth-workspace/auth-workspace.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ <h6 class="dropdown-header">Status: {{isWriter ? 'Writer' : 'Auditor'}}</h6>
1313
<a *ngFor="let request of requests" class="dropdown-item nested-item waves-light" mdbWavesEffect (click)="makeWriter(request)">{{request.length>20 ? (request | slice:0:20)+'...' : request}}</a>
1414
</li>
1515
</div>
16+
<a *ngIf="isOwner && isPrivate" class="dropdown-item waves-light" mdbWavesEffect (click)="swapWorkspacePrivacy()">Make project public</a>
17+
<a *ngIf="isOwner && !isPrivate" class="dropdown-item waves-light" mdbWavesEffect (click)="swapWorkspacePrivacy()">Make project private</a>
1618
</div>
1719
</li>
1820
</div>

src/app/auth/auth-workspace/auth-workspace.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ a.dropdown-item:hover {
1616
.nestedDropdown {
1717
position: absolute;
1818
top: 9em;
19-
right: 10em;
19+
right: 9.95em;
2020
max-width: 15em;
2121

2222
background-color: $primary-color-variant;

src/app/auth/auth-workspace/auth-workspace.component.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit } from '@angular/core';
1+
import { Component, OnInit, OnDestroy } from '@angular/core';
22
import { Router, NavigationEnd } from '@angular/router';
33

44
import { WorkspaceService } from 'src/app/services/workspace.service';
@@ -16,17 +16,20 @@ import { ToasterMessages } from '../../../assets/messages/toasterMessages';
1616
templateUrl: './auth-workspace.component.html',
1717
styleUrls: ['./auth-workspace.component.scss']
1818
})
19-
export class AuthWorkspaceComponent implements OnInit {
19+
export class AuthWorkspaceComponent implements OnInit, OnDestroy {
2020
modalRef: MDBModalRef;
2121
requests: Array<string> = [];
2222
userEmail: string = '';
23+
userId: string;
2324
toasterMessages: ToasterMessages = new ToasterMessages(this.toastr);
25+
workspaceId: string;
2426

2527
// Workspace Component Filters
2628
insideWorkspace: Boolean = false;
2729
regexp = /\/\bworkspace\/\b.*/g;
2830
isWriter: boolean = false;
2931
isOwner: boolean = false;
32+
isPrivate: boolean;
3033

3134
public nestedDropdown: boolean = false;
3235

@@ -41,15 +44,25 @@ export class AuthWorkspaceComponent implements OnInit {
4144
this.hearRoute();
4245
this.hearWriteRequests();
4346
this.hearUser();
47+
this.workspaceId = this.router.url.split('/')[2];
4448
}
4549

4650
ngOnInit() {
4751
this.insideWorkspace = this.regexp.test(this.router.url) ? true : false;
52+
this.workspaceId = this.router.url.split('/')[2];
4853

4954
this.workspaceService.localIsWriter.subscribe( status => {
5055
this.isWriter = status;
5156
// status ? this.loadUserMode() : null; Idle system
5257
});
58+
this.isPrivate = null;
59+
this.workspaceService.localIsPrivate.subscribe(privacy => {
60+
this.isPrivate = privacy;
61+
});
62+
}
63+
64+
ngOnDestroy() {
65+
this.isPrivate = null;
5366
}
5467

5568
askForWrite() { // Need to do a GET to work with updated data
@@ -60,6 +73,14 @@ export class AuthWorkspaceComponent implements OnInit {
6073
this.workspaceService.makeWriter(newWriterEmail);
6174
}
6275

76+
swapWorkspacePrivacy() {
77+
if (this.userEmail == null) return;
78+
var workspaceId = this.router.url.split('/')[2];
79+
80+
this.workspaceService.swapWorkspacePrivacy(workspaceId, this.userId);
81+
this.toasterMessages.swapWorkspacePrivacy(!this.isPrivate);
82+
}
83+
6384
getWriteRequests() {
6485
console.log('You are the writer, getting write requests...');
6586
}
@@ -93,6 +114,7 @@ export class AuthWorkspaceComponent implements OnInit {
93114
console.log("Owner: ", this.workspaceService.localWorkspace.getValue().owner.email, "Writer: ", this.workspaceService.localWorkspace.getValue().writer, " User: ", user.email);
94115
this.isOwner = (workspace.owner.email == user.email);
95116
this.userEmail = user.email;
117+
this.userId = user.uid;
96118
this.workspaceService.isWriter(user.email).subscribe(
97119
result => {
98120
if (result) {

0 commit comments

Comments
 (0)