Skip to content

Commit

Permalink
Add TwitchPanelLayout and setup in NextJS
Browse files Browse the repository at this point in the history
refs TS-1656 TS-1658
  • Loading branch information
Oksamies committed Apr 27, 2023
1 parent 878c662 commit 585d40e
Show file tree
Hide file tree
Showing 17 changed files with 204 additions and 3 deletions.
3 changes: 3 additions & 0 deletions apps/twitch-extensions-nextjs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
35 changes: 35 additions & 0 deletions apps/twitch-extensions-nextjs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
38 changes: 38 additions & 0 deletions apps/twitch-extensions-nextjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
10 changes: 10 additions & 0 deletions apps/twitch-extensions-nextjs/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const withPreconstruct = require("@preconstruct/next");

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
transpilePackages: ["react"],
output: "export",
};

module.exports = withPreconstruct(nextConfig);
25 changes: 25 additions & 0 deletions apps/twitch-extensions-nextjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@thunderstore/twitch-extensions-nextjs",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@preconstruct/next": "^4.0.0",
"@thunderstore/cyberstorm": "^0.1.0",
"@thunderstore/cyberstorm-styles": "^0.1.0",
"@types/node": "18.15.11",
"@types/react": "18.0.35",
"@types/react-dom": "18.0.11",
"eslint": "8.38.0",
"eslint-config-next": "13.3.0",
"next": "13.3.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "5.0.4"
}
}
6 changes: 6 additions & 0 deletions apps/twitch-extensions-nextjs/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { AppProps } from "next/app";
import "@thunderstore/cyberstorm-styles";

export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}
13 changes: 13 additions & 0 deletions apps/twitch-extensions-nextjs/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Html, Head, Main, NextScript } from "next/document";

export default function Document() {
return (
<Html lang="en">
<Head></Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
13 changes: 13 additions & 0 deletions apps/twitch-extensions-nextjs/pages/api/hello.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from "next";

type Data = {
name: string;
};

export default function handler(
req: NextApiRequest,
res: NextApiResponse<Data>
) {
res.status(200).json({ name: "John Doe" });
}
9 changes: 9 additions & 0 deletions apps/twitch-extensions-nextjs/pages/twitchpanel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { TwitchProfilePanelLayout } from "@thunderstore/cyberstorm";

export default function Communities() {
return (
<div>
<TwitchProfilePanelLayout />
</div>
);
}
Binary file added apps/twitch-extensions-nextjs/public/favicon.ico
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/twitch-extensions-nextjs/public/next.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/twitch-extensions-nextjs/public/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions apps/twitch-extensions-nextjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "pages/twitchpanel.html"],
"exclude": ["node_modules"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ProfilePanel } from "../../ProfilePanel/ProfilePanel";

/**
* Cyberstorm TwitchPanelLayout Layout
*/
export function TwitchProfilePanelLayout() {
const profile = getProfileData();
return <ProfilePanel profile={profile} />;
}

TwitchProfilePanelLayout.displayName = "ProfilePanelLayout";
TwitchProfilePanelLayout.defaultProps = {};

function getProfileData() {
return {
code: "TEST_CODE",
name: "TEST_NAME",
mods: [
{ name: "TEST_MOD_NAME_1", version: "0.0.1", url: "example.com" },
{ name: "TEST_MOD_NAME_2", version: "0.0.2", url: "example.com" },
{ name: "TEST_MOD_NAME_3", version: "0.0.3", url: "example.com" },
],
};
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import styles from "./ProfilePanel.module.css";
import { faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
Expand All @@ -24,7 +23,7 @@ export interface ProfilePanelProps {
/**
* Cyberstorm ProfilePanel component
*/
export const ProfilePanel: React.FC<ProfilePanelProps> = (props) => {
export function ProfilePanel(props: ProfilePanelProps) {
const { profile } = props;

return (
Expand Down Expand Up @@ -54,6 +53,6 @@ export const ProfilePanel: React.FC<ProfilePanelProps> = (props) => {
</div>
</div>
);
};
}

ProfilePanel.displayName = "ProfilePanel";
1 change: 1 addition & 0 deletions packages/cyberstorm/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export * from "./components/Layout/PackageDetailLayout/PackageDetailLayout";
export * from "./components/Layout/PackageListLayout/PackageListLayout";
export * from "./components/Layout/Settings/SettingsLayout";
export * from "./components/Layout/Teams/TeamsLayout";
export * from "./components/Layout/TwitchProfilePanelLayout/TwitchProfilePanelLayout";

export * from "./components/Layout/Developers/ManifestValidator/ManifestValidatorLayout";
export * from "./components/Layout/Developers/MarkdownPreview/MarkdownPreviewLayout";
Expand Down

0 comments on commit 585d40e

Please sign in to comment.