Connect, collaborate, and grow with a community of TypeScript developers
feat: adds script for ingestion (#885)
bautistaaae929af45f3d6
diff --git a/.prettierignore b/.prettierignoreindex 173e8493..35a3979e 100644--- a/.prettierignore+++ b/.prettierignore@@ -13,6 +13,6 @@ monaco-editor.d.tspnpm-lock.yaml!apps/**-!challenges/**+challenges/**!packages/**!tooling/**diff --git a/challenges/generic-type-arguments/metadata.json b/challenges/generic-type-arguments/metadata.jsonindex 4387de31..55bc81aa 100644--- a/challenges/generic-type-arguments/metadata.json+++ b/challenges/generic-type-arguments/metadata.json@@ -1,4 +1,5 @@{"id": "generic-type-arguments",+ "difficulty": "beginner","prerequisites": ["primitive-data-types", "type-aliases"]}diff --git a/challenges/generic-type-constraints/metadata.json b/challenges/generic-type-constraints/metadata.jsonindex 94dccec0..b71b4219 100644--- a/challenges/generic-type-constraints/metadata.json+++ b/challenges/generic-type-constraints/metadata.json@@ -1,4 +1,5 @@{"id": "generic-type-constraints",+ "difficulty": "beginner","prerequisites": []}diff --git a/challenges/index-signatures/metadata.json b/challenges/index-signatures/metadata.jsonindex b15def05..7cc045a6 100644--- a/challenges/index-signatures/metadata.json+++ b/challenges/index-signatures/metadata.json@@ -1,4 +1,5 @@{"id": "index-signatures",+ "difficulty": "beginner","prerequisites": ["type-aliases", "primitive-data-types"]}diff --git a/challenges/indexed-types/metadata.json b/challenges/indexed-types/metadata.jsonindex 1c5af0e7..791dba0d 100644--- a/challenges/indexed-types/metadata.json+++ b/challenges/indexed-types/metadata.json@@ -1,4 +1,5 @@{"id": "indexed-types",+ "difficulty": "beginner","prerequisites": ["primitive-types", "type-unions", "keyof", "literal-types"]}diff --git a/challenges/keyof/metadata.json b/challenges/keyof/metadata.jsonindex 0c9ef4c6..25a629f9 100644--- a/challenges/keyof/metadata.json+++ b/challenges/keyof/metadata.json@@ -1,4 +1,5 @@{"id": "keyof",+ "difficulty": "beginner","prerequisites": ["type-aliases", "literal-types", "type-unions"]}diff --git a/challenges/literal-types/metadata.json b/challenges/literal-types/metadata.jsonindex 423d9afe..34f6d2d7 100644--- a/challenges/literal-types/metadata.json+++ b/challenges/literal-types/metadata.json@@ -1,4 +1,5 @@{"id": "literal-types",+ "difficulty": "beginner","prerequisites": ["primitive-data-types", "type-unions"]}diff --git a/challenges/mapped-object-types/metadata.json b/challenges/mapped-object-types/metadata.jsonindex f527970e..a21af54d 100644--- a/challenges/mapped-object-types/metadata.json+++ b/challenges/mapped-object-types/metadata.json@@ -1,4 +1,5 @@{"id": "mapped-object-types",+ "difficulty": "beginner","prerequisites": ["index-signatures", "keyof", "generic-type-arguments", "indexed-types"]}diff --git a/challenges/pick/metadata.json b/challenges/pick/metadata.jsonindex dd3eb14f..14ad63cd 100644--- a/challenges/pick/metadata.json+++ b/challenges/pick/metadata.json@@ -1,4 +1,5 @@{"id": "pick",+ "difficulty": "easy","prerequisites": ["literal-types", "keyof", "mapped-object-types", "generic-type-constraints"]}diff --git a/challenges/primitive-data-types/metadata.json b/challenges/primitive-data-types/metadata.jsonindex bcb0ea51..fa5d4dc9 100644--- a/challenges/primitive-data-types/metadata.json+++ b/challenges/primitive-data-types/metadata.json@@ -1,4 +1,5 @@{"id": "primitive-data-types",+ "difficulty": "beginner","prerequisites": []}diff --git a/challenges/type-aliases/metadata.json b/challenges/type-aliases/metadata.jsonindex 041776bb..38584778 100644--- a/challenges/type-aliases/metadata.json+++ b/challenges/type-aliases/metadata.json@@ -1,4 +1,5 @@{"id": "type-aliases",+ "difficulty": "beginner","prerequisites": ["primitive-data-types"]}diff --git a/challenges/type-unions/metadata.json b/challenges/type-unions/metadata.jsonindex 678fee58..c9e3c682 100644--- a/challenges/type-unions/metadata.json+++ b/challenges/type-unions/metadata.json@@ -1,4 +1,5 @@{"id": "type-unions",+ "difficulty": "beginner","prerequisites": ["type-aliases", "literal-types"]}diff --git a/challenges/typeof/metadata.json b/challenges/typeof/metadata.jsonindex 56b6828e..aaf816df 100644--- a/challenges/typeof/metadata.json+++ b/challenges/typeof/metadata.json@@ -1,4 +1,5 @@{"id": "typeof",+ "difficulty": "beginner","prerequisites": ["literal-types", "type-unions", "type-aliases"]}diff --git a/package.json b/package.jsonindex 108b3634..67e3b20d 100644--- a/package.json+++ b/package.json@@ -10,6 +10,7 @@"db:push": "turbo db:push","db:reset": "turbo db:reset","db:seed": "turbo db:seed",+ "db:prod:seed": "turbo db:reset && turbo db:prod:seed","db:studio": "turbo db:studio","dev": "turbo dev --filter=!@repo/emails --concurrency=1000","dev:email": "turbo dev --filter @repo/emails",diff --git a/packages/db/mocks/challenges.mock.ts b/packages/db/mocks/challenges.mock.tsindex 8ec52f4a..898e5862 100644--- a/packages/db/mocks/challenges.mock.ts+++ b/packages/db/mocks/challenges.mock.ts@@ -3,8 +3,8 @@ import { readdir, readFile, rm } from 'node:fs/promises';import { resolve } from 'node:path';import { simpleGit } from 'simple-git';import { parse } from 'yaml';-import { slugify } from '../seed';+const slugify = (str: string) => str.toLowerCase().replace(/\s/g, '-');export interface InfoFile {title: string;author: {@@ -67,7 +67,6 @@ export async function loadChallengesFromTypeChallenge() {status: ChallengeStatus.ACTIVE,code: prompt,tests: testData,- // prompt: `// TEST CASE START\n${testData}\n\n// CODE START\n${prompt}`,difficulty: difficulty === 'warm' ? 'BEGINNER' : (difficulty.toUpperCase() as Difficulty),shortDescription: README.slice(0, 100),});diff --git a/packages/db/mocks/comment.mock.ts b/packages/db/mocks/comment.mock.tsindex c3b2fbf4..6e83745b 100644--- a/packages/db/mocks/comment.mock.ts+++ b/packages/db/mocks/comment.mock.ts@@ -1,12 +1,8 @@import { faker } from '@faker-js/faker';import { type Prisma } from '@prisma/client';-import { trashId } from '../seed';+import { trashId } from '../seed/dev';-/**- *- * @returns Creates a mock user.- */-export default function CommentMock(+export function createComment(commentNumber: number,parentId?: number,): Prisma.CommentCreateManyInput {diff --git a/packages/db/mocks/user.mock.ts b/packages/db/mocks/user.mock.tsindex 47023d20..42348d93 100644--- a/packages/db/mocks/user.mock.ts+++ b/packages/db/mocks/user.mock.ts@@ -1,11 +1,7 @@import { faker } from '@faker-js/faker';import { type Prisma } from '@prisma/client';-/**- *- * @returns Creates a mock user.- */-export default function UserMock(): Prisma.UserCreateManyInput {+export function createUser(): Prisma.UserCreateManyInput {// Create emailconst email = faker.internet.email();// Created At@@ -19,3 +15,6 @@ export default function UserMock(): Prisma.UserCreateManyInput {createdAt,};}++export const createUsers = (numberOfUsersToCreate: number) =>+ Array.from({ length: numberOfUsersToCreate }, () => createUser());diff --git a/packages/db/package.json b/packages/db/package.jsonindex a18e76ef..dd22109f 100644--- a/packages/db/package.json+++ b/packages/db/package.json@@ -22,7 +22,8 @@"db:generate": "dotenv -e ../../.env prisma generate","db:push": "dotenv -e ../../.env prisma db push","db:reset": "dotenv -e ../../.env prisma db push -- --force-reset",- "db:seed": "dotenv -e ../../.env tsx ./seed/index.ts",+ "db:seed": "dotenv -e ../../.env tsx ./seed/dev.ts",+ "db:prod:seed": "dotenv -e ../../.env tsx ./seed/prod.ts","db:studio": "dotenv -e ../../.env prisma studio","format": "prettier . --check --cache --cache-location=\"node_modules/.cache/prettiercache\"","format:fix": "prettier . --write --cache --cache-location=\"node_modules/.cache/prettiercache\" --log-level=warn",diff --git a/packages/db/seed/data/beginner/desc.md b/packages/db/seed/data/beginner/desc.mddeleted file mode 100644index d89071a7..00000000--- a/packages/db/seed/data/beginner/desc.md+++ /dev/null@@ -1,20 +0,0 @@-Implement the built-in `Pick<T, K>` generic without using it.--Constructs a type by picking the set of properties `K` from `T`--For example:--```ts-interface Todo {- title: string;- description: string;- completed: boolean;-}--type TodoPreview = MyPick<Todo, 'title' | 'completed'>;--const todo: TodoPreview = {- title: 'Clean room',- completed: false,-};-```diff --git a/packages/db/seed/data/beginner/prompt.md b/packages/db/seed/data/beginner/prompt.mddeleted file mode 100644index 228545b4..00000000--- a/packages/db/seed/data/beginner/prompt.md+++ /dev/null@@ -1,7 +0,0 @@-// TEST CASE START-Extends<HelloWorld, `Hello, ${string}`>()--Extends<HelloWorld, `${string}!`>()--// CODE START-type HelloWorld = ""diff --git a/packages/db/seed/data/challenge-ingest.ts b/packages/db/seed/data/challenge-ingest.tsnew file mode 100644index 00000000..d629a515--- /dev/null+++ b/packages/db/seed/data/challenge-ingest.ts@@ -0,0 +1,112 @@+import { type Prisma } from '@prisma/client';+import fs from 'node:fs';+import path from 'node:path';++export async function ingestChallenges(challengePath: string) {+ const challengesToCreate: Prisma.ChallengeCreateManyInput[] = [];+ try {+ const items = await fs.promises.readdir(challengePath);++ for (const item of items) {+ const itemPath = path.join(challengePath, item);++ if (itemPath.includes('blank') || itemPath.includes('solutions')) {+ continue;+ }++ const stats = await fs.promises.stat(itemPath);++ if (stats.isDirectory()) {+ const challengeToCreate = await buildChallenge(itemPath);+ challengesToCreate.push(challengeToCreate);+ }+ }+ } catch (error) {+ console.error('Error:', error);+ }++ return challengesToCreate;+}++async function buildChallenge(pathToDirectory: string) {+ const challengeToCreate: Prisma.ChallengeCreateManyInput = {+ status: 'ACTIVE',+ } as Prisma.ChallengeCreateManyInput;++ const files = await fs.promises.readdir(pathToDirectory);++ for (const file of files) {+ const itemPath = path.join(pathToDirectory, file);++ if (itemPath.includes('blank') || itemPath.includes('solutions')) {+ continue;+ }++ const stats = await fs.promises.stat(itemPath);++ if (stats.isFile()) {+ const fileName = path.parse(itemPath).name;++ if (fileName === 'prompt') {+ try {+ const fileContents = await fs.promises.readFile(itemPath, 'utf8');+ challengeToCreate.description = fileContents;+ challengeToCreate.shortDescription = fileContents.slice(0, 100);+ } catch (jsonError) {+ console.error('Error parsing JSON:', jsonError);+ }+ }+ if (fileName === 'user') {+ try {+ const fileContents = await fs.promises.readFile(itemPath, 'utf8');+ challengeToCreate.code = fileContents;+ } catch (jsonError) {+ console.error('Error parsing JSON:', jsonError);+ }+ }+ if (fileName === 'tests') {+ try {+ const fileContents = await fs.promises.readFile(itemPath, 'utf8');+ challengeToCreate.tests = fileContents;+ } catch (jsonError) {+ console.error('Error parsing JSON:', jsonError);+ }+ }+ if (fileName === 'metadata') {+ try {+ const fileContents = await fs.promises.readFile(itemPath, 'utf8');+ const jsonData = JSON.parse(fileContents);+ challengeToCreate.difficulty = jsonData.difficulty.toUpperCase();+ challengeToCreate.name = hyphenatedToPascalCase(jsonData.id);+ challengeToCreate.slug = jsonData.id;+ // console.log('Parsed JSON:', jsonData);+ } catch (jsonError) {+ console.error('Error parsing JSON:', jsonError);+ }+ }+ // @TODO: we'll ingest solutions later+ // const isWithinSolutionsDirectory = challengePath.split('/').at(-1) === 'solutions';+ //+ // if (isWithinSolutionsDirectory) {+ // if (fileExtension === '.ts') {+ // try {+ // const fileContents = await fs.promises.readFile(itemPath, 'utf8');+ // // console.log('Parsed ts:', fileContents);+ // } catch (jsonError) {+ // console.error('Error parsing JSON:', jsonError);+ // }+ // }+ // } else {+ // // console.log(`File: ${itemPath} (Extension: ${fileExtension})`);+ // }+ }+ }++ return challengeToCreate;+}++function hyphenatedToPascalCase(input: string): string {+ const words = input.split('-');+ const pascalWords = words.map((word) => word.charAt(0).toUpperCase() + word.slice(1));+ return pascalWords.join(' ');+}diff --git a/packages/db/seed/data/easy/desc.md b/packages/db/seed/data/easy/desc.mddeleted file mode 100644index d89071a7..00000000--- a/packages/db/seed/data/easy/desc.md+++ /dev/null@@ -1,20 +0,0 @@-Implement the built-in `Pick<T, K>` generic without using it.--Constructs a type by picking the set of properties `K` from `T`--For example:--```ts-interface Todo {- title: string;- description: string;- completed: boolean;-}--type TodoPreview = MyPick<Todo, 'title' | 'completed'>;--const todo: TodoPreview = {- title: 'Clean room',- completed: false,-};-```diff --git a/packages/db/seed/data/easy/prompt.md b/packages/db/seed/data/easy/prompt.mddeleted file mode 100644index 228545b4..00000000--- a/packages/db/seed/data/easy/prompt.md+++ /dev/null@@ -1,7 +0,0 @@-// TEST CASE START-Extends<HelloWorld, `Hello, ${string}`>()--Extends<HelloWorld, `${string}!`>()--// CODE START-type HelloWorld = ""diff --git a/packages/db/seed/data/extreme/desc.md b/packages/db/seed/data/extreme/desc.mddeleted file mode 100644index 0ac99951..00000000--- a/packages/db/seed/data/extreme/desc.md+++ /dev/null@@ -1,13 +0,0 @@-Implement a generic `GetReadonlyKeys<T>` that returns a union of the readonly keys of an Object.--For example--```ts-interface Todo {- readonly title: string;- readonly description: string;- completed: boolean;-}--type Keys = GetReadonlyKeys<Todo>; // expected to be "title" | "description"-```diff --git a/packages/db/seed/data/extreme/prompt.md b/packages/db/seed/data/extreme/prompt.mddeleted file mode 100644index 228545b4..00000000--- a/packages/db/seed/data/extreme/prompt.md+++ /dev/null@@ -1,7 +0,0 @@-// TEST CASE START-Extends<HelloWorld, `Hello, ${string}`>()--Extends<HelloWorld, `${string}!`>()--// CODE START-type HelloWorld = ""diff --git a/packages/db/seed/data/hard/desc.md b/packages/db/seed/data/hard/desc.mddeleted file mode 100644index ca9324ff..00000000--- a/packages/db/seed/data/hard/desc.md+++ /dev/null@@ -1,35 +0,0 @@-Implement a simple version of a Vue-like typing support.--By providing a function name `SimpleVue` (similar to `Vue.extend` or `defineComponent`), it should properly infer the `this` type inside computed and methods.--In this challenge, we assume that SimpleVue take an Object with `data`, `computed` and `methods` fields as it's only argument,--- `data` is a simple function that returns an object that exposes the context `this`, but you won't be accessible to other computed values or methods.--- `computed` is an Object of functions that take the context as `this`, doing some calculation and returns the result. The computed results should be exposed to the context as the plain return values instead of functions.--- `methods` is an Object of functions that take the context as `this` as well. Methods can access the fields exposed by `data`, `computed` as well as other `methods`. The different between `computed` is that `methods` exposed as functions as-is.--The type of `SimpleVue's return value can be arbitrary.--```ts-const instance = SimpleVue({- data() {- return {- firstname: 'Type',- lastname: 'Challenges',- amount: 10,- };- },- computed: {- fullname() {- return this.firstname + ' ' + this.lastname;- },- },- methods: {- hi() {- alert(this.fullname.toLowerCase());- },- },-});-```diff --git a/packages/db/seed/data/hard/prompt.md b/packages/db/seed/data/hard/prompt.mddeleted file mode 100644index 228545b4..00000000--- a/packages/db/seed/data/hard/prompt.md+++ /dev/null@@ -1,7 +0,0 @@-// TEST CASE START-Extends<HelloWorld, `Hello, ${string}`>()--Extends<HelloWorld, `${string}!`>()--// CODE START-type HelloWorld = ""diff --git a/packages/db/seed/data/medium/desc.md b/packages/db/seed/data/medium/desc.mddeleted file mode 100644index 20cf4210..00000000--- a/packages/db/seed/data/medium/desc.md+++ /dev/null@@ -1,19 +0,0 @@-Implement the built-in `Omit<T, K>` generic without using it.--Constructs a type by picking the set of properties `K` from `T`--For example:--```ts-interface Todo {- title: string;- description: string;- completed: boolean;-}--type TodoPreview = MyOmit<Todo, 'description' | 'title'>;--const todo: TodoPreview = {- completed: false,-};-```diff --git a/packages/db/seed/data/medium/prompt.md b/packages/db/seed/data/medium/prompt.mddeleted file mode 100644index 228545b4..00000000--- a/packages/db/seed/data/medium/prompt.md+++ /dev/null@@ -1,7 +0,0 @@-// TEST CASE START-Extends<HelloWorld, `Hello, ${string}`>()--Extends<HelloWorld, `${string}!`>()--// CODE START-type HelloWorld = ""diff --git a/packages/db/seed/index.ts b/packages/db/seed/index.tsdeleted file mode 100644index bf4ff879..00000000--- a/packages/db/seed/index.ts+++ /dev/null@@ -1,155 +0,0 @@-import { faker } from '@faker-js/faker';-import { PrismaClient, type Challenge, type Prisma } from '@prisma/client';-import uuidByString from 'uuid-by-string';-import { loadChallengesFromTypeChallenge } from '../mocks/challenges.mock';-import CommentMock from '../mocks/comment.mock';-import UserMock from '../mocks/user.mock';--const prisma = new PrismaClient();--export const slugify = (str: string) => str.toLowerCase().replace(/\s/g, '-');-const usersToBeMade = Array.from({ length: 15 }, () => UserMock());-const alotOfSharedSolutions = (challengeId: number) =>- Array.from({ length: 50 }, () => ({- challengeId,- title: faker.lorem.words(7),- description: faker.lorem.words({ min: 5, max: 25 }),- }));--await prisma.user.createMany({- data: usersToBeMade,-});--// Load the challenges.-const data = await loadChallengesFromTypeChallenge();-const users = await prisma.user- .findMany({- select: {- id: true,- },- })- .then((r) => r.map((u) => u.id));--await prisma.challenge.createMany({- data: data.map((challenge) => ({- ...challenge,- userId: faker.helpers.arrayElement(users),- })),-});--export const trashId = uuidByString('trash');-export const gId = uuidByString('g');--const tracks = [- {- name: 'Crafting TypeScript Utility Types',- description:- "This collection guides you through hands-on exercises to recreate Typescript's built-in utility types.",- },- {- name: 'Typescript Wizardry',- description:- "Dive into the elite realm of TypeScript mastery with our 'Pro-Level TypeScript Challenges.' Designed for seasoned professionals, this collection offers a formidable gauntlet of intricate exercises, pushing the boundaries of your TypeScript expertise to the limit.",- },- {- name: 'Javascript Built in Methods',- description:- "This collection of challenges equips you to develop and enhance standard JavaScript methods, all while harnessing TypeScript's advanced type system to achieve a fully typesafe developer experience.",- },- {- name: 'Understanding Typescript Syntax',- description:- 'A collection of challenging exercises that dive into type annotations, generics, and more to level up your typescript abilities.',- },- {- name: 'Typescript Foundations',- description:- "'Typescript Foundations' is a curated set of challenges designed to build a strong foundation. From basic syntax to advanced concepts, this collection offers hands-on exercises to help you become a TypeScript Hero.",- },-];--for (const [index, track] of tracks.entries()) {- const challenges = await getRandomChallenges(index);-- const createdTrack = await prisma.track.create({- data: {- name: track.name,- slug: slugify(track.name),- description: track.description,- visible: true,- },- });-- await prisma.trackChallenge.createMany({- data: challenges.map((challenge, index) => ({- challengeId: challenge.id,- trackId: createdTrack.id,- orderId: index,- })),- });-}--try {- const someChallenge = await prisma.challenge.findFirst({- where: {- status: 'ACTIVE',- },- });-- await prisma.user.upsert({- where: { id: trashId },- update: {},- create: {- id: trashId,- email: '[email protected]',- name: 'chris',- sharedSolution: {- create: alotOfSharedSolutions(someChallenge?.id ?? 2),- },- },- });-- let commentNum = 0;- const comments = Array.from({ length: 50 }, () => CommentMock(++commentNum));-- const replies: Prisma.CommentCreateManyInput[] = [];-- const { comment: createdComments } = await prisma.challenge.update({- where: { id: someChallenge?.id },- include: {- comment: true,- },- data: {- comment: {- create: comments,- },- },- });-- for (const comment of createdComments) {- replies.push(CommentMock(++commentNum, comment.id), CommentMock(++commentNum, comment.id));- }-- await prisma.challenge.update({- where: { id: someChallenge?.id },- data: {- comment: {- create: replies,- },- },- });-- await prisma.$disconnect();-} catch (e) {- console.error(e);- await prisma.$disconnect();- process.exit(1);-}--async function getRandomChallenges(iteration: number): Promise<Challenge[]> {- const challenges = await prisma.challenge.findMany({- take: 10,- skip: 10 * iteration,- });- return challenges;-}diff --git a/packages/db/seed/prod.ts b/packages/db/seed/prod.tsindex 186447c9..d732efa7 100644--- a/packages/db/seed/prod.ts+++ b/packages/db/seed/prod.ts@@ -1,8 +1,13 @@-import { PrismaClient } from '@prisma/client';+import path from 'node:path';+import { fileURLToPath } from 'node:url';import uuidByString from 'uuid-by-string';-import { loadChallengesFromTypeChallenge } from '../mocks/challenges.mock';+import { prisma } from '../src';+import { ingestChallenges } from './data/challenge-ingest';-const prisma = new PrismaClient();+const __filename = fileURLToPath(import.meta.url);+const __dirname = path.dirname(__filename);++const challengePath = path.join(__dirname, '../../../challenges');export const slugify = (str: string) => str.toLowerCase().replace(/\s/g, '-');const TYPE_CHALLENGE_ID = uuidByString('type-challenges');@@ -23,13 +28,9 @@ try {},});- const data = await loadChallengesFromTypeChallenge();-+ const challengesToCreate = await ingestChallenges(challengePath);await prisma.challenge.createMany({- data: data.map((challenge) => ({- ...challenge,- userId: typeChallengeUser.id,- })),+ data: challengesToCreate.map((challenge) => ({ ...challenge, userId: typeChallengeUser.id })),});await prisma.$disconnect();diff --git a/packages/db/turbo.json b/packages/db/turbo.jsonindex 4312e3c8..79ef807c 100644--- a/packages/db/turbo.json+++ b/packages/db/turbo.json@@ -18,6 +18,10 @@"dependsOn": ["db:push"],"cache": false},+ "db:prod:seed": {+ "dependsOn": ["db:push"],+ "cache": false+ },"db:studio": {"cache": false}diff --git a/packages/monaco/src/index.tsx b/packages/monaco/src/index.tsxindex e39a8533..aecb9ae4 100644--- a/packages/monaco/src/index.tsx+++ b/packages/monaco/src/index.tsx@@ -8,7 +8,7 @@ import { CheckCircle2, ChevronUp, XCircle } from '@repo/ui/icons';import clsx from 'clsx';import lzstring from 'lz-string';import type * as monaco from 'monaco-editor';-import { usePathname, useRouter, useSearchParams } from 'next/navigation';+import { usePathname, useSearchParams } from 'next/navigation';import React, { useState } from 'react';import { useResetEditor } from './editor-hooks';import { PrettierFormatProvider } from './prettier';@@ -37,9 +37,7 @@ export type TsErrors = [];export function CodePanel(props: CodePanelProps) {- console.log({ slug: props.challenge.slug });const params = useSearchParams();- const router = useRouter();const pathname = usePathname();const isPlayground = pathname.includes('playground');const { toast } = useToast();