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): update /guides path to /packages #2738

Merged
merged 4 commits into from
Jan 30, 2024
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
2 changes: 1 addition & 1 deletion apps/daffio/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const appRoutes: Routes = [
<DaffRouteWithNamedViews>{
path: '',
children: [
{ path: 'guides', loadChildren: () => import('./guides/guides.module').then(m => m.DaffioGuidesModule) },
{ path: 'packages', loadChildren: () => import('./packages/packages.module').then(m => m.DaffioPackagesModule) },
],
data: {
daffNamedViews: {
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: '/api', title: 'Docs' },
{ path: '/packages', 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: '/api', title: 'Docs' },
{ path: '/packages', title: 'Docs' },
{ path: '/support', title: 'Support' },
];

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

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

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: '/api', title: 'Docs' },
{ path: '/packages', title: 'Docs' },
];

constructor(private store: Store<any>) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
})
export class DaffioDocsSidebarContentComponent {
links: any[] = [
{ path: '/guides', title: 'Packages' },
{ path: '/packages', title: 'Packages' },
{ path: '/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: '/api', title: 'Docs' },
{ path: '/packages', title: 'Docs' },
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
MockStore,
provideMockStore,
} from '@ngrx/store/testing';
import { DaffioDocsPackagesListContainerModule } from 'apps/daffio/src/app/guides/containers/packages-list/packages-list.module';
import { BehaviorSubject } from 'rxjs';

import { DaffBreakpoints } from '@daffodil/design';
Expand All @@ -24,6 +23,7 @@ import {
DAFFIO_DOCS_CONTENT_SIDEBAR_KIND,
DaffioDocsSidebarContainer,
} from './docs-sidebar.component';
import { DaffioDocsPackagesListContainerModule } from '../../../../packages/containers/packages-list/packages-list.module';
import { DaffioDocsSidebarContentComponentModule } from '../../components/docs-sidebar-content/docs-sidebar-content.module';
import { selectSidebarKind } from '../../reducers';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { LetDirective } from '@ngrx/component';
import { DaffioDocsPackagesListContainerModule } from 'apps/daffio/src/app/guides/containers/packages-list/packages-list.module';

import { DaffioDocsSidebarContainer } from './docs-sidebar.component';
import { DaffioDocsPackagesListContainerModule } from '../../../../packages/containers/packages-list/packages-list.module';
import { DaffioDocsSidebarContentComponentModule } from '../../components/docs-sidebar-content/docs-sidebar-content.module';

@NgModule({
Expand Down
2 changes: 1 addition & 1 deletion apps/daffio/src/app/core/sidebar/sidebar.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { DaffRouterNamedViewOutletModule } from '@daffodil/router';

import { DaffioSidebarViewportContainer } from './containers/sidebar-viewport/sidebar-viewport.component';
import { DaffioSidebarStateModule } from './sidebar.state.module';
import { DaffioDocsPackagesListContainerModule } from '../../guides/containers/packages-list/packages-list.module';
import { DaffioDocsPackagesListContainerModule } from '../../packages/containers/packages-list/packages-list.module';

@NgModule({
imports: [
Expand Down
8 changes: 0 additions & 8 deletions apps/daffio/src/app/docs/models/guide-list.ts

This file was deleted.

8 changes: 8 additions & 0 deletions apps/daffio/src/app/docs/models/packages-list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface DaffioPackagesList {
id: string;
title: string;
path?: string;
children?: DaffioPackagesList[];
}


Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ import {

import { DocsResolver } from './docs-resolver.service';
import { DaffioDoc } from '../models/doc';
import { DaffioGuideList } from '../models/guide-list';
import { DaffioPackagesList } from '../models/packages-list';
import { DaffioDocsServiceInterface } from '../services/docs-service.interface';
import { DaffioDocsService } from '../services/docs.service';
import { DaffioDocsFactory } from '../testing/factories/docs.factory';

describe('DocsResolver', () => {
let resolver: DocsResolver<DaffioDoc, DaffioGuideList>;
let docsService: DaffioDocsService<DaffioDoc, DaffioGuideList>;
let resolver: DocsResolver<DaffioDoc, DaffioPackagesList>;
let docsService: DaffioDocsService<DaffioDoc, DaffioPackagesList>;
let router: Router;

const doc = new DaffioDocsFactory().create();
const stubDocService: DaffioDocsServiceInterface<DaffioDoc, DaffioGuideList> = {
const stubDocService: DaffioDocsServiceInterface<DaffioDoc, DaffioPackagesList> = {
get: (path: string): Observable<DaffioDoc> => of(doc),
getGuideList: () => of(),
};
Expand Down
4 changes: 2 additions & 2 deletions apps/daffio/src/app/docs/resolvers/docs-resolver.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import {
} from '@daffodil/core/routing';

import { DaffioDoc } from '../models/doc';
import { DaffioGuideList } from '../models/guide-list';
import { DaffioPackagesList } from '../models/packages-list';
import { DaffioDocsService } from '../services/docs.service';

@Injectable({
providedIn: 'root',
})
export class DocsResolver<T extends DaffioDoc, V extends DaffioGuideList> {
export class DocsResolver<T extends DaffioDoc, V extends DaffioPackagesList> {

constructor(private docService: DaffioDocsService<T, V>, private router: Router) { }

Expand Down
5 changes: 2 additions & 3 deletions apps/daffio/src/app/docs/services/docs-service.interface.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Observable } from 'rxjs';

import { DaffioDoc } from '../models/doc';
import { DaffioDocList } from '../models/doc-list';
import { DaffioGuideList } from '../models/guide-list';
import { DaffioPackagesList } from '../models/packages-list';

export interface DaffioDocsServiceInterface<T extends DaffioDoc = DaffioDoc, V extends DaffioGuideList = DaffioGuideList> {
export interface DaffioDocsServiceInterface<T extends DaffioDoc = DaffioDoc, V extends DaffioPackagesList = DaffioPackagesList> {
get(path: string): Observable<T>;
getGuideList(): Observable<V>;
}
10 changes: 5 additions & 5 deletions apps/daffio/src/app/docs/services/docs.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import {
DaffioAssetFetchServiceInterface,
} from '../../core/assets/fetch/service.interface';
import { DaffioDoc } from '../models/doc';
import { DaffioGuideList } from '../models/guide-list';
import { DaffioPackagesList } from '../models/packages-list';
import { DaffioDocsFactory } from '../testing/factories/docs.factory';
import { mockGuides } from '../testing/factories/guide-list.factory';
import { mockPackages } from '../testing/factories/packages-list.factory';

describe('DaffioDocsService', () => {
let service: DaffioDocsService<DaffioDoc, DaffioGuideList>;
let service: DaffioDocsService<DaffioDoc, DaffioPackagesList>;
let fetchAssetServiceSpy: jasmine.SpyObj<DaffioAssetFetchServiceInterface>;
let doc: DaffioDoc;
const mockGuideList = mockGuides;
const mockGuideList = mockPackages;

beforeEach(() => {
fetchAssetServiceSpy = jasmine.createSpyObj('DaffioAssetFetchService', ['fetch']);
Expand Down Expand Up @@ -53,7 +53,7 @@ describe('DaffioDocsService', () => {

service.getGuideList().subscribe((guides) => {
expect(guides).toEqual(mockGuideList);
expect(fetchAssetServiceSpy.fetch).toHaveBeenCalledWith('/assets/daffio/docs/guides/guide-list.json');
expect(fetchAssetServiceSpy.fetch).toHaveBeenCalledWith('/assets/daffio/docs/packages/guide-list.json');
done();
});
});
Expand Down
6 changes: 3 additions & 3 deletions apps/daffio/src/app/docs/services/docs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import {
DaffioAssetFetchServiceInterface,
} from '../../core/assets/fetch/service.interface';
import { DaffioDoc } from '../models/doc';
import { DaffioGuideList } from '../models/guide-list';
import { DaffioPackagesList } from '../models/packages-list';

@Injectable({
providedIn: 'root',
})
export class DaffioDocsService<T extends DaffioDoc = DaffioDoc, V extends DaffioGuideList = DaffioGuideList> implements DaffioDocsServiceInterface<T, V> {
export class DaffioDocsService<T extends DaffioDoc = DaffioDoc, V extends DaffioPackagesList = DaffioPackagesList> implements DaffioDocsServiceInterface<T, V> {

constructor(
@Inject(DaffioAssetFetchService) private fetchAsset: DaffioAssetFetchServiceInterface,
Expand All @@ -30,6 +30,6 @@ export class DaffioDocsService<T extends DaffioDoc = DaffioDoc, V extends Daffio
}

getGuideList(): Observable<V> {
return this.fetchAsset.fetch<V>(`${this.docsPath}guides/guide-list.json`);
return this.fetchAsset.fetch<V>(`${this.docsPath}packages/guide-list.json`);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DaffioGuideList } from '../../models/guide-list';
import { DaffioPackagesList } from '../../models/packages-list';

export const mockGuides: DaffioGuideList = {
export const mockPackages: DaffioPackagesList = {
id: '',
title: '',
children: [
Expand All @@ -12,39 +12,39 @@ export const mockGuides: DaffioGuideList = {
id: '',
title: 'Overview',
children: [],
path: 'guides/cart',
path: 'packages/cart',
},
{
id: 'install',
title: 'Installation',
children: [],
path: 'guides/cart/install',
path: 'packages/cart/install',
},
{
id: 'testing',
title: 'Testing',
children: [],
path: 'guides/cart/testing',
path: 'packages/cart/testing',
},
],
},
{
id: 'category',
title: '@daffodil/category',
children: [],
path: 'guides/category',
path: 'packages/category',
},
{
id: 'checkout',
title: '@daffodil/checkout',
children: [],
path: 'guides/checkout',
path: 'packages/checkout',
},
{
id: 'core',
title: '@daffodil/core',
children: [],
path: 'guides/core',
path: 'packages/core',
},
{
id: 'design',
Expand All @@ -54,7 +54,7 @@ export const mockGuides: DaffioGuideList = {
id: '',
title: 'Overview',
children: [],
path: 'guides/design',
path: 'packages/design',
},
{
id: 'theming',
Expand All @@ -64,7 +64,7 @@ export const mockGuides: DaffioGuideList = {
id: 'installation',
title: 'Daffodil Theming Installation Guide',
children: [],
path: 'guides/design/theming/installation',
path: 'packages/design/theming/installation',
},
],
},
Expand All @@ -78,13 +78,13 @@ export const mockGuides: DaffioGuideList = {
id: '',
title: 'Overview',
children: [],
path: 'guides/product',
path: 'packages/product',
},
{
id: 'in-memory-driver',
title: 'Using the InMemory Driver',
children: [],
path: 'guides/product/in-memory-driver',
path: 'packages/product/in-memory-driver',
},
],
},
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<ul daff-tree [tree]="_tree" *ngIf="_tree">
<ng-template #daffTreeItemWithChildrenTpl let-node>
<button daffTreeItem [node]="node">{{ node.title }} </button>
<button daffTreeItem [node]="node">{{ node.title }} </button>
</ng-template>

<ng-template #daffTreeItemTpl let-node>
<a daffTreeItem [node]="node" [routerLink]="node.url">{{ node.title }}</a>
<a daffTreeItem [node]="node" [routerLink]="node.url">{{ node.title }}</a>
</ng-template>
</ul>
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('DaffioDocsPackagesListComponent', () => {
],
};

component.guideList = {
component.packagesList = {
id: 'root',
title: 'root',
children: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
daffTransformTreeInPlace,
} from '@daffodil/design/tree';

import { DaffioGuideList } from '../../../docs/models/guide-list';
import { DaffioPackagesList } from '../../../docs/models/packages-list';

const visit = (guide: DaffioGuideList): DaffTreeData<unknown> => ({
const visit = (guide: DaffioPackagesList): DaffTreeData<unknown> => ({
id: guide.id,
title: guide.title,
url: guide.path,
Expand All @@ -27,19 +27,19 @@ const visit = (guide: DaffioGuideList): DaffTreeData<unknown> => ({
})
export class DaffioDocsPackagesListComponent {

_guideList: DaffioGuideList;
_packagesList: DaffioPackagesList;
/**
* The guide list to render
*/
@Input()
get guideList(): DaffioGuideList {
return this._guideList;
get packagesList(): DaffioPackagesList {
return this._packagesList;
};
set guideList(val: DaffioGuideList) {
if(this._guideList !== val) {
set packagesList(val: DaffioPackagesList) {
if(this._packagesList !== val) {
this._tree = daffTransformTreeInPlace(val, visit, 'children');
}
this._guideList = val;
this._packagesList = val;
}

_tree: DaffTreeData<unknown>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from 'rxjs';

import { DaffioDoc } from '../../../docs/models/doc';
import { DaffioGuideList } from '../../../docs/models/guide-list';
import { DaffioPackagesList } from '../../../docs/models/packages-list';
import { DaffioDocsService } from '../../../docs/services/docs.service';
import { DaffioPackage } from '../../components/package-cards/package-cards.component';

Expand All @@ -24,7 +24,7 @@ export class DaffioDocsPackageCardsContainer implements OnInit {
packagesList$: Observable<DaffioPackage[]>;

constructor(
private docService: DaffioDocsService<DaffioDoc, DaffioGuideList>,
private docService: DaffioDocsService<DaffioDoc, DaffioPackagesList>,
) {}

ngOnInit() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<daffio-docs-packages-list [packagesList]="packagesList$ | async"></daffio-docs-packages-list>
Loading
Loading