diff --git a/src/components/ambassador/AmbassadorCards/index.js b/src/components/ambassador/AmbassadorCards/index.js
index 4f812eaf8..ce9de4877 100644
--- a/src/components/ambassador/AmbassadorCards/index.js
+++ b/src/components/ambassador/AmbassadorCards/index.js
@@ -31,6 +31,7 @@ export default function AmbassadorCards({
setLoadingCards(false);
};
+
React.useEffect(() => {
getPosts();
setCardData(undefined);
diff --git a/src/components/blog/BlogCards/index.js b/src/components/blog/BlogCards/index.js
index 530d71dd9..f9c861e36 100644
--- a/src/components/blog/BlogCards/index.js
+++ b/src/components/blog/BlogCards/index.js
@@ -11,7 +11,7 @@ export default function BlogCards({
const [loadingCards, setLoadingCards] = React.useState(true);
const getPosts = async () => {
- const data = await getBlogPosts(filterCallback.join(','));
+ const data = await getBlogPosts(filterCallback.join('+'));
const resultset = []
if (data.topics) {
for (const topic of data.topics) {
diff --git a/src/components/marketplace/MarketplaceCards/index.js b/src/components/marketplace/MarketplaceCards/index.js
index 3dd5ca268..b71c86bf8 100644
--- a/src/components/marketplace/MarketplaceCards/index.js
+++ b/src/components/marketplace/MarketplaceCards/index.js
@@ -18,7 +18,7 @@ export default function MarketplaceCards({filterCallback}) {
const [loadingCards, setLoadingCards] = React.useState(true);
const getPosts = async () => {
- const data = await getMarketplacePosts(filterCallback.join(','));
+ const data = await getMarketplacePosts(filterCallback.tags.join('+'), filterCallback.category);
console.log(data)
const resultset = [];
if (data.topics) {
diff --git a/src/components/marketplace/MarketplaceSidebar/MarketplaceSidebarButton/index.js b/src/components/marketplace/MarketplaceSidebar/MarketplaceSidebarButton/index.js
index d6c84eb81..8782fdc9b 100644
--- a/src/components/marketplace/MarketplaceSidebar/MarketplaceSidebarButton/index.js
+++ b/src/components/marketplace/MarketplaceSidebar/MarketplaceSidebarButton/index.js
@@ -4,14 +4,35 @@ import styles from './styles.module.css';
export default function MarketplaceSidebarButton({
filterCallback,
- text
+ text,
+ id,
+ isCategory,
+ category
}) {
const [isActive, setIsActive] = React.useState(false);
- const activeClass = isActive ? styles.tagSelected : ''
- function setFilters(e, f) {
- filterCallback(f)
- setIsActive(current => !current);
+ let activeClass = ''
+ if (isCategory && category === id) {
+ activeClass = styles.tagSelected
+ } else if (isCategory && category !== id) {
+ activeClass = ''
+ } else {
+ activeClass = isActive ? styles.tagSelected : ''
}
- return
setFilters(e, text)} className={activeClass + ' ' + styles.tag}>{text}
+ //const activeClass = isActive ? styles.tagSelected : ''
+ function setFilters(e, id) {
+ if (isCategory) {
+ if (category === id) {
+ filterCallback({"category": "marketplace"})
+ } else {
+ filterCallback({"category": id})
+ }
+
+ } else {
+ filterCallback({"tag": id})
+ }
+ setIsActive(current => !current);
+
+ }
+ return setFilters(e, id)} className={activeClass + ' ' + styles.tag}>{text}
}
diff --git a/src/components/marketplace/MarketplaceSidebar/index.js b/src/components/marketplace/MarketplaceSidebar/index.js
index f62bdaf67..96f97dae8 100644
--- a/src/components/marketplace/MarketplaceSidebar/index.js
+++ b/src/components/marketplace/MarketplaceSidebar/index.js
@@ -3,21 +3,37 @@ import clsx from 'clsx';
import styles from './styles.module.css';
import useBaseUrl from '@docusaurus/useBaseUrl';
import Link from '@docusaurus/Link';
-import { getTags } from '../../../services/DiscourseService';
+import { getCatagories, getTags } from '../../../services/DiscourseService';
import MarketplaceSidebarButton from './MarketplaceSidebarButton';
export default function MarketplaceSidebar({
- filterCallback
+ filterCallback,
+ selectedCategory
}) {
const [tagProductData, setTagProductData] = React.useState();
const [tagTechnologyData, setTagTechnologyData] = React.useState();
+ const [catIntegrationTypeData, setCatIntegrationTypeData] = React.useState();
const [filterTags, setFilterTags] = React.useState(true);
const getTagData = async () => {
- const data = await getTags();
+ const tagData = await getTags();
+ const categoryData = await getCatagories();
+
const tagTechnologyResultset = []
const tagProductResultset = []
- for (const tagGroup of data.extras.tag_groups) {
+ const catIntegrationType = []
+
+ for (const category of categoryData.category_list.categories) {
+ // 59 for marketplace
+ if (category.id === 59) {
+ for (const subCategory of category.subcategory_list) {
+
+ catIntegrationType.push({"name": subCategory.name, "slug": subCategory.slug})
+ }
+ }
+ }
+
+ for (const tagGroup of tagData.extras.tag_groups) {
if (tagGroup.id === 20) {
for (const tag of tagGroup.tags) {
tagProductResultset.push(tag.text)
@@ -31,6 +47,7 @@ export default function MarketplaceSidebar({
}
setTagProductData(tagProductResultset)
setTagTechnologyData(tagTechnologyResultset)
+ setCatIntegrationTypeData(catIntegrationType)
};
function toggleSeeAll() {
@@ -44,19 +61,19 @@ export default function MarketplaceSidebar({
const filterText = filterTags ? 'See All Tags' : 'See Less Tags'
- if (tagProductData && tagTechnologyData) {
+ if (tagProductData && catIntegrationTypeData) {
return (
Items by Product
{tagProductData.map(function(a, index){
- return
+ return
})}
-
Items by Identity Governance
+
Items by Integration Type
- {tagTechnologyData.map(function(a, index){
- return
10 && filterTags ? styles.hidden : ''} >
+ {catIntegrationTypeData.map(function(a, index){
+ return
10 && filterTags ? styles.hidden : ''} >
})}
toggleSeeAll()}>
diff --git a/src/pages/marketplace.js b/src/pages/marketplace.js
index 0bd99ac98..7602e5cd3 100644
--- a/src/pages/marketplace.js
+++ b/src/pages/marketplace.js
@@ -10,28 +10,37 @@ import MarketplaceCards from '../components/marketplace/MarketplaceCards';
import MarketplaceSidebar from '../components/marketplace/MarketplaceSidebar';
export default function Marketplace() {
- const [filteredProduct, setFilteredProduct] = React.useState([]);
+ const [filteredProduct, setFilteredProduct] = React.useState({"category": "marketplace", "tags": []});
const {siteConfig} = useDocusaurusContext();
const handleClick = (data) => {
- var tempFilter = filteredProduct.slice()
+ var tempFilter = filteredProduct.tags.slice()
- const index = tempFilter.indexOf(data);
- if (index !== -1) {
- tempFilter.splice(index, 1);
- } else {
- tempFilter.push(data)
+ if (data.tag) {
+ const index = tempFilter.indexOf(data.tag);
+ if (index !== -1) {
+ tempFilter.splice(index, 1);
+ } else {
+ tempFilter.push(data.tag)
+ }
}
- setFilteredProduct(tempFilter)
+
+ if (data.category) {
+ setFilteredProduct({"category": data.category, "tags": [tempFilter]})
+ } else {
+ setFilteredProduct({"category": filteredProduct.category, "tags": [tempFilter]})
+ }
+
+
};
return (
diff --git a/src/services/DiscourseService.js b/src/services/DiscourseService.js
index 48dce7ae3..9b7dd58e1 100644
--- a/src/services/DiscourseService.js
+++ b/src/services/DiscourseService.js
@@ -44,7 +44,6 @@ export async function checkImage(url) {
const response = await fetch(
url,
);
- console.log(response)
return true
} catch (error) {
return false;
@@ -69,12 +68,16 @@ export async function getBlogPosts(tags) {
}
}
-export async function getMarketplacePosts(tags) {
+export async function getMarketplacePosts(tags, category) {
+ let filterCategory = 'marketplace'
+ if (category) {
+ filterCategory = category
+ }
let url = ''
if (tags) {
- url = 'https://developer.sailpoint.com/discuss/search.json?q=category:marketplace+tags:' + tags
+ url = 'https://developer.sailpoint.com/discuss/search.json?q=category:' + filterCategory + '+tags:' + tags
} else {
- url = 'https://developer.sailpoint.com/discuss/search.json?q=category:marketplace'
+ url = 'https://developer.sailpoint.com/discuss/search.json?q=category:' + filterCategory
}
try {
const response = await fetch(
@@ -128,4 +131,15 @@ export async function getTags() {
} catch (error) {
return [];
}
+}
+
+export async function getCatagories() {
+ try {
+ const response = await fetch(
+ 'https://developer.sailpoint.com/discuss/categories.json',
+ );
+ return await response.json();
+ } catch (error) {
+ return [];
+ }
}
\ No newline at end of file