From 2db955bd7b09a264b2c2f0a282c805e76ac7a49a Mon Sep 17 00:00:00 2001 From: Sheldon Cooper Date: Sat, 17 Jan 2026 15:46:49 -0500 Subject: [PATCH] fix: page styling, search page --- apps/vdb-backend/src/index.ts | 10 ++-- apps/vdn-static/index.html | 2 +- apps/vdn-static/src/App.vue | 2 +- .../molecules/HomeSectionWrapper.vue | 4 +- .../src/components/pages/KotobaPage.vue | 8 ++-- apps/vdn-static/src/service/kotoba.service.ts | 12 +++++ apps/vdn-static/src/service/web.service.ts | 4 ++ libs/common/src/dto.ts | 46 +++++++++++-------- 8 files changed, 54 insertions(+), 34 deletions(-) create mode 100644 apps/vdn-static/src/service/kotoba.service.ts create mode 100644 apps/vdn-static/src/service/web.service.ts diff --git a/apps/vdb-backend/src/index.ts b/apps/vdb-backend/src/index.ts index 5ba7124..0f76771 100644 --- a/apps/vdb-backend/src/index.ts +++ b/apps/vdb-backend/src/index.ts @@ -59,17 +59,13 @@ function initExpress() { await Lemma.find({ relations: { word_forms: { lect: true } } }) ).filter((e) => { for (const wf of e.word_forms) { - if (wf.word_form.includes(search_term)) { - return true; - } + return wf.word_form.includes(search_term); } }); - const lects = await Lect.find(); res.status(200).send({ terms: lemmas.length, - results: lemmas, - lects: lects, + results: lemmas }); }); @@ -101,6 +97,8 @@ function initExpress() { }); } + +//todo: redo this without using google sheets; instead, use a local CSV or like. /** * @param auth The authenticated Google OAuth client. */ diff --git a/apps/vdn-static/index.html b/apps/vdn-static/index.html index f3b171b..0dc687b 100644 --- a/apps/vdn-static/index.html +++ b/apps/vdn-static/index.html @@ -1,5 +1,5 @@ - + diff --git a/apps/vdn-static/src/App.vue b/apps/vdn-static/src/App.vue index 9d8265e..2be3a2c 100644 --- a/apps/vdn-static/src/App.vue +++ b/apps/vdn-static/src/App.vue @@ -56,7 +56,7 @@ const closeBurger = (): void => { Kotoba - + diff --git a/apps/vdn-static/src/components/molecules/HomeSectionWrapper.vue b/apps/vdn-static/src/components/molecules/HomeSectionWrapper.vue index 6bc79bc..946bc81 100644 --- a/apps/vdn-static/src/components/molecules/HomeSectionWrapper.vue +++ b/apps/vdn-static/src/components/molecules/HomeSectionWrapper.vue @@ -13,7 +13,7 @@ defineProps<{ diff --git a/apps/vdn-static/src/components/pages/KotobaPage.vue b/apps/vdn-static/src/components/pages/KotobaPage.vue index 6df35e7..701555b 100644 --- a/apps/vdn-static/src/components/pages/KotobaPage.vue +++ b/apps/vdn-static/src/components/pages/KotobaPage.vue @@ -5,13 +5,13 @@
- +

+ ⚠under construction :3⚠ +

- - - diff --git a/apps/vdn-static/src/service/kotoba.service.ts b/apps/vdn-static/src/service/kotoba.service.ts new file mode 100644 index 0000000..958eecc --- /dev/null +++ b/apps/vdn-static/src/service/kotoba.service.ts @@ -0,0 +1,12 @@ +import axios from "axios"; +import SERVER_URL from "./web.service" +import type { SearchResult } from "@repo/common/dto"; + +export default class KotobaService { + + public static search(search_term:string){ + return axios.get(`${SERVER_URL}/search`, + {params:{ search_term }}); + } + +} \ No newline at end of file diff --git a/apps/vdn-static/src/service/web.service.ts b/apps/vdn-static/src/service/web.service.ts new file mode 100644 index 0000000..05b840d --- /dev/null +++ b/apps/vdn-static/src/service/web.service.ts @@ -0,0 +1,4 @@ +/* Establish constants here */ +export default class WebConstants { + static SERVER_URL: string = "http://localhost:1225" +} \ No newline at end of file diff --git a/libs/common/src/dto.ts b/libs/common/src/dto.ts index 9fffed4..6e17723 100644 --- a/libs/common/src/dto.ts +++ b/libs/common/src/dto.ts @@ -1,51 +1,57 @@ +export interface SearchResult { + terms: number; + results: LemmaDto[]; + lects: LectDto[]; +} + export interface LemmaDto { - lemma_name: string; - word_forms: WordFormDto[]; - examples: ExampleDto[]; - definitions: DefinitionDto[]; - comments: CommentDto[]; - media: MediaDto[]; - + lemma_name: string; + word_forms: WordFormDto[]; + examples: ExampleDto[]; + definitions: DefinitionDto[]; + comments: CommentDto[]; + media: MediaDto[]; parts_of_speech: PartOfSpeechDto[]; } + export interface LectDto { - name: string; + name: string; word_forms: WordFormDto[]; } export interface WordFormDto { - word_form_id: number; - word_form: string; - lemma: LemmaDto; + word_form_id: number; + word_form: string; + lemma: LemmaDto; lect: LectDto; } export interface ExampleDto { - example_id: number; - example_text: string; + example_id: number; + example_text: string; lemma: LemmaDto; } export interface MediaDto { - media_id: number; - media_url: string; + media_id: number; + media_url: string; lemma: LemmaDto; } export interface DefinitionDto { - definition_id: number; - definition_text: string; + definition_id: number; + definition_text: string; lemma: LemmaDto; } export interface CommentDto { - comment_id: number; - comment_text: string; + comment_id: number; + comment_text: string; lemma: LemmaDto; } export interface PartOfSpeechDto { - long_form: string; + long_form: string; short_form: string; }