diff --git a/adev/src/app/main.component.ts b/adev/src/app/main.component.ts new file mode 100644 index 00000000000..dca2b2b8d9b --- /dev/null +++ b/adev/src/app/main.component.ts @@ -0,0 +1,28 @@ +import {Component, effect, inject, model, WritableSignal} from '@angular/core'; +import {IS_SEARCH_DIALOG_OPEN, Search} from '@angular/docs'; +import {RouterOutlet} from '@angular/router'; + +@Component({ + standalone: true, + selector: 'adev-main', + imports: [RouterOutlet], + template: ``, +}) +export default class MainComponent { + private readonly displaySearchDialog: WritableSignal = inject(IS_SEARCH_DIALOG_OPEN); + private readonly searchService = inject(Search); + search = model(''); + + constructor() { + effect( + () => { + const search = this.search(); + if (search !== undefined) { + this.displaySearchDialog.set(true); + this.searchService.updateSearchQuery(search); + } + }, + {allowSignalWrites: true}, + ); + } +} diff --git a/adev/src/app/routes.ts b/adev/src/app/routes.ts index ae96698e794..4f561e13583 100644 --- a/adev/src/app/routes.ts +++ b/adev/src/app/routes.ts @@ -12,6 +12,7 @@ import {Route} from '@angular/router'; import {DefaultPage, PagePrefix} from './core/enums/pages'; import {SUB_NAVIGATION_DATA} from './sub-navigation-data'; import {mapApiManifestToRoutes} from './features/references/helpers/manifest.helper'; +import MainComponent from './main.component'; // Docs navigation data contains routes which navigates to /tutorials pages, in // that case we should load Tutorial component @@ -236,6 +237,7 @@ const REDIRECT_ROUTES: Route[] = [ export const routes: Route[] = [ { path: '', + component: MainComponent, children: [ { path: '',