diff --git a/apps/cyberstorm-remix/app/p/packageListing.tsx b/apps/cyberstorm-remix/app/p/packageListing.tsx index 9fb0c8492..5baa8e61c 100644 --- a/apps/cyberstorm-remix/app/p/packageListing.tsx +++ b/apps/cyberstorm-remix/app/p/packageListing.tsx @@ -4,13 +4,13 @@ import { useLoaderData, useLocation, useOutletContext, - useRevalidator, + // useRevalidator, } from "@remix-run/react"; import { CopyButton, Heading, Image, - Modal, + // Modal, NewBreadCrumbs, NewButton, NewIcon, @@ -23,7 +23,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { ApiError } from "@thunderstore/thunderstore-api"; import { ThunderstoreLogo } from "@thunderstore/cyberstorm/src/svg/svg"; import { - faCog, + // faCog, faUsers, faHandHoldingHeart, faDownload, @@ -35,8 +35,8 @@ import TeamMembers from "./components/TeamMembers/TeamMembers"; import { useEffect, useRef, useState } from "react"; import { useHydrated } from "remix-utils/use-hydrated"; import { - PackageDeprecateAction, - PackageEditForm, + // PackageDeprecateAction, + // PackageEditForm, PackageLikeAction, } from "@thunderstore/cyberstorm-forms"; import { PageHeader } from "~/commonComponents/PageHeader/PageHeader"; @@ -120,14 +120,17 @@ export async function loader({ params }: LoaderFunctionArgs) { // } export default function Community() { - const { community, communityFilters, listing, team } = - useLoaderData(); + // TODO: Enable when APIs are available + // const { community, communityFilters, listing, team } = + // useLoaderData(); + const { community, listing, team } = useLoaderData(); const location = useLocation(); const outletContext = useOutletContext() as OutletContextShape; const currentUser = outletContext.currentUser; const config = outletContext.requestConfig; + const domain = outletContext.domain; const [isLiked, setIsLiked] = useState(false); @@ -139,13 +142,13 @@ export default function Community() { ); }; - const revalidator = useRevalidator(); - - const revalidateLoaderData = async () => { - if (revalidator.state === "idle") { - revalidator.revalidate(); - } - }; + // TODO: Enable when APIs are available + // const revalidator = useRevalidator(); + // const revalidateLoaderData = async () => { + // if (revalidator.state === "idle") { + // revalidator.revalidate(); + // } + // }; useEffect(() => { if (currentUser?.username) { @@ -199,53 +202,54 @@ export default function Community() { ? "source" : "details"; - const managementTools = ( - - - - - Manage - - } - > - { - return { label: cat.name, value: cat.slug }; - })} - community={listing.community_identifier} - namespace={listing.namespace} - package={listing.name} - current_categories={listing.categories} - isDeprecated={listing.is_deprecated} - dataUpdateTrigger={revalidateLoaderData} - deprecationButton={ - - {listing.is_deprecated ? "Undeprecate" : "Deprecate"} - - } - config={config} - /> - - ); + // TODO: Enable when APIs are available + // const managementTools = ( + // + // + // + // + // Manage + // + // } + // > + // { + // return { label: cat.name, value: cat.slug }; + // })} + // community={listing.community_identifier} + // namespace={listing.namespace} + // package={listing.name} + // current_categories={listing.categories} + // isDeprecated={listing.is_deprecated} + // dataUpdateTrigger={revalidateLoaderData} + // deprecationButton={ + // + // {listing.is_deprecated ? "Undeprecate" : "Deprecate"} + // + // } + // config={config} + // /> + // + // ); return ( <> @@ -333,12 +337,12 @@ export default function Community() { } />
- {/* TODO: Admin tools */} - {currentUser?.teams.some(function (cuTeam) { + {/* TODO: Admin tools // TODO: Enable when APIs are available*/} + {/* {currentUser?.teams.some(function (cuTeam) { return cuTeam?.name === listing.team.name; }) ? managementTools - : null} + : null} */}
@@ -372,14 +376,25 @@ export default function Community() { }, current: currentTab === "required", }, + // TODO: Once Analysis page is ready, enable it + // { + // itemProps: { + // key: "wiki", + // primitiveType: "cyberstormLink", + // linkId: "PackageWiki", + // community: listing.community_identifier, + // namespace: listing.namespace, + // package: listing.name, + // "aria-current": currentTab === "wiki", + // children: <>Wiki, + // }, + // current: currentTab === "wiki", + // }, { itemProps: { key: "wiki", - primitiveType: "cyberstormLink", - linkId: "PackageWiki", - community: listing.community_identifier, - namespace: listing.namespace, - package: listing.name, + primitiveType: "link", + href: `${domain}/c/${listing.community_identifier}/p/${listing.namespace}/${listing.name}/wiki`, "aria-current": currentTab === "wiki", children: <>Wiki, }, @@ -414,14 +429,25 @@ export default function Community() { // TODO: Version count field needs to be added to the endpoint // numberSlateValue: listing.versionCount, }, + // TODO: Once Analysis page is ready, enable it + // { + // itemProps: { + // key: "source", + // primitiveType: "cyberstormLink", + // linkId: "PackageSource", + // community: listing.community_identifier, + // namespace: listing.namespace, + // package: listing.name, + // "aria-current": currentTab === "source", + // children: <>Analysis, + // }, + // current: currentTab === "source", + // }, { itemProps: { key: "source", - primitiveType: "cyberstormLink", - linkId: "PackageSource", - community: listing.community_identifier, - namespace: listing.namespace, - package: listing.name, + href: `${domain}/c/${listing.community_identifier}/p/${listing.namespace}/${listing.name}/source`, + primitiveType: "link", "aria-current": currentTab === "source", children: <>Analysis, }, diff --git a/apps/cyberstorm-remix/app/root.tsx b/apps/cyberstorm-remix/app/root.tsx index 6e2fa32ac..15b496d6a 100644 --- a/apps/cyberstorm-remix/app/root.tsx +++ b/apps/cyberstorm-remix/app/root.tsx @@ -68,6 +68,7 @@ declare global { export type OutletContextShape = { currentUser: CurrentUser | undefined; requestConfig: () => RequestConfig; + domain: string; }; export const meta: MetaFunction = () => { @@ -190,6 +191,11 @@ export function Layout({ children }: { children: React.ReactNode }) { } function App() { + // TODO: Remove this customization when legacy site is removed + const domain = + getPublicEnvVariables(["PUBLIC_SITE_URL"]).PUBLIC_SITE_URL ?? + "https://thunderstore.io"; + const [currentUser, setCurrentUser] = useState( undefined ); @@ -208,7 +214,13 @@ function App() { }, []); return ( - + ); }