Open platform to collect and prioritize feedback
feature: make tags clickable (#985)
Théo SZANTOfb62715bb056
diff --git a/public/assets/images/heroicons-eye.svg b/public/assets/images/heroicons-eye.svgnew file mode 100644index 000000000..744413d71--- /dev/null+++ b/public/assets/images/heroicons-eye.svg@@ -0,0 +1,4 @@+<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />+</svg>\ No newline at end of filediff --git a/public/components/ShowTag.scss b/public/components/ShowTag.scssindex 77c4a5d76..2cf3f0234 100644--- a/public/components/ShowTag.scss+++ b/public/components/ShowTag.scss@@ -12,6 +12,15 @@padding: 0 8px;border: 0;+ &[href] {+ opacity: 0.9;+ transition: opacity 0.1s;++ &:hover {+ opacity: 1;+ }+ }+svg {height: 8px;margin-right: 2px;diff --git a/public/components/ShowTag.tsx b/public/components/ShowTag.tsxindex a1ba20bc8..aa0ea2f9b 100644--- a/public/components/ShowTag.tsx+++ b/public/components/ShowTag.tsx@@ -7,6 +7,7 @@ import { classSet } from "@fider/services"interface TagProps {tag: Tagcircular?: boolean+ link?: boolean}const getRGB = (color: string) => {@@ -34,8 +35,9 @@ export const ShowTag = (props: TagProps) => {})return (- <div- title={`${props.tag.name}${!props.tag.isPublic ? " (Private)" : ""}`}+ <a+ href={props.link && props.tag.slug ? `/?tags=${props.tag.slug}` : undefined}+ title={`${props.tag.name}${props.tag.isPublic ? "" : " (Private)"}`}className={className}style={{backgroundColor: `#${props.tag.color}`,@@ -52,6 +54,6 @@ export const ShowTag = (props: TagProps) => {</svg>)}{props.circular ? "" : props.tag.name || "Tag"}- </div>+ </a>)}diff --git a/public/pages/Administration/components/TagListItem.tsx b/public/pages/Administration/components/TagListItem.tsxindex c08abd57f..f841c3e37 100644--- a/public/pages/Administration/components/TagListItem.tsx+++ b/public/pages/Administration/components/TagListItem.tsx@@ -82,7 +82,7 @@ export const TagListItem = (props: TagListItemProps) => {return (<HStack justify="between">- <ShowTag tag={tag} />+ <ShowTag tag={tag} link /><HStack>{buttons}</HStack></HStack>)diff --git a/public/pages/DesignSystem/DesignSystem.page.tsx b/public/pages/DesignSystem/DesignSystem.page.tsxindex abc2f777c..ccc4906fd 100644--- a/public/pages/DesignSystem/DesignSystem.page.tsx+++ b/public/pages/DesignSystem/DesignSystem.page.tsx@@ -64,6 +64,7 @@ const robStark: User = {const easyTag: Tag = { id: 1, slug: "easy", name: "Easy", color: "82c460", isPublic: true }const normalTag: Tag = { id: 2, slug: "normal", name: "Normal", color: "ebb134", isPublic: false }const hardTag: Tag = { id: 3, slug: "hard", name: "Hard", color: "9c3630", isPublic: false }+const linkTag: Tag = { id: 4, slug: "link", name: "Link", color: "0991db", isPublic: true }const visibilityPublic = { label: "Public", value: "public" }const visibilityPrivate = { label: "Private", value: "private" }@@ -352,11 +353,13 @@ const DesignSystemPage = () => {<ShowTag tag={easyTag} /><ShowTag tag={normalTag} /><ShowTag tag={hardTag} />+ <ShowTag tag={linkTag} link /></HStack><HStack>- <ShowTag tag={easyTag} circular={true} />- <ShowTag tag={normalTag} circular={true} />- <ShowTag tag={hardTag} circular={true} />+ <ShowTag tag={easyTag} circular />+ <ShowTag tag={normalTag} circular />+ <ShowTag tag={hardTag} circular />+ <ShowTag tag={linkTag} circular link /></HStack></VStack>diff --git a/public/pages/Home/components/ListPosts.tsx b/public/pages/Home/components/ListPosts.tsxindex 367b61b98..e6d63a0b2 100644--- a/public/pages/Home/components/ListPosts.tsx+++ b/public/pages/Home/components/ListPosts.tsx@@ -32,7 +32,7 @@ const ListPostItem = (props: { post: Post; user?: CurrentUser; tags: Tag[] }) =>{props.tags.length >= 1 && (<HStack className="flex-wrap">{props.tags.map((tag) => (- <ShowTag key={tag.id} tag={tag} />+ <ShowTag key={tag.id} tag={tag} link />))}</HStack>)}diff --git a/public/pages/Home/components/TagsFilter.tsx b/public/pages/Home/components/TagsFilter.tsxindex c18580e1e..cee7dbb60 100644--- a/public/pages/Home/components/TagsFilter.tsx+++ b/public/pages/Home/components/TagsFilter.tsx@@ -38,7 +38,7 @@ export const TagsFilter = (props: TagsFilterProps) => {<Dropdown.ListItem onClick={toggle(t)} key={t.id}><HStack spacing={2}><Icon sprite={IconCheck} className={`h-4 text-green-600 ${!selected.includes(t.slug) && "invisible"}`} />- <ShowTag tag={t} circular={true} />+ <ShowTag tag={t} circular /><span>{t.name}</span></HStack></Dropdown.ListItem>diff --git a/public/pages/ShowPost/components/TagListItem.tsx b/public/pages/ShowPost/components/TagListItem.tsxindex cc78eddd0..c9b542184 100644--- a/public/pages/ShowPost/components/TagListItem.tsx+++ b/public/pages/ShowPost/components/TagListItem.tsx@@ -18,7 +18,7 @@ export const TagListItem = (props: TagListItemProps) => {return (<HStack className="clickable hover:bg-gray-100 rounded py-1" onClick={onClick}><Icon sprite={IconCheck} className={`h-4 text-green-600 ${!props.assigned && "invisible"}`} />- <ShowTag tag={props.tag} circular={true} />+ <ShowTag tag={props.tag} circular /><span>{props.tag.name}</span></HStack>)diff --git a/public/pages/ShowPost/components/TagsPanel.tsx b/public/pages/ShowPost/components/TagsPanel.tsxindex fd6960785..314a3f54c 100644--- a/public/pages/ShowPost/components/TagsPanel.tsx+++ b/public/pages/ShowPost/components/TagsPanel.tsx@@ -56,7 +56,7 @@ export const TagsPanel = (props: TagsPanelProps) => {assignedTags.length > 0 ? (<VStack spacing={2} className="flex-items-baseline">{assignedTags.map((tag) => (- <ShowTag key={tag.id} tag={tag} />+ <ShowTag key={tag.id} tag={tag} link />))}</VStack>) : (