Connect, collaborate, and grow with a community of TypeScript developers
something happened
Chris Bautista3b266e5907e3
diff --git a/.eslintrc.cjs b/.eslintrc.cjsnew file mode 100644index 00000000..237efddd--- /dev/null+++ b/.eslintrc.cjs@@ -0,0 +1,34 @@+// eslint-disable-next-line @typescript-eslint/no-var-requires+const path = require('path');++/** @type {import("eslint").Linter.Config} */+const config = {+ overrides: [+ {+ extends: ['plugin:@typescript-eslint/recommended-requiring-type-checking'],+ files: ['*.ts', '*.tsx'],+ parserOptions: {+ project: path.join(__dirname, 'tsconfig.json'),+ },+ },+ ],+ parser: '@typescript-eslint/parser',+ parserOptions: {+ project: path.join(__dirname, 'tsconfig.json'),+ },+ plugins: ['@typescript-eslint'],+ extends: ['next/core-web-vitals', 'plugin:@typescript-eslint/recommended'],+ rules: {+ '@typescript-eslint/consistent-type-imports': [+ 'warn',+ {+ prefer: 'type-imports',+ fixStyle: 'inline-type-imports',+ },+ ],+ '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],+ '@typescript-eslint/no-empty-interface': 'off',+ },+};++module.exports = config;diff --git a/src/app/layout.tsx b/src/app/layout.tsxnew file mode 100644index 00000000..da476f47--- /dev/null+++ b/src/app/layout.tsx@@ -0,0 +1,19 @@+import { Providers } from './providers';++import '../styles/globals.css';++export const metadata = {+ title: 'Next.js',+ description: 'Generated by Next.js',+};++export default function RootLayout({ children }: { children: React.ReactNode }) {+ return (+ <html suppressHydrationWarning>+ <head />+ <body>+ <Providers>{children}</Providers>+ </body>+ </html>+ );+}diff --git a/src/app/page.tsx b/src/app/page.tsxnew file mode 100644index 00000000..954ec61b--- /dev/null+++ b/src/app/page.tsx@@ -0,0 +1,34 @@+import { getServerSession } from 'next-auth';+import Head from 'next/head';+import { CodePanel } from '~/components/ui/editor';+import { TypographyH1 } from '~/components/ui/h1';+import { Navigation } from '~/components/ui/navigation';+import { authOptions } from '~/server/auth';++export default async function Index() {+ const session = await getServerSession(authOptions);+ return (+ <>+ <Head>+ <title>Type Hero</title>+ <meta+ name="description"+ content="Level up your typescript skills with interactive exercises"+ />+ <link rel="icon" href="/favicon.ico" />+ </Head>+ <Navigation />+ <header>+ <TypographyH1>TypeHero</TypographyH1>+ </header>+ <main>+ <div className="flex flex-col items-center justify-center gap-4">+ <p className="text-center text-2xl text-white">+ {session && <span>Logged in as {session.user?.name}</span>}+ </p>+ </div>+ <CodePanel />+ </main>+ </>+ );+}diff --git a/src/app/providers.tsx b/src/app/providers.tsxnew file mode 100644index 00000000..eac070f3--- /dev/null+++ b/src/app/providers.tsx@@ -0,0 +1,10 @@+'use client';++import { ThemeProvider } from 'next-themes';++interface Props {+ children: React.ReactNode;+}+export function Providers({ children }: Props) {+ return <ThemeProvider attribute="class">{children}</ThemeProvider>;+}diff --git a/src/components/home/index.tsx b/src/components/home/index.tsxnew file mode 100644index 00000000..21860d1f--- /dev/null+++ b/src/components/home/index.tsx@@ -0,0 +1,4 @@+interface Props {}+export default function Home() {+ return <div>Home</div>;+}diff --git a/src/components/ui/editor/index.tsx b/src/components/ui/editor/index.tsxindex d27f674a..7df53231 100644--- a/src/components/ui/editor/index.tsx+++ b/src/components/ui/editor/index.tsx@@ -1,3 +1,4 @@+'use client';import Editor from '@monaco-editor/react';import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';import React from 'react';diff --git a/src/components/ui/navigation.tsx b/src/components/ui/navigation.tsxindex 69b38ce3..1dbb0f53 100644--- a/src/components/ui/navigation.tsx+++ b/src/components/ui/navigation.tsx@@ -1,3 +1,5 @@+'use client';+import { useTheme } from 'next-themes';import { Bell, Moon, Sun } from 'lucide-react';diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsxnew file mode 100644index 00000000..73cbf7be--- /dev/null+++ b/src/pages/home/index.tsx@@ -0,0 +1,8 @@+import Home from '~/components/home';++// export const getServerSideProps = compose(authenticatedRoute, async (ctx) => {+// });++const HomePage = () => <Home />;++export default HomePage;diff --git a/src/pages/index.tsx b/src/pages/index.tsxdeleted file mode 100644index eda688d9..00000000--- a/src/pages/index.tsx+++ /dev/null@@ -1,58 +0,0 @@-import { type NextPage } from 'next';--import { signIn, signOut, useSession } from 'next-auth/react';--import Head from 'next/head';-import { CodePanel } from '~/components/ui/editor';-import { TypographyH1 } from '~/components/ui/h1';-import { Navigation } from '~/components/ui/navigation';-import { api } from '~/utils/api';--const Home: NextPage = () => {- return (- <>- <Head>- <title>Type Hero</title>- <meta- name="description"- content="Level up your typescript skills with interactive exercises"- />- <link rel="icon" href="/favicon.ico" />- </Head>- <Navigation />- <header>- <TypographyH1>TypeHero</TypographyH1>- </header>- <main>- <AuthShowcase />- <CodePanel />- </main>- </>- );-};--export default Home;--const AuthShowcase: React.FC = () => {- const { data: sessionData } = useSession();-- const { data: secretMessage } = api.example.getSecretMessage.useQuery(- undefined, // no input- { enabled: sessionData?.user !== undefined },- );-- return (- <div className="flex flex-col items-center justify-center gap-4">- <p className="text-center text-2xl text-white">- {sessionData && <span>Logged in as {sessionData.user?.name}</span>}- {secretMessage && <span> - {secretMessage}</span>}- </p>- <button- className="rounded-full bg-white/10 px-10 py-3 font-semibold text-white no-underline transition hover:bg-white/20"- onClick={sessionData ? () => void signOut() : () => void signIn()}- >- {sessionData ? 'Sign out' : 'Sign in'}- </button>- </div>- );-};diff --git a/src/server/api/routers/example.ts b/src/server/api/routers/example.tsindex 3471999b..10296466 100644--- a/src/server/api/routers/example.ts+++ b/src/server/api/routers/example.ts@@ -8,10 +8,6 @@ export const exampleRouter = createTRPCRouter({};}),- getAll: publicProcedure.query(({ ctx }) => {- return ctx.prisma.example.findMany();- }),-getSecretMessage: protectedProcedure.query(() => {return 'you can now see this secret message!';}),diff --git a/tailwind.config.ts b/tailwind.config.tsindex 2c0575b6..f0237416 100644--- a/tailwind.config.ts+++ b/tailwind.config.ts@@ -1,76 +1,76 @@-const { fontFamily } = require("tailwindcss/defaultTheme");+const { fontFamily } = require('tailwindcss/defaultTheme');/** @type {import('tailwindcss').Config} */module.exports = {- darkMode: ["class"],- content: ["src/**/*.{ts,tsx}"],+ darkMode: ['class'],+ content: ['./app/**/*.{js,ts,jsx,tsx,mdx}', 'src/**/*.{ts,tsx}'],theme: {container: {center: true,- padding: "1rem",+ padding: '1rem',screens: {- "2xl": "1400px",+ '2xl': '1400px',},},extend: {colors: {- border: "hsl(var(--border))",- input: "hsl(var(--input))",- ring: "hsl(var(--ring))",- background: "hsl(var(--background))",- foreground: "hsl(var(--foreground))",+ border: 'hsl(var(--border))',+ input: 'hsl(var(--input))',+ ring: 'hsl(var(--ring))',+ background: 'hsl(var(--background))',+ foreground: 'hsl(var(--foreground))',primary: {- DEFAULT: "hsl(var(--primary))",- foreground: "hsl(var(--primary-foreground))",+ DEFAULT: 'hsl(var(--primary))',+ foreground: 'hsl(var(--primary-foreground))',},secondary: {- DEFAULT: "hsl(var(--secondary))",- foreground: "hsl(var(--secondary-foreground))",+ DEFAULT: 'hsl(var(--secondary))',+ foreground: 'hsl(var(--secondary-foreground))',},destructive: {- DEFAULT: "hsl(var(--destructive))",- foreground: "hsl(var(--destructive-foreground))",+ DEFAULT: 'hsl(var(--destructive))',+ foreground: 'hsl(var(--destructive-foreground))',},muted: {- DEFAULT: "hsl(var(--muted))",- foreground: "hsl(var(--muted-foreground))",+ DEFAULT: 'hsl(var(--muted))',+ foreground: 'hsl(var(--muted-foreground))',},accent: {- DEFAULT: "hsl(var(--accent))",- foreground: "hsl(var(--accent-foreground))",+ DEFAULT: 'hsl(var(--accent))',+ foreground: 'hsl(var(--accent-foreground))',},popover: {- DEFAULT: "hsl(var(--popover))",- foreground: "hsl(var(--popover-foreground))",+ DEFAULT: 'hsl(var(--popover))',+ foreground: 'hsl(var(--popover-foreground))',},card: {- DEFAULT: "hsl(var(--card))",- foreground: "hsl(var(--card-foreground))",+ DEFAULT: 'hsl(var(--card))',+ foreground: 'hsl(var(--card-foreground))',},},borderRadius: {lg: `var(--radius)`,md: `calc(var(--radius) - 2px)`,- sm: "calc(var(--radius) - 4px)",+ sm: 'calc(var(--radius) - 4px)',},fontFamily: {- sans: ["var(--font-sans)", ...fontFamily.sans],+ sans: ['var(--font-sans)', ...fontFamily.sans],},keyframes: {- "accordion-down": {+ 'accordion-down': {from: { height: 0 },- to: { height: "var(--radix-accordion-content-height)" },+ to: { height: 'var(--radix-accordion-content-height)' },},- "accordion-up": {- from: { height: "var(--radix-accordion-content-height)" },+ 'accordion-up': {+ from: { height: 'var(--radix-accordion-content-height)' },to: { height: 0 },},},animation: {- "accordion-down": "accordion-down 0.2s ease-out",- "accordion-up": "accordion-up 0.2s ease-out",+ 'accordion-down': 'accordion-down 0.2s ease-out',+ 'accordion-up': 'accordion-up 0.2s ease-out',},},},- plugins: [require("tailwindcss-animate")],+ plugins: [require('tailwindcss-animate')],};diff --git a/tsconfig.json b/tsconfig.jsonindex a76e2ef3..bf347be7 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -25,7 +25,12 @@"~/*": ["./src/*"]- }+ },+ "plugins": [+ {+ "name": "next"+ }+ ]},"include": [".eslintrc.cjs",@@ -33,7 +38,8 @@"**/*.ts","**/*.tsx","**/*.cjs",- "**/*.mjs"+ "**/*.mjs",+ ".next/types/**/*.ts"],"exclude": ["node_modules"