Skip to content

Commit

Permalink
Renamed Explore Endpoints to Endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits committed Apr 5, 2024
1 parent e940a79 commit eb54c41
Show file tree
Hide file tree
Showing 11 changed files with 155 additions and 160 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"install-if-package-changed": "git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD | grep --quiet yarn.lock && yarn install || exit 0",
"prepare": "husky",
"pre-commit": "yarn lint-staged",
"pre-push": "yarn lint:ts",
"pre-push": "yarn lint:ts && yarn test",
"git-info": "rm -rf src/generated/ && mkdir src/generated/ && echo export default \"{\\\"commitHash\\\": \\\"$(git rev-parse --short HEAD)\\\", \\\"version\\\": \\\"$(git describe --tags --always)\\\"};\" > src/generated/gitInfo.ts"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ import { parseJsonString } from "@/helpers/parseJsonString";
import { openUrl } from "@/helpers/openUrl";

import { Routes } from "@/constants/routes";
import { EXPLORE_ENDPOINTS_PAGES_HORIZON } from "@/constants/exploreEndpointsPages";
import { useExploreEndpoint } from "@/query/useExploreEndpoint";
import { ENDPOINTS_PAGES_HORIZON } from "@/constants/endpointsPages";
import { useEndpoint } from "@/query/useEndpoint";
import {
AnyObject,
AssetObject,
AssetObjectValue,
Network,
} from "@/types/types";

export default function ExploreEndpoints() {
export default function Endpoints() {
const pathname = usePathname();
const currentPage = pathname.split(Routes.EXPLORE_ENDPOINTS)?.[1];
const currentPage = pathname.split(Routes.ENDPOINTS)?.[1];

const page = EXPLORE_ENDPOINTS_PAGES_HORIZON.navItems
const page = ENDPOINTS_PAGES_HORIZON.navItems
.find((page) => pathname.includes(page.route))
?.nestedItems?.find((i) => i.route === pathname);

Expand All @@ -51,7 +51,7 @@ export default function ExploreEndpoints() {
pageData?.requiredParams?.split(",") || [],
);

const { exploreEndpoints, network } = useStore();
const { endpoints, network } = useStore();
const {
params,
currentEndpoint,
Expand All @@ -60,7 +60,7 @@ export default function ExploreEndpoints() {
updateCurrentEndpoint,
updateNetwork,
resetParams,
} = exploreEndpoints;
} = endpoints;

const REGEX_TEMPLATE_SEARCH_PARAMS = /\{\?.+?\}/;
const REGEX_TEMPLATE_SEARCH_PARAMS_VALUE = /(?<=\{\?).+?(?=\})/;
Expand Down Expand Up @@ -122,7 +122,7 @@ export default function ExploreEndpoints() {
refetch,
isSuccess,
isError,
} = useExploreEndpoint(
} = useEndpoint(
requestUrl,
// There is only one endpoint request for POST, using params directly for
// simplicity.
Expand Down Expand Up @@ -216,7 +216,7 @@ export default function ExploreEndpoints() {
const resetQuery = useCallback(
() =>
queryClient.resetQueries({
queryKey: ["exploreEndpoint", "response"],
queryKey: ["endpoint", "response"],
}),
[queryClient],
);
Expand Down Expand Up @@ -607,8 +607,8 @@ export default function ExploreEndpoints() {
);
};

if (pathname === Routes.EXPLORE_ENDPOINTS) {
return <ExploreEndpointsLandingPage />;
if (pathname === Routes.ENDPOINTS) {
return <EndpointsLandingPage />;
}

if (!pageData) {
Expand Down Expand Up @@ -704,7 +704,7 @@ export default function ExploreEndpoints() {
);
}

const ExploreEndpointsLandingPage = () => {
const EndpointsLandingPage = () => {
const infoCards = [
{
id: "stellar-rpc",
Expand All @@ -731,7 +731,7 @@ const ExploreEndpointsLandingPage = () => {
<Card>
<div className="CardText">
<Text size="lg" as="h1" weight="medium">
Explore Endpoints
Endpoints
</Text>

<Text size="sm" as="p">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

import React from "react";
import { LayoutSidebarContent } from "@/components/layout/LayoutSidebarContent";
import { EXPLORE_ENDPOINTS_PAGES_HORIZON } from "@/constants/exploreEndpointsPages";
import { ENDPOINTS_PAGES_HORIZON } from "@/constants/endpointsPages";

export default function ExploreEndpointsTemplate({
export default function EndpointsTemplate({
children,
}: {
children: React.ReactNode;
}) {
return (
// TODO: add saved endpoints
// TODO: add RPC endpoints
<LayoutSidebarContent sidebar={[EXPLORE_ENDPOINTS_PAGES_HORIZON]}>
<LayoutSidebarContent sidebar={[ENDPOINTS_PAGES_HORIZON]}>
{children}
</LayoutSidebarContent>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/MainNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const primaryNavLinks: NavLink[] = [
label: "Account",
},
{
href: Routes.EXPLORE_ENDPOINTS,
label: "Explore Endpoints",
href: Routes.ENDPOINTS,
label: "Endpoints",
},
{
href: Routes.BUILD_TRANSACTION,
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/LayoutSidebarContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ export const LayoutSidebarContent = ({

const Link = ({ item, pathname }: { item: SidebarLink; pathname: string }) => {
const isSelectedParent = item.nestedItems?.length
? pathname?.split(Routes.EXPLORE_ENDPOINTS)?.[1]?.split("/")?.[1] ===
item.route?.split(Routes.EXPLORE_ENDPOINTS)?.[1]?.split("/")?.[1]
? pathname?.split(Routes.ENDPOINTS)?.[1]?.split("/")?.[1] ===
item.route?.split(Routes.ENDPOINTS)?.[1]?.split("/")?.[1]
: false;

const [isExpanded, setIsExpanded] = useState(isSelectedParent);
Expand Down
Loading

0 comments on commit eb54c41

Please sign in to comment.