Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

progress

Chris Bautistae3c50fe203cc
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index 755228f3..1c456094 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -36,6 +36,7 @@ const config = {
},
],
'@typescript-eslint/no-empty-interface': 'off',
+ '@typescript-eslint/ban-ts-comment': 'off',
},
};
diff --git a/package.json b/package.json
index bb006f4d..60008f2c 100644
--- a/package.json
+++ b/package.json
@@ -45,6 +45,8 @@
"react-dom": "18.2.0",
"react-hook-form": "^7.45.0",
"react-markdown": "^8.0.7",
+ "react-syntax-highlighter": "^15.5.0",
+ "remark-gfm": "^3.0.1",
"superjson": "1.12.2",
"tailwind-merge": "^1.12.0",
"tailwindcss-animate": "^1.0.5",
@@ -60,6 +62,7 @@
"@types/prettier": "^2.7.2",
"@types/react": "^18.2.8",
"@types/react-dom": "^18.2.4",
+ "@types/react-syntax-highlighter": "^15.5.7",
"@typescript-eslint/eslint-plugin": "^5.59.6",
"@typescript-eslint/parser": "^5.59.6",
"autoprefixer": "^10.4.14",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 629764de..17060c7b 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -100,6 +100,12 @@ dependencies:
react-markdown:
specifier: ^8.0.7
version: 8.0.7(@types/[email protected])([email protected])
+ react-syntax-highlighter:
+ specifier: ^15.5.0
+ version: 15.5.0([email protected])
+ remark-gfm:
+ specifier: ^3.0.1
+ version: 3.0.1
superjson:
specifier: 1.12.2
version: 1.12.2
@@ -141,6 +147,9 @@ devDependencies:
'@types/react-dom':
specifier: ^18.2.4
version: 18.2.4
+ '@types/react-syntax-highlighter':
+ specifier: ^15.5.7
+ version: 15.5.7
'@typescript-eslint/eslint-plugin':
specifier: ^5.59.6
version: 5.59.6(@typescript-eslint/[email protected])([email protected])([email protected])
@@ -1779,6 +1788,12 @@ packages:
dependencies:
'@types/react': 18.2.8
+ resolution: {integrity: sha512-bo5fEO5toQeyCp0zVHBeggclqf5SQ/Z5blfFmjwO5dkMVGPgmiwZsJh9nu/Bo5L7IHTuGWrja6LxJVE2uB5ZrQ==}
+ dependencies:
+ '@types/react': 18.2.8
+ dev: true
+
resolution: {integrity: sha512-lTyWUNrd8ntVkqycEEplasWy2OxNlShj3zqS0LuB1ENUGis5HodmhM7DtCoUGbxj3VW/WsGA0DUhpG6XrM7gPA==}
dependencies:
@@ -2205,6 +2220,10 @@ packages:
resolution: {integrity: sha512-I4/duVK4wL6rAK/aKZl3HXB4g+lIZvaT4VLAn2rCgJ38jVLb0lv2Xug6QuqmxXFVRJMF74SPPWPJ/1Sdm3vCzw==}
+ resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}
+ dev: false
+
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
engines: {node: '>=10'}
@@ -2213,10 +2232,22 @@ packages:
supports-color: 7.2.0
dev: true
+ resolution: {integrity: sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==}
+ dev: false
+
+ resolution: {integrity: sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==}
+ dev: false
+
resolution: {integrity: sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==}
dev: false
+ resolution: {integrity: sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==}
+ dev: false
+
resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==}
engines: {node: '>= 8.10.0'}
@@ -2269,6 +2300,10 @@ packages:
delayed-stream: 1.0.0
dev: false
+ resolution: {integrity: sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw==}
+ dev: false
+
resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==}
dev: false
@@ -2595,6 +2630,11 @@ packages:
engines: {node: '>=10'}
dev: true
+ resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==}
+ engines: {node: '>=12'}
+ dev: false
+
resolution: {integrity: sha512-zjLJ9B9bbeWSo5q+iHfdt8gVYyT+y2BpWDfjR6XMBtFRSMKRGjllDKxnuKBV1q2Y/QpwLM2PXHJTMRyblCmRAg==}
peerDependencies:
@@ -2944,6 +2984,12 @@ packages:
dependencies:
reusify: 1.0.4
+ resolution: {integrity: sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==}
+ dependencies:
+ format: 0.2.2
+ dev: false
+
resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==}
engines: {node: ^10.12.0 || >=12.0.0}
@@ -2992,6 +3038,11 @@ packages:
mime-types: 2.1.35
dev: false
+ resolution: {integrity: sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==}
+ engines: {node: '>=0.4.x'}
+ dev: false
+
resolution: {integrity: sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==}
dev: true
@@ -3193,10 +3244,28 @@ packages:
dependencies:
function-bind: 1.1.1
+ resolution: {integrity: sha512-7j6mrk/qqkSehsM92wQjdIgWM2/BW61u/53G6xmC8i1OmEdKLHbk419QKQUjz6LglWsfqoiHmyMRkP1BGjecNQ==}
+ dev: false
+
resolution: {integrity: sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==}
dev: false
+ resolution: {integrity: sha512-nDM6bvd7lIqDUiYEiu5Sl/+6ReP0BMk/2f4U/Rooccxkj0P5nm+acM5PrGJ/t5I8qPGiqZSE6hVAwZEdZIvP4w==}
+ dependencies:
+ '@types/hast': 2.3.4
+ comma-separated-tokens: 1.0.8
+ hast-util-parse-selector: 2.2.5
+ property-information: 5.6.0
+ space-separated-tokens: 1.1.5
+ dev: false
+
+ resolution: {integrity: sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==}
+ dev: false
+
resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==}
engines: {node: '>=10.17.0'}
@@ -3253,6 +3322,17 @@ packages:
loose-envify: 1.4.0
dev: false
+ resolution: {integrity: sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==}
+ dev: false
+
+ resolution: {integrity: sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==}
+ dependencies:
+ is-alphabetical: 1.0.4
+ is-decimal: 1.0.4
+ dev: false
+
resolution: {integrity: sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==}
engines: {node: '>= 0.4'}
@@ -3311,6 +3391,10 @@ packages:
has-tostringtag: 1.0.0
dev: true
+ resolution: {integrity: sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==}
+ dev: false
+
resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==}
engines: {node: '>=8'}
@@ -3333,6 +3417,10 @@ packages:
dependencies:
is-extglob: 2.1.1
+ resolution: {integrity: sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==}
+ dev: false
+
resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==}
engines: {node: '>=14.16'}
@@ -3572,6 +3660,10 @@ packages:
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
dev: false
+ resolution: {integrity: sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==}
+ dev: false
+
resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==}
hasBin: true
@@ -3584,6 +3676,13 @@ packages:
tslib: 2.5.3
dev: false
+ resolution: {integrity: sha512-8Ktj+prEb1RoCPkEOrPMYUN/nCggB7qAWe3a7OpMjWQkh3l2RD5wKRQ+o8Q8YuI9RG/xs95waaI/E6ym/7NsTw==}
+ dependencies:
+ fault: 1.0.4
+ highlight.js: 10.7.3
+ dev: false
+
resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==}
engines: {node: '>=10'}
@@ -3603,6 +3702,10 @@ packages:
engines: {node: '>=8'}
dev: false
+ resolution: {integrity: sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==}
+ dev: false
+
resolution: {integrity: sha512-8SVPMuHqlPME/z3gqVwWY4zVXn8lqKv/pAhC57FuJ40ImXyBpmO5ukh98zB2v7Blql2FiHjHv9LVztSIqjY+MA==}
dependencies:
@@ -3611,6 +3714,15 @@ packages:
unist-util-visit: 4.1.2
dev: false
+ resolution: {integrity: sha512-MTtdFRz/eMDHXzeK6W3dO7mXUlF82Gom4y0oOgvHhh/HXZAGvIQDUvQ0SuUx+j2tv44b8xTHOm8K/9OoRFnXKw==}
+ dependencies:
+ '@types/mdast': 3.0.11
+ escape-string-regexp: 5.0.0
+ unist-util-is: 5.2.1
+ unist-util-visit-parents: 5.1.3
+ dev: false
+
resolution: {integrity: sha512-4xTO/M8c82qBcnQc1tgpNtubGUW/Y1tBQ1B0i5CtSoelOLKFYlElIr3bvgREYYO5iRqbMY1YuqZng0GVOI8Qww==}
dependencies:
@@ -3630,6 +3742,69 @@ packages:
- supports-color
dev: false
+ resolution: {integrity: sha512-My8KJ57FYEy2W2LyNom4n3E7hKTuQk/0SES0u16tjA9Z3oFkF4RrC/hPAPgjlSpezsOvI8ObcXcElo92wn5IGA==}
+ dependencies:
+ '@types/mdast': 3.0.11
+ ccount: 2.0.1
+ mdast-util-find-and-replace: 2.2.2
+ micromark-util-character: 1.2.0
+ dev: false
+
+ resolution: {integrity: sha512-56D19KOGbE00uKVj3sgIykpwKL179QsVFwx/DCW0u/0+URsryacI4MAdNJl0dh+u2PSsD9FtxPFbHCzJ78qJFQ==}
+ dependencies:
+ '@types/mdast': 3.0.11
+ mdast-util-to-markdown: 1.5.0
+ micromark-util-normalize-identifier: 1.1.0
+ dev: false
+
+ resolution: {integrity: sha512-DAPhYzTYrRcXdMjUtUjKvW9z/FNAMTdU0ORyMcbmkwYNbKocDpdk+PX1L1dQgOID/+vVs1uBQ7ElrBQfZ0cuiQ==}
+ dependencies:
+ '@types/mdast': 3.0.11
+ mdast-util-to-markdown: 1.5.0
+ dev: false
+
+ resolution: {integrity: sha512-jjcpmNnQvrmN5Vx7y7lEc2iIOEytYv7rTvu+MeyAsSHTASGCCRA79Igg2uKssgOs1i1po8s3plW0sTu1wkkLGg==}
+ dependencies:
+ '@types/mdast': 3.0.11
+ markdown-table: 3.0.3
+ mdast-util-from-markdown: 1.3.1
+ mdast-util-to-markdown: 1.5.0
+ transitivePeerDependencies:
+ - supports-color
+ dev: false
+
+ resolution: {integrity: sha512-PFTA1gzfp1B1UaiJVyhJZA1rm0+Tzn690frc/L8vNX1Jop4STZgOE6bxUhnzdVSB+vm2GU1tIsuQcA9bxTQpMQ==}
+ dependencies:
+ '@types/mdast': 3.0.11
+ mdast-util-to-markdown: 1.5.0
+ dev: false
+
+ resolution: {integrity: sha512-qvZ608nBppZ4icQlhQQIAdc6S3Ffj9RGmzwUKUWuEICFnd1LVkN3EktF7ZHAgfcEdvZB5owU9tQgt99e2TlLjg==}
+ dependencies:
+ mdast-util-from-markdown: 1.3.1
+ mdast-util-gfm-autolink-literal: 1.0.3
+ mdast-util-gfm-footnote: 1.0.2
+ mdast-util-gfm-strikethrough: 1.0.3
+ mdast-util-gfm-table: 1.0.7
+ mdast-util-gfm-task-list-item: 1.0.2
+ mdast-util-to-markdown: 1.5.0
+ transitivePeerDependencies:
+ - supports-color
+ dev: false
+
+ resolution: {integrity: sha512-WmI1gTXUBJo4/ZmSk79Wcb2HcjPJBzM1nlI/OUWA8yk2X9ik3ffNbBGsU+09BFmXaL1IBb9fiuvq6/KMiNycSg==}
+ dependencies:
+ '@types/mdast': 3.0.11
+ unist-util-is: 5.2.1
+ dev: false
+
resolution: {integrity: sha512-pits93r8PhnIoU4Vy9bjW39M2jJ6/tdHyja9rrot9uujkN7UTU9SDnE6WNJz/IGyQk3XHX6yNNtrBH6cQzm8Hw==}
dependencies:
@@ -3643,6 +3818,19 @@ packages:
unist-util-visit: 4.1.2
dev: false
+ resolution: {integrity: sha512-bbv7TPv/WC49thZPg3jXuqzuvI45IL2EVAr/KxF0BSdHsU0ceFHOmwQn6evxAh1GaoK/6GQ1wp4R4oW2+LFL/A==}
+ dependencies:
+ '@types/mdast': 3.0.11
+ '@types/unist': 2.0.6
+ longest-streak: 3.1.0
+ mdast-util-phrasing: 3.0.1
+ mdast-util-to-string: 3.2.0
+ micromark-util-decode-string: 1.1.0
+ unist-util-visit: 4.1.2
+ zwitch: 2.0.4
+ dev: false
+
resolution: {integrity: sha512-V4Zn/ncyN1QNSqSBxTrMOLpjr+IKdHl2v3KVLoWmDPscP4r9GcCi71gjgvUV1SFSKh92AjAG4peFuBl2/YgCJg==}
dependencies:
@@ -3678,6 +3866,78 @@ packages:
uvu: 0.5.6
dev: false
+ resolution: {integrity: sha512-z3wJSLrDf8kRDOh2qBtoTRD53vJ+CWIyo7uyZuxf/JAbNJjiHsOpG1y5wxk8drtv3ETAHutCu6N3thkOOgueWg==}
+ dependencies:
+ micromark-util-character: 1.2.0
+ micromark-util-sanitize-uri: 1.2.0
+ micromark-util-symbol: 1.1.0
+ micromark-util-types: 1.1.0
+ dev: false
+
+ resolution: {integrity: sha512-Yxn7z7SxgyGWRNa4wzf8AhYYWNrwl5q1Z8ii+CSTTIqVkmGZF1CElX2JI8g5yGoM3GAman9/PVCUFUSJ0kB/8Q==}
+ dependencies:
+ micromark-core-commonmark: 1.1.0
+ micromark-factory-space: 1.1.0
+ micromark-util-character: 1.2.0
+ micromark-util-normalize-identifier: 1.1.0
+ micromark-util-sanitize-uri: 1.2.0
+ micromark-util-symbol: 1.1.0
+ micromark-util-types: 1.1.0
+ uvu: 0.5.6
+ dev: false
+
+ resolution: {integrity: sha512-sX0FawVE1o3abGk3vRjOH50L5TTLr3b5XMqnP9YDRb34M0v5OoZhG+OHFz1OffZ9dlwgpTBKaT4XW/AsUVnSDw==}
+ dependencies:
+ micromark-util-chunked: 1.1.0
+ micromark-util-classify-character: 1.1.0
+ micromark-util-resolve-all: 1.1.0
+ micromark-util-symbol: 1.1.0
+ micromark-util-types: 1.1.0
+ uvu: 0.5.6
+ dev: false
+
+ resolution: {integrity: sha512-3ZORTHtcSnMQEKtAOsBQ9/oHp9096pI/UvdPtN7ehKvrmZZ2+bbWhi0ln+I9drmwXMt5boocn6OlwQzNXeVeqw==}
+ dependencies:
+ micromark-factory-space: 1.1.0
+ micromark-util-character: 1.2.0
+ micromark-util-symbol: 1.1.0
+ micromark-util-types: 1.1.0
+ uvu: 0.5.6
+ dev: false
+
+ resolution: {integrity: sha512-5XWB9GbAUSHTn8VPU8/1DBXMuKYT5uOgEjJb8gN3mW0PNW5OPHpSdojoqf+iq1xo7vWzw/P8bAHY0n6ijpXF7g==}
+ dependencies:
+ micromark-util-types: 1.1.0
+ dev: false
+
+ resolution: {integrity: sha512-RMFXl2uQ0pNQy6Lun2YBYT9g9INXtWJULgbt01D/x8/6yJ2qpKyzdZD3pi6UIkzF++Da49xAelVKUeUMqd5eIQ==}
+ dependencies:
+ micromark-factory-space: 1.1.0
+ micromark-util-character: 1.2.0
+ micromark-util-symbol: 1.1.0
+ micromark-util-types: 1.1.0
+ uvu: 0.5.6
+ dev: false
+
+ resolution: {integrity: sha512-vb9OoHqrhCmbRidQv/2+Bc6pkP0FrtlhurxZofvOEy5o8RtuuvTq+RQ1Vw5ZDNrVraQZu3HixESqbG+0iKk/MQ==}
+ dependencies:
+ micromark-extension-gfm-autolink-literal: 1.0.5
+ micromark-extension-gfm-footnote: 1.1.2
+ micromark-extension-gfm-strikethrough: 1.0.7
+ micromark-extension-gfm-table: 1.0.7
+ micromark-extension-gfm-tagfilter: 1.0.2
+ micromark-extension-gfm-task-list-item: 1.0.5
+ micromark-util-combine-extensions: 1.1.0
+ micromark-util-types: 1.1.0
+ dev: false
+
resolution: {integrity: sha512-XaNDROBgx9SgSChd69pjiGKbV+nfHGDPVYFs5dOoDd7ZnMAE+Cuu91BCpsY8RT2NP9vo/B8pds2VQNCLiu0zhg==}
dependencies:
@@ -4187,6 +4447,17 @@ packages:
callsites: 3.1.0
dev: true
+ resolution: {integrity: sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==}
+ dependencies:
+ character-entities: 1.2.4
+ character-entities-legacy: 1.1.4
+ character-reference-invalid: 1.1.4
+ is-alphanumerical: 1.0.4
+ is-decimal: 1.0.4
+ is-hexadecimal: 1.0.4
+ dev: false
+
resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}
engines: {node: '>=8'}
@@ -4401,6 +4672,16 @@ packages:
dependencies:
'@prisma/engines': 4.14.0
+ resolution: {integrity: sha512-t13BGPUlFDR7wRB5kQDG4jjl7XeuH6jbJGt11JHPL96qwsEHNX2+68tFXqc1/k+/jALsbSWJKUOT/hcYAZ5LkA==}
+ engines: {node: '>=6'}
+ dev: false
+
+ resolution: {integrity: sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==}
+ engines: {node: '>=6'}
+ dev: false
+
resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==}
dependencies:
@@ -4408,6 +4689,12 @@ packages:
object-assign: 4.1.1
react-is: 16.13.1
+ resolution: {integrity: sha512-YUHSPk+A30YPv+0Qf8i9Mbfe/C0hdPXk1s1jPVToV8pk8BQtpw10ct89Eo7OWkutrwqvT0eicAxlOg3dOAu8JA==}
+ dependencies:
+ xtend: 4.0.2
+ dev: false
+
resolution: {integrity: sha512-kma4U7AFCTwpqq5twzC1YVIDXSqg6qQK6JN0smOw8fgRy1OkMi0CYSzFmsy6dnqSenamAtj0CyXMUJ1Mf6oROg==}
dev: false
@@ -4553,6 +4840,19 @@ packages:
tslib: 2.5.3
dev: false
+ resolution: {integrity: sha512-+zq2myprEnQmH5yw6Gqc8lD55QHnpKaU8TOcFeC/Lg/MQSs8UknEA0JC4nTZGFAXC2J2Hyj/ijJ7NlabyPi2gg==}
+ peerDependencies:
+ react: '>= 0.14.0'
+ dependencies:
+ '@babel/runtime': 7.22.5
+ highlight.js: 10.7.3
+ lowlight: 1.20.0
+ prismjs: 1.29.0
+ react: 18.2.0
+ refractor: 3.6.0
+ dev: false
+
resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==}
engines: {node: '>=0.10.0'}
@@ -4571,6 +4871,14 @@ packages:
dependencies:
picomatch: 2.3.1
+ resolution: {integrity: sha512-MY9W41IOWxxk31o+YvFCNyNzdkc9M20NoZK5vq6jkv4I/uh2zkWcfudj0Q1fovjUQJrNewS9NMzeTtqPf+n5EA==}
+ dependencies:
+ hastscript: 6.0.0
+ parse-entities: 2.0.0
+ prismjs: 1.27.0
+ dev: false
+
resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==}
@@ -4583,6 +4891,17 @@ packages:
functions-have-names: 1.2.3
dev: true
+ resolution: {integrity: sha512-lEFDoi2PICJyNrACFOfDD3JlLkuSbOa5Wd8EPt06HUdptv8Gn0bxYTdbU/XXQ3swAPkEaGxxPN9cbnMHvVu1Ig==}
+ dependencies:
+ '@types/mdast': 3.0.11
+ mdast-util-gfm: 2.0.2
+ micromark-extension-gfm: 2.0.3
+ unified: 10.1.2
+ transitivePeerDependencies:
+ - supports-color
+ dev: false
+
resolution: {integrity: sha512-3ydxgHa/ZQzG8LvC7jTXccARYDcRld3VfcgIIFs7bI6vbRSxJJmzgLEIIoYKyrfhaY+ujuWaf/PJiMZXoiCXgw==}
dependencies:
@@ -4759,6 +5078,10 @@ packages:
engines: {node: '>=0.10.0'}
dev: true
+ resolution: {integrity: sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA==}
+ dev: false
+
resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==}
dev: false
@@ -5307,6 +5630,11 @@ packages:
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
+ resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==}
+ engines: {node: '>=0.4'}
+ dev: false
+
resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
@@ -5338,3 +5666,7 @@ packages:
react: 18.2.0
use-sync-external-store: 1.2.0([email protected])
dev: false
+
+ resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
+ dev: false
diff --git a/prisma/challenges.mock.ts b/prisma/challenges.mock.ts
new file mode 100644
index 00000000..c9881d80
--- /dev/null
+++ b/prisma/challenges.mock.ts
@@ -0,0 +1,198 @@
+import type { Difficulty, Prisma } from '@prisma/client';
+import { gId, trashId } from './seed';
+function randomTrueOrFalse() {
+ return Math.random() > 0.5;
+}
+export const CHALLENGE_MAP: Record<
+ Difficulty,
+ (v: number) => Prisma.ChallengeCreateWithoutUserInput
+> = {
+ BEGINNER: (challengeIndex: number) => ({
+ name: `Beginner Challenge ${challengeIndex + 1}`,
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ Bookmark: randomTrueOrFalse()
+ ? {
+ create: {
+ userId: randomTrueOrFalse() ? trashId : gId,
+ },
+ }
+ : undefined,
+ description: `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,
+}
+\`\`\`
+ `,
+ prompt: `/* _____________ Test Cases _____________ */
+Extends<HelloWorld, \`Hello, \${string}\`>()
+
+Extends<HelloWorld, \`\${string}!\`>()
+
+/* _____________ Your Code Here _____________ */
+type HelloWorld =`,
+ difficulty: 'BEGINNER',
+ }),
+
+ EASY: (challengeIndex: number) => ({
+ name: `Easy Challenge ${challengeIndex + 1}`,
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ description: `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,
+}
+\`\`\`
+ `,
+ prompt: `/* _____________ Test Cases _____________ */
+Extends<HelloWorld, \`Hello, \${string}\`>()
+
+Extends<HelloWorld, \`\${string}!\`>()
+
+/* _____________ Your Code Here _____________ */
+type HelloWorld =`,
+ difficulty: 'EASY',
+ }),
+ MEDIUM: (challengeIndex: number) => ({
+ name: `Medium Challenge ${challengeIndex + 1}`,
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ description: `
+ 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,
+}
+\`\`\`
+ `,
+ prompt: `/* _____________ Test Cases _____________ */
+Extends<HelloWorld, \`Hello, \${string}\`>()
+
+Extends<HelloWorld, \`\${string}!\`>()
+
+/* _____________ Your Code Here _____________ */
+type HelloWorld =`,
+ difficulty: 'MEDIUM',
+ }),
+ HARD: (challengeIndex: number) => ({
+ name: `Hard Challenge ${challengeIndex + 1}`,
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ description: `
+ Implement a simpiled 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())
+ }
+ }
+})
+\`\`\`
+`,
+ prompt: `/* _____________ Test Cases _____________ */
+Extends<HelloWorld, \`Hello, \${string}\`>()
+
+Extends<HelloWorld, \`\${string}!\`>()
+
+/* _____________ Your Code Here _____________ */
+type HelloWorld =`,
+ difficulty: 'HARD',
+ }),
+ EXTREME: (challengeIndex: number) => ({
+ name: `Extreme Challenge ${challengeIndex + 1}`,
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ description: `
+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"
+\`\`\`
+`,
+ prompt: `/* _____________ Test Cases _____________ */
+Extends<HelloWorld, \`Hello, \${string}\`>()
+
+Extends<HelloWorld, \`\${string}!\`>()
+
+/* _____________ Your Code Here _____________ */
+type HelloWorld =`,
+ difficulty: 'EXTREME',
+ }),
+};
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index a58b5236..37393569 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -76,6 +76,7 @@ model User {
Solution Solution[]
Comment Comment[]
Report Report[]
+ Bookmark Bookmark[]
}
model VerificationToken {
@@ -92,14 +93,15 @@ model Challenge {
updatedAt DateTime @updatedAt
difficulty Difficulty
name String
- description String
- prompt String
+ description Json
+ prompt Json
user User @relation(fields: [userId], references: [id])
userId String
Vote Vote[]
Solution Solution[]
Comment Comment[]
Report Report[]
+ Bookmark Bookmark[]
@@index([userId])
}
@@ -154,3 +156,14 @@ model Report {
@@index([userId])
@@index([challengeId])
}
+
+model Bookmark {
+ id Int @id @default(autoincrement())
+ user User @relation(fields: [userId], references: [id])
+ userId String
+ challenge Challenge? @relation(fields: [challengeId], references: [id])
+ challengeId Int?
+
+ @@index([userId])
+ @@index([challengeId])
+}
diff --git a/prisma/seed.ts b/prisma/seed.ts
index da588916..c4d29498 100644
--- a/prisma/seed.ts
+++ b/prisma/seed.ts
@@ -1,5 +1,6 @@
-import { Difficulty, Prisma, PrismaClient } from '@prisma/client';
+import { type Difficulty, type Prisma, PrismaClient } from '@prisma/client';
import uuidByString from 'uuid-by-string';
+import { CHALLENGE_MAP } from './challenges.mock';
const prisma = new PrismaClient();
const CHALLENGES_TO_CREATE = 50;
@@ -8,29 +9,15 @@ const randomDifficulty = (): Difficulty => {
return DIFFICULTIES[Math.floor(Math.random() * DIFFICULTIES.length)] as Difficulty;
};
-const challenges = (who: string): Prisma.ChallengeCreateNestedManyWithoutUserInput => ({
- create: Array.from({ length: CHALLENGES_TO_CREATE }, (_, challengeIndex) => ({
- name: `Challenge ${challengeIndex + 1}`,
- createdAt: new Date(),
- updatedAt: new Date(),
- description: `### ${who} is a cool guy
- - he likes to eat ${who}
- - he likes to sleep in ${who}
- - he likes to be ${who}
- `,
- prompt: `/* _____________ Test Cases _____________ */
-Extends<HelloWorld, \`Hello, \${string}\`>()
-
-Extends<HelloWorld, \`\${string}!\`>()
-
-/* _____________ Your Code Here _____________ */
-type HelloWorld =`,
- difficulty: randomDifficulty(),
- })),
+const challenges = (): Prisma.ChallengeCreateNestedManyWithoutUserInput => ({
+ create: Array.from({ length: CHALLENGES_TO_CREATE }, (_, challengeIndex) =>
+ CHALLENGE_MAP[randomDifficulty()](challengeIndex),
+ ),
});
+export const trashId = uuidByString('trash');
+export const gId = uuidByString('g');
async function main() {
- const trashId = uuidByString('trash');
await prisma.user.upsert({
where: { id: trashId },
update: {},
@@ -38,10 +25,9 @@ async function main() {
id: trashId,
name: 'chris',
- Challenge: challenges('trash'),
+ Challenge: challenges(),
},
});
- const gId = uuidByString('g');
await prisma.user.upsert({
where: { id: gId },
update: {},
@@ -49,7 +35,7 @@ async function main() {
id: gId,
name: 'g',
- Challenge: challenges('g'),
+ Challenge: challenges(),
},
});
}
diff --git a/src/components/challenge/description-panel.tsx b/src/components/challenge/description-panel.tsx
index 17d7669b..5de9accc 100644
--- a/src/components/challenge/description-panel.tsx
+++ b/src/components/challenge/description-panel.tsx
@@ -2,13 +2,19 @@
import type { Challenge, Vote } from '@prisma/client';
import { clsx } from 'clsx';
+import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism';
+import remarkGfm from 'remark-gfm';
+import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
import { debounce } from 'lodash';
-import { ArrowBigUp } from 'lucide-react';
+import { Bookmark, Share, ThumbsUp } from 'lucide-react';
import { useSession } from 'next-auth/react';
import { useRef, useState } from 'react';
import ReactMarkdown from 'react-markdown';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../ui/tabs';
import { incrementOrDecrementUpvote } from './increment.action';
+import { TypographyH3 } from '../ui/typography/h3';
+import { DifficultyBadge } from '../explore/difficulty-badge';
+import { Button } from '../ui/button';
interface Props {
challenge: Challenge & {
@@ -39,11 +45,14 @@ export function DescriptionPanel({ challenge }: Props) {
<TabsTrigger value="solutions">Solutions</TabsTrigger>
</TabsList>
<TabsContent value="description" className="mt-0">
- <div className="flex h-full">
- <div className="p-t-[2px] flex w-[30px] items-start justify-center">
+ <div className="h-full p-5">
+ <TypographyH3 className="mb-2 font-medium">{challenge.name}</TypographyH3>
+ <div className="mb-6 flex items-center gap-6">
+ <DifficultyBadge difficulty={challenge.difficulty} />
{session?.data?.user?.id && (
- <button
- className=""
+ <Button
+ className="gap-2 p-1"
+ variant="ghost"
onClick={(): void => {
let shouldIncrement: boolean;
if (hasVoted) {
@@ -62,13 +71,47 @@ export function DescriptionPanel({ challenge }: Props) {
);
}}
>
- <ArrowBigUp className={clsx({ 'fill-red-500': hasVoted })} />
- {votes}
- </button>
+ <ThumbsUp
+ size={20}
+ className={clsx({
+ 'fill-green-700 stroke-green-700': hasVoted,
+ 'stroke-gray-500': !hasVoted,
+ })}
+ />
+ <span className="self-end text-lg text-gray-500">{votes}</span>
+ </Button>
)}
+ <Bookmark className="stroke-gray-500" />
+ <Share className="stroke-gray-500" />
</div>
<div className="prose-invert prose-h3:text-xl">
- <ReactMarkdown>{challenge.description}</ReactMarkdown>
+ {/* @ts-ignore */}
+ <ReactMarkdown
+ remarkPlugins={[remarkGfm]}
+ components={{
+ p: ({ ...props }) => <p className="mb-4" {...props} />,
+ code({ inline, className, children, ...props }) {
+ const match = /language-(\w+)/.exec(className || '');
+ return !inline && match ? (
+ <SyntaxHighlighter
+ // @ts-ignore
+ style={vscDarkPlus} // theme
+ language={match[1]}
+ PreTag="section" // parent tag
+ {...props}
+ >
+ {String(children).replace(/\n$/, '')}
+ </SyntaxHighlighter>
+ ) : (
+ <code className={className} {...props}>
+ {children}
+ </code>
+ );
+ },
+ }}
+ >
+ {challenge.description}
+ </ReactMarkdown>
</div>
</div>
</TabsContent>
diff --git a/src/components/explore/difficulty-badge.tsx b/src/components/explore/difficulty-badge.tsx
index ce869db8..b021f5fd 100644
--- a/src/components/explore/difficulty-badge.tsx
+++ b/src/components/explore/difficulty-badge.tsx
@@ -1,20 +1,21 @@
import { Difficulty } from '@prisma/client';
import { Badge } from '../ui/badge';
-import clsx from 'clsx';
interface Props {
difficulty: Difficulty;
}
+
+const COLORS_BY_DIFFICULTY = {
+ BEGINNER: 'bg-pink-300',
+ EASY: 'bg-green-300',
+ MEDIUM: 'bg-yellow-300',
+ HARD: 'bg-red-300',
+ EXTREME: 'bg-orange-300',
+};
export function DifficultyBadge({ difficulty }: Props) {
return (
<Badge
- className={clsx({
- 'bg-pink-300': difficulty === 'BEGINNER',
- 'bg-green-300': difficulty === 'EASY',
- 'bg-yellow-300': difficulty === 'MEDIUM',
- 'bg-red-300': difficulty === 'HARD',
- 'bg-orange-300': difficulty === 'EXTREME',
- })}
+ className={`${COLORS_BY_DIFFICULTY[difficulty]} hover:${COLORS_BY_DIFFICULTY[difficulty]}}`}
>
{difficulty}
</Badge>