Skip to content

Commit

Permalink
chore(resource-catalog): use developent version of Support API
Browse files Browse the repository at this point in the history
  • Loading branch information
yomatters committed Nov 4, 2024
1 parent ea84e5e commit 1da49d8
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
3 changes: 1 addition & 2 deletions src/resource-group-affinity-group.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import Section from "./section";

export default function ResourceGroupAffinityGroup({ baseUri, infoGroupId }) {
const data = useJSON(
`https://support.access-ci.org/api/1.0/affinity_groups/${infoGroupId}`,
{ corsProxy: true }
`https://md-2261-accessmatch.pantheonsite.io/api/1.0/affinity_groups/${infoGroupId}`
);
if (!data || data.error || !data.length) return;
const slackUri = stripTags(data[0].slack_link);
Expand Down
3 changes: 1 addition & 2 deletions src/resource-group-documentation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import Section from "./section";

export default function ResourceGroupDocumentation({ baseUri, infoGroupId }) {
const data = useJSON(
`https://support.access-ci.org/api/1.0/kb/${infoGroupId}`,
{ corsProxy: true }
`https://md-2261-accessmatch.pantheonsite.io/api/1.0/kb/${infoGroupId}`
);

if (!data || data.error || !data.length) return;
Expand Down
2 changes: 1 addition & 1 deletion src/resource-group-event.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function ResourceGroupEvent({
speaker,
title,
}) {
const eventUri = extractHref(registration || "");
const eventUri = registration;
const headingContent = eventUri ? <a href={eventUri}>{title}</a> : title;
const metadata = [];
let icon = null;
Expand Down
3 changes: 1 addition & 2 deletions src/resource-group-events.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ export default function ResourceGroupEvents({ baseUri, infoGroupId }) {
"https://operations-api.access-ci.org/wh2/news/v1/affiliation/access-ci.org/future_outages/"
);
const eventData = useJSON(
`https://support.access-ci.org/api/1.1/events/ag/${infoGroupId}`,
{ corsProxy: true }
`https://md-2261-accessmatch.pantheonsite.io/api/1.1/events/ag/${infoGroupId}`
);
const filteredAnnouncements = useTransform(
[groupData, currentAnnouncementData, futureAnnouncementData],
Expand Down
25 changes: 15 additions & 10 deletions src/utils.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,16 +261,21 @@ export const stripTags = (html) =>
html.replace(/(<[^>]+>)/g, "").replace(/&nbsp;/g, " ");

export const htmlToJsx = (html) => {
const links = Array.from(html.matchAll(/<a([^>]+)>([^<]+)<\/a>/g));
const textNodes = html.split(/<a[^<]+<\/a>/g);
const result = [];
while (textNodes.length > 0) {
result.push(stripTags(textNodes.shift()));
let link = links.shift();
if (link) {
let href = extractHref(link[1]);
if (href) result.push(<a href={href}>{link[2]}</a>);
const paragraphs = [];
for (let pText of html.split("</p>")) {
const links = Array.from(pText.matchAll(/<a([^>]+)>([^<]+)<\/a>/g));
const textNodes = pText.split(/<a[^<]+<\/a>/g);
const paragraph = [];
while (textNodes.length > 0) {
paragraph.push(stripTags(textNodes.shift()));
let link = links.shift();
if (link) {
let href = extractHref(link[1]);
if (href) paragraph.push(<a href={href}>{link[2]}</a>);
}
}
paragraphs.push(<p>{paragraph}</p>);
}
return result;

return paragraphs;
};

0 comments on commit 1da49d8

Please sign in to comment.