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(daffio,dgeni): docsgen guides and move under docs namespace #2824

Merged
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
39 changes: 0 additions & 39 deletions apps/daffio/src/app/api/api-routing.module.ts

This file was deleted.

9 changes: 0 additions & 9 deletions apps/daffio/src/app/api/models/api-reference.ts

This file was deleted.

42 changes: 10 additions & 32 deletions apps/daffio/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@ import {
import { DaffRouteWithNamedViews } from '@daffodil/router';

import { DaffioMarketingFooterComponent } from './core/footer/marketing-footer/marketing-footer.component';
import { DaffioSimpleFooterComponent } from './core/footer/simple-footer/simple-footer.component';
import { DaffioDocsHeaderContainer } from './core/header/containers/docs-header/docs-header.component';
import { DaffioMarketingHeaderContainer } from './core/header/containers/marketing-header/marketing-header.component';
import { DaffioDocsSidebarContentComponent } from './core/sidebar/components/docs-sidebar-content/docs-sidebar-content.component';
import { DaffioMarketingSidebarContentComponent } from './core/sidebar/components/marketing-sidebar-content/marketing-sidebar-content.component';
import { DaffioSidebarFooterComponent } from './core/sidebar/components/sidebar-footer/sidebar-footer.component';
import { DaffioSidebarHeaderComponent } from './core/sidebar/components/sidebar-header/sidebar-header.component';
import { DaffioDocsSidebarContainer } from './core/sidebar/containers/docs-sidebar/docs-sidebar.component';
import { TemplateComponent } from './core/template/template.component';
import { DaffioRouterNamedViewsEnum } from './named-views/models/named-views.enum';

export const appRoutes: Routes = [
{
path: '', component: TemplateComponent,
path: '',
component: TemplateComponent,
data: {
daffNamedViews: {
[DaffioRouterNamedViewsEnum.SIDEBARHEADER]: DaffioSidebarHeaderComponent,
[DaffioRouterNamedViewsEnum.SIDEBARFOOTER]: DaffioSidebarFooterComponent,
},
},
children: [
<DaffRouteWithNamedViews>{
path: '',
Expand All @@ -33,41 +36,16 @@ export const appRoutes: Routes = [
data: {
daffNamedViews: {
[DaffioRouterNamedViewsEnum.NAV]: DaffioMarketingHeaderContainer,
[DaffioRouterNamedViewsEnum.SIDEBARHEADER]: DaffioSidebarHeaderComponent,
[DaffioRouterNamedViewsEnum.SIDEBARCONTENT]: DaffioMarketingSidebarContentComponent,
[DaffioRouterNamedViewsEnum.SIDEBARFOOTER]: DaffioSidebarFooterComponent,
[DaffioRouterNamedViewsEnum.FOOTER]: DaffioMarketingFooterComponent,
},
},
},
<DaffRouteWithNamedViews>{
{
path: '',
children: [
{ path: 'api', loadChildren: () => import('./api/api.module').then(m => m.DaffioApiModule) },
{ path: 'docs', loadChildren: () => import('./docs/docs.module').then(m => m.DaffioDocssModule) },
],
data: {
daffNamedViews: {
[DaffioRouterNamedViewsEnum.NAV]: DaffioDocsHeaderContainer,
[DaffioRouterNamedViewsEnum.SIDEBARHEADER]: DaffioSidebarHeaderComponent,
[DaffioRouterNamedViewsEnum.SIDEBARCONTENT]: DaffioDocsSidebarContentComponent,
[DaffioRouterNamedViewsEnum.SIDEBARFOOTER]: DaffioSidebarFooterComponent,
[DaffioRouterNamedViewsEnum.FOOTER]: DaffioSimpleFooterComponent,
},
},
},
<DaffRouteWithNamedViews>{
path: '',
children: [
{ path: 'packages', loadChildren: () => import('./packages/packages.module').then(m => m.DaffioPackagesModule) },
],
data: {
daffNamedViews: {
[DaffioRouterNamedViewsEnum.NAV]: DaffioDocsHeaderContainer,
[DaffioRouterNamedViewsEnum.SIDEBARHEADER]: DaffioSidebarHeaderComponent,
[DaffioRouterNamedViewsEnum.SIDEBARCONTENT]: DaffioDocsSidebarContainer,
[DaffioRouterNamedViewsEnum.SIDEBARFOOTER]: DaffioSidebarFooterComponent,
},
},
},
],
},
Expand Down
2 changes: 0 additions & 2 deletions apps/daffio/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { DaffioDocsSidebarContentComponentModule } from './core/sidebar/componen
import { DaffioMarketingSidebarContentComponentModule } from './core/sidebar/components/marketing-sidebar-content/marketing-sidebar-content.module';
import { DaffioSidebarFooterComponentModule } from './core/sidebar/components/sidebar-footer/sidebar-footer.module';
import { DaffioSidebarHeaderComponentModule } from './core/sidebar/components/sidebar-header/sidebar-header.module';
import { DaffioDocsSidebarContainerModule } from './core/sidebar/containers/docs-sidebar/docs-sidebar.module';
import { TemplateModule } from './core/template/template.module';
import { environment } from '../environments/environment';

Expand All @@ -48,7 +47,6 @@ import { environment } from '../environments/environment';
DaffioSidebarFooterComponentModule,
DaffioSimpleFooterComponentModule,
DaffioMarketingFooterComponentModule,
DaffioDocsSidebarContainerModule,

//Make sure this loads after Router and Store
StoreRouterConnectingModule.forRoot({ serializer: FullRouterStateSerializer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class DaffioFooterComponent {

links: any[] = [
{ path: '/why-pwa', title: 'Why PWA' },
{ path: '/packages', title: 'Docs' },
{ path: '/docs', title: 'Docs' },
{ path: '/support', title: 'Support' },
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class DaffioSimpleFooterComponent {

links: any[] = [
{ path: '/why-pwa', title: 'Why PWA' },
{ path: '/packages', title: 'Docs' },
{ path: '/docs', title: 'Docs' },
{ path: '/support', title: 'Support' },
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ export class DaffioDocsHeaderContainer {
faBars = faBars;

links: any[] = [
{ path: '/packages', title: 'Packages' },
{ path: '/api', title: 'API Index' },
{ path: '/docs/guides', title: 'Guides' },
{ path: '/docs/packages', title: 'Packages' },
{ path: '/docs/api', title: 'API Index' },
];

constructor(private store: Store<any>) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class DaffioMarketingHeaderContainer {

links: any[] = [
{ path: '/why-pwa', title: 'Why PWA' },
{ path: '/packages', title: 'Docs' },
{ path: '/docs', title: 'Docs' },
];

constructor(private store: Store<any>) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
})
export class DaffioDocsSidebarContentComponent {
links: any[] = [
{ path: '/packages', title: 'Packages' },
{ path: '/api', title: 'API Index' },
{ path: '/docs/guides', title: 'Guides' },
{ path: '/docs/packages', title: 'Packages' },
{ path: '/docs/api', title: 'API Index' },
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ import {
export class DaffioMarketingSidebarContentComponent {
links: any[] = [
{ path: '/why-pwa', title: 'Why PWA' },
{ path: '/packages', title: 'Docs' },
{ path: '/docs', title: 'Docs' },
];
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<ng-container *ngrxLet="sidebarKind$; let sidebarKind">
<ng-container *ngrxLet="isBigTablet$; let isBigTablet">
<daffio-docs-packages-list-container *ngIf="isBigTablet || sidebarKind === contentSidebarKind"></daffio-docs-packages-list-container>
<daffio-docs-sidebar-content *ngIf="!isBigTablet && !sidebarKind"></daffio-docs-sidebar-content>
@if (isBigTablet || sidebarKind === contentSidebarKind) {
<ng-container [daffRouterNamedViewOutlet]="docsSidebarNamedView"></ng-container>
}
@if (!isBigTablet && !sidebarKind) {
<daffio-docs-sidebar-content></daffio-docs-sidebar-content>
}
</ng-container>
</ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
BreakpointState,
} from '@angular/cdk/layout';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { Component } from '@angular/core';
import {
ComponentFixture,
TestBed,
Expand All @@ -18,34 +19,43 @@ import {
import { BehaviorSubject } from 'rxjs';

import { DaffBreakpoints } from '@daffodil/design';
import {
DaffRouterNamedViewService,
DaffRouterNamedViews,
} from '@daffodil/router';

import {
DAFFIO_DOCS_CONTENT_SIDEBAR_KIND,
DaffioDocsSidebarContainer,
} from './docs-sidebar.component';
import { DaffioDocsPackagesListContainerModule } from '../../../../packages/containers/packages-list/packages-list.module';
import { DaffioRouterNamedViewsEnum } from '../../../../named-views/models/named-views.enum';
import { DaffioDocsSidebarContentComponentModule } from '../../components/docs-sidebar-content/docs-sidebar-content.module';
import { selectSidebarKind } from '../../reducers';

@Component({ template: '', standalone: true })
class TestComponent {}

describe('DaffioDocsSidebarContainer', () => {
let component: DaffioDocsSidebarContainer;
let fixture: ComponentFixture<DaffioDocsSidebarContainer>;
let store: MockStore;
let breakpointSpy: jasmine.SpyObj<BreakpointObserver>;
let breakpointState: BehaviorSubject<BreakpointState>;

let namedViewServiceSpy: jasmine.SpyObj<DaffRouterNamedViewService>;
let namedViews: BehaviorSubject<DaffRouterNamedViews>;

beforeEach(waitForAsync(() => {
namedViews = new BehaviorSubject({});
namedViewServiceSpy = jasmine.createSpyObj('DaffRouterNamedViewService', {}, { namedViews$: namedViews });
breakpointSpy = jasmine.createSpyObj('BreakpointObserver', ['observe']);

TestBed.configureTestingModule({
imports: [
LetDirective,
RouterTestingModule,
HttpClientTestingModule,
DaffioDocsPackagesListContainerModule,
DaffioDocsSidebarContentComponentModule,
],
declarations: [
DaffioDocsSidebarContainer,
],
providers: [
Expand All @@ -54,6 +64,10 @@ describe('DaffioDocsSidebarContainer', () => {
provide: BreakpointObserver,
useValue: breakpointSpy,
},
{
provide: DaffRouterNamedViewService,
useValue: namedViewServiceSpy,
},
],
})
.compileComponents();
Expand Down Expand Up @@ -92,23 +106,29 @@ describe('DaffioDocsSidebarContainer', () => {
beforeEach(() => {
store.overrideSelector(selectSidebarKind, undefined);
store.setState({});
namedViews.next({
[DaffioRouterNamedViewsEnum.DOCS_SIDEBAR]: TestComponent,
});
fixture.detectChanges();
});

it('should render <daffio-docs-packages-list-container>', () => {
expect(fixture.debugElement.query(By.css('daffio-docs-packages-list-container'))).toBeTruthy();
it('should render the docs sidebar content', () => {
expect(fixture.debugElement.query(By.directive(TestComponent))).toBeTruthy();
});
});

describe('and when the sidebar kind is content', () => {
beforeEach(() => {
store.overrideSelector(selectSidebarKind, DAFFIO_DOCS_CONTENT_SIDEBAR_KIND);
store.setState({});
namedViews.next({
[DaffioRouterNamedViewsEnum.DOCS_SIDEBAR]: TestComponent,
});
fixture.detectChanges();
});

it('should render <daffio-docs-packages-list-container>', () => {
expect(fixture.debugElement.query(By.css('daffio-docs-packages-list-container'))).toBeTruthy();
it('should render the docs sidebar content', () => {
expect(fixture.debugElement.query(By.directive(TestComponent))).toBeTruthy();
});
});
});
Expand Down Expand Up @@ -138,11 +158,14 @@ describe('DaffioDocsSidebarContainer', () => {
beforeEach(() => {
store.overrideSelector(selectSidebarKind, DAFFIO_DOCS_CONTENT_SIDEBAR_KIND);
store.setState({});
namedViews.next({
[DaffioRouterNamedViewsEnum.DOCS_SIDEBAR]: TestComponent,
});
fixture.detectChanges();
});

it('should render <daffio-docs-packages-list-container>', () => {
expect(fixture.debugElement.query(By.css('daffio-docs-packages-list-container'))).toBeTruthy();
it('should render the docs sidebar content', () => {
expect(fixture.debugElement.query(By.directive(TestComponent))).toBeTruthy();
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Component,
OnInit,
} from '@angular/core';
import { LetDirective } from '@ngrx/component';
import {
select,
Store,
Expand All @@ -14,7 +15,10 @@ import {
} from 'rxjs';

import { DaffBreakpoints } from '@daffodil/design';
import { DaffRouterNamedViewOutletModule } from '@daffodil/router';

import { DaffioRouterNamedViewsEnum } from '../../../../named-views/models/named-views.enum';
import { DaffioDocsSidebarContentComponentModule } from '../../components/docs-sidebar-content/docs-sidebar-content.module';
import { selectSidebarKind } from '../../reducers';

export const DAFFIO_DOCS_CONTENT_SIDEBAR_KIND = 'content';
Expand All @@ -27,9 +31,16 @@ export const DAFFIO_DOCS_CONTENT_SIDEBAR_KIND = 'content';
selector: 'daffio-docs-sidebar-container',
templateUrl: './docs-sidebar.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
LetDirective,
DaffRouterNamedViewOutletModule,
DaffioDocsSidebarContentComponentModule,
],
})
export class DaffioDocsSidebarContainer implements OnInit {
contentSidebarKind = DAFFIO_DOCS_CONTENT_SIDEBAR_KIND;
readonly docsSidebarNamedView = DaffioRouterNamedViewsEnum.DOCS_SIDEBAR;

constructor(
private store: Store,
Expand Down

This file was deleted.

Loading
Loading