From 67be414d822f13007a447d063d3f9638198c7c85 Mon Sep 17 00:00:00 2001 From: Bhasher Date: Fri, 5 Jan 2024 02:22:34 +0100 Subject: [PATCH] Split types in files --- frontend/src/api/cards.ts | 7 +- frontend/src/api/projects.ts | 8 ++- frontend/src/api/tags.ts | 6 +- frontend/src/lib/api/cards.ts | 3 +- frontend/src/lib/api/projects.ts | 4 +- frontend/src/lib/api/tags.ts | 3 +- .../lib/components/project/card/card.svelte | 6 +- .../card/header/menus/group_menu.svelte | 2 +- .../card/header/menus/sort_menu.svelte | 2 +- .../components/project/card/modal_card.svelte | 4 +- .../components/project/card/modal_tag.svelte | 4 +- .../card/modal_tag/modal_tag_title.svelte | 2 +- .../card/modal_tag/modal_tag_value.svelte | 4 +- .../project/card/modal_tag/select_tags.svelte | 4 +- .../components/project/card/modal_tags.svelte | 4 +- .../src/lib/components/project/column.svelte | 9 +-- .../src/lib/components/project/header.svelte | 5 +- .../src/lib/components/project/project.svelte | 7 +- .../components/projects/selectProject.svelte | 2 +- frontend/src/lib/components/sidebar.svelte | 12 ++-- frontend/src/lib/{stores => }/config.ts | 0 frontend/src/lib/index.ts | 1 - frontend/src/lib/stores/interfaces.ts | 68 ------------------- frontend/src/lib/stores/project_tags.ts | 5 +- frontend/src/lib/stores/smallStore.ts | 11 +-- frontend/src/lib/types/Card.ts | 9 +++ frontend/src/lib/types/MeTag.ts | 9 +++ frontend/src/lib/types/Project.ts | 4 ++ frontend/src/lib/types/TagOption.ts | 5 ++ frontend/src/lib/types/TagValue.ts | 6 ++ frontend/src/lib/types/View.ts | 9 +++ frontend/src/lib/utils/api.ts | 2 +- frontend/src/lib/utils/parser.ts | 27 ++++++++ frontend/src/routes/+page.svelte | 4 +- frontend/src/routes/[project]/+page.svelte | 12 ++-- 35 files changed, 145 insertions(+), 125 deletions(-) rename frontend/src/lib/{stores => }/config.ts (100%) delete mode 100644 frontend/src/lib/index.ts delete mode 100644 frontend/src/lib/stores/interfaces.ts create mode 100644 frontend/src/lib/types/Card.ts create mode 100644 frontend/src/lib/types/MeTag.ts create mode 100644 frontend/src/lib/types/Project.ts create mode 100644 frontend/src/lib/types/TagOption.ts create mode 100644 frontend/src/lib/types/TagValue.ts create mode 100644 frontend/src/lib/types/View.ts create mode 100644 frontend/src/lib/utils/parser.ts diff --git a/frontend/src/api/cards.ts b/frontend/src/api/cards.ts index aeb8387..f442ae5 100644 --- a/frontend/src/api/cards.ts +++ b/frontend/src/api/cards.ts @@ -1,6 +1,7 @@ -import type { Card, TagValue } from '../stores/interfaces'; -import api, { processError } from '../utils/api'; -import status from '../utils/status'; +import type TagValue from '$lib/types/TagValue'; +import type Card from '$lib/types/Card'; +import api, { processError } from '$lib/utils/api'; +import status from '$lib/utils/status'; export async function newCardApi(projectId: number, tags: TagValue[]): Promise { const response = await api.post(`/v1/cards`, { diff --git a/frontend/src/api/projects.ts b/frontend/src/api/projects.ts index 85bfde9..23a1cbf 100644 --- a/frontend/src/api/projects.ts +++ b/frontend/src/api/projects.ts @@ -1,6 +1,8 @@ -import { parseCards, type Card, type Project } from '../stores/interfaces'; -import api, { processError } from '../utils/api'; -import status from '../utils/status'; +import type Card from '$lib/types/Card'; +import type Project from '$lib/types/Project'; +import api, { processError } from '$lib/utils/api'; +import { parseCards } from '$lib/utils/parser'; +import status from '$lib/utils/status'; export async function getProjectAPI(projectId: number): Promise { const response = await api.get(`/v1/projects/${projectId}`); diff --git a/frontend/src/api/tags.ts b/frontend/src/api/tags.ts index 3d87fac..0b582e8 100644 --- a/frontend/src/api/tags.ts +++ b/frontend/src/api/tags.ts @@ -1,6 +1,6 @@ -import type { MeTag, TagOption } from '../stores/interfaces'; -import api, { processError } from '../utils/api'; -import status from '../utils/status'; +import type TagOption from '$lib/types/TagOption'; +import api, { processError } from '$lib/utils/api'; +import status from '$lib/utils/status'; export async function updateTagAPI(option: TagOption): Promise { const response = diff --git a/frontend/src/lib/api/cards.ts b/frontend/src/lib/api/cards.ts index aeb8387..00c6f5d 100644 --- a/frontend/src/lib/api/cards.ts +++ b/frontend/src/lib/api/cards.ts @@ -1,4 +1,5 @@ -import type { Card, TagValue } from '../stores/interfaces'; +import type { TagValue } from "$lib/types/TagValue"; +import type { Card } from "$lib/types/Card"; import api, { processError } from '../utils/api'; import status from '../utils/status'; diff --git a/frontend/src/lib/api/projects.ts b/frontend/src/lib/api/projects.ts index 44160cf..23a1cbf 100644 --- a/frontend/src/lib/api/projects.ts +++ b/frontend/src/lib/api/projects.ts @@ -1,5 +1,7 @@ -import { parseCards, type Card, type Project } from '$lib/stores/interfaces'; +import type Card from '$lib/types/Card'; +import type Project from '$lib/types/Project'; import api, { processError } from '$lib/utils/api'; +import { parseCards } from '$lib/utils/parser'; import status from '$lib/utils/status'; export async function getProjectAPI(projectId: number): Promise { diff --git a/frontend/src/lib/api/tags.ts b/frontend/src/lib/api/tags.ts index 07cbd8f..88b2b63 100644 --- a/frontend/src/lib/api/tags.ts +++ b/frontend/src/lib/api/tags.ts @@ -1,4 +1,5 @@ -import type { MeTag, TagOption } from '$lib/stores/interfaces'; +import type { TagOption } from "$lib/types/TagOption"; +import type { MeTag } from "$lib/types/MeTag"; import api, { processError } from '$lib/utils/api'; import status from '$lib/utils/status'; diff --git a/frontend/src/lib/components/project/card/card.svelte b/frontend/src/lib/components/project/card/card.svelte index 8dab445..78e19a3 100644 --- a/frontend/src/lib/components/project/card/card.svelte +++ b/frontend/src/lib/components/project/card/card.svelte @@ -1,7 +1,7 @@ diff --git a/frontend/src/lib/components/project/column.svelte b/frontend/src/lib/components/project/column.svelte index 2f4b172..d1cf5b3 100644 --- a/frontend/src/lib/components/project/column.svelte +++ b/frontend/src/lib/components/project/column.svelte @@ -1,12 +1,13 @@