-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
137 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
<script setup lang="ts"> | ||
import { getTopicTagMap } from '~/composables/getTopicTagMap' | ||
import { getTopicTagLabelGetter } from '~/composables/getTopicTagLabelGetter' | ||
defineProps<{ | ||
data: string[] | ||
}>() | ||
const topicTagMap = getTopicTagMap() | ||
const topicLabelGetter = getTopicTagLabelGetter() | ||
</script> | ||
|
||
<template> | ||
<div v-if="data.length > 0"> | ||
<span | ||
v-for="tag in data" | ||
:key="tag" | ||
v-for="label in data" | ||
:key="label" | ||
class="px-2.5 font-size-3 inline-flex pointer-events-auto bg-[--vp-c-bg-soft] mr-2 rounded-full color-[--vp-c-text-2]" | ||
>#{{ topicTagMap.get(tag) }}</span | ||
> | ||
#{{ topicTagMap.get(topicLabelGetter.getTag(label) ?? '') }} | ||
</span> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export const getForumLocaleLabelGetter = () => { | ||
const getLabel = (locale?: string | null | undefined) => | ||
locale ? `LC-${locale}` : null | ||
|
||
const getLocale = (label?: string | null | undefined) => | ||
label ? String(label).replace(/^LC-/g, '') : null | ||
|
||
const isLabel = (label?: string | null | undefined) => | ||
label && String(label).startsWith('LC-') | ||
|
||
return { | ||
getLabel, | ||
getLocale, | ||
isLabel, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
export const getTopicTagLabelGetter = () => { | ||
const constructList: [string, string][] = [ | ||
['DOCS-ISSUE', 'CATA-DOCS-ISSUE'], | ||
['TYPOS-ISSUE', 'CATA-TYPOS-ISSUE'], | ||
['DISPLAY-ISSUE', 'CATA-DISPLAY-ISSUE'], | ||
['LOGIN-ISSUE', 'CATA-LOGIN-ISSUE'], | ||
['PERFORMANCE-ISSUE', 'CATA-PERFORMANCE-ISSUE'], | ||
['TRANSLATION-ISSUE', 'CATA-TRANSLATION-ISSUE'], | ||
['OTHER-ISSUE', 'CATA-OTHER-ISSUE'], | ||
['PIN-ISSUE', 'CATA-PIN-ISSUE'], | ||
['ALL-PLATFORM', 'CATA-ALL-PLATFORM'], | ||
['WEB-PLATFORM', 'CATA-WEB-PLATFORM'], | ||
['CLIENT-PLATFORM', 'CATA-CLIENT-PLATFORM'], | ||
] | ||
|
||
const forwardMap = new Map(constructList) | ||
|
||
const reverseMap = new Map(constructList.map(([key, value]) => [value, key])) | ||
|
||
const getTag = (label?: string | null | undefined) => | ||
reverseMap.get(label ?? '') | ||
|
||
const getLabel = (tag?: string | null | undefined) => | ||
forwardMap.get(tag ?? '') | ||
|
||
const isTag = (tag?: string | null | undefined) => forwardMap.has(tag ?? '') | ||
|
||
const isLabel = (label?: string | null | undefined) => | ||
reverseMap.has(label ?? '') | ||
|
||
const toTags = (labels?: string[] | null | undefined) => | ||
labels ? labels.map((label) => getTag(label)) : [] | ||
|
||
const toLabels = (tags?: string[] | null | undefined) => | ||
tags ? tags.map((tag) => getLabel(tag)) : [] | ||
|
||
return { | ||
getTag, | ||
getLabel, | ||
isTag, | ||
isLabel, | ||
toTags, | ||
toLabels, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export const getTopicTypeLabelGetter = () => { | ||
const constructList: [string, string][] = [ | ||
['FEAT', 'TYP-FEAT'], | ||
['ANN', 'TYP-ANN'], | ||
['BUG', 'TYP-BUG'], | ||
['SUG', 'TYP-SUG'], | ||
] | ||
|
||
const forwardMap = new Map(constructList) | ||
|
||
const reverseMap = new Map(constructList.map(([key, value]) => [value, key])) | ||
|
||
const getType = (label?: string | null | undefined) => | ||
reverseMap.get(label ?? '') | ||
|
||
const getLabel = (type?: string | null | undefined) => | ||
forwardMap.get(type ?? '') | ||
|
||
const isType = (type?: string | null | undefined) => | ||
forwardMap.has(type ?? '') | ||
|
||
const isLabel = (label?: string | null | undefined) => | ||
reverseMap.has(label ?? '') | ||
|
||
return { | ||
getType, | ||
getLabel, | ||
isType, | ||
isLabel, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters