diff --git a/src/resources/js/app.ts b/src/resources/js/app.ts index 6ff6c587..c47efb6c 100644 --- a/src/resources/js/app.ts +++ b/src/resources/js/app.ts @@ -8,7 +8,7 @@ import { createInertiaApp } from '@inertiajs/vue3'; import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers'; // @ts-expect-error Declaration of ZiggyVue import { ZiggyVue } from 'ziggy-js/dist/vue.m'; -import { HasRolePlugin } from '@/plugins/user/authorize'; +import { HasRolePlugin } from '@/shared/plugins/user/authorize'; import PrimeVue from 'primevue/config'; import Tailwind from 'primevue/passthrough/tailwind'; import ToastService from 'primevue/toastservice'; diff --git a/src/resources/js/entities/anime/model/index.ts b/src/resources/js/entities/anime/model/index.ts index 1b54def6..0fdee505 100644 --- a/src/resources/js/entities/anime/model/index.ts +++ b/src/resources/js/entities/anime/model/index.ts @@ -1 +1,5 @@ -export { type AnimePagination, type AnimePerDomain } from './types'; +export { + type AnimePagination, + type AddedAnimePerDomain, + type AddedAnimePerMonth, +} from './types'; diff --git a/src/resources/js/entities/anime/model/types.ts b/src/resources/js/entities/anime/model/types.ts index 3dbea242..9b780805 100644 --- a/src/resources/js/entities/anime/model/types.ts +++ b/src/resources/js/entities/anime/model/types.ts @@ -2,6 +2,8 @@ import { Laravel, Models } from '@/types'; type AnimePagination = Laravel.Pagination; -type AnimePerDomain = Record; +type AddedAnimePerDomain = Record; -export { type AnimePagination, type AnimePerDomain }; +type AddedAnimePerMonth = number[]; + +export { type AnimePagination, type AddedAnimePerDomain, type AddedAnimePerMonth }; diff --git a/src/resources/js/features/dashboard/charts/count-anime-per-domain/CountAnimePerDomain.vue b/src/resources/js/features/dashboard/charts/count-anime-per-domain/CountAnimePerDomain.vue index 4eac89d8..2c8b79c6 100644 --- a/src/resources/js/features/dashboard/charts/count-anime-per-domain/CountAnimePerDomain.vue +++ b/src/resources/js/features/dashboard/charts/count-anime-per-domain/CountAnimePerDomain.vue @@ -1,16 +1,20 @@ + + + + diff --git a/src/resources/js/features/navigation/search-button/index.ts b/src/resources/js/features/navigation/search-button/index.ts new file mode 100644 index 00000000..4c4d236e --- /dev/null +++ b/src/resources/js/features/navigation/search-button/index.ts @@ -0,0 +1 @@ +export { default as SearchButton } from './SearchButton.vue'; diff --git a/src/resources/js/features/navigation/search-modal/SearchModal.test.ts b/src/resources/js/features/navigation/search-modal/SearchModal.test.ts new file mode 100644 index 00000000..cdc071d2 --- /dev/null +++ b/src/resources/js/features/navigation/search-modal/SearchModal.test.ts @@ -0,0 +1,34 @@ +import { describe, expect, it } from 'vitest'; +import { mount } from '@vue/test-utils'; +import { Modal } from '@/shared/ui/modal'; +import { TextInput } from '@/shared/ui/input/text'; +import SearchModal from './SearchModal.vue'; + +describe('SearchModal test (SearchModal.vue)', () => { + it('Shows modal when visible is true', () => { + const wrapper = mount(SearchModal, { + props: { visible: true }, + }); + + expect(wrapper.findComponent(Modal).props('visible')).toBeTruthy(); + }); + + it('Modal emits closed event when it is closed', async () => { + const wrapper = mount(SearchModal, { + props: { visible: true }, + }); + + await wrapper.findComponent(Modal).vm.$emit('close'); + expect(wrapper.emitted()).toHaveProperty('closed'); + }); + + it('Modal binds input value to ref', async () => { + const wrapper = mount(SearchModal, { + props: { visible: true }, + }); + + const input = wrapper.findComponent(TextInput); + await input.setValue('test query'); + expect(wrapper.vm.query).toBe('test query'); + }); +}); diff --git a/src/resources/js/features/navigation/search-modal/SearchModal.vue b/src/resources/js/features/navigation/search-modal/SearchModal.vue new file mode 100644 index 00000000..80ca33ee --- /dev/null +++ b/src/resources/js/features/navigation/search-modal/SearchModal.vue @@ -0,0 +1,37 @@ + + + + + diff --git a/src/resources/js/features/navigation/search-modal/index.ts b/src/resources/js/features/navigation/search-modal/index.ts new file mode 100644 index 00000000..78f1cd75 --- /dev/null +++ b/src/resources/js/features/navigation/search-modal/index.ts @@ -0,0 +1 @@ +export { default as SearchModal } from './SearchModal.vue'; diff --git a/src/resources/js/features/navigation/search/SearchInput.test.ts b/src/resources/js/features/navigation/search/SearchInput.test.ts deleted file mode 100644 index 046313c2..00000000 --- a/src/resources/js/features/navigation/search/SearchInput.test.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { mount } from '@vue/test-utils'; -import SearchInput from './SearchInput.vue'; -import { describe, expect, it } from 'vitest'; - -describe('SearchInput test (SearchInput.vue)', () => { - it('renders input element', () => { - const wrapper = mount(SearchInput); - const input = wrapper.find('input'); - - expect(input.exists()).toBeTruthy(); - }); - - it('focuses on input when CTRL + K is pressed', async () => { - const wrapper = mount(SearchInput, { attachTo: document.body }); - const input = wrapper.find('input'); - - const ctrlKEvent = new KeyboardEvent('keydown', { ctrlKey: true, key: 'k' }); - window.dispatchEvent(ctrlKEvent); - - await wrapper.vm.$nextTick(); - - expect(input.element).toBe(document.activeElement); - }); - - it('updates query when input value changes', async () => { - const wrapper = mount(SearchInput); - const input = wrapper.find('input'); - - await input.setValue('test query'); - - expect(wrapper.vm.query).toBe('test query'); - }); -}); diff --git a/src/resources/js/features/navigation/search/SearchInput.vue b/src/resources/js/features/navigation/search/SearchInput.vue deleted file mode 100644 index a5c7240f..00000000 --- a/src/resources/js/features/navigation/search/SearchInput.vue +++ /dev/null @@ -1,36 +0,0 @@ - - - - - diff --git a/src/resources/js/features/navigation/search/index.ts b/src/resources/js/features/navigation/search/index.ts deleted file mode 100644 index 1a688d8f..00000000 --- a/src/resources/js/features/navigation/search/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as SearchInput } from './SearchInput.vue'; diff --git a/src/resources/js/features/telegram/login-widget/TelegramLoginWidget.test.ts b/src/resources/js/features/telegram/login-widget/TelegramLoginWidget.test.ts index 86a63b90..75be4735 100644 --- a/src/resources/js/features/telegram/login-widget/TelegramLoginWidget.test.ts +++ b/src/resources/js/features/telegram/login-widget/TelegramLoginWidget.test.ts @@ -1,7 +1,7 @@ import { mount } from '@vue/test-utils'; import { describe, expect, it, vitest } from 'vitest'; import TelegramLoginWidget from './TelegramLoginWidget.vue'; -import { RequestAccess, WidgetSize } from './types'; +import { RequestAccess, WidgetSize } from './model/types'; describe('TelegramLoginWidget test (TelegramLoginWidget.vue)', () => { it('Renders correctly', async () => { diff --git a/src/resources/js/features/telegram/login-widget/TelegramLoginWidget.vue b/src/resources/js/features/telegram/login-widget/TelegramLoginWidget.vue index 229b2474..4b4b5eb3 100644 --- a/src/resources/js/features/telegram/login-widget/TelegramLoginWidget.vue +++ b/src/resources/js/features/telegram/login-widget/TelegramLoginWidget.vue @@ -1,7 +1,7 @@