diff --git a/src/app/common/components/TheHeader.vue b/src/app/common/components/TheHeader.vue index 7f18e65..466975c 100644 --- a/src/app/common/components/TheHeader.vue +++ b/src/app/common/components/TheHeader.vue @@ -7,8 +7,7 @@ import TheBrandLogo from "./TheBrandLogo.vue";
diff --git a/src/app/files/FilesTable/FilesTable.vue b/src/app/files/FilesTable/FilesTable.vue deleted file mode 100644 index ab6bffc..0000000 --- a/src/app/files/FilesTable/FilesTable.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - diff --git a/src/app/files/FilesTable/index.ts b/src/app/files/FilesTable/index.ts deleted file mode 100644 index 16c8eb9..0000000 --- a/src/app/files/FilesTable/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { default as FilesTable } from "./FilesTable.vue"; -export * from "./ports"; -export { FILES_TABLE_API_PROVIDE_KEY } from "./store"; diff --git a/src/app/files/FilesTable/ports.ts b/src/app/files/FilesTable/ports.ts deleted file mode 100644 index d930d6c..0000000 --- a/src/app/files/FilesTable/ports.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { BaseFetchManyApiPort } from "@/shared/lib/ports"; -import type { AppFile } from "../domain"; - -export type FilesTableApiPort = BaseFetchManyApiPort; diff --git a/src/app/files/FilesTable/store.ts b/src/app/files/FilesTable/store.ts deleted file mode 100644 index b318ed0..0000000 --- a/src/app/files/FilesTable/store.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { useLoader } from "@/shared/lib/composables/loader"; -import { defineInjectKey, validInject } from "@/shared/lib/di"; -import { storeToRefs } from "pinia"; -import { reactive } from "vue"; -import { useFilesStore } from "../store"; -import type { FilesTableApiPort } from "./ports"; - -export const FILES_TABLE_API_PROVIDE_KEY = - defineInjectKey("FilesTableApi"); - -export function useFilesTableStore() { - const api = validInject(FILES_TABLE_API_PROVIDE_KEY); - - const filesStore = useFilesStore(); - const { files } = storeToRefs(filesStore); - - const loader = useLoader(); - async function fetchMany() { - const files = await loader.wait(api.fetchMany({})); - filesStore.setFiles(files); - } - - return reactive({ - loading: loader.loading, - files, - fetchMany, - }); -} diff --git a/src/app/files/domain/file.ts b/src/app/files/domain/file.ts deleted file mode 100644 index 7d96388..0000000 --- a/src/app/files/domain/file.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { Entity } from "@/shared/lib/entity"; - -export interface AppFile extends Entity { - name: string; - createdAt: Date; -} diff --git a/src/app/files/domain/index.ts b/src/app/files/domain/index.ts deleted file mode 100644 index 1530d1b..0000000 --- a/src/app/files/domain/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { AppFile } from "./file"; diff --git a/src/app/files/index.ts b/src/app/files/index.ts deleted file mode 100644 index 94dbc3b..0000000 --- a/src/app/files/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { FilesTableApiPort } from "./FilesTable"; - -export type FileApiPort = FilesTableApiPort; diff --git a/src/app/files/store.ts b/src/app/files/store.ts deleted file mode 100644 index 7fe263b..0000000 --- a/src/app/files/store.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { defineStore } from "pinia"; -import { ref } from "vue"; -import type { AppFile } from "./domain"; - -export const useFilesStore = defineStore("files", () => { - const data = ref([] as AppFile[]); - - function setFiles(files: AppFile[]): void { - data.value = files; - } - - function addFile(file: AppFile): void { - data.value.unshift(file); - } - - return { files: data, setFiles, addFile }; -}); diff --git a/src/app/lists/ListForm/AudienceListForm.vue b/src/app/lists/ListForm/AudienceListForm.vue deleted file mode 100644 index 6f505ba..0000000 --- a/src/app/lists/ListForm/AudienceListForm.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - diff --git a/src/app/lists/ListForm/index.ts b/src/app/lists/ListForm/index.ts deleted file mode 100644 index 3fdf240..0000000 --- a/src/app/lists/ListForm/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { default as AudienceListForm } from "./AudienceListForm.vue"; -export * from "./ports"; -export { LIST_FORM_API_PROVIDE_KEY } from "./store"; diff --git a/src/app/lists/ListForm/ports.ts b/src/app/lists/ListForm/ports.ts deleted file mode 100644 index 61150a6..0000000 --- a/src/app/lists/ListForm/ports.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { BaseCreateApiPort } from "@/shared/lib/ports"; -import type { List } from "../domain"; - -export interface ListFormApiCreateProps { - displayName: string; -} - -export type ListFormApiPort = BaseCreateApiPort; diff --git a/src/app/lists/ListForm/store.ts b/src/app/lists/ListForm/store.ts deleted file mode 100644 index 3b9c6e2..0000000 --- a/src/app/lists/ListForm/store.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { useLoader } from "@/shared/lib/composables/loader"; -import { defineInjectKey, validInject } from "@/shared/lib/di"; -import { reactive } from "vue"; -import { useListsStore } from "../store"; -import type { ListFormApiCreateProps, ListFormApiPort } from "./ports"; - -export const LIST_FORM_API_PROVIDE_KEY = - defineInjectKey("ListFormApi"); - -export function useListFormStore() { - const api = validInject(LIST_FORM_API_PROVIDE_KEY); - - const listsStore = useListsStore(); - - const loader = useLoader(); - async function create(data: ListFormApiCreateProps) { - const list = await loader.wait(api.create(data)); - listsStore.addList(list); - } - - return reactive({ - loading: loader.loading, - create, - }); -} diff --git a/src/app/lists/ListsTable/AudienceListsTable.vue b/src/app/lists/ListsTable/AudienceListsTable.vue deleted file mode 100644 index 2193146..0000000 --- a/src/app/lists/ListsTable/AudienceListsTable.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - diff --git a/src/app/lists/ListsTable/index.ts b/src/app/lists/ListsTable/index.ts deleted file mode 100644 index a0b4202..0000000 --- a/src/app/lists/ListsTable/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { default as AudienceListsTable } from "./AudienceListsTable.vue"; -export * from "./ports"; -export { LISTS_TABLE_API_PROVIDE_KEY } from "./store"; diff --git a/src/app/lists/ListsTable/ports.ts b/src/app/lists/ListsTable/ports.ts deleted file mode 100644 index 80e681e..0000000 --- a/src/app/lists/ListsTable/ports.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { BaseFetchManyApiPort } from "@/shared/lib/ports"; -import type { List } from "../domain"; - -export type ListsTableApiPort = BaseFetchManyApiPort; diff --git a/src/app/lists/ListsTable/store.ts b/src/app/lists/ListsTable/store.ts deleted file mode 100644 index 12b71fb..0000000 --- a/src/app/lists/ListsTable/store.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { useLoader } from "@/shared/lib/composables/loader"; -import { defineInjectKey, validInject } from "@/shared/lib/di"; -import { storeToRefs } from "pinia"; -import { reactive } from "vue"; -import { useListsStore } from "../store"; -import type { ListsTableApiPort } from "./ports"; - -export const LISTS_TABLE_API_PROVIDE_KEY = - defineInjectKey("ListsTableApi"); - -export function useListsTableStore() { - const api = validInject(LISTS_TABLE_API_PROVIDE_KEY); - - const listsStore = useListsStore(); - const { lists } = storeToRefs(listsStore); - - const loader = useLoader(); - async function fetchMany() { - const lists = await loader.wait(api.fetchMany({})); - listsStore.setLists(lists); - } - - return reactive({ - loading: loader.loading, - lists, - fetchMany, - }); -} diff --git a/src/app/lists/index.ts b/src/app/lists/index.ts index 2e95825..d4fa5b4 100644 --- a/src/app/lists/index.ts +++ b/src/app/lists/index.ts @@ -1,8 +1,3 @@ -import type { ListsTableApiPort } from "./ListsTable"; import type { ListsSelectApiPort } from "./ListsSelect"; -import type { ListFormApiPort } from "./ListForm"; -export type { ListFormApiCreateProps } from "./ListForm"; -export type ListApiPort = ListsTableApiPort & - ListsSelectApiPort & - ListFormApiPort; +export type ListApiPort = ListsSelectApiPort; diff --git a/src/infra/api/file.ts b/src/infra/api/file.ts deleted file mode 100644 index 61dacd7..0000000 --- a/src/infra/api/file.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { FileApiPort } from "@/app/files"; -import type { AppFile } from "@/app/files/domain"; -import { delay } from "@/shared/lib/utils/promise"; -import { faker } from "@faker-js/faker"; - -let $instance: FileApiPort | undefined; - -export class MockFileApi implements FileApiPort { - #files: AppFile[]; - - constructor() { - this.#files = Array.from(new Array(20).keys()).map((_) => { - const id = faker.datatype.uuid(); - const name = faker.system.fileName(); - const createdAt = faker.date.birthdate(); - return { id, name, createdAt }; - }); - } - - static getInstance() { - if (!$instance) { - $instance = new MockFileApi(); - } - return $instance; - } - - async fetchMany(): Promise { - await delay(1000); - return this.#files.concat(); - } -} diff --git a/src/infra/api/list.ts b/src/infra/api/list.ts index 5553912..4224df3 100644 --- a/src/infra/api/list.ts +++ b/src/infra/api/list.ts @@ -1,4 +1,4 @@ -import type { ListApiPort, ListFormApiCreateProps } from "@/app/lists"; +import type { ListApiPort } from "@/app/lists"; import type { List } from "@/app/lists/domain"; import { delay } from "@/shared/lib/utils/promise"; import { faker } from "@faker-js/faker"; @@ -23,17 +23,6 @@ export class MockListApi implements ListApiPort { return $instance; } - async create(createListData: ListFormApiCreateProps): Promise { - const list: List = { - id: faker.datatype.uuid(), - ...createListData, - }; - - this.#lists.unshift(list); - await delay(1000); - return list; - } - async fetchMany(): Promise { await delay(1000); return this.#lists.concat(); diff --git a/src/pages/FilesPage.vue b/src/pages/FilesPage.vue deleted file mode 100644 index eabad3b..0000000 --- a/src/pages/FilesPage.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - diff --git a/src/pages/audience/AudienceCreateListPage.vue b/src/pages/audience/AudienceCreateListPage.vue deleted file mode 100644 index 4ce6237..0000000 --- a/src/pages/audience/AudienceCreateListPage.vue +++ /dev/null @@ -1,33 +0,0 @@ - - - diff --git a/src/pages/audience/AudienceListsPage.vue b/src/pages/audience/AudienceListsPage.vue deleted file mode 100644 index dc602c9..0000000 --- a/src/pages/audience/AudienceListsPage.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - diff --git a/src/pages/audience/AudiencePage.vue b/src/pages/audience/AudiencePage.vue deleted file mode 100644 index 21f48c3..0000000 --- a/src/pages/audience/AudiencePage.vue +++ /dev/null @@ -1,14 +0,0 @@ - - - diff --git a/src/pages/audience/AudienceContactsPage.vue b/src/pages/audience/ContactsPage.vue similarity index 94% rename from src/pages/audience/AudienceContactsPage.vue rename to src/pages/audience/ContactsPage.vue index 4cdd032..222dbda 100644 --- a/src/pages/audience/AudienceContactsPage.vue +++ b/src/pages/audience/ContactsPage.vue @@ -53,7 +53,6 @@ provide(LISTS_SELECT_API_PROVIDE_KEY, listApi); Контакты import("./AudiencePage.vue"), - children: [ - { - path: "contacts/new", - name: "audience_create_contact", - component: () => import("./AudienceCreateContactPage.vue"), - }, - { - path: "contacts/:listId?", - name: "audience_contacts", - component: () => import("./AudienceContactsPage.vue"), - }, - { - path: "lists/new", - name: "audience_create_list", - component: () => import("./AudienceCreateListPage.vue"), - }, - { - path: "lists", - name: "audience_lists", - component: () => import("./AudienceListsPage.vue"), - }, - ], + path: "/contacts/new", + name: "audience_create_contact", + component: () => import("./CreateContactPage.vue"), + }, + { + path: "/contacts/:listId?", + name: "audience_contacts", + component: () => import("./ContactsPage.vue"), }, ]; diff --git a/src/pages/router.ts b/src/pages/router.ts index 64a8c60..cf390cf 100644 --- a/src/pages/router.ts +++ b/src/pages/router.ts @@ -10,11 +10,6 @@ const router = createRouter({ redirect: { name: "audience" }, }, ...audienceRoutes, - { - path: "/files", - name: "email_files", - component: () => import("./FilesPage.vue"), - }, { path: "/:pathMatch(.*)*", name: "not_found",