parent
de2099011b
commit
f2e346fa49
73
frontend/src/lib/container.ts
Normal file
73
frontend/src/lib/container.ts
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
import type { AuthApiService } from '$lib/auth/adapter/gateway/authApiService';
|
||||||
|
import { AuthRepositoryImpl } from '$lib/auth/adapter/gateway/authRepositoryImpl';
|
||||||
|
import type { AuthBloc } from '$lib/auth/adapter/presenter/authBloc';
|
||||||
|
import type { AuthRepository } from '$lib/auth/application/gateway/authRepository';
|
||||||
|
import { GetCurrentUserUseCase } from '$lib/auth/application/useCase/getCurrentUserUseCase';
|
||||||
|
import { AuthApiServiceImpl } from '$lib/auth/framework/api/authApiServiceImpl';
|
||||||
|
import type { ImageApiService } from '$lib/image/adapter/gateway/imageApiService';
|
||||||
|
import { ImageRepositoryImpl } from '$lib/image/adapter/gateway/imageRepositoryImpl';
|
||||||
|
import type { ImageBloc } from '$lib/image/adapter/presenter/imageBloc';
|
||||||
|
import type { ImageRepository } from '$lib/image/application/gateway/imageRepository';
|
||||||
|
import type { UploadImageUseCase } from '$lib/image/application/useCase/uploadImageUseCase';
|
||||||
|
import { ImageApiServiceImpl } from '$lib/image/framework/api/imageApiServiceImpl';
|
||||||
|
import type { PostApiService } from '$lib/post/adapter/gateway/postApiService';
|
||||||
|
import { PostRepositoryImpl } from '$lib/post/adapter/gateway/postRepositoryImpl';
|
||||||
|
import type { PostBloc } from '$lib/post/adapter/presenter/postBloc';
|
||||||
|
import type { PostListBloc } from '$lib/post/adapter/presenter/postListBloc';
|
||||||
|
import type { PostRepository } from '$lib/post/application/gateway/postRepository';
|
||||||
|
import { GetAllPostsUseCase } from '$lib/post/application/useCase/getAllPostsUseCase';
|
||||||
|
import { GetPostUseCase } from '$lib/post/application/useCase/getPostUseCase';
|
||||||
|
import { PostApiServiceImpl } from '$lib/post/framework/api/postApiServiceImpl';
|
||||||
|
|
||||||
|
export class Container {
|
||||||
|
private fetchFn: typeof fetch;
|
||||||
|
|
||||||
|
private _authApiService?: AuthApiService;
|
||||||
|
private _imageApiService?: ImageApiService;
|
||||||
|
private _postApiService?: PostApiService;
|
||||||
|
|
||||||
|
private _authRepository?: AuthRepository;
|
||||||
|
private _imageRepository?: ImageRepository;
|
||||||
|
private _postRepository?: PostRepository;
|
||||||
|
|
||||||
|
private _getCurrentUserUseCase?: GetCurrentUserUseCase;
|
||||||
|
private _uploadImageUseCase?: UploadImageUseCase;
|
||||||
|
private _getAllPostUseCase?: GetAllPostsUseCase;
|
||||||
|
private _getPostUseCase?: GetPostUseCase;
|
||||||
|
|
||||||
|
constructor(fetchFn: typeof fetch) {
|
||||||
|
this.fetchFn = fetchFn;
|
||||||
|
}
|
||||||
|
|
||||||
|
private get authApiService(): AuthApiService {
|
||||||
|
this._authApiService ??= new AuthApiServiceImpl(this.fetchFn);
|
||||||
|
return this._authApiService;
|
||||||
|
}
|
||||||
|
|
||||||
|
private get imageApiService(): ImageApiService {
|
||||||
|
this._imageApiService ??= new ImageApiServiceImpl(this.fetchFn);
|
||||||
|
return this._imageApiService;
|
||||||
|
}
|
||||||
|
|
||||||
|
private get postApiService(): PostApiService {
|
||||||
|
this._postApiService ??= new PostApiServiceImpl(this.fetchFn);
|
||||||
|
return this._postApiService;
|
||||||
|
}
|
||||||
|
|
||||||
|
private get authRepository(): AuthRepository {
|
||||||
|
this._authRepository ??= new AuthRepositoryImpl(this.authApiService);
|
||||||
|
return this._authRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
private get imageRepository(): ImageRepository {
|
||||||
|
this._imageRepository ??= new ImageRepositoryImpl(this.imageApiService);
|
||||||
|
return this._imageRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
private get postRepository(): PostRepository {
|
||||||
|
this._postRepository ??= new PostRepositoryImpl(this.postApiService);
|
||||||
|
return this._postRepository;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ApiService
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import MottoAnimatedMark from './MottoAnimatedMark.svelte';
|
import MottoAnimatedMark from '$lib/home/framework/ui/MottoAnimatedMark.svelte';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getContext } from 'svelte';
|
import { getContext } from 'svelte';
|
||||||
import UploadImageDialoag from './UploadImageDialoag.svelte';
|
import UploadImageDialoag from '$lib/image/framework/ui/UploadImageDialoag.svelte';
|
||||||
import { ImageBloc, ImageEventType } from '$lib/image/adapter/presenter/imageBloc';
|
import { ImageBloc, ImageEventType } from '$lib/image/adapter/presenter/imageBloc';
|
||||||
import { StatusType } from '$lib/common/adapter/presenter/asyncState';
|
import { StatusType } from '$lib/common/adapter/presenter/asyncState';
|
||||||
import { toast } from 'svelte-sonner';
|
import { toast } from 'svelte-sonner';
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
<DialogTitle>Upload Image</DialogTitle>
|
<DialogTitle>Upload Image</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<form id="upload-form" onsubmit={onSubmit}>
|
<form id="upload-image-form" onsubmit={onSubmit}>
|
||||||
<Label for="file-input" class="pb-2">
|
<Label for="file-input" class="pb-2">
|
||||||
{`Image File (${imageMimeTypes.join(', ')})`}
|
{`Image File (${imageMimeTypes.join(', ')})`}
|
||||||
</Label>
|
</Label>
|
||||||
@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
<DialogFooter class="mt-6">
|
<DialogFooter class="mt-6">
|
||||||
<Button variant="outline" onclick={close} {disabled}>Cancel</Button>
|
<Button variant="outline" onclick={close} {disabled}>Cancel</Button>
|
||||||
<Button type="submit" form="upload-form" {disabled}>Submit</Button>
|
<Button type="submit" form="upload-image-form" {disabled}>Submit</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
35
frontend/src/lib/post/framework/ui/CreatePostDialog.svelte
Normal file
35
frontend/src/lib/post/framework/ui/CreatePostDialog.svelte
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { Button, buttonVariants } from '$lib/common/framework/components/ui/button';
|
||||||
|
import { Dialog } from '$lib/common/framework/components/ui/dialog';
|
||||||
|
import DialogContent from '$lib/common/framework/components/ui/dialog/dialog-content.svelte';
|
||||||
|
import DialogFooter from '$lib/common/framework/components/ui/dialog/dialog-footer.svelte';
|
||||||
|
import DialogHeader from '$lib/common/framework/components/ui/dialog/dialog-header.svelte';
|
||||||
|
import DialogTitle from '$lib/common/framework/components/ui/dialog/dialog-title.svelte';
|
||||||
|
import DialogTrigger from '$lib/common/framework/components/ui/dialog/dialog-trigger.svelte';
|
||||||
|
|
||||||
|
const {
|
||||||
|
disabled,
|
||||||
|
onSubmit: createPost,
|
||||||
|
}: {
|
||||||
|
disabled: boolean;
|
||||||
|
onSubmit: () => Promise<void>;
|
||||||
|
} = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Dialog>
|
||||||
|
<DialogTrigger class={buttonVariants({ variant: 'default' })}>Create</DialogTrigger>
|
||||||
|
<DialogContent
|
||||||
|
showCloseButton={false}
|
||||||
|
onInteractOutside={(e) => e.preventDefault()}
|
||||||
|
onEscapeKeydown={(e) => e.preventDefault()}
|
||||||
|
>
|
||||||
|
<DialogHeader class="mb-4">
|
||||||
|
<DialogTitle>Create Post</DialogTitle>
|
||||||
|
</DialogHeader>
|
||||||
|
|
||||||
|
<DialogFooter class="mt-6">
|
||||||
|
<Button variant="outline" onclick={close} {disabled}>Cancel</Button>
|
||||||
|
<Button type="submit" form="upload-image-form" {disabled}>Submit</Button>
|
||||||
|
</DialogFooter>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
11
frontend/src/lib/post/framework/ui/PostManagementPage.svelte
Normal file
11
frontend/src/lib/post/framework/ui/PostManagementPage.svelte
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<script>
|
||||||
|
import CreatePostDialog from '$lib/post/framework/ui/CreatePostDialog.svelte';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="dashboard-container mb-10">
|
||||||
|
<div class="flex flex-row items-center justify-between">
|
||||||
|
<h1 class="py-16 text-5xl font-bold text-gray-800">Image</h1>
|
||||||
|
<CreatePostDialog disabled={isLoading} onSubmit={onUploadImageDialogSubmit} />
|
||||||
|
</div>
|
||||||
|
<p>Gallery is currently unavailable.</p>
|
||||||
|
</div>
|
Loading…
x
Reference in New Issue
Block a user