From e28703dfb2ae72910f730e54ae9a7ad3bc9a9188 Mon Sep 17 00:00:00 2001 From: tonyaellie Date: Fri, 25 Oct 2024 14:40:45 +0000 Subject: [PATCH] chore: get front end tests passing --- frontend/assets/css/main.css | 58 ++++++++++++++++++++ frontend/components/Base/SectionHeader.vue | 1 - frontend/components/Form/Autocomplete2.vue | 10 ++-- frontend/components/Form/TextArea.vue | 13 ++--- frontend/components/Form/TextField.vue | 10 ++-- frontend/components/Item/Card.vue | 2 +- frontend/components/Item/CreateModal.vue | 8 ++- frontend/components/Item/View/Table.vue | 24 ++++---- frontend/components/Label/CreateModal.vue | 6 +- frontend/components/Location/CreateModal.vue | 8 ++- frontend/components/Location/Selector.vue | 8 ++- frontend/components/Location/Tree/Root.vue | 1 + frontend/components/Maintenance/ListView.vue | 4 +- frontend/components/global/Markdown.vue | 50 +---------------- frontend/composables/use-formatters.ts | 23 ++------ frontend/layouts/default.vue | 18 +++--- frontend/lib/api/__test__/user/items.test.ts | 4 +- frontend/pages/item/[id]/index.vue | 11 +--- frontend/pages/item/[id]/index/edit.vue | 4 +- frontend/pages/label/[id].vue | 8 ++- frontend/pages/location/[id].vue | 14 ++++- frontend/pages/profile.vue | 15 +++-- frontend/pages/tools.vue | 4 ++ 23 files changed, 168 insertions(+), 136 deletions(-) diff --git a/frontend/assets/css/main.css b/frontend/assets/css/main.css index 8a9d8fa72..185c47f5f 100644 --- a/frontend/assets/css/main.css +++ b/frontend/assets/css/main.css @@ -28,3 +28,61 @@ ::-webkit-scrollbar-thumb:hover { background-color: #9B9B9B; } + +.scroll-bg::-webkit-scrollbar { + width: 0.5rem; +} + +.scroll-bg::-webkit-scrollbar-thumb { + border-radius: 0.25rem; + @apply bg-base-300; +} + +.markdown > :first-child { + margin-top: 0px !important; +} + +.markdown :where(p, ul, ol, dl, blockquote, h1, h2, h3, h4, h5, h6) { + margin-top: var(--y-gap); + margin-bottom: var(--y-gap); +} + +.markdown :where(ul) { + list-style: disc; + margin-left: 2rem; +} + +.markdown :where(ol) { + list-style: decimal; + margin-left: 2rem; +} +/* Heading Styles */ +.markdown :where(h1) { + font-size: 2rem; + font-weight: 700; +} + +.markdown :where(h2) { + font-size: 1.5rem; + font-weight: 700; +} + +.markdown :where(h3) { + font-size: 1.25rem; + font-weight: 700; +} + +.markdown :where(h4) { + font-size: 1rem; + font-weight: 700; +} + +.markdown :where(h5) { + font-size: 0.875rem; + font-weight: 700; +} + +.markdown :where(h6) { + font-size: 0.75rem; + font-weight: 700; +} diff --git a/frontend/components/Base/SectionHeader.vue b/frontend/components/Base/SectionHeader.vue index 387d160fc..9f1a86f25 100644 --- a/frontend/components/Base/SectionHeader.vue +++ b/frontend/components/Base/SectionHeader.vue @@ -4,7 +4,6 @@ class="flex items-center text-3xl font-bold tracking-tight" :class="{ 'text-neutral-content': dark, - 'text-content': !dark, }" > diff --git a/frontend/components/Form/Autocomplete2.vue b/frontend/components/Form/Autocomplete2.vue index 92fef222a..d9ce505cc 100644 --- a/frontend/components/Form/Autocomplete2.vue +++ b/frontend/components/Form/Autocomplete2.vue @@ -156,7 +156,7 @@ const matches = index.value.search("*" + search.value + "*"); - let resultIDs = [] + const resultIDs = []; for (let i = 0; i < matches.length; i++) { const match = matches[i]; const item = props.items[parseInt(match.ref)]; @@ -170,9 +170,11 @@ * Resolve the issue of language not being supported */ for (let i = 0; i < props.items.length; i++) { - const item = props.items[i] - if(resultIDs.find(item_ => item_ === item.id) != undefined){continue} - if(item.treeString.indexOf(search.value) > -1){ + const item = props.items[i]; + if (resultIDs.find(item_ => item_ === item.id) !== undefined) { + continue; + } + if (item.treeString.includes(search.value)) { const display = extractDisplay(item); list.push({ id: i, display, value: item }); } diff --git a/frontend/components/Form/TextArea.vue b/frontend/components/Form/TextArea.vue index f208b3274..87207415a 100644 --- a/frontend/components/Form/TextArea.vue +++ b/frontend/components/Form/TextArea.vue @@ -6,10 +6,10 @@ :class="{ 'text-red-600': typeof value === 'string' && - ((maxLength && value.length > maxLength) || (minLength && value.length < minLength)), + ((maxLength !== -1 && value.length > maxLength) || (minLength !== -1 && value.length < minLength)), }" > - {{ typeof value === "string" && (maxLength || minLength) ? `${value.length}/${maxLength}` : "" }} + {{ typeof value === "string" && (maxLength !== -1 || minLength !== -1) ? `${value.length}/${maxLength}` : "" }}