Skip to content

Commit

Permalink
fix: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
thatsamsonkid committed Nov 20, 2024
1 parent 4f4cec3 commit 122b8aa
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
23 changes: 11 additions & 12 deletions apps/app/src/app/core/services/ui-docs.service.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
import { waitFor } from '@analogjs/trpc';
import { Injectable } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { type NestedComponents } from '../models/ui-docs.model';
import { Subject, shareReplay, switchMap } from 'rxjs';
import { injectTRPCClient } from '../../../trpc-client';
import { waitFor } from '@analogjs/trpc';
import { shareReplay, Subject, switchMap } from 'rxjs';

import { type NestedComponents } from '../models/ui-docs.model';

@Injectable()
export class UIDocsService {
private _trpc = injectTRPCClient();
private _uiDocs = toSignal(this._trpc.docs.list.query());

public triggerRefresh$ = new Subject<void>();
public uiDocs$ = this.triggerRefresh$.pipe(
switchMap(() => this._trpc.docs.list.query()),
shareReplay(1)
);
public uiDocs = toSignal(this.uiDocs$)
switchMap(() => this._trpc.docs.list.query()),
shareReplay(1),
);
public uiDocs = toSignal(this.uiDocs$);

constructor(){
void waitFor(this.uiDocs$);
this.triggerRefresh$.next();
constructor() {
void waitFor(this.uiDocs$);
this.triggerRefresh$.next();
}

getPrimitiveDoc(primitive: string): { brain?: NestedComponents; helm?: NestedComponents } | undefined {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ export class UIApiDocsComponent {
public docType = input<'brain' | 'helm'>('brain');

protected uiDocs = computed(() => this._uiDocsService.getPrimitiveDoc(this.primitive()) ?? null);
protected uiPrimitiveItems = computed(() => this.uiDocs()?.[this.docType()] ?? {});
protected uiPrimitiveItems = computed(() => this.uiDocs()?.[this.docType()] ?? {});
protected uiPrimitiveEntries = computed(() => Object.keys(this.uiPrimitiveItems() ?? []));

// FIXME: Typing was getting weird
forceIterator(item:any):any[] {
return item && Array.isArray(item)? item :[]
}
// FIXME: Typing was getting weird
forceIterator(item: any): any[] {
return item && Array.isArray(item) ? item : [];
}
}
4 changes: 2 additions & 2 deletions apps/app/src/server/trpc/routers/docs.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import docsData from '../../../public/assets/ui-api.json';
import { publicProcedure, router } from '../trpc';
import docsData from "../../../public/assets/ui-api.json";

export const docsRouter = router({
list: publicProcedure.query(async () => {
return docsData
return docsData;
}),
});
2 changes: 1 addition & 1 deletion apps/app/src/server/trpc/routers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { noteRouter } from './notes';

export const appRouter = router({
note: noteRouter,
docs:docsRouter
docs: docsRouter,
});
// export type definition of API
export type AppRouter = typeof appRouter;

0 comments on commit 122b8aa

Please sign in to comment.