-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move most of Package page under NextJS
- Loading branch information
Showing
30 changed files
with
1,606 additions
and
31 deletions.
There are no files selected for viewing
File renamed without changes.
81 changes: 81 additions & 0 deletions
81
...ckage)/@tspackage/p/[namespace]/(packageRoute)/[package]/(dependants)/dependants/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
"use client"; | ||
import { useDapper } from "@thunderstore/dapper"; | ||
import { usePromise } from "@thunderstore/use-promise"; | ||
|
||
import rootStyles from "../../../../../../../../../../RootLayout.module.css"; | ||
import styles from "./DependantsPage.module.css"; | ||
import { | ||
BreadCrumbs, | ||
CommunitiesLink, | ||
CommunityLink, | ||
PackageLink, | ||
PackageSearch, | ||
TeamLink, | ||
} from "@thunderstore/cyberstorm"; | ||
|
||
export default function Page({ | ||
params, | ||
}: { | ||
params: { community: string; namespace: string; package: string }; | ||
}) { | ||
const dapper = useDapper(); | ||
const community = usePromise(dapper.getCommunity, [params.community]); | ||
const filters = usePromise(dapper.getCommunityFilters, [params.community]); | ||
|
||
const listingType = { | ||
kind: "package-dependants" as const, | ||
communityId: params.community, | ||
namespaceId: params.namespace, | ||
packageName: params.package, | ||
}; | ||
|
||
return ( | ||
<section className={rootStyles.content}> | ||
<div className={rootStyles.container}> | ||
<> | ||
<BreadCrumbs> | ||
<CommunitiesLink>Communities</CommunitiesLink> | ||
<CommunityLink community={params.community}> | ||
{community.name} | ||
</CommunityLink> | ||
Packages | ||
<TeamLink community={params.community} team={params.namespace}> | ||
{params.namespace} | ||
</TeamLink> | ||
<PackageLink | ||
community={params.community} | ||
namespace={params.namespace} | ||
package={params.package} | ||
> | ||
{params.package} | ||
</PackageLink> | ||
Dependants | ||
</BreadCrumbs> | ||
<header className={rootStyles.pageHeader}> | ||
<div className={styles.header}> | ||
Mods that depend on{" "} | ||
<PackageLink | ||
community={params.community} | ||
namespace={params.namespace} | ||
package={params.package} | ||
> | ||
{params.package} | ||
</PackageLink> | ||
{" by "} | ||
<TeamLink community={params.community} team={params.namespace}> | ||
{params.namespace} | ||
</TeamLink> | ||
</div> | ||
</header> | ||
<main className={rootStyles.main}> | ||
<PackageSearch | ||
listingType={listingType} | ||
packageCategories={filters.package_categories} | ||
sections={filters.sections} | ||
/> | ||
</main> | ||
</> | ||
</div> | ||
</section> | ||
); | ||
} |
28 changes: 28 additions & 0 deletions
28
...geRoute)/[package]/(pkg)/@packageCard/@packageManagement/PackageManagementForm.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.root { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--gap--32); | ||
max-height: 70%; | ||
} | ||
|
||
.section { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--gap--16); | ||
} | ||
|
||
.statusTag { | ||
display: flex; | ||
} | ||
|
||
.title { | ||
font-weight: var(--font-weight-bold); | ||
font-size: var(--font-size--l); | ||
line-height: var(--line-height--l); | ||
} | ||
|
||
.footer { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
} |
60 changes: 60 additions & 0 deletions
60
...age/p/[namespace]/(packageRoute)/[package]/(pkg)/@packageCard/@packageManagement/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
"use client"; | ||
import { Alert, Button, Tag, TextInput } from "@thunderstore/cyberstorm"; | ||
import styles from "./PackageManagementForm.module.css"; | ||
import { useDapper } from "@thunderstore/dapper"; | ||
import { usePromise } from "@thunderstore/use-promise"; | ||
import { faCircleExclamation } from "@fortawesome/pro-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
|
||
export default function Page({ | ||
params, | ||
}: { | ||
params: { community: string; namespace: string; package: string }; | ||
}) { | ||
const dapper = useDapper(); | ||
const packageData = usePromise(dapper.getPackageListingDetails, [ | ||
params.community, | ||
params.namespace, | ||
params.package, | ||
]); | ||
|
||
return ( | ||
<div className={styles.root}> | ||
<div className={styles.section}> | ||
<Alert | ||
icon={<FontAwesomeIcon icon={faCircleExclamation} />} | ||
content={ | ||
"Changes might take several minutes to show publicly! Info shown below is always up to date." | ||
} | ||
variant="info" | ||
/> | ||
<div className={styles.title}>Package status</div> | ||
<div className={styles.statusTag}> | ||
<Tag | ||
size="medium" | ||
label={packageData.is_deprecated ? "DEPRECATED" : "ACTIVE"} | ||
colorScheme={packageData.is_deprecated ? "yellow" : "success"} | ||
/> | ||
</div> | ||
</div> | ||
<div className={styles.section}> | ||
<div className={styles.title}>Edit categories</div> | ||
<TextInput /> | ||
</div> | ||
<div className={styles.footer}> | ||
{packageData.is_deprecated ? ( | ||
<Button.Root paddingSize="large" colorScheme="default"> | ||
<Button.ButtonLabel>Undeprecate</Button.ButtonLabel> | ||
</Button.Root> | ||
) : ( | ||
<Button.Root paddingSize="large" colorScheme="warning"> | ||
<Button.ButtonLabel>Deprecate</Button.ButtonLabel> | ||
</Button.Root> | ||
)} | ||
<Button.Root paddingSize="large" colorScheme="success"> | ||
<Button.ButtonLabel>Save changes</Button.ButtonLabel> | ||
</Button.Root> | ||
</div> | ||
</div> | ||
); | ||
} |
120 changes: 120 additions & 0 deletions
120
.../p/[namespace]/(packageRoute)/[package]/(pkg)/@packageCard/PackageDetailLayout.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
.packageInfo { | ||
display: flex; | ||
flex-direction: row; | ||
gap: var(--gap--32); | ||
justify-content: space-between; | ||
} | ||
|
||
.packageInfoDetails { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--gap--8); | ||
} | ||
|
||
.packageInfoMeta { | ||
display: flex; | ||
flex-direction: row; | ||
gap: var(--gap--16); | ||
} | ||
|
||
.description { | ||
color: var(--color-text--default); | ||
white-space: pre-wrap; | ||
overflow-wrap: anywhere; | ||
} | ||
|
||
.headerActions { | ||
display: flex; | ||
flex-basis: 354px; | ||
flex-direction: column; | ||
align-items: flex-end; | ||
justify-content: space-between; | ||
} | ||
|
||
.installButton { | ||
position: relative; | ||
bottom: -1rem; | ||
width: 354px; | ||
} | ||
|
||
.installButtonIcon { | ||
max-width: var(--space--24); | ||
} | ||
|
||
.installButtonIcon svg { | ||
width: 1.655rem; | ||
height: 1.462rem; | ||
} | ||
|
||
.metaButtonWrapper { | ||
display: flex; | ||
flex-grow: 1; | ||
gap: var(--gap--8); | ||
} | ||
|
||
.metaDownloadButton { | ||
display: flex; | ||
flex-grow: 1; | ||
} | ||
|
||
.metaDownloadButton > div { | ||
display: flex; | ||
flex-grow: 1; | ||
} | ||
|
||
.metaInfo { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--gap--16); | ||
min-width: 354px; | ||
} | ||
|
||
.dependencyStringWrapper { | ||
display: flex; | ||
gap: var(--gap--8); | ||
align-items: center; | ||
max-width: 180px; | ||
max-height: 21px; | ||
} | ||
|
||
.dependencyString { | ||
overflow: hidden; | ||
white-space: nowrap; | ||
text-overflow: ellipsis; | ||
} | ||
|
||
.dependantsLink { | ||
color: var(--color-highlight); | ||
} | ||
|
||
@media (max-width: 60rem) { | ||
.packageInfo { | ||
flex-direction: column; | ||
gap: 0; | ||
} | ||
|
||
.headerActions { | ||
flex-direction: row; | ||
justify-content: space-between; | ||
width: 100%; | ||
} | ||
} | ||
|
||
.tabIcon { | ||
line-height: normal; | ||
} | ||
|
||
.modImage { | ||
min-width: 9rem; | ||
max-width: 9rem; | ||
min-height: 9rem; | ||
max-height: 9rem; | ||
border-radius: var(--border-radius--8); | ||
} | ||
|
||
.categoriesCard { | ||
display: flex; | ||
flex-flow: row wrap; | ||
gap: 0.5rem; | ||
row-gap: 0.5rem; | ||
} |
97 changes: 97 additions & 0 deletions
97
...(package)/@tspackage/p/[namespace]/(packageRoute)/[package]/(pkg)/@packageCard/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
"use client"; | ||
import { PageHeader, Dialog, Button, TeamLink } from "@thunderstore/cyberstorm"; | ||
import styles from "./PackageDetailLayout.module.css"; | ||
import { useDapper } from "@thunderstore/dapper"; | ||
import { usePromise } from "@thunderstore/use-promise"; | ||
import { ThunderstoreLogo } from "@thunderstore/cyberstorm/src/svg/svg"; | ||
import { | ||
faArrowUpRight, | ||
faUsers, | ||
faCog, | ||
} from "@fortawesome/pro-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import { ReactNode, Suspense } from "react"; | ||
|
||
export default function PackageCardLayout({ | ||
packageManagement, | ||
params, | ||
}: { | ||
packageManagement: ReactNode; | ||
params: { community: string; namespace: string; package: string }; | ||
}) { | ||
const dapper = useDapper(); | ||
const packageData = usePromise(dapper.getPackageListingDetails, [ | ||
params.community, | ||
params.namespace, | ||
params.package, | ||
]); | ||
const displayName = params.package.replace(/_/g, " "); | ||
|
||
const packageDetailsMeta = [ | ||
<TeamLink | ||
key="team" | ||
community={packageData.community_identifier} | ||
team={packageData.namespace} | ||
> | ||
<Button.Root plain colorScheme="transparentPrimary" paddingSize="small"> | ||
<Button.ButtonIcon> | ||
<FontAwesomeIcon icon={faUsers} /> | ||
</Button.ButtonIcon> | ||
<Button.ButtonLabel>{packageData.namespace}</Button.ButtonLabel> | ||
</Button.Root> | ||
</TeamLink>, | ||
]; | ||
|
||
if (packageData.website_url) { | ||
packageDetailsMeta.push( | ||
<a key="website" href={packageData.website_url}> | ||
<Button.Root plain colorScheme="transparentPrimary" paddingSize="small"> | ||
<Button.ButtonLabel>{packageData.website_url}</Button.ButtonLabel> | ||
<Button.ButtonIcon> | ||
<FontAwesomeIcon icon={faArrowUpRight} /> | ||
</Button.ButtonIcon> | ||
</Button.Root> | ||
</a> | ||
); | ||
} | ||
|
||
return ( | ||
<div className={styles.packageInfo}> | ||
<PageHeader | ||
title={displayName} | ||
image={ | ||
<img className={styles.modImage} alt="" src={packageData.icon_url} /> | ||
Check warning Code scanning / ESLint Prevent usage of `<img>` element due to slower LCP and higher bandwidth. Warning
Using <img> could result in slower LCP and higher bandwidth. Consider using <Image /> from next/image to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
|
||
} | ||
description={packageData.description} | ||
meta={packageDetailsMeta} | ||
/> | ||
<div className={styles.headerActions}> | ||
<Dialog.Root | ||
title="Manage Package" | ||
trigger={ | ||
<Button.Root colorScheme="primary" paddingSize="medium"> | ||
<Button.ButtonIcon> | ||
<FontAwesomeIcon icon={faCog} /> | ||
</Button.ButtonIcon> | ||
<Button.ButtonLabel>Manage</Button.ButtonLabel> | ||
</Button.Root> | ||
} | ||
> | ||
<Suspense fallback={<p>TODO: SKELETON packageManagement</p>}> | ||
{packageManagement} | ||
</Suspense> | ||
</Dialog.Root> | ||
<a href={packageData.install_url} className={styles.installButton}> | ||
<Button.Root plain paddingSize="huge" colorScheme="fancyAccent"> | ||
<Button.ButtonIcon iconSize="big"> | ||
<ThunderstoreLogo /> | ||
</Button.ButtonIcon> | ||
<Button.ButtonLabel fontSize="huge" fontWeight="800"> | ||
Install | ||
</Button.ButtonLabel> | ||
</Button.Root> | ||
</a> | ||
</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.