Skip to content
Open
Show file tree
Hide file tree
Changes from 8 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
19 changes: 19 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { FaqComponent } from '@pages/faq/faq.component';
import { MainComponent } from '@pages/main/main.component';

const routes: Routes = [
{ path: '', component: MainComponent },
{ path: 'faq', component: FaqComponent },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FAQ module can be built in a lazy way

{
path: '**',
redirectTo: '',
},
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
})
export class AppRoutingModule {}
7 changes: 1 addition & 6 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
gdColumns.xs="100% 100% "
>
<ngcommunity-header gdArea="header"></ngcommunity-header>
<ngcommunity-main
*ngIf="(communitie$ | async) as communities"
gdArea="main"
[communities]="communities"
>
</ngcommunity-main>
<router-outlet></router-outlet>
</div>
<ngcommunity-footer></ngcommunity-footer>
6 changes: 1 addition & 5 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,4 @@ import { CommunityService } from '@shared/services';
selector: 'ngcommunity-root',
templateUrl: './app.component.html',
})
export class AppComponent {
communitie$ = this.communityService.communities;

constructor(private communityService: CommunityService) {}
}
export class AppComponent {}
4 changes: 2 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { PagesModule } from './pages/pages.module';
import { SharedModule } from './shared/shared.module';
import { RouterModule } from '@angular/router';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';
import { AppRoutingModule } from './app-routing.module';

@NgModule({
declarations: [AppComponent],
Expand All @@ -15,8 +15,8 @@ import { environment } from '../environments/environment';
SharedModule,
PagesModule,
HttpClientModule,
RouterModule.forRoot([]),
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }),
AppRoutingModule,
],
providers: [],
bootstrap: [AppComponent],
Expand Down
24 changes: 24 additions & 0 deletions src/app/pages/faq/faq.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
h6 {
color: #c10707;
font-size: 20px;
}

a {
color: #c10707;
}

.text-container {
margin-left: 15%;
margin-right: 15%;
color: #333;
}

.text-content {
font-weight: 400;
line-height: 1.5;
font-size: 16px;
}

.question {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make the design responsive

margin: 20px;
}
60 changes: 60 additions & 0 deletions src/app/pages/faq/faq.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<div class="text-container">
<div class="text-content">
<div class="question">
<h6>What is Angular-Communities?</h6>
<p>
Angular-communities in an initiative born in Málaga, Spain. It started as a small
open-source project built by four Angular devs from Málaga (see about us for more info) who
aimed to create a space where every single Angular community out there could be found and
located on the world map. This way, the visibility of all the Angular communities around the
world is increased, which is always a good thing! As more and more community members started
to show interest in Angular-Communities, our small project began to grow. Our goal now is to
create a space where all information regarding Angular can be found: communities,
conferences, events...
</p>
</div>
<div class="question">
<h6>I host an Angular community, can I add it to Angular-Communities?</h6>
<p>Of course! We're looking forwards to adding your community.</p>
</div>
<div class="question">
<h6>Can Angular conferences/events like ngSpain, ngConf etc. be added too?</h6>
<p>
We're working on also adding all the Angular events! Would you like to help us out? You can
find more information
<a target="_blank" href="https://github.com/voidcosmos/angular-communities/issues/42"
>here</a
>.
</p>
</div>
<div class="question">
<h6>How do I add my community to Angular-Communities?</h6>
<p>
All you need to do is open a PR, filling in the required fields with the information about
your community. We'll review it, and if all is well, your community will be added! For more
info, see
<a target="_blank" href="https://github.com/voidcosmos/angular-communities"
>the Angular-Communities README.</a
>
</p>
</div>
<div class="question">
<h6>Can I participate in the Angular-Communities project?</h6>
<p>
Of course you can! Any help at all is very welcome. See the following question for
information on how to contribute.
</p>
</div>
<div class="question">
<h6>How can I contribute to the Angular-Communities project?</h6>
<p>
You can find all the information related to contributing
<a
target="_blank"
href="https://github.com/voidcosmos/angular-communities/blob/master/.github/CONTRIBUTING.md"
>here</a
>.
</p>
</div>
</div>
</div>
8 changes: 8 additions & 0 deletions src/app/pages/faq/faq.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Component } from "@angular/core";

@Component({
selector: "app-faq",
templateUrl: "./faq.component.html",
styleUrls: ["./faq.component.css"]
})
export class FaqComponent {}
16 changes: 16 additions & 0 deletions src/app/pages/faq/faq.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SharedModule } from '@shared/shared.module';
import { FlexLayoutModule } from '@angular/flex-layout';
import { ReactiveFormsModule } from '@angular/forms';
import { MatInputModule } from '@angular/material/input';
import { FaqComponent } from './faq.component';

const COMPONENTS = [FaqComponent];

@NgModule({
declarations: [...COMPONENTS],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, it isn't needed spread it, like in SharedModule

Suggested change
declarations: [...COMPONENTS],
declarations: [COMPONENTS],

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once again, my mistake for copy-pasting 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also fixed in 32a3833

imports: [CommonModule, SharedModule, FlexLayoutModule, ReactiveFormsModule, MatInputModule],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the modules are imported via shared, can be removed 👍

Suggested change
imports: [CommonModule, SharedModule, FlexLayoutModule, ReactiveFormsModule, MatInputModule],
imports: [SharedModule],

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, those modules shouldn't even be imported in faqModule anyway. My mistake, for copy-pasting xD

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 32a3833

exports: [...COMPONENTS],
})
export class FaqModule {}
1 change: 1 addition & 0 deletions src/app/pages/main/main.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
gdColumns.xs="100% auto"
gdRows.xs="35% 65%"
fxFlexFill
*ngIf="communitie$ | async as communities"
>
<ngcommunity-map
gdArea="map"
Expand Down
15 changes: 11 additions & 4 deletions src/app/pages/main/main.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { Community, Communities } from '@shared/interfaces';
import { Component, Input } from '@angular/core';
import { map } from 'rxjs/operators';
import { CommunityService } from '@shared/services';

@Component({
selector: 'ngcommunity-main',
Expand All @@ -10,11 +11,17 @@ import { map } from 'rxjs/operators';
})
export class MainComponent {
@Input()
communities: Communities;
/* communities: Communities; */
communitie$ = this.communityService.communities;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This observable is going to perform two requests and more if we move to the new faq page and come back. We should avoid it using shareReplay(1), but it can't be placed here. We should change service, and move communities getter to simple property (communitie$?). Something like

communitie$ = this.httpClient
      .get<Communities>(this.JSON_COMMUNITIES)
      .pipe(map(communities => this.normalizeCommunities(communities)), shareReplay(1));

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are completely right, fixed in f4afebb

community$ = this.route.fragment.pipe(map(community => this.communitie$[community]));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't going to work communitie$ is an observable now. I think it should work

Suggested change
community$ = this.route.fragment.pipe(map(community => this.communitie$[community]));
community$ = this.route.fragment.pipe(withLatestFrom(this.communitie$), map(([community, communities]) => communities[community]));

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Fixed in 65e0b60


community$ = this.route.fragment.pipe(map(community => this.communities[community]));

constructor(private router: Router, private route: ActivatedRoute) {}
constructor(
private router: Router,
private route: ActivatedRoute,
private communityService: CommunityService,
) {
console.log(this.communitie$);
}

changeCommunity(community?: Community) {
this.router.navigate([], {
Expand Down
3 changes: 2 additions & 1 deletion src/app/pages/pages.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { NgModule } from '@angular/core';

import { MainModule } from './main/main.module';
import { FaqModule } from './faq/faq.module';
import { SharedModule } from '../shared/shared.module';

@NgModule({
declarations: [],
imports: [SharedModule, MainModule],
imports: [SharedModule, MainModule, FaqModule],
providers: [],
exports: [MainModule],
})
Expand Down
3 changes: 2 additions & 1 deletion src/app/shared/components/header/header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
alt="Angular communities logo"
src="assets/images/angular-communities-logo_md.png"
/>
<span>ANGULAR COMMUNITIES</span>
<a routerLink="">ANGULAR COMMUNITIES</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏👏

</div>
<div>
<a class="menu" routerLink="/faq">FAQ</a>
<a
href="https://www.github.com/voidcosmos/angular-communities"
target="_blank"
Expand Down
5 changes: 5 additions & 0 deletions src/app/shared/components/header/header.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ img {
width: 40px;
height: 40px;
}

a {
padding: 12px 10px;
}

.social-button--github {
margin: 0px;
width: 40px;
Expand Down
3 changes: 2 additions & 1 deletion src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatToolbarModule } from '@angular/material/toolbar';
import { NgModule } from '@angular/core';
import { ScrollingModule } from '@angular/cdk/scrolling';
import { RouterModule } from '@angular/router';

const CORE_MODULES = [BrowserAnimationsModule, CommonModule, FormsModule, ReactiveFormsModule];

Expand All @@ -49,7 +50,7 @@ const MATERIAL_MODULES = [

@NgModule({
declarations: COMPONENTS,
imports: [MATERIAL_MODULES, CORE_MODULES, FlexLayoutModule],
imports: [MATERIAL_MODULES, CORE_MODULES, FlexLayoutModule, RouterModule],
exports: [COMPONENTS, MATERIAL_MODULES, CORE_MODULES, FlexLayoutModule],
})
export class SharedModule {}