Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed Explore Endpoints to Endpoints #813

Merged
merged 2 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 3 additions & 3 deletions src/components/MainNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ const primaryNavLinks: NavLink[] = [
label: "Account",
},
{
href: Routes.EXPLORE_ENDPOINTS,
label: "Explore Endpoints",
href: Routes.ENDPOINTS,
label: "Endpoints",
},
{
href: Routes.BUILD_TRANSACTION,
label: "Transactions",
},
{
href: Routes.VIEW_XDR,
label: "View XDR",
label: "XDR",
},
{
href: Routes.SOROBAN_CONTRACT_EXPLORER,
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
Loading