diff --git a/package.json b/package.json index 9a68faf..ace6d0a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "qapp-core", - "version": "1.0.13", + "version": "1.0.14", "description": "Qortal's core React library with global state, UI components, and utilities", "main": "dist/index.js", "module": "dist/index.mjs", diff --git a/src/components/IndexManager/IndexManager.tsx b/src/components/IndexManager/IndexManager.tsx index d6d6a43..c5d7541 100644 --- a/src/components/IndexManager/IndexManager.tsx +++ b/src/components/IndexManager/IndexManager.tsx @@ -567,7 +567,11 @@ const CreateIndex = ({ const identifier = `idx-${hashedRootName}-${hashedLink}-`; const res = await fetch(`/arbitrary/indices/${nameParam}/${identifier}`) const data = await res.json() - setRecommendedIndices(data) + const uniqueByTerm = data.filter( + (item: any, index: number, self: any) => + index === self.findIndex((t: any) => t.term === item.term) + ); + setRecommendedIndices(uniqueByTerm) } catch (error) { } @@ -656,7 +660,9 @@ const CreateIndex = ({ - + + { return `/arbitrary/THUMBNAIL/${encodeURIComponent(qortalName)}/qortal_avatar?async=true` -} \ No newline at end of file +} + +const removeTrailingSlash = (str: string) => str.replace(/\/$/, ''); + +export const createQortalLink = (type: 'APP' | 'WEBSITE', appName: string, path: string) => { + + let link = 'qortal://' + type + '/' + appName + if(path && path.startsWith('/')){ + link = link + removeTrailingSlash(path) + } + if(path && !path.startsWith('/')){ + link = link + '/' + removeTrailingSlash(path) + } + return link + }; \ No newline at end of file