mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 10:33:30 +01:00
refactor: split out package constant
This commit is contained in:
@@ -32,14 +32,13 @@ import { Variable } from '~/components/model/Variable';
|
||||
import { MemberProvider } from '~/contexts/member';
|
||||
import { createApiModel } from '~/util/api-model.server';
|
||||
import { findMember, findMemberByKey } from '~/util/model.server';
|
||||
import { PACKAGES } from '~/util/packages';
|
||||
import { findPackage, getMembers } from '~/util/parse.server';
|
||||
|
||||
export const getStaticPaths: GetStaticPaths = async () => {
|
||||
const packages = ['builders', 'collection', 'proxy', 'rest', 'voice', 'ws'];
|
||||
|
||||
const pkgs = (
|
||||
await Promise.all(
|
||||
packages.map(async (packageName) => {
|
||||
PACKAGES.map(async (packageName) => {
|
||||
try {
|
||||
let data: any[] = [];
|
||||
let versions: string[] = [];
|
||||
@@ -121,7 +120,7 @@ export const getStaticPaths: GetStaticPaths = async () => {
|
||||
|
||||
return {
|
||||
paths: pkgs,
|
||||
fallback: true,
|
||||
fallback: 'blocking',
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import Link from 'next/link';
|
||||
import { useRouter } from 'next/router';
|
||||
import type { GetStaticPaths, GetStaticProps } from 'next/types';
|
||||
import { VscArrowLeft, VscArrowRight, VscPackage } from 'react-icons/vsc';
|
||||
import { PACKAGES } from '~/util/packages';
|
||||
|
||||
interface VersionProps {
|
||||
packageName: string;
|
||||
@@ -24,9 +25,7 @@ interface VersionProps {
|
||||
}
|
||||
|
||||
export const getStaticPaths: GetStaticPaths = () => {
|
||||
const packages = ['builders', 'collection', 'proxy', 'rest', 'voice', 'ws'];
|
||||
|
||||
const versions = packages.map((packageName) => ({ params: { package: packageName } }));
|
||||
const versions = PACKAGES.map((packageName) => ({ params: { package: packageName } }));
|
||||
|
||||
return {
|
||||
paths: versions,
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
} from '@mantine/core';
|
||||
import Link from 'next/link';
|
||||
import { VscArrowRight, VscPackage } from 'react-icons/vsc';
|
||||
import { PACKAGES } from '~/util/packages';
|
||||
|
||||
const useStyles = createStyles((theme) => ({
|
||||
control: {
|
||||
@@ -29,15 +30,13 @@ export default function PackagesRoute() {
|
||||
const { classes } = useStyles();
|
||||
const { colorScheme } = useMantineColorScheme();
|
||||
|
||||
const packages = ['builders', 'collection', 'proxy', 'rest', 'voice', 'ws'];
|
||||
|
||||
return (
|
||||
<Container pt={128} size="xs">
|
||||
<Stack sx={{ flexGrow: 1 }}>
|
||||
<Title order={2} ml="xs">
|
||||
Select a package:
|
||||
</Title>
|
||||
{packages.map((pkg) => (
|
||||
{PACKAGES.map((pkg) => (
|
||||
<Link key={pkg} href={`/docs/packages/${pkg}`} passHref>
|
||||
<UnstyledButton className={classes.control} component="a">
|
||||
<Group position="apart">
|
||||
|
||||
Reference in New Issue
Block a user