Skip to content

Commit

Permalink
openUrl helper
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits committed Apr 5, 2024
1 parent cc5c6b8 commit 5a685dc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
11 changes: 3 additions & 8 deletions src/app/(sidebar)/explore-endpoints/[[...pages]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { isEmptyObject } from "@/helpers/isEmptyObject";
import { sanitizeArray } from "@/helpers/sanitizeArray";
import { sanitizeObject } from "@/helpers/sanitizeObject";
import { parseJsonString } from "@/helpers/parseJsonString";
import { openUrl } from "@/helpers/openUrl";

import { Routes } from "@/constants/routes";
import { EXPLORE_ENDPOINTS_PAGES_HORIZON } from "@/constants/exploreEndpointsPages";
Expand Down Expand Up @@ -712,10 +713,7 @@ const ExploreEndpointsLandingPage = () => {
buttonLabel: "See docs",
buttonIcon: <Icon.LinkExternal01 />,
buttonAction: () =>
window.open(
"https://developers.stellar.org/network/soroban-rpc/methods",
"_blank",
),
openUrl("https://developers.stellar.org/network/soroban-rpc/methods"),
},
{
id: "horizon",
Expand All @@ -724,10 +722,7 @@ const ExploreEndpointsLandingPage = () => {
buttonLabel: "See docs",
buttonIcon: <Icon.LinkExternal01 />,
buttonAction: () =>
window.open(
"https://developers.stellar.org/network/horizon/resources",
"_blank",
),
openUrl("https://developers.stellar.org/network/horizon/resources"),
},
];

Expand Down
12 changes: 5 additions & 7 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { LayoutContentContainer } from "@/components/layout/LayoutContentContain
import { InfoCards } from "@/components/InfoCards";
import { SdsLink } from "@/components/SdsLink";
import { Routes } from "@/constants/routes";
import { openUrl } from "@/helpers/openUrl";

export default function Introduction() {
const infoCards = [
Expand All @@ -17,7 +18,7 @@ export default function Introduction() {
"Learn to build world-class applications on the Stellar network in a gamified experience",
buttonLabel: "Go to site",
buttonIcon: <Icon.LinkExternal01 />,
buttonAction: () => window.open("https://quest.stellar.org/", "_blank"),
buttonAction: () => openUrl("https://quest.stellar.org/"),
},
{
id: "tools",
Expand All @@ -27,7 +28,7 @@ export default function Introduction() {
buttonLabel: "See tools",
buttonIcon: undefined,
buttonAction: () =>
window.open("https://developers.stellar.org/docs/tools/sdks", "_blank"),
openUrl("https://developers.stellar.org/docs/tools/sdks"),
},
{
id: "stellar-rpc",
Expand All @@ -36,10 +37,7 @@ export default function Introduction() {
buttonLabel: "Go to docs",
buttonIcon: <Icon.LinkExternal01 />,
buttonAction: () =>
window.open(
"https://developers.stellar.org/network/soroban-rpc",
"_blank",
),
openUrl("https://developers.stellar.org/network/soroban-rpc"),
},
{
id: "horizon",
Expand All @@ -49,7 +47,7 @@ export default function Introduction() {
buttonLabel: "Go to docs",
buttonIcon: <Icon.LinkExternal01 />,
buttonAction: () =>
window.open("https://developers.stellar.org/network/horizon", "_blank"),
openUrl("https://developers.stellar.org/network/horizon"),
},
];

Expand Down
3 changes: 3 additions & 0 deletions src/helpers/openUrl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const openUrl = (url: string) => {
return window.open(url, "_blank", "noopener,noreferrer");
};

0 comments on commit 5a685dc

Please sign in to comment.