@pplancq/react-template 2.9.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/mise.toml +2 -2
- package/mocks/browser.ts +1 -1
- package/mocks/fixtures/user.ts +14 -14
- package/mocks/handlers/userHandlers.ts +3 -3
- package/mocks/server.ts +1 -1
- package/package.json +24 -25
- package/playwright-report/html/index.html +90 -0
- package/playwright-report/sonar-results.xml +20 -0
- package/playwright.config.ts +3 -3
- package/src/app/App.tsx +5 -5
- package/src/app/AppHTMLElement.tsx +4 -4
- package/src/app/README.md +2 -2
- package/src/app/assets/css/index.ts +2 -2
- package/src/app/assets/css/reset.css +3 -3
- package/src/app/config/queryClientConfig.ts +1 -1
- package/src/app/config/serviceContainer.ts +2 -2
- package/src/app/providers/Providers/Providers.tsx +5 -5
- package/src/app/providers/QueryClientProvider/QueryClientProvider.tsx +3 -3
- package/src/app/providers/ServiceProvider/ServiceContext.ts +2 -2
- package/src/app/providers/ServiceProvider/ServiceProvider.tsx +4 -4
- package/src/app/routing/Router.tsx +2 -2
- package/src/app/routing/appRoutes.ts +1 -1
- package/src/app/routing/routes.tsx +3 -3
- package/src/demo/README.md +5 -4
- package/src/demo/application/dtos/ArchitecturePrinciple.ts +1 -1
- package/src/demo/application/use-cases/GetArchitecturePrinciplesUseCase.ts +3 -3
- package/src/demo/application/use-cases/GetArchitecturePrinciplesUseCaseInterface.ts +1 -1
- package/src/demo/application/use-cases/GetDemoUsersUseCase.ts +3 -3
- package/src/demo/application/use-cases/GetDemoUsersUseCaseInterface.ts +1 -1
- package/src/demo/domain/repositories/ArchitecturePrincipleRepositoryInterface.d.ts +1 -1
- package/src/demo/domain/repositories/DemoUserRepositoryInterface.d.ts +1 -1
- package/src/demo/infrastructure/repositories/HttpDemoUserRepository.ts +5 -5
- package/src/demo/infrastructure/repositories/StaticArchitecturePrincipleRepository.ts +14 -14
- package/src/demo/serviceDemo.ts +14 -13
- package/src/demo/serviceIdentifiers.ts +4 -4
- package/src/demo/ui/components/DemoFooter/DemoFooter.tsx +5 -5
- package/src/demo/ui/components/DemoFooter/index.ts +1 -1
- package/src/demo/ui/components/DemoHeader/DemoHeader.tsx +10 -10
- package/src/demo/ui/components/DemoHeader/index.ts +1 -1
- package/src/demo/ui/components/DemoNavigation/DemoNavigation.tsx +4 -4
- package/src/demo/ui/components/DemoNavigation/index.ts +1 -1
- package/src/demo/ui/components/Input/Input.tsx +3 -3
- package/src/demo/ui/components/Input/index.ts +1 -1
- package/src/demo/ui/components/Logo/Logo.tsx +2 -2
- package/src/demo/ui/components/Logo/index.ts +1 -1
- package/src/demo/ui/components/NavLink/NavLink.tsx +3 -3
- package/src/demo/ui/components/NavLink/index.ts +1 -1
- package/src/demo/ui/components/TextInput/TextInput.tsx +3 -3
- package/src/demo/ui/components/TextInput/index.ts +1 -1
- package/src/demo/ui/forms/ProfileForm/ProfileForm.tsx +9 -9
- package/src/demo/ui/forms/ProfileForm/index.ts +1 -1
- package/src/demo/ui/hooks/useDemoUsersQuery/useDemoUsersQuery.ts +5 -5
- package/src/demo/ui/layouts/DemoLayout/DemoLayout.tsx +4 -4
- package/src/demo/ui/layouts/MainTemplate/MainTemplate.tsx +2 -2
- package/src/demo/ui/layouts/MainTemplate/index.ts +1 -1
- package/src/demo/ui/pages/DemoHome/DemoHome.module.scss +5 -5
- package/src/demo/ui/pages/DemoHome/DemoHome.tsx +6 -6
- package/src/demo/ui/pages/DependencyInjectionDemo/DependencyInjectionDemo.tsx +5 -5
- package/src/demo/ui/pages/ReactHookFormDemo/ReactHookFormDemo.tsx +4 -4
- package/src/demo/ui/pages/ReactQueryDemo/ReactQueryDemo.tsx +3 -3
- package/src/demo/ui/routing/demoAppRoutes.ts +4 -4
- package/src/demo/ui/routing/demoRoutes.tsx +8 -8
- package/src/main.ts +5 -5
- package/src/react-app-env.d.ts +1 -1
- package/src/shared/infrastructure/http/constant.ts +8 -8
- package/src/shared/infrastructure/http/fetchApi.ts +3 -3
- package/src/shared/ui/hooks/useService/useService.ts +4 -4
- package/test-results/.last-run.json +4 -0
- package/tests/e2e/demo.test.ts +17 -0
- package/tests/e2e/fixture/playwright.fixture.ts +15 -0
- package/tests/{utils → e2e/utils}/createNetworkFixture.ts +2 -2
- package/tests/{utils → e2e/utils}/createTestWithCoverageFixture.ts +8 -8
- package/tests/{utils → e2e/utils}/playwright.globalSetup.ts +4 -4
- package/tests/{utils → e2e/utils}/playwright.globalTeardown.ts +3 -3
- package/{src/app/__tests__ → tests/unit/app}/AppHTMLElement.test.tsx +14 -14
- package/tests/unit/demo/ui/components/DemoFooter/Footer.test.tsx +15 -0
- package/tests/unit/demo/ui/components/DemoHeader/Header.test.tsx +15 -0
- package/tests/unit/demo/ui/components/Logo/Logo.test.tsx +12 -0
- package/tsconfig.json +1 -1
- package/vitest.config.mts +1 -1
- package/postcss.config.mjs +0 -5
- package/src/demo/ui/components/DemoFooter/__tests__/Footer.test.tsx +0 -15
- package/src/demo/ui/components/DemoHeader/__tests__/Header.test.tsx +0 -15
- package/src/demo/ui/components/Logo/__tests__/Logo.test.tsx +0 -12
- package/tests/demo.test.ts +0 -17
- package/tests/fixture/playwright.fixture.ts +0 -15
- /package/{src/demo/ui/components/DemoFooter/__tests__ → tests/unit/demo/ui/components/DemoFooter}/__snapshots__/Footer.test.tsx.snap +0 -0
- /package/{src/demo/ui/components/DemoHeader/__tests__ → tests/unit/demo/ui/components/DemoHeader}/__snapshots__/Header.test.tsx.snap +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<testExecutions version="1">
|
|
2
|
+
<file path="/Users/paul/dev/@pplancq/dev-tools/packages/react-template/tests/e2e/demo.test.ts">
|
|
3
|
+
<testCase name="Demo Test › should have a title" duration="218">
|
|
4
|
+
</testCase>
|
|
5
|
+
<testCase name="Demo Test › should data fetching" duration="225">
|
|
6
|
+
</testCase>
|
|
7
|
+
</file>
|
|
8
|
+
<file path="/Users/paul/dev/@pplancq/dev-tools/packages/react-template/tests/e2e/demo.test.ts">
|
|
9
|
+
<testCase name="Demo Test › should have a title" duration="210">
|
|
10
|
+
</testCase>
|
|
11
|
+
<testCase name="Demo Test › should data fetching" duration="226">
|
|
12
|
+
</testCase>
|
|
13
|
+
</file>
|
|
14
|
+
<file path="/Users/paul/dev/@pplancq/dev-tools/packages/react-template/tests/e2e/demo.test.ts">
|
|
15
|
+
<testCase name="Demo Test › should have a title" duration="518">
|
|
16
|
+
</testCase>
|
|
17
|
+
<testCase name="Demo Test › should data fetching" duration="509">
|
|
18
|
+
</testCase>
|
|
19
|
+
</file>
|
|
20
|
+
</testExecutions>
|
package/playwright.config.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { defineConfig, devices } from '@playwright/test';
|
|
|
3
3
|
const appUrl = 'http://localhost:3000';
|
|
4
4
|
|
|
5
5
|
export default defineConfig({
|
|
6
|
-
testDir: 'tests',
|
|
6
|
+
testDir: 'tests/e2e',
|
|
7
7
|
outputDir: 'test-results',
|
|
8
8
|
fullyParallel: true,
|
|
9
9
|
forbidOnly: Boolean(process.env.CI),
|
|
@@ -18,8 +18,8 @@ export default defineConfig({
|
|
|
18
18
|
{ outputFile: 'playwright-report/sonar-results.xml', sonarcloud: true },
|
|
19
19
|
],
|
|
20
20
|
],
|
|
21
|
-
globalSetup: 'tests/utils/playwright.globalSetup.ts',
|
|
22
|
-
globalTeardown: 'tests/utils/playwright.globalTeardown.ts',
|
|
21
|
+
globalSetup: 'tests/e2e/utils/playwright.globalSetup.ts',
|
|
22
|
+
globalTeardown: 'tests/e2e/utils/playwright.globalTeardown.ts',
|
|
23
23
|
use: {
|
|
24
24
|
baseURL: appUrl,
|
|
25
25
|
trace: 'retain-on-failure',
|
package/src/app/App.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { queryClient } from
|
|
2
|
-
import { serviceContainer } from
|
|
3
|
-
import { Providers } from
|
|
4
|
-
import { Router } from
|
|
1
|
+
import { queryClient } from "@App/config/queryClientConfig";
|
|
2
|
+
import { serviceContainer } from "@App/config/serviceContainer";
|
|
3
|
+
import { Providers } from "@App/providers/Providers/Providers";
|
|
4
|
+
import { Router } from "@App/routing/Router";
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import "@App/assets/css";
|
|
7
7
|
|
|
8
8
|
type AppProps = {
|
|
9
9
|
basename?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { App } from
|
|
2
|
-
import { StrictMode } from
|
|
3
|
-
import { createRoot, type Root } from
|
|
1
|
+
import { App } from "@App/App";
|
|
2
|
+
import { StrictMode } from "react";
|
|
3
|
+
import { createRoot, type Root } from "react-dom/client";
|
|
4
4
|
|
|
5
5
|
// eslint-disable-next-line import/no-default-export
|
|
6
6
|
export default class AppHTMLElement extends HTMLElement {
|
|
@@ -18,7 +18,7 @@ export default class AppHTMLElement extends HTMLElement {
|
|
|
18
18
|
this.isMounted = true;
|
|
19
19
|
this.root.render(
|
|
20
20
|
<StrictMode>
|
|
21
|
-
<App basename={this.getAttribute(
|
|
21
|
+
<App basename={this.getAttribute("basename") ?? ""} />
|
|
22
22
|
</StrictMode>,
|
|
23
23
|
);
|
|
24
24
|
}
|
package/src/app/README.md
CHANGED
|
@@ -24,8 +24,8 @@ place in the application where the Inversify container is created and all bounde
|
|
|
24
24
|
are loaded:
|
|
25
25
|
|
|
26
26
|
```ts
|
|
27
|
-
import { serviceDemo } from
|
|
28
|
-
import { Container } from
|
|
27
|
+
import { serviceDemo } from "@Demo/serviceDemo";
|
|
28
|
+
import { Container } from "inversify";
|
|
29
29
|
|
|
30
30
|
export const serviceContainer = new Container();
|
|
31
31
|
serviceContainer.load(serviceDemo);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "./reset.css";
|
|
2
|
+
import "./mainBody.css";
|
|
@@ -83,8 +83,8 @@ video {
|
|
|
83
83
|
vertical-align: baseline;
|
|
84
84
|
font: inherit;
|
|
85
85
|
font-family:
|
|
86
|
-
-apple-system, BlinkMacSystemFont,
|
|
87
|
-
|
|
86
|
+
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans",
|
|
87
|
+
"Helvetica Neue", sans-serif;
|
|
88
88
|
font-size: 100%;
|
|
89
89
|
-webkit-font-smoothing: antialiased;
|
|
90
90
|
-moz-osx-font-smoothing: grayscale;
|
|
@@ -128,5 +128,5 @@ table {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
code {
|
|
131
|
-
font-family: source-code-pro, Menlo, Monaco, Consolas,
|
|
131
|
+
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
|
|
132
132
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { QueryClientProvider } from
|
|
2
|
-
import { ServiceProvider } from
|
|
3
|
-
import type { QueryClient } from
|
|
4
|
-
import type { Container } from
|
|
5
|
-
import type { PropsWithChildren } from
|
|
1
|
+
import { QueryClientProvider } from "@App/providers/QueryClientProvider/QueryClientProvider";
|
|
2
|
+
import { ServiceProvider } from "@App/providers/ServiceProvider/ServiceProvider";
|
|
3
|
+
import type { QueryClient } from "@tanstack/react-query";
|
|
4
|
+
import type { Container } from "inversify";
|
|
5
|
+
import type { PropsWithChildren } from "react";
|
|
6
6
|
|
|
7
7
|
type ProvidersProps = PropsWithChildren<{
|
|
8
8
|
queryClient: QueryClient;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type QueryClient, QueryClientProvider as ReactQueryClientProvider } from
|
|
2
|
-
import { ReactQueryDevtools } from
|
|
3
|
-
import type { PropsWithChildren } from
|
|
1
|
+
import { type QueryClient, QueryClientProvider as ReactQueryClientProvider } from "@tanstack/react-query";
|
|
2
|
+
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
3
|
+
import type { PropsWithChildren } from "react";
|
|
4
4
|
|
|
5
5
|
type ClientProviderProps = {
|
|
6
6
|
queryClient: QueryClient;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ServiceContext } from
|
|
2
|
-
import type { Container } from
|
|
3
|
-
import type { PropsWithChildren } from
|
|
4
|
-
import { useRef } from
|
|
1
|
+
import { ServiceContext } from "@App/providers/ServiceProvider/ServiceContext";
|
|
2
|
+
import type { Container } from "inversify";
|
|
3
|
+
import type { PropsWithChildren } from "react";
|
|
4
|
+
import { useRef } from "react";
|
|
5
5
|
|
|
6
6
|
export type ServiceProviderProps = PropsWithChildren<{
|
|
7
7
|
container: Container;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { demoRoutes } from
|
|
2
|
-
import type { RouteObject } from
|
|
1
|
+
import { demoRoutes } from "@Demo/ui/routing/demoRoutes";
|
|
2
|
+
import type { RouteObject } from "react-router";
|
|
3
3
|
|
|
4
4
|
export const routeObject: RouteObject[] = [
|
|
5
5
|
{
|
|
6
|
-
path:
|
|
6
|
+
path: "/",
|
|
7
7
|
children: [demoRoutes],
|
|
8
8
|
},
|
|
9
9
|
];
|
package/src/demo/README.md
CHANGED
|
@@ -96,8 +96,8 @@ Declares unique `Symbol` identifiers for every service in the context:
|
|
|
96
96
|
|
|
97
97
|
```ts
|
|
98
98
|
export const DEMO_SERVICES = Object.freeze({
|
|
99
|
-
DemoUserRepository: Symbol.for(
|
|
100
|
-
GetDemoUsersUseCase: Symbol.for(
|
|
99
|
+
DemoUserRepository: Symbol.for("Demo.DemoUserRepository"),
|
|
100
|
+
GetDemoUsersUseCase: Symbol.for("Demo.GetDemoUsersUseCase"),
|
|
101
101
|
// ...
|
|
102
102
|
});
|
|
103
103
|
```
|
|
@@ -111,7 +111,7 @@ A `ContainerModule` that binds each service identifier to its concrete implement
|
|
|
111
111
|
free of framework metadata:
|
|
112
112
|
|
|
113
113
|
```ts
|
|
114
|
-
export const serviceDemo: ContainerModule = new ContainerModule(options => {
|
|
114
|
+
export const serviceDemo: ContainerModule = new ContainerModule((options) => {
|
|
115
115
|
options
|
|
116
116
|
.bind<DemoUserRepositoryInterface>(DEMO_SERVICES.DemoUserRepository)
|
|
117
117
|
.toDynamicValue(() => new HttpDemoUserRepository())
|
|
@@ -120,7 +120,8 @@ export const serviceDemo: ContainerModule = new ContainerModule(options => {
|
|
|
120
120
|
options
|
|
121
121
|
.bind<GetDemoUsersUseCaseInterface>(DEMO_SERVICES.GetDemoUsersUseCase)
|
|
122
122
|
.toDynamicValue(
|
|
123
|
-
services =>
|
|
123
|
+
(services) =>
|
|
124
|
+
new GetDemoUsersUseCase(services.get<DemoUserRepositoryInterface>(DEMO_SERVICES.DemoUserRepository)),
|
|
124
125
|
)
|
|
125
126
|
.inSingletonScope();
|
|
126
127
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ArchitecturePrinciple } from
|
|
2
|
-
import type { GetArchitecturePrinciplesUseCaseInterface } from
|
|
3
|
-
import type { ArchitecturePrincipleRepositoryInterface } from
|
|
1
|
+
import type { ArchitecturePrinciple } from "@Demo/application/dtos/ArchitecturePrinciple";
|
|
2
|
+
import type { GetArchitecturePrinciplesUseCaseInterface } from "@Demo/application/use-cases/GetArchitecturePrinciplesUseCaseInterface";
|
|
3
|
+
import type { ArchitecturePrincipleRepositoryInterface } from "@Demo/domain/repositories/ArchitecturePrincipleRepositoryInterface";
|
|
4
4
|
|
|
5
5
|
export class GetArchitecturePrinciplesUseCase implements GetArchitecturePrinciplesUseCaseInterface {
|
|
6
6
|
public constructor(private readonly architecturePrincipleRepository: ArchitecturePrincipleRepositoryInterface) {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ArchitecturePrinciple } from
|
|
1
|
+
import type { ArchitecturePrinciple } from "@Demo/application/dtos/ArchitecturePrinciple";
|
|
2
2
|
|
|
3
3
|
export interface GetArchitecturePrinciplesUseCaseInterface {
|
|
4
4
|
execute: () => ArchitecturePrinciple[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { GetDemoUsersUseCaseInterface } from
|
|
2
|
-
import type { DemoUser } from
|
|
3
|
-
import type { DemoUserRepositoryInterface } from
|
|
1
|
+
import type { GetDemoUsersUseCaseInterface } from "@Demo/application/use-cases/GetDemoUsersUseCaseInterface";
|
|
2
|
+
import type { DemoUser } from "@Demo/domain/entities/DemoUser";
|
|
3
|
+
import type { DemoUserRepositoryInterface } from "@Demo/domain/repositories/DemoUserRepositoryInterface";
|
|
4
4
|
|
|
5
5
|
export class GetDemoUsersUseCase implements GetDemoUsersUseCaseInterface {
|
|
6
6
|
public constructor(private readonly demoUserRepository: DemoUserRepositoryInterface) {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ArchitecturePrinciple } from
|
|
1
|
+
import type { ArchitecturePrinciple } from "@Demo/application/dtos/ArchitecturePrinciple";
|
|
2
2
|
|
|
3
3
|
export interface ArchitecturePrincipleRepositoryInterface {
|
|
4
4
|
getAll: () => ArchitecturePrinciple[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DemoUser } from
|
|
2
|
-
import type { DemoUserRepositoryInterface } from
|
|
3
|
-
import { fetchApi } from
|
|
1
|
+
import type { DemoUser } from "@Demo/domain/entities/DemoUser";
|
|
2
|
+
import type { DemoUserRepositoryInterface } from "@Demo/domain/repositories/DemoUserRepositoryInterface";
|
|
3
|
+
import { fetchApi } from "@Shared/infrastructure/http/fetchApi";
|
|
4
4
|
|
|
5
5
|
type DemoUserApiResponse = {
|
|
6
6
|
id: number;
|
|
@@ -11,14 +11,14 @@ type DemoUserApiResponse = {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export class HttpDemoUserRepository implements DemoUserRepositoryInterface {
|
|
14
|
-
private readonly apiPath =
|
|
14
|
+
private readonly apiPath = "https://jsonplaceholder.typicode.com/users";
|
|
15
15
|
|
|
16
16
|
public readonly getAll = async (): Promise<DemoUser[]> => {
|
|
17
17
|
const users = await fetchApi<DemoUserApiResponse[]>({
|
|
18
18
|
path: this.apiPath,
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
return users.map(user => ({
|
|
21
|
+
return users.map((user) => ({
|
|
22
22
|
id: user.id,
|
|
23
23
|
name: user.name,
|
|
24
24
|
username: user.username.toUpperCase(),
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import type { ArchitecturePrinciple } from
|
|
2
|
-
import type { ArchitecturePrincipleRepositoryInterface } from
|
|
1
|
+
import type { ArchitecturePrinciple } from "@Demo/application/dtos/ArchitecturePrinciple";
|
|
2
|
+
import type { ArchitecturePrincipleRepositoryInterface } from "@Demo/domain/repositories/ArchitecturePrincipleRepositoryInterface";
|
|
3
3
|
|
|
4
4
|
export class StaticArchitecturePrincipleRepository implements ArchitecturePrincipleRepositoryInterface {
|
|
5
5
|
private readonly architecturePrinciples: ArchitecturePrinciple[] = [
|
|
6
6
|
{
|
|
7
|
-
title:
|
|
8
|
-
description:
|
|
9
|
-
layer:
|
|
7
|
+
title: "Domain stays framework-free",
|
|
8
|
+
description: "The demo domain only defines contracts and pure data structures. React and Inversify stay outside.",
|
|
9
|
+
layer: "domain",
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
title:
|
|
13
|
-
description:
|
|
14
|
-
layer:
|
|
12
|
+
title: "Application orchestrates use cases",
|
|
13
|
+
description: "Use cases expose intent-driven APIs such as GetDemoUsersUseCase instead of leaking infrastructure.",
|
|
14
|
+
layer: "application",
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
title:
|
|
17
|
+
title: "Infrastructure implements contracts",
|
|
18
18
|
description:
|
|
19
|
-
|
|
20
|
-
layer:
|
|
19
|
+
"Concrete adapters, such as the HTTP repository, live in infrastructure and are selected by the container.",
|
|
20
|
+
layer: "infrastructure",
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
title:
|
|
23
|
+
title: "UI depends on abstractions",
|
|
24
24
|
description:
|
|
25
|
-
|
|
26
|
-
layer:
|
|
25
|
+
"React pages use hooks and useService to resolve use cases without importing infrastructure directly.",
|
|
26
|
+
layer: "ui",
|
|
27
27
|
},
|
|
28
28
|
];
|
|
29
29
|
|
package/src/demo/serviceDemo.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import { ContainerModule } from
|
|
10
|
-
import { DEMO_SERVICES } from
|
|
1
|
+
import { GetArchitecturePrinciplesUseCase } from "@Demo/application/use-cases/GetArchitecturePrinciplesUseCase";
|
|
2
|
+
import type { GetArchitecturePrinciplesUseCaseInterface } from "@Demo/application/use-cases/GetArchitecturePrinciplesUseCaseInterface";
|
|
3
|
+
import { GetDemoUsersUseCase } from "@Demo/application/use-cases/GetDemoUsersUseCase";
|
|
4
|
+
import type { GetDemoUsersUseCaseInterface } from "@Demo/application/use-cases/GetDemoUsersUseCaseInterface";
|
|
5
|
+
import type { ArchitecturePrincipleRepositoryInterface } from "@Demo/domain/repositories/ArchitecturePrincipleRepositoryInterface";
|
|
6
|
+
import type { DemoUserRepositoryInterface } from "@Demo/domain/repositories/DemoUserRepositoryInterface";
|
|
7
|
+
import { HttpDemoUserRepository } from "@Demo/infrastructure/repositories/HttpDemoUserRepository";
|
|
8
|
+
import { StaticArchitecturePrincipleRepository } from "@Demo/infrastructure/repositories/StaticArchitecturePrincipleRepository";
|
|
9
|
+
import { ContainerModule } from "inversify";
|
|
10
|
+
import { DEMO_SERVICES } from "./serviceIdentifiers";
|
|
11
11
|
|
|
12
|
-
export const serviceDemo: ContainerModule = new ContainerModule(options => {
|
|
12
|
+
export const serviceDemo: ContainerModule = new ContainerModule((options) => {
|
|
13
13
|
options
|
|
14
14
|
.bind<DemoUserRepositoryInterface>(DEMO_SERVICES.DemoUserRepository)
|
|
15
15
|
.toDynamicValue(() => new HttpDemoUserRepository())
|
|
@@ -18,7 +18,8 @@ export const serviceDemo: ContainerModule = new ContainerModule(options => {
|
|
|
18
18
|
options
|
|
19
19
|
.bind<GetDemoUsersUseCaseInterface>(DEMO_SERVICES.GetDemoUsersUseCase)
|
|
20
20
|
.toDynamicValue(
|
|
21
|
-
services =>
|
|
21
|
+
(services) =>
|
|
22
|
+
new GetDemoUsersUseCase(services.get<DemoUserRepositoryInterface>(DEMO_SERVICES.DemoUserRepository)),
|
|
22
23
|
)
|
|
23
24
|
.inSingletonScope();
|
|
24
25
|
|
|
@@ -30,7 +31,7 @@ export const serviceDemo: ContainerModule = new ContainerModule(options => {
|
|
|
30
31
|
options
|
|
31
32
|
.bind<GetArchitecturePrinciplesUseCaseInterface>(DEMO_SERVICES.GetArchitecturePrinciplesUseCase)
|
|
32
33
|
.toDynamicValue(
|
|
33
|
-
services =>
|
|
34
|
+
(services) =>
|
|
34
35
|
new GetArchitecturePrinciplesUseCase(
|
|
35
36
|
services.get<ArchitecturePrincipleRepositoryInterface>(DEMO_SERVICES.ArchitecturePrincipleRepository),
|
|
36
37
|
),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const DEMO_SERVICES = Object.freeze({
|
|
2
|
-
DemoUserRepository: Symbol.for(
|
|
3
|
-
GetDemoUsersUseCase: Symbol.for(
|
|
4
|
-
ArchitecturePrincipleRepository: Symbol.for(
|
|
5
|
-
GetArchitecturePrinciplesUseCase: Symbol.for(
|
|
2
|
+
DemoUserRepository: Symbol.for("Demo.DemoUserRepository"),
|
|
3
|
+
GetDemoUsersUseCase: Symbol.for("Demo.GetDemoUsersUseCase"),
|
|
4
|
+
ArchitecturePrincipleRepository: Symbol.for("Demo.ArchitecturePrincipleRepository"),
|
|
5
|
+
GetArchitecturePrinciplesUseCase: Symbol.for("Demo.GetArchitecturePrinciplesUseCase"),
|
|
6
6
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import logo from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Link } from
|
|
1
|
+
import logo from "@Demo/ui/assets/images/logo.png";
|
|
2
|
+
import { Logo } from "@Demo/ui/components/Logo/Logo";
|
|
3
|
+
import { demoAppRoutes } from "@Demo/ui/routing/demoAppRoutes";
|
|
4
|
+
import { Link } from "react-router";
|
|
5
5
|
|
|
6
|
-
import classes from
|
|
6
|
+
import classes from "./DemoFooter.module.css";
|
|
7
7
|
|
|
8
8
|
export const DemoFooter = () => {
|
|
9
9
|
return (
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DemoFooter } from
|
|
1
|
+
export { DemoFooter } from "./DemoFooter";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import logo from
|
|
2
|
-
import { DemoNavigation } from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { Link } from
|
|
1
|
+
import logo from "@Demo/ui/assets/images/logo.png";
|
|
2
|
+
import { DemoNavigation } from "@Demo/ui/components/DemoNavigation/DemoNavigation";
|
|
3
|
+
import { Logo } from "@Demo/ui/components/Logo/Logo";
|
|
4
|
+
import { demoAppRoutes } from "@Demo/ui/routing/demoAppRoutes";
|
|
5
|
+
import { Link } from "react-router";
|
|
6
6
|
|
|
7
|
-
import classes from
|
|
7
|
+
import classes from "./DemoHeader.module.css";
|
|
8
8
|
|
|
9
9
|
export const DemoHeader = () => {
|
|
10
10
|
return (
|
|
@@ -14,10 +14,10 @@ export const DemoHeader = () => {
|
|
|
14
14
|
</Link>
|
|
15
15
|
<DemoNavigation
|
|
16
16
|
links={[
|
|
17
|
-
{ label:
|
|
18
|
-
{ label:
|
|
19
|
-
{ label:
|
|
20
|
-
{ label:
|
|
17
|
+
{ label: "Overview", url: demoAppRoutes.home },
|
|
18
|
+
{ label: "React Query", url: demoAppRoutes.reactQuery },
|
|
19
|
+
{ label: "React Hook Form", url: demoAppRoutes.reactHookForm },
|
|
20
|
+
{ label: "Dependency Injection", url: demoAppRoutes.dependencyInjection },
|
|
21
21
|
]}
|
|
22
22
|
/>
|
|
23
23
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DemoHeader } from
|
|
1
|
+
export { DemoHeader } from "./DemoHeader";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NavLink } from
|
|
2
|
-
import { useId } from
|
|
3
|
-
import classes from
|
|
1
|
+
import { NavLink } from "@Demo/ui/components/NavLink/NavLink";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import classes from "./DemoNavigation.module.css";
|
|
4
4
|
|
|
5
5
|
type DemoNavigationProps = {
|
|
6
6
|
links: { label: string; url: string }[];
|
|
@@ -12,7 +12,7 @@ export const DemoNavigation = ({ links }: DemoNavigationProps) => {
|
|
|
12
12
|
return (
|
|
13
13
|
<nav>
|
|
14
14
|
<ul className={classes.navList}>
|
|
15
|
-
{links.map(link => (
|
|
15
|
+
{links.map((link) => (
|
|
16
16
|
<li key={`${id} ${link.label} ${link.url}`}>
|
|
17
17
|
<NavLink to={link.url} className={classes.a}>
|
|
18
18
|
{link.label}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DemoNavigation } from
|
|
1
|
+
export { DemoNavigation } from "./DemoNavigation";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { forwardRef, InputHTMLAttributes, useId } from
|
|
2
|
-
import classes from
|
|
1
|
+
import { forwardRef, InputHTMLAttributes, useId } from "react";
|
|
2
|
+
import classes from "./Input.module.scss";
|
|
3
3
|
|
|
4
4
|
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
5
5
|
label: string;
|
|
@@ -24,4 +24,4 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(({ label, hasError
|
|
|
24
24
|
);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
Input.displayName =
|
|
27
|
+
Input.displayName = "Input";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Input } from
|
|
1
|
+
export { Input } from "./Input";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import classes from
|
|
1
|
+
import classes from "./Logo.module.css";
|
|
2
2
|
|
|
3
3
|
type LogoProps = {
|
|
4
4
|
src: string;
|
|
@@ -6,6 +6,6 @@ type LogoProps = {
|
|
|
6
6
|
size?: string;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export const Logo = ({ src, alt, size =
|
|
9
|
+
export const Logo = ({ src, alt, size = "80px" }: LogoProps) => {
|
|
10
10
|
return <img className={classes.logoStyle} style={{ width: size }} src={src} alt={alt} />;
|
|
11
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Logo } from
|
|
1
|
+
export { Logo } from "./Logo";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ComponentProps } from
|
|
2
|
-
import { NavLink as RouterNavLink } from
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { NavLink as RouterNavLink } from "react-router";
|
|
3
3
|
|
|
4
4
|
type NavLinkProps = ComponentProps<typeof RouterNavLink>;
|
|
5
5
|
|
|
6
6
|
export const NavLink = ({ className, ...props }: NavLinkProps) => (
|
|
7
|
-
<RouterNavLink {...props} className={[className].filter(Boolean).join(
|
|
7
|
+
<RouterNavLink {...props} className={[className].filter(Boolean).join(" ")} />
|
|
8
8
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { NavLink } from
|
|
1
|
+
export { NavLink } from "./NavLink";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Input } from
|
|
2
|
-
import type { InputHTMLAttributes } from
|
|
3
|
-
import { type FieldError, useFormContext } from
|
|
1
|
+
import { Input } from "@Demo/ui/components/Input/Input";
|
|
2
|
+
import type { InputHTMLAttributes } from "react";
|
|
3
|
+
import { type FieldError, useFormContext } from "react-hook-form";
|
|
4
4
|
|
|
5
5
|
interface TextInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
6
6
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { TextInput } from
|
|
1
|
+
export { TextInput } from "./TextInput";
|