|
1 | | -import {APP_ID, inject, LOCALE_ID, provideAppInitializer, provideZoneChangeDetection} from '@angular/core'; |
2 | | -import {AppComponent} from './app/app.component'; |
3 | | -import {routes} from './app/app.routes'; |
4 | 1 | import {bootstrapApplication} from '@angular/platform-browser'; |
5 | | -import {Apollo} from 'apollo-angular'; |
6 | | -import {MAT_TOOLTIP_DEFAULT_OPTIONS, MatTooltipDefaultOptions} from '@angular/material/tooltip'; |
7 | | -import {apolloOptionsProvider} from './app/shared/config/apollo-options.provider'; |
8 | | -import {LocalizedPaginatorIntlService} from './app/shared/services/localized-paginator-intl.service'; |
9 | | -import {DATE_PIPE_DEFAULT_OPTIONS, DatePipeConfig, registerLocaleData} from '@angular/common'; |
10 | | -import { |
11 | | - activityInterceptor, |
12 | | - graphqlQuerySigner, |
13 | | - naturalProviders, |
14 | | - NaturalSwissParsingDateAdapter, |
15 | | - provideErrorHandler, |
16 | | - provideIcons, |
17 | | - provideSeo, |
18 | | -} from '@ecodev/natural'; |
19 | | -import {provideHttpClient, withInterceptors} from '@angular/common/http'; |
20 | | -import {MAT_PAGINATOR_DEFAULT_OPTIONS, MatPaginatorDefaultOptions, MatPaginatorIntl} from '@angular/material/paginator'; |
21 | | -import { |
22 | | - DateAdapter, |
23 | | - ErrorStateMatcher, |
24 | | - provideNativeDateAdapter, |
25 | | - ShowOnDirtyErrorStateMatcher, |
26 | | -} from '@angular/material/core'; |
27 | | -import {LoggerExtraService} from './app/shared/services/logger-extra.service'; |
28 | | -import {localConfig} from './app/shared/generated-config'; |
29 | | -import localeFRCH from '@angular/common/locales/fr-CH'; |
30 | | -import {provideRouter, withInMemoryScrolling, withRouterConfig} from '@angular/router'; |
31 | | -import {MAT_TABS_CONFIG, MatTabsConfig} from '@angular/material/tabs'; |
32 | | - |
33 | | -registerLocaleData(localeFRCH); |
34 | | - |
35 | | -const matTooltipCustomConfig: MatTooltipDefaultOptions = { |
36 | | - showDelay: 5, |
37 | | - hideDelay: 5, |
38 | | - touchendHideDelay: 5, |
39 | | - touchGestures: 'off', |
40 | | -}; |
| 2 | +import {appConfig} from './app/app.config'; |
| 3 | +import {AppComponent} from './app/app.component'; |
41 | 4 |
|
42 | | -bootstrapApplication(AppComponent, { |
43 | | - providers: [ |
44 | | - provideZoneChangeDetection({eventCoalescing: true}), |
45 | | - provideNativeDateAdapter(), |
46 | | - Apollo, |
47 | | - naturalProviders, |
48 | | - provideErrorHandler(localConfig.log.url, LoggerExtraService), |
49 | | - provideSeo({ |
50 | | - applicationName: 'Les artisans de la transition', |
51 | | - defaultDescription: 'Comprendre l’urgence écologique, Des pistes pour y répondre', |
52 | | - defaultRobots: 'all, index, follow', |
53 | | - }), |
54 | | - provideIcons({}), |
55 | | - {provide: APP_ID, useValue: 'serverApp'}, |
56 | | - { |
57 | | - provide: DateAdapter, |
58 | | - useClass: NaturalSwissParsingDateAdapter, |
59 | | - }, |
60 | | - { |
61 | | - provide: DATE_PIPE_DEFAULT_OPTIONS, |
62 | | - useValue: {dateFormat: 'dd.MM.y HH:mm'} satisfies DatePipeConfig, |
63 | | - }, |
64 | | - { |
65 | | - // Use OnDirty instead of default OnTouched, that allows to validate while editing. Touched is updated after blur. |
66 | | - provide: ErrorStateMatcher, |
67 | | - useClass: ShowOnDirtyErrorStateMatcher, |
68 | | - }, |
69 | | - { |
70 | | - // See https://github.com/angular/components/issues/26580 |
71 | | - provide: MAT_PAGINATOR_DEFAULT_OPTIONS, |
72 | | - useValue: { |
73 | | - formFieldAppearance: 'fill', |
74 | | - } satisfies MatPaginatorDefaultOptions, |
75 | | - }, |
76 | | - { |
77 | | - provide: MAT_TABS_CONFIG, |
78 | | - useValue: { |
79 | | - stretchTabs: false, |
80 | | - } satisfies MatTabsConfig, |
81 | | - }, |
82 | | - { |
83 | | - provide: LOCALE_ID, |
84 | | - useValue: 'fr-CH', |
85 | | - }, |
86 | | - { |
87 | | - provide: DATE_PIPE_DEFAULT_OPTIONS, |
88 | | - useValue: { |
89 | | - timezone: 'fr-CH', |
90 | | - } satisfies DatePipeConfig, |
91 | | - }, |
92 | | - { |
93 | | - provide: MatPaginatorIntl, |
94 | | - useClass: LocalizedPaginatorIntlService, |
95 | | - }, |
96 | | - apolloOptionsProvider, |
97 | | - {provide: MAT_TOOLTIP_DEFAULT_OPTIONS, useValue: matTooltipCustomConfig}, |
98 | | - provideHttpClient(withInterceptors([activityInterceptor, graphqlQuerySigner(localConfig.signedQueries.key)])), |
99 | | - provideRouter( |
100 | | - routes, |
101 | | - withRouterConfig({ |
102 | | - paramsInheritanceStrategy: 'always', |
103 | | - }), |
104 | | - withInMemoryScrolling({ |
105 | | - scrollPositionRestoration: 'top', |
106 | | - }), |
107 | | - ), |
108 | | - provideAppInitializer(() => { |
109 | | - const dateAdapter = inject(DateAdapter); |
110 | | - dateAdapter.setLocale('fr-ch'); |
111 | | - }), |
112 | | - ], |
113 | | -}).catch((err: unknown) => { |
| 5 | +bootstrapApplication(AppComponent, appConfig).catch((err: unknown) => { |
114 | 6 | console.error(err); |
115 | 7 | }); |
0 commit comments