Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/faq #63

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Feat/faq #63

wants to merge 16 commits into from

Conversation

NyaGarcia
Copy link
Member

Regarding #59

@NyaGarcia NyaGarcia requested review from tonivj5 and Caballerog June 25, 2020 13:49
Copy link
Member

@tonivj5 tonivj5 left a comment

Choose a reason for hiding this comment

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

Good work! :-)

We should change service to avoid perform more requests than needed

src/app/pages/main/main.component.ts Outdated Show resolved Hide resolved
@@ -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.

👏👏

communities: Communities;
/* communities: Communities; */
communitie$ = this.communityService.communities;
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

@@ -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


@NgModule({
declarations: [...COMPONENTS],
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

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

Copy link
Member

@tonivj5 tonivj5 left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

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


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

@Caballerog Caballerog requested review from tonivj5 and Caballerog June 6, 2021 17:18
@sonarcloud
Copy link

sonarcloud bot commented Jun 6, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants