From e536ca65193f4b5b062ac3affb39c4afa30680ed Mon Sep 17 00:00:00 2001 From: pluja Date: Mon, 26 May 2025 18:04:45 +0000 Subject: [PATCH] Release 202505261804 --- web/src/components/BadgeSmall.astro | 8 ++ web/src/components/BadgeStandard.astro | 4 +- web/src/components/BadgeStandardFilter.astro | 41 ++++++ web/src/components/Chat.astro | 10 +- web/src/components/CommentSummary.astro | 9 +- web/src/components/InputCheckboxGroup.astro | 2 +- web/src/constants/serviceSuggestionType.ts | 12 +- web/src/pages/about.mdx | 4 +- .../admin/service-suggestions/[id].astro | 25 ++-- .../admin/service-suggestions/index.astro | 124 +++++++++++++----- web/src/pages/service-suggestion/[id].astro | 32 +++-- web/src/pages/service-suggestion/index.astro | 49 +++++-- web/src/pages/service-suggestion/new.astro | 3 +- 13 files changed, 244 insertions(+), 79 deletions(-) create mode 100644 web/src/components/BadgeStandardFilter.astro diff --git a/web/src/components/BadgeSmall.astro b/web/src/components/BadgeSmall.astro index a38a144..5be48cb 100644 --- a/web/src/components/BadgeSmall.astro +++ b/web/src/components/BadgeSmall.astro @@ -126,11 +126,13 @@ type Props = Polymorphic< VariantProps & { as: Tag icon?: string + endIcon?: string text: string inlineIcon?: boolean classNames?: { icon?: string text?: string + endIcon?: string } } > @@ -138,6 +140,7 @@ type Props = Polymorphic< const { as: Tag = 'div', icon: iconName, + endIcon: endIconName, text: textContent, inlineIcon, classNames, @@ -159,4 +162,9 @@ const { base, icon: iconSlot, text: textSlot } = badge({ color, variant }) ) } {textContent} + { + !!endIconName && ( + + ) + } diff --git a/web/src/components/BadgeStandard.astro b/web/src/components/BadgeStandard.astro index b1e2032..3af2578 100644 --- a/web/src/components/BadgeStandard.astro +++ b/web/src/components/BadgeStandard.astro @@ -8,11 +8,12 @@ import type { Polymorphic } from 'astro/types' type Props = Polymorphic<{ as: Tag icon: string + endIcon?: string text: string inlineIcon?: boolean }> -const { icon, text, class: className, inlineIcon, as: Tag = 'div', ...divProps } = Astro.props +const { icon, text, class: className, inlineIcon, endIcon, as: Tag = 'div', ...divProps } = Astro.props --- {text} + {!!endIcon && } diff --git a/web/src/components/BadgeStandardFilter.astro b/web/src/components/BadgeStandardFilter.astro new file mode 100644 index 0000000..db110e0 --- /dev/null +++ b/web/src/components/BadgeStandardFilter.astro @@ -0,0 +1,41 @@ +--- +import { uniq } from 'lodash-es' + +import { cn } from '../lib/cn' + +import BadgeStandard from './BadgeStandard.astro' + +import type { ComponentProps } from 'astro/types' + +type Props = Omit< + ComponentProps, + 'as' | 'endIcon' | 'href' | 'icon' | 'text' | 'variant' +> & { + name: string + value: string + label: string + icon: string +} + +const { name, value, label, icon, ...props } = Astro.props + +const selectedValues = Astro.url.searchParams.getAll(name) +const isSelected = selectedValues.includes(value) + +const url = new URL(Astro.url) +url.searchParams.delete(name) +const valuesToSet = uniq(isSelected ? selectedValues.filter((v) => v !== value) : [...selectedValues, value]) +for (const value of valuesToSet) { + url.searchParams.set(name, value) +} +--- + + diff --git a/web/src/components/Chat.astro b/web/src/components/Chat.astro index 63ec14d..6041748 100644 --- a/web/src/components/Chat.astro +++ b/web/src/components/Chat.astro @@ -76,7 +76,15 @@ const inputErrors = isInputError(result?.error) ? result.error.fields : {} /> -