Connect, collaborate, and grow with a community of TypeScript developers
poc of solution editor (#123)
bautistaaaaaccd333282c
diff --git a/package.json b/package.jsonindex 25c12cad..327eba38 100644--- a/package.json+++ b/package.json@@ -41,6 +41,7 @@"@trpc/react-query": "^10.26.0","@trpc/server": "^10.26.0","@types/lodash": "^4.14.195",+ "@uiw/react-md-editor": "^3.23.3","class-variance-authority": "^0.6.0","clsx": "^1.2.1","cmdk": "^0.2.0",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex df428250..f256be4b 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -85,6 +85,9 @@ dependencies:'@types/lodash':specifier: ^4.14.195version: 4.14.195+ '@uiw/react-md-editor':+ specifier: ^3.23.3class-variance-authority:specifier: ^0.6.0version: 0.6.0([email protected])@@ -2150,10 +2153,18 @@ packages:/@types/[email protected]:resolution: {integrity: sha512-BsAaKhB+7X+H4GnSjGhJG9Qi8Tw+inU9nJDwmD5CgOmBLEI6ArdhikpLX7DjbjDRDTbqZzU2LSQNZg8WGPiSZQ==}+ /@types/[email protected]:+ resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==}+ dev: false+/@types/[email protected]:resolution: {integrity: sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==}dev: true+ /@types/[email protected]:+ resolution: {integrity: sha512-ZTaqn/qSqUuAq1YwvOFQfVW1AR/oQJlLSZVustdjwI+GZ8kr0MSHBj0tsXPW1EqHubx50gtBEjbPGsdZwQwCjQ==}+ dev: false+/@types/[email protected]:resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==}@@ -2338,6 +2349,51 @@ packages:eslint-visitor-keys: 3.4.1dev: true+ /@uiw/[email protected]:+ resolution: {integrity: sha512-6szYjEU4xMkIqi4LPJLQIHBBBxazNxH0/slF1Ph4xtDtyeiJkIiNgr/PQxJX/REyWWLWllWTiCN491tnLWCOdA==}+ dev: false++ resolution: {integrity: sha512-fmIGvBpK6HJyDFf7EokjZSIS0713Bq5KwhOsZ8IkbCMYDcDThFlmMkTTqyzGjL3phrkP9ED5O63WSILzefqe6A==}+ peerDependencies:+ react: '>=16.8.0'+ react-dom: '>=16.8.0'+ dependencies:+ '@babel/runtime': 7.22.5+ '@uiw/copy-to-clipboard': 1.0.14+ react: 18.2.0+ react-dom: 18.2.0([email protected])+ react-markdown: 8.0.7(@types/[email protected])([email protected])+ rehype-attr: 2.1.4+ rehype-autolink-headings: 6.1.1+ rehype-ignore: 1.0.5+ rehype-prism-plus: 1.5.1+ rehype-raw: 6.1.1+ rehype-rewrite: 3.0.6+ rehype-slug: 5.1.0+ remark-gfm: 3.0.1+ unist-util-visit: 4.1.2+ transitivePeerDependencies:+ - '@types/react'+ - supports-color+ dev: false++ resolution: {integrity: sha512-19A3atJgDzmNudDN9otkmnV3DYZzqVUqaHj3bo1qdwOzZIYiHlL65NuknzJBZqYkgAP0p4ZZhs1riyvVT7gWyA==}+ peerDependencies:+ react: '>=16.8.0'+ react-dom: '>=16.8.0'+ dependencies:+ '@babel/runtime': 7.22.5+ '@uiw/react-markdown-preview': 4.1.13(@types/[email protected])([email protected])([email protected])+ react: 18.2.0+ react-dom: 18.2.0([email protected])+ rehype: 12.0.1+ transitivePeerDependencies:+ - '@types/react'+ - supports-color+ dev: false+resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}peerDependencies:@@ -2512,6 +2568,10 @@ packages:resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}+ resolution: {integrity: sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ==}+ dev: false+resolution: {integrity: sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==}engines: {node: '>=0.6'}@@ -2521,6 +2581,10 @@ packages:resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==}engines: {node: '>=8'}+ resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==}+ dev: false+resolution: {integrity: sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==}engines: {node: '>= 5.10.0'}@@ -2614,10 +2678,18 @@ packages:supports-color: 7.2.0dev: true+ resolution: {integrity: sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==}+ dev: false+resolution: {integrity: sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==}dev: false+ resolution: {integrity: sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==}+ dev: false+resolution: {integrity: sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==}dev: false@@ -2630,6 +2702,10 @@ packages:resolution: {integrity: sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==}dev: false+ resolution: {integrity: sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==}+ dev: false+resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==}engines: {node: '>= 8.10.0'}@@ -2740,6 +2816,10 @@ packages:which: 2.0.2dev: true+ resolution: {integrity: sha512-HYPSb7y/Z7BNDCOrakL4raGO2zltZkbeXyAd6Tg9obzix6QhzxCotdBl6VT0Dv4vZfJGVz3WL/xaEI9Ly3ul0g==}+ dev: false+resolution: {integrity: sha512-IiJwMC8rdZE0+xiEZHeru6YoONC4rfPMqGm2W85jMIbkFvv5nFTwJVFHam2eFrN6txmoUYFAFXiv8ICVeTO0MA==}dev: false@@ -2962,6 +3042,11 @@ packages:path-type: 4.0.0dev: true+ resolution: {integrity: sha512-9S6m9Sukh1cZNknO1CWAr2QAWsbKLafQiyM5gZ7VgXHeuaoUwffKN4q6NC4A/Mf9iiPlOXQEKW/Mv/mh9/3YFA==}+ hasBin: true+ dev: false+resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==}@@ -3612,6 +3697,10 @@ packages:resolve-pkg-maps: 1.0.0dev: true+ resolution: {integrity: sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==}+ dev: false+resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}engines: {node: '>= 6'}@@ -3748,10 +3837,114 @@ packages:dependencies:function-bind: 1.1.1+ resolution: {integrity: sha512-Nz7FfPBuljzsN3tCQ4kCBKqdNhQE2l0Tn+X1ubgKBPRoiDIu1mL08Cfw4k7q71+Duyaw7DXDN+VTAp4Vh3oCOw==}+ dependencies:+ '@types/hast': 2.3.4+ '@types/unist': 2.0.6+ hastscript: 7.2.0+ property-information: 6.2.0+ vfile: 5.3.7+ vfile-location: 4.1.0+ web-namespaces: 2.0.1+ dev: false++ resolution: {integrity: sha512-X2+RwZIMTMKpXUzlotatPzWj8bspCymtXH3cfG3iQKV+wPF53Vgaqxi/eLqGck0wKq1kS9nvoB1wchbCPEL8sg==}+ dev: false++ resolution: {integrity: sha512-iAuRp+ESgJoRFJbSyaqsfvJDY6zzmFoEnL1gtz1+U8gKtGGj1p0CVlysuUAUjq95qlZESHINLThwJzNGmgGZxA==}+ dependencies:+ '@types/hast': 2.3.4+ dev: false++ resolution: {integrity: sha512-O1bKah6mhgEq2WtVMk+Ta5K7pPMqsBBlmzysLdcwKVrqzZQ0CHqUPiIVspNhAG1rvxpvJjtGee17XfauZYKqVA==}+ dependencies:+ '@types/hast': 2.3.4+ '@types/unist': 2.0.6+ dev: false+resolution: {integrity: sha512-7j6mrk/qqkSehsM92wQjdIgWM2/BW61u/53G6xmC8i1OmEdKLHbk419QKQUjz6LglWsfqoiHmyMRkP1BGjecNQ==}dev: false+ resolution: {integrity: sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA==}+ dependencies:+ '@types/hast': 2.3.4+ dev: false++ resolution: {integrity: sha512-RujVQfVsOrxzPOPSzZFiwofMArbQke6DJjnFfceiEbFh7S05CbPt0cYN+A5YeD3pso0JQk6O1aHBnx9+Pm2uqg==}+ dependencies:+ '@types/hast': 2.3.4+ '@types/parse5': 6.0.3+ hast-util-from-parse5: 7.1.2+ hast-util-to-parse5: 7.1.0+ html-void-elements: 2.0.1+ parse5: 6.0.1+ unist-util-position: 4.0.4+ unist-util-visit: 4.1.2+ vfile: 5.3.7+ web-namespaces: 2.0.1+ zwitch: 2.0.4+ dev: false++ resolution: {integrity: sha512-QQhWMhgTFRhCaQdgTKzZ5g31GLQ9qRb1hZtDPMqQaOhpLBziWcshUS0uCR5IJ0U1jrK/mxg35fmcq+Dp/Cy2Aw==}+ dependencies:+ '@types/hast': 2.3.4+ '@types/unist': 2.0.6+ bcp-47-match: 2.0.3+ comma-separated-tokens: 2.0.3+ css-selector-parser: 1.4.1+ direction: 2.0.1+ hast-util-has-property: 2.0.1+ hast-util-to-string: 2.0.0+ hast-util-whitespace: 2.0.1+ not: 0.1.0+ nth-check: 2.1.1+ property-information: 6.2.0+ space-separated-tokens: 2.0.2+ unist-util-visit: 4.1.2+ zwitch: 2.0.4+ dev: false++ resolution: {integrity: sha512-4tpQTUOr9BMjtYyNlt0P50mH7xj0Ks2xpo8M943Vykljf99HW6EzulIoJP1N3eKOSScEHzyzi9dm7/cn0RfGwA==}+ dependencies:+ '@types/hast': 2.3.4+ '@types/unist': 2.0.6+ ccount: 2.0.1+ comma-separated-tokens: 2.0.3+ hast-util-raw: 7.2.3+ hast-util-whitespace: 2.0.1+ html-void-elements: 2.0.1+ property-information: 6.2.0+ space-separated-tokens: 2.0.2+ stringify-entities: 4.0.3+ zwitch: 2.0.4+ dev: false++ resolution: {integrity: sha512-YNRgAJkH2Jky5ySkIqFXTQiaqcAtJyVE+D5lkN6CdtOqrnkLfGYYrEcKuHOJZlp+MwjSwuD3fZuawI+sic/RBw==}+ dependencies:+ '@types/hast': 2.3.4+ comma-separated-tokens: 2.0.3+ property-information: 6.2.0+ space-separated-tokens: 2.0.2+ web-namespaces: 2.0.1+ zwitch: 2.0.4+ dev: false++ resolution: {integrity: sha512-02AQ3vLhuH3FisaMM+i/9sm4OXGSq1UhOOCpTLLQtHdL3tZt7qil69r8M8iDkZYyC0HCFylcYoP+8IO7ddta1A==}+ dependencies:+ '@types/hast': 2.3.4+ dev: false+resolution: {integrity: sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==}dev: false@@ -3766,10 +3959,24 @@ packages:space-separated-tokens: 1.1.5dev: false+ resolution: {integrity: sha512-TtYPq24IldU8iKoJQqvZOuhi5CyCQRAbvDOX0x1eW6rsHSxa/1i2CCiptNTotGHJ3VoHRGmqiv6/D3q113ikkw==}+ dependencies:+ '@types/hast': 2.3.4+ comma-separated-tokens: 2.0.3+ hast-util-parse-selector: 3.1.1+ property-information: 6.2.0+ space-separated-tokens: 2.0.2+ dev: false+resolution: {integrity: sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==}dev: false+ resolution: {integrity: sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A==}+ dev: false+resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==}engines: {node: '>=10.17.0'}@@ -3841,6 +4048,10 @@ packages:resolution: {integrity: sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==}dev: false+ resolution: {integrity: sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==}+ dev: false+resolution: {integrity: sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==}dependencies:@@ -3848,6 +4059,13 @@ packages:is-decimal: 1.0.4dev: false+ resolution: {integrity: sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==}+ dependencies:+ is-alphabetical: 2.0.1+ is-decimal: 2.0.1+ dev: false+resolution: {integrity: sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==}engines: {node: '>= 0.4'}@@ -3910,6 +4128,10 @@ packages:resolution: {integrity: sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==}dev: false+ resolution: {integrity: sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==}+ dev: false+resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==}engines: {node: '>=8'}@@ -3936,6 +4158,10 @@ packages:resolution: {integrity: sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==}dev: false+ resolution: {integrity: sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==}+ dev: false+resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==}engines: {node: '>=14.16'}@@ -4793,6 +5019,10 @@ packages:engines: {node: '>=0.10.0'}dev: true+ resolution: {integrity: sha512-5PDmaAsVfnWUgTUbJ3ERwn7u79Z0dYxN9ErxCpVJJqe2RK0PJ3z+iFUxuqjwtlDDegXvtWoxD/3Fzxox7tFGWA==}+ dev: false+resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==}engines: {node: '>=8'}@@ -4807,6 +5037,12 @@ packages:path-key: 4.0.0dev: true+ resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==}+ dependencies:+ boolbase: 1.0.0+ dev: false+resolution: {integrity: sha512-a5ERWK1kh38ExDEfoO6qUHJb32rd7aYmPHuyCu3Fta/cnICvYmgd2uhuKXvPD+PXB+gCEYYEaQdIRAjCOwAKNA==}dev: false@@ -4972,6 +5208,27 @@ packages:is-hexadecimal: 1.0.4dev: false+ resolution: {integrity: sha512-SWzvYcSJh4d/SGLIOQfZ/CoNv6BTlI6YEQ7Nj82oDVnRpwe/Z/F1EMx42x3JAOwGBlCjeCH0BRJQbQ/opHL17w==}+ dependencies:+ '@types/unist': 2.0.6+ character-entities: 2.0.2+ character-entities-legacy: 3.0.0+ character-reference-invalid: 2.0.1+ decode-named-character-reference: 1.0.2+ is-alphanumerical: 2.0.1+ is-decimal: 2.0.1+ is-hexadecimal: 2.0.1+ dev: false++ resolution: {integrity: sha512-twN+njEipszzlMJd4ONUYgSfZPDxgHhT9Ahed5uTigpQn90FggW4SA/AIPq/6a149fTbE9qBEcSwE3FAEp6wQQ==}+ dev: false++ resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==}+ dev: false+resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}engines: {node: '>=8'}@@ -5504,6 +5761,15 @@ packages:prismjs: 1.27.0dev: false+ resolution: {integrity: sha512-/fk5sI0iTgFYlmVGYVew90AoYnNMP6pooClx/XKqyeeCQXrL0Kvgn8V0VEht5ccdljbzzF1i3Q213gcntkRExg==}+ dependencies:+ '@types/hast': 2.3.4+ '@types/prismjs': 1.26.0+ hastscript: 7.2.0+ parse-entities: 4.0.1+ dev: false+resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==}@@ -5516,6 +5782,101 @@ packages:functions-have-names: 1.2.3dev: true+ resolution: {integrity: sha512-iAeaL5JyF4XxkcvWzpi/0SAF7iV7qOTaHS56tJuEsXziQc3+PEmMn65kV8OFgbO9mRVY7J1fRC/aLvot1PsNkg==}+ engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}+ dependencies:+ unified: 10.1.2+ unist-util-visit: 4.1.2+ dev: false++ resolution: {integrity: sha512-NMYzZIsHM3sA14nC5rAFuUPIOfg+DFmf9EY1YMhaNlB7+3kK/ZlE6kqPfuxr1tsJ1XWkTrMtMoyHosU70d35mA==}+ dependencies:+ '@types/hast': 2.3.4+ extend: 3.0.2+ hast-util-has-property: 2.0.1+ hast-util-heading-rank: 2.1.1+ hast-util-is-element: 2.1.3+ unified: 10.1.2+ unist-util-visit: 4.1.2+ dev: false++ resolution: {integrity: sha512-JQXS5eDwXaYKwB8JEYFJJA/YvGi0sSNUOYuiURMtuPTg8tuWHFB91JMYLbImH1FyvyGQM4fIBqNMAPB50WR2Bw==}+ engines: {node: ^14.13.1 || >=16.0.0}+ dependencies:+ hast-util-select: 5.0.5+ unified: 10.1.2+ unist-util-visit: 4.1.2+ dev: false++ resolution: {integrity: sha512-MJJKONunHjoTh4kc3dsM1v3C9kGrrxvA3U8PxZlP2SjH8RNUSrb+lF7Y0KVaUDnGH2QZ5vAn7ulkiajM9ifuqg==}+ dependencies:+ '@types/hast': 2.3.4+ hast-util-from-parse5: 7.1.2+ parse5: 6.0.1+ unified: 10.1.2+ dev: false++ resolution: {integrity: sha512-mowYefSfrIkMMxkb0fwuEXlvc5nA9b1vQ6mzujM81Qx28RI0mo7jCHsBZ2tJ4eIJKXdFn+EdPkZZBGB10K02vg==}+ dependencies:+ hast-util-to-string: 2.0.0+ parse-numeric-range: 1.3.0+ refractor: 4.8.1+ rehype-parse: 8.0.4+ unist-util-filter: 4.0.1+ unist-util-visit: 4.1.2+ dev: false++ resolution: {integrity: sha512-d6AKtisSRtDRX4aSPsJGTfnzrX2ZkHQLE5kiUuGOeEoLpbEulFF4hj0mLPbsa+7vmguDKOVVEQdHKDSwoaIDsQ==}+ dependencies:+ '@types/hast': 2.3.4+ hast-util-raw: 7.2.3+ unified: 10.1.2+ dev: false++ resolution: {integrity: sha512-REDTNCvsKcAazy8IQWzKp66AhSUDSOIKssSCqNqCcT9sN7JCwAAm3mWGTUdUzq80ABuy8d0D6RBwbnewu1aY1g==}+ engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}+ dependencies:+ hast-util-select: 5.0.5+ unified: 10.1.2+ unist-util-visit: 4.1.2+ dev: false++ resolution: {integrity: sha512-Gf91dJoXneiorNEnn+Phx97CO7oRMrpi+6r155tTxzGuLtm+QrI4cTwCa9e1rtePdL4i9tSO58PeSS6HWfgsiw==}+ dependencies:+ '@types/hast': 2.3.4+ github-slugger: 2.0.0+ hast-util-has-property: 2.0.1+ hast-util-heading-rank: 2.1.1+ hast-util-to-string: 2.0.0+ unified: 10.1.2+ unist-util-visit: 4.1.2+ dev: false++ resolution: {integrity: sha512-kWiZ1bgyWlgOxpqD5HnxShKAdXtb2IUljn3hQAhySeak6IOQPPt6DeGnsIh4ixm7yKJWzm8TXFuC/lPfcWHJqw==}+ dependencies:+ '@types/hast': 2.3.4+ hast-util-to-html: 8.0.4+ unified: 10.1.2+ dev: false++ resolution: {integrity: sha512-ey6kAqwLM3X6QnMDILJthGvG1m1ULROS9NT4uG9IDCuv08SFyLlreSuvOa//DgEvbXx62DS6elGVqusWhRUbgw==}+ dependencies:+ '@types/hast': 2.3.4+ rehype-parse: 8.0.4+ rehype-stringify: 9.0.3+ unified: 10.1.2+ dev: false+resolution: {integrity: sha512-lEFDoi2PICJyNrACFOfDD3JlLkuSbOa5Wd8EPt06HUdptv8Gn0bxYTdbU/XXQ3swAPkEaGxxPN9cbnMHvVu1Ig==}dependencies:@@ -5765,6 +6126,13 @@ packages:es-abstract: 1.21.2dev: true+ resolution: {integrity: sha512-BP9nNHMhhfcMbiuQKCqMjhDP5yBCAxsPu4pHFFzJ6Alo9dZgY4VLDPutXqIjpRiMoKdp7Av85Gr73Q5uH9k7+g==}+ dependencies:+ character-entities-html4: 2.1.0+ character-entities-legacy: 3.0.0+ dev: false+resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==}engines: {node: '>=8'}@@ -6058,6 +6426,14 @@ packages:vfile: 5.3.7dev: false+ resolution: {integrity: sha512-RynicUM/vbOSTSiUK+BnaK9XMfmQUh6gyi7L6taNgc7FIf84GukXVV3ucGzEN/PhUUkdP5hb1MmXc+3cvPUm5Q==}+ dependencies:+ '@types/unist': 2.0.6+ unist-util-is: 5.2.1+ unist-util-visit-parents: 5.1.3+ dev: false+resolution: {integrity: sha512-qF72kLmPxAw0oN2fwpWIqbXAVyEqUzDHMsbtPvOudIlUzXYFIeQIuxXQCRCFh22B7cixvU0MG7m3MW8FTq/S+A==}dev: false@@ -6182,6 +6558,13 @@ packages:sade: 1.8.1dev: false+ resolution: {integrity: sha512-YF23YMyASIIJXpktBa4vIGLJ5Gs88UB/XePgqPmTa7cDA+JeO3yclbpheQYCHjVHBn/yePzrXuygIL+xbvRYHw==}+ dependencies:+ '@types/unist': 2.0.6+ vfile: 5.3.7+ dev: false+resolution: {integrity: sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==}dependencies:@@ -6225,6 +6608,10 @@ packages:graceful-fs: 4.2.11dev: false+ resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==}+ dev: false+resolution: {integrity: sha512-7FjigXNsBfopEj+5DV2nhNpfic2vumtjjgPmeDKk45z+MJwXKKfhPB7118Pfzrmh4jqOMST6Ch37iPAHoImg5g==}dependencies:diff --git a/prisma/schema.prisma b/prisma/schema.prismaindex 0762ff6d..ba56fdbc 100644--- a/prisma/schema.prisma+++ b/prisma/schema.prisma@@ -138,9 +138,8 @@ model Vote {model SharedSolution {id Int @id @default(autoincrement())createdAt DateTime @default(now())+ title Stringdescription String @db.MediumText- solution Solution @relation(fields: [solutionId], references: [id])- solutionId IntVote Vote[]User User? @relation(fields: [userId], references: [id])userId String?@@ -148,22 +147,20 @@ model SharedSolution {challengeId Int?SolutionComment SolutionComment[]- @@index([solutionId])@@index([userId])@@index([challengeId])}model Solution {- id Int @id @default(autoincrement())- code String @db.MediumText- createdAt DateTime @default(now())- isSuccessful Boolean- user User @relation(fields: [userId], references: [id])- userId String- challenge Challenge @relation(fields: [challengeId], references: [id])- challengeId Int- Vote Vote[]- SharedSolution SharedSolution[]+ id Int @id @default(autoincrement())+ code String @db.MediumText+ createdAt DateTime @default(now())+ isSuccessful Boolean+ user User @relation(fields: [userId], references: [id])+ userId String+ challenge Challenge @relation(fields: [challengeId], references: [id])+ challengeId Int+ Vote Vote[]@@index([userId])@@index([challengeId])diff --git a/src/components/challenge/description-panel-skeleton.tsx b/src/components/challenge/description-panel-skeleton.tsxindex ae06364b..15978583 100644--- a/src/components/challenge/description-panel-skeleton.tsx+++ b/src/components/challenge/description-panel-skeleton.tsx@@ -4,7 +4,7 @@ export function DescriptionPanelSkeleton() {return (<><Tabs defaultValue="description" className="w-full">- <TabsList className="sticky top-0 grid h-auto w-full grid-cols-2 rounded-none border-b border-zinc-300 bg-background dark:border-zinc-700 dark:bg-muted">+ <TabsList className="sticky top-0 grid h-auto w-full grid-cols-3 rounded-none border-b border-zinc-300 bg-background dark:border-zinc-700 dark:bg-muted"><TabsTriggervalue="description"className="rounded-md rounded-tl-lg duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"@@ -17,6 +17,12 @@ export function DescriptionPanelSkeleton() {>Solutions</TabsTrigger>+ <TabsTrigger+ value="submissions"+ className="rounded-md rounded-tr-lg duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"+ >+ Submissions+ </TabsTrigger></TabsList><TabsContent value="description" className="mt-0 dark:bg-muted"><div className="h-full p-5">@@ -65,6 +71,26 @@ export function DescriptionPanelSkeleton() {</div></div></TabsContent>+ <TabsContent className="flex h-full flex-col space-y-2 p-5" value="submissions">+ <div className="flex flex-col space-y-10">+ <div className="prose-invert flex flex-col space-y-2 prose-h3:text-xl">+ <div className="h-4 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>+ <div className="h-4 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>+ <div className="h-4 w-1/2 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>+ </div>+ <div className="prose-invert flex flex-col space-y-2 prose-h3:text-xl">+ <div className="h-4 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>+ <div className="h-4 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>+ <div className="h-4 w-1/2 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>+ </div>+ <div className="prose-invert flex flex-col space-y-2 prose-h3:text-xl">+ <div className="h-4 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>+ <div className="h-4 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>+ <div className="h-4 w-1/2 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>+ </div>+ </div>+ </TabsContent>+ 2</Tabs></>);diff --git a/src/components/challenge/description-panel.tsx b/src/components/challenge/description-panel.tsxindex 1cc58c9a..46636247 100644--- a/src/components/challenge/description-panel.tsx+++ b/src/components/challenge/description-panel.tsx@@ -7,14 +7,15 @@ import { useSession } from 'next-auth/react';import { useRouter } from 'next/navigation';import { useRef, useState } from 'react';+import { useForm } from 'react-hook-form';import { Button } from '~/components/ui/button';import {Dialog,DialogContent,+ DialogFooter,DialogHeader,DialogTitle,DialogTrigger,- DialogFooter,} from '~/components/ui/dialog';import { Tabs, TabsContent, TabsList, TabsTrigger } from '~/components/ui/tabs';import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '~/components/ui/tooltip';@@ -22,18 +23,17 @@ import { TypographyH3 } from '~/components/ui/typography/h3';import type { Challenge } from '.';import { DifficultyBadge } from '../explore/difficulty-badge';import { ActionMenu } from '../ui/action-menu';+import { Checkbox } from '../ui/checkbox';+import { Form, FormField, FormItem } from '../ui/form';+import { Markdown } from '../ui/markdown';import { Textarea } from '../ui/textarea';+import { TypographyLarge } from '../ui/typography/large';+import { toast } from '../ui/use-toast';import { addOrRemoveBookmark } from './bookmark.action';import { incrementOrDecrementUpvote } from './increment.action';+import { addReport } from './report.action';import { ShareForm } from './share-form';import { Solutions } from './solutions';-import { Form, FormField, FormItem } from '../ui/form';-import { useForm } from 'react-hook-form';-import { Checkbox } from '../ui/checkbox';-import { TypographyLarge } from '../ui/typography/large';-import { addReport } from './report.action';-import { toast } from '../ui/use-toast';-import { Markdown } from '../ui/markdown';import { Submissions } from './submissions';interface Props {@@ -304,11 +304,11 @@ export function DescriptionPanel({ challenge }: Props) {</DialogTrigger><DialogContent className="w-[200px]"><DialogHeader>- <DialogTitle>Share this challenege</DialogTitle>- <div className="pt-4">- <ShareForm />- </div>+ <DialogTitle>Share this challenge</DialogTitle></DialogHeader>+ <div className="pt-4">+ <ShareForm />+ </div></DialogContent></Dialog><TooltipProvider>diff --git a/src/components/challenge/editor/index.tsx b/src/components/challenge/editor/index.tsxindex 4b08f8fd..793326c5 100644--- a/src/components/challenge/editor/index.tsx+++ b/src/components/challenge/editor/index.tsx@@ -269,10 +269,10 @@ export const CodePanel = (props: Props) => {<DialogContent className="w-[200px]"><DialogHeader><DialogTitle>Settings</DialogTitle>- <div className="pt-4">- <SettingsForm />- </div></DialogHeader>+ <div className="pt-4">+ <SettingsForm />+ </div></DialogContent></Dialog></div>diff --git a/src/components/challenge/solutions.tsx b/src/components/challenge/solutions/index.tsxsimilarity index 66%rename from src/components/challenge/solutions.tsxrename to src/components/challenge/solutions/index.tsxindex dff7b0ff..1169410c 100644--- a/src/components/challenge/solutions.tsx+++ b/src/components/challenge/solutions/index.tsx@@ -2,13 +2,23 @@import { ArrowUp, MessageCircle, Plus } from 'lucide-react';import { Button } from '~/components/ui/button';-import type { Challenge } from '.';+import {+ Dialog,+ DialogContent,+ DialogHeader,+ DialogTitle,+ DialogTrigger,+} from '~/components/ui/dialog';+import type { Challenge } from '..';+import { SolutionEditor } from './solution-editor';+import { useState } from 'react';interface Props {challenge: NonNullable<Challenge>;}export function Solutions({ challenge }: Props) {const hasSolution = challenge.Solution?.length > 0;+ const [openSolutionEditor, setOpenSolutionEditor] = useState(false);const handleClick = () => {console.log('do stuff');@@ -25,13 +35,30 @@ export function Solutions({ challenge }: Props) {Tag 2</div></div>- <Button- className="h-8 rounded-xl bg-emerald-600 hover:bg-emerald-500 dark:bg-emerald-400 dark:hover:bg-emerald-300"- onClick={() => handleClick()}- disabled={!hasSolution}- >- <Plus className="mr-2 h-4 w-4" /> Solution- </Button>+ <Dialog open={openSolutionEditor} onOpenChange={setOpenSolutionEditor}>+ <DialogTrigger>+ <Button+ className="h-8 rounded-xl bg-emerald-600 hover:bg-emerald-500 dark:bg-emerald-400 dark:hover:bg-emerald-300"+ onClick={() => handleClick()}+ disabled={!hasSolution}+ >+ <Plus className="mr-2 h-4 w-4" /> Solution+ </Button>+ </DialogTrigger>+ <DialogContent+ onEscapeKeyDown={(e) => e.preventDefault()}+ onPointerDownOutside={(e) => e.preventDefault()}+ className="flex h-5/6 w-11/12 max-w-none flex-col md:w-11/12"+ displayX={false}+ >+ <DialogHeader>+ <DialogTitle>Share your solution</DialogTitle>+ </DialogHeader>+ <div className="h-full pt-4">+ <SolutionEditor challenge={challenge} setOpen={setOpenSolutionEditor} />+ </div>+ </DialogContent>+ </Dialog></div><div className="relative flex flex-col"><SolutionRow />diff --git a/src/components/challenge/solutions/post-solution.action.ts b/src/components/challenge/solutions/post-solution.action.tsnew file mode 100644index 00000000..66c5934c--- /dev/null+++ b/src/components/challenge/solutions/post-solution.action.ts@@ -0,0 +1,19 @@+'use server';+import { prisma } from '~/server/db';++interface Args {+ challengeId: number;+ description: string;+ title: string;+ userId: string;+}+export async function postSolution({ challengeId, description, title, userId }: Args) {+ await prisma.sharedSolution.create({+ data: {+ challengeId,+ description,+ title,+ userId,+ },+ });+}diff --git a/src/components/challenge/solutions/solution-editor.tsx b/src/components/challenge/solutions/solution-editor.tsxnew file mode 100644index 00000000..339f1f81--- /dev/null+++ b/src/components/challenge/solutions/solution-editor.tsx@@ -0,0 +1,106 @@+import { zodResolver } from '@hookform/resolvers/zod';+import MDEditor from '@uiw/react-md-editor';+import { useForm } from 'react-hook-form';+import { z } from 'zod';+import { Button } from '~/components/ui/button';+import { Form, FormControl, FormField, FormItem, FormMessage } from '~/components/ui/form';+import { Input } from '~/components/ui/input';+import { useToast } from '~/components/ui/use-toast';+import { postSolution } from './post-solution.action';+import type { Challenge } from '..';+import { useSession } from 'next-auth/react';++const getDefaultMarkdown = (solution: string) => `+## Thoughts+<!-- Any thoughts you might like to share about the problem(within TOS of course). -->++## Approach+<!-- Provide some details on how you approached this challenge. -->+++## Code+\`\`\`ts+${solution}+\`\`\`+`;++const formSchema = z.object({+ title: z.string(),+ content: z.string(),+});++export type FormSchema = z.infer<typeof formSchema>;++interface Props {+ challenge: NonNullable<Challenge>;+ setOpen: (v: boolean) => void;+}++export function SolutionEditor({ setOpen, challenge }: Props) {+ const session = useSession();+ const form = useForm<FormSchema>({+ resolver: zodResolver(formSchema),+ defaultValues: {+ content: getDefaultMarkdown(challenge.Solution[0]?.code ?? ''),+ },+ });+ const { toast } = useToast();++ const onSubmit = async (data: FormSchema) => {+ try {+ await postSolution({+ challengeId: challenge.id,+ description: data.content,+ title: data.title,+ userId: session?.data?.user?.id as string,+ });+ toast({+ variant: 'success',+ title: 'Your solution has been posted!',+ });+ } catch (error) {+ toast({+ variant: 'destructive',+ title: 'Uh oh! Something went wrong. Please try again.',+ });+ } finally {+ setOpen(false);+ }+ };++ return (+ <div className="flex h-full flex-col gap-3">+ <Form {...form}>+ {/* eslint-disable-next-line @typescript-eslint/no-misused-promises */}+ <form className="flex h-full flex-col gap-3" onSubmit={form.handleSubmit(onSubmit)}>+ <FormField+ control={form.control}+ name="title"+ render={({ field }) => (+ <FormItem>+ <FormControl>+ <Input {...field} placeholder="Enter a title for your solution." />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="content"+ render={({ field }) => (+ // @ts-ignore+ <MDEditor height="100%" value={field.value} onChange={field.onChange} />+ )}+ />+ <div className="flex items-center justify-end gap-2">+ <Button variant="ghost" type="button" onClick={() => setOpen(false)}>+ Cancel+ </Button>+ <Button type="submit">Post</Button>+ </div>+ </form>+ </Form>+ </div>+ );+}diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsxindex 9b58fa96..c4d9a296 100644--- a/src/components/ui/dialog.tsx+++ b/src/components/ui/dialog.tsx@@ -15,6 +15,10 @@ const DialogPortal = ({ className, ...props }: DialogPrimitive.DialogPortalProps);DialogPortal.displayName = DialogPrimitive.Portal.displayName;+interface ContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {+ displayX?: boolean;+}+const DialogOverlay = React.forwardRef<React.ElementRef<typeof DialogPrimitive.Overlay>,React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>@@ -32,8 +36,8 @@ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;const DialogContent = React.forwardRef<React.ElementRef<typeof DialogPrimitive.Content>,- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>->(({ className, children, ...props }, ref) => (+ ContentProps+>(({ className, children, displayX = true, ...props }, ref) => (<DialogPortal><DialogOverlay /><DialogPrimitive.Content@@ -45,10 +49,12 @@ const DialogContent = React.forwardRef<{...props}>{children}- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">- <X className="h-4 w-4" />- <span className="sr-only">Close</span>- </DialogPrimitive.Close>+ {displayX && (+ <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">+ <X className="h-4 w-4" />+ <span className="sr-only">Close</span>+ </DialogPrimitive.Close>+ )}</DialogPrimitive.Content></DialogPortal>));