From 4eba0dc6f40fb775a99dbaf4c789bdab4bd0b647 Mon Sep 17 00:00:00 2001 From: AykutSarac Date: Fri, 19 Jan 2024 22:06:35 +0300 Subject: [PATCH] feat: enable ai --- package.json | 22 +++--- pnpm-lock.yaml | 94 +++++++++++++------------- src/components/PromptInput/index.tsx | 13 +--- src/containers/Toolbar/OptionsMenu.tsx | 26 ++++--- 4 files changed, 76 insertions(+), 79 deletions(-) diff --git a/package.json b/package.json index e16989e0e73..54d6500044c 100644 --- a/package.json +++ b/package.json @@ -14,16 +14,16 @@ "analyze": "ANALYZE=true npm run build" }, "dependencies": { - "@mantine/code-highlight": "^7.4.2", - "@mantine/core": "^7.4.2", - "@mantine/hooks": "^7.4.2", + "@mantine/code-highlight": "^7.4.1", + "@mantine/core": "^7.4.1", + "@mantine/hooks": "^7.4.1", "@monaco-editor/react": "^4.6.0", "@sentry/nextjs": "^7.94.1", "@supabase/auth-helpers-nextjs": "^0.8.7", "@supabase/auth-helpers-react": "^0.4.2", "@supabase/supabase-js": "^2.39.3", "@tanstack/react-query": "^4.36.1", - "allotment": "^1.20.0", + "allotment": "^1.19.5", "axios": "^1.6.5", "dayjs": "^1.11.10", "gofmt.js": "^0.0.2", @@ -44,7 +44,7 @@ "lodash.update": "^4.10.2", "maketypes": "^1.1.2", "million": "^2.6.4", - "next": "14.1.0", + "next": "13.5.6", "pako": "^2.1.0", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -59,7 +59,7 @@ "styled-components": "^6.1.8", "toml": "^3.0.0", "use-long-press": "^3.2.0", - "zustand": "^4.5.0" + "zustand": "^4.4.7" }, "devDependencies": { "@next/bundle-analyzer": "^14.1.0", @@ -72,16 +72,16 @@ "@types/lodash.set": "^4.3.9", "@types/lodash.unset": "^4.5.9", "@types/lodash.update": "^4.10.9", - "@types/node": "^20.11.5", + "@types/node": "^20.4.7", "@types/pako": "^2.0.3", - "@types/react": "18.2.48", + "@types/react": "18.2.45", "@types/react-dom": "^18.2.18", "eslint": "8.56.0", - "eslint-config-next": "14.1.0", - "eslint-config-prettier": "^9.1.0", + "eslint-config-next": "14.0.4", + "eslint-config-prettier": "^8.10.0", "eslint-plugin-prettier": "^5.1.3", "eslint-plugin-unused-imports": "^3.0.0", - "prettier": "^3.2.4", + "prettier": "^3.2.2", "ts-node": "^10.9.2", "typescript": "5.3.3" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 916ebdb0d6c..b00393d8cdb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,14 +6,14 @@ settings: dependencies: '@mantine/code-highlight': - specifier: ^7.4.2 - version: 7.4.2(@mantine/core@7.4.2)(@mantine/hooks@7.4.2)(react-dom@18.2.0)(react@18.2.0) + specifier: ^7.4.1 + version: 7.4.1(@mantine/core@7.4.1)(@mantine/hooks@7.4.1)(react-dom@18.2.0)(react@18.2.0) '@mantine/core': - specifier: ^7.4.2 - version: 7.4.2(@mantine/hooks@7.4.2)(@types/react@18.2.48)(react-dom@18.2.0)(react@18.2.0) + specifier: ^7.4.1 + version: 7.4.1(@mantine/hooks@7.4.1)(@types/react@18.2.45)(react-dom@18.2.0)(react@18.2.0) '@mantine/hooks': - specifier: ^7.4.2 - version: 7.4.2(react@18.2.0) + specifier: ^7.4.1 + version: 7.4.1(react@18.2.0) '@monaco-editor/react': specifier: ^4.6.0 version: 4.6.0(monaco-editor@0.45.0)(react-dom@18.2.0)(react@18.2.0) @@ -33,8 +33,8 @@ dependencies: specifier: ^4.36.1 version: 4.36.1(react-dom@18.2.0)(react@18.2.0) allotment: - specifier: ^1.20.0 - version: 1.20.0(react-dom@18.2.0)(react@18.2.0) + specifier: ^1.19.5 + version: 1.19.5(react-dom@18.2.0)(react@18.2.0) axios: specifier: ^1.6.5 version: 1.6.5 @@ -96,8 +96,8 @@ dependencies: specifier: ^2.6.4 version: 2.6.4 next: - specifier: 14.1.0 - version: 14.1.0(@babel/core@7.23.7)(react-dom@18.2.0)(react@18.2.0) + specifier: 13.5.6 + version: 13.5.6(@babel/core@7.23.7)(react-dom@18.2.0)(react@18.2.0) pako: specifier: ^2.1.0 version: 2.1.0 @@ -150,7 +150,7 @@ devDependencies: version: 14.1.0 '@trivago/prettier-plugin-sort-imports': specifier: ^4.3.0 - version: 4.3.0(prettier@3.2.4) + version: 4.3.0(prettier@3.2.2) '@types/js-yaml': specifier: ^4.0.9 version: 4.0.9 @@ -176,8 +176,8 @@ devDependencies: specifier: ^4.10.9 version: 4.10.9 '@types/node': - specifier: ^20.11.5 - version: 20.11.5 + specifier: ^20.4.7 + version: 20.4.7 '@types/pako': specifier: ^2.0.3 version: 2.0.3 @@ -198,16 +198,20 @@ devDependencies: version: 9.1.0(eslint@8.56.0) eslint-plugin-prettier: specifier: ^5.1.3 - version: 5.1.3(eslint-config-prettier@9.1.0)(eslint@8.56.0)(prettier@3.2.4) - eslint-plugin-unused-imports: - specifier: ^3.0.0 - version: 3.0.0(eslint@8.56.0) + version: 5.1.3(eslint-config-prettier@8.10.0)(eslint@8.56.0)(prettier@3.2.2) prettier: specifier: ^3.2.4 version: 3.2.4 ts-node: specifier: ^10.9.2 version: 10.9.2(@types/node@20.11.5)(typescript@5.3.3) +======= + specifier: ^3.2.2 + version: 3.2.2 + ts-node: + specifier: ^10.9.2 + version: 10.9.2(@types/node@20.4.7)(typescript@5.3.3) +>>>>>>> bcfcc1c (feat: enable ai) typescript: specifier: 5.3.3 version: 5.3.3 @@ -679,31 +683,31 @@ packages: call-bind: 1.0.5 dev: false - /@mantine/code-highlight@7.4.2(@mantine/core@7.4.2)(@mantine/hooks@7.4.2)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-CVo3gMOWW+hjDQg2S63BZNmXHGRFYtugtWDIwC8fv7U6P2acs1OuxuXUrGkHkm8s3jJNTWB4kF2vd+7x5Z8GpQ==} + /@mantine/code-highlight@7.4.1(@mantine/core@7.4.1)(@mantine/hooks@7.4.1)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-zfUZuwP2hXnz3BC1H2tH/clc00NS36XQMmkMeVLTKDl8mU3vMiDPxjsODvrieLbat7rUfqaD9mqhJShwCL1D/g==} peerDependencies: - '@mantine/core': 7.4.2 - '@mantine/hooks': 7.4.2 + '@mantine/core': 7.4.1 + '@mantine/hooks': 7.4.1 react: ^18.2.0 react-dom: ^18.2.0 dependencies: - '@mantine/core': 7.4.2(@mantine/hooks@7.4.2)(@types/react@18.2.48)(react-dom@18.2.0)(react@18.2.0) - '@mantine/hooks': 7.4.2(react@18.2.0) + '@mantine/core': 7.4.1(@mantine/hooks@7.4.1)(@types/react@18.2.45)(react-dom@18.2.0)(react@18.2.0) + '@mantine/hooks': 7.4.1(react@18.2.0) clsx: 2.0.0 highlight.js: 11.9.0 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) dev: false - /@mantine/core@7.4.2(@mantine/hooks@7.4.2)(@types/react@18.2.48)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-kXmq7NjSd1AsOIzqPwQhA7SeZS9hrbARRqhRwr4LLR3NKps9hLmVto441DnpHH/D27eL9gGLSl4GRIdogjX6mg==} + /@mantine/core@7.4.1(@mantine/hooks@7.4.1)(@types/react@18.2.45)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-crz9BemmwR8V/h6db9FgznCp0Ssp6rCUYkBBO4JprpH8NDSEblHyWcZZo43IuA1vZptp8eyrhRNJ4nfe8CAYFQ==} peerDependencies: - '@mantine/hooks': 7.4.2 + '@mantine/hooks': 7.4.1 react: ^18.2.0 react-dom: ^18.2.0 dependencies: '@floating-ui/react': 0.24.8(react-dom@18.2.0)(react@18.2.0) - '@mantine/hooks': 7.4.2(react@18.2.0) + '@mantine/hooks': 7.4.1(react@18.2.0) clsx: 2.0.0 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) @@ -715,8 +719,8 @@ packages: - '@types/react' dev: false - /@mantine/hooks@7.4.2(react@18.2.0): - resolution: {integrity: sha512-tNtn/SNOtSmjLQmIk4S5nsTJjV84Oj0AUYRrAN78HHw3bfWp6bdWbgYPtPEH9e6iFJfdxiX0hrLfWqROalAsbQ==} + /@mantine/hooks@7.4.1(react@18.2.0): + resolution: {integrity: sha512-7gV9YR+xZ1L69MGVaSNwV0gaxIz4bCZuGxXTtnuaamDcO/4YiNDtmvdD7/jC/RTa1iJMnZ6YiYrcPXLOn+8saQ==} peerDependencies: react: ^18.2.0 dependencies: @@ -1211,7 +1215,7 @@ packages: use-sync-external-store: 1.2.0(react@18.2.0) dev: false - /@trivago/prettier-plugin-sort-imports@4.3.0(prettier@3.2.4): + /@trivago/prettier-plugin-sort-imports@4.3.0(prettier@3.2.2): resolution: {integrity: sha512-r3n0onD3BTOVUNPhR4lhVK4/pABGpbA7bW3eumZnYdKaHkf1qEC+Mag6DPbGNuuh0eG8AaYj+YqmVHSiGslaTQ==} peerDependencies: '@vue/compiler-sfc': 3.x @@ -1226,7 +1230,7 @@ packages: '@babel/types': 7.17.0 javascript-natural-sort: 0.7.1 lodash: 4.17.21 - prettier: 3.2.4 + prettier: 3.2.2 transitivePeerDependencies: - supports-color dev: true @@ -1306,10 +1310,8 @@ packages: /@types/lodash@4.14.202: resolution: {integrity: sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ==} - /@types/node@20.11.5: - resolution: {integrity: sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==} - dependencies: - undici-types: 5.26.5 + /@types/node@20.4.7: + resolution: {integrity: sha512-bUBrPjEry2QUTsnuEjzjbS7voGWCc30W0qzgMf90GPeDGFRakvrz47ju+oqDAKCXLUCe39u57/ORMl/O/04/9g==} /@types/pako@2.0.3: resolution: {integrity: sha512-bq0hMV9opAcrmE0Byyo0fY3Ew4tgOevJmQ9grUhpXQhYfyLJ1Kqg3P33JT5fdbT2AjeAjR51zqqVjAL/HMkx7Q==} @@ -1345,11 +1347,11 @@ packages: /@types/ws@8.5.10: resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==} dependencies: - '@types/node': 20.11.5 + '@types/node': 20.4.7 dev: false - /@typescript-eslint/parser@6.19.0(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-1DyBLG5SH7PYCd00QlroiW60YJ4rWMuUGa/JBV0iZuqi4l4IK3twKPq5ZkEebmGqRjXWVgsUzfd3+nZveewgow==} + /@typescript-eslint/parser@6.15.0(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-MkgKNnsjC6QwcMdlNAel24jjkEO/0hQaMDLqP4S9zq5HBAUJNQB6y+3DwLjX7b3l2b37eNAxMPLwb3/kh8VKdA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -1463,8 +1465,8 @@ packages: uri-js: 4.4.1 dev: true - /allotment@1.20.0(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-G02sKgkSCIMpQozuuEkBHblv4aWVGrHQJuOgfCZn3YtHrvmfzS5+mu1N5eWUkpucu/JMl/0FmeCta662RtyaAw==} + /allotment@1.19.5(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-lQDeuqMkEEzITT56NAXNOWxRXycqVyV62w3X7jVZQS9n+cznDx6RLJMD1cnWcRMfCdPUmAj07FAIR69ueytxDQ==} peerDependencies: react: ^17.0.0 || ^18.0.0 react-dom: ^17.0.0 || ^18.0.0 @@ -2396,7 +2398,7 @@ packages: object.fromentries: 2.0.7 dev: true - /eslint-plugin-prettier@5.1.3(eslint-config-prettier@9.1.0)(eslint@8.56.0)(prettier@3.2.4): + /eslint-plugin-prettier@5.1.3(eslint-config-prettier@8.10.0)(eslint@8.56.0)(prettier@3.2.2): resolution: {integrity: sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -2411,8 +2413,8 @@ packages: optional: true dependencies: eslint: 8.56.0 - eslint-config-prettier: 9.1.0(eslint@8.56.0) - prettier: 3.2.4 + eslint-config-prettier: 8.10.0(eslint@8.56.0) + prettier: 3.2.2 prettier-linter-helpers: 1.0.0 synckit: 0.8.6 dev: true @@ -4100,8 +4102,8 @@ packages: fast-diff: 1.3.0 dev: true - /prettier@3.2.4: - resolution: {integrity: sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==} + /prettier@3.2.2: + resolution: {integrity: sha512-HTByuKZzw7utPiDO523Tt2pLtEyK7OibUD9suEJQrPUCYQqrHr74GGX6VidMrovbf/I50mPqr8j/II6oBAuc5A==} engines: {node: '>=14'} hasBin: true dev: true @@ -4936,7 +4938,7 @@ packages: tslib: 2.6.2 dev: false - /ts-node@10.9.2(@types/node@20.11.5)(typescript@5.3.3): + /ts-node@10.9.2(@types/node@20.4.7)(typescript@5.3.3): resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} hasBin: true peerDependencies: diff --git a/src/components/PromptInput/index.tsx b/src/components/PromptInput/index.tsx index 778193d11bc..0851b542332 100644 --- a/src/components/PromptInput/index.tsx +++ b/src/components/PromptInput/index.tsx @@ -1,14 +1,5 @@ import React from "react"; -import { - ActionIcon, - TextInput, - Text, - Loader, - Tooltip, - HoverCard, - Flex, - Badge, -} from "@mantine/core"; +import { ActionIcon, TextInput, Loader, Tooltip, HoverCard, Flex, Badge } from "@mantine/core"; import { getHotkeyHandler } from "@mantine/hooks"; import styled from "styled-components"; import { FunctionsHttpError } from "@supabase/supabase-js"; @@ -95,7 +86,7 @@ export const PromptInput = () => { } }; - if (!promptVisible) return null; + if (!promptVisible || !premium) return null; return ( { + const premium = useUser(state => state.premium); const toggleGestures = useConfig(state => state.toggleGestures); const toggleChildrenCount = useConfig(state => state.toggleChildrenCount); const toggleDarkMode = useConfig(state => state.toggleDarkMode); @@ -68,17 +70,19 @@ export const OptionsMenu = () => { > Dark Mode - } - onClick={() => toggleAI(!aiEnabled)} - > - - JSON Crack AI{" "} - - Alpha - - - + {premium && ( + } + onClick={() => toggleAI(!aiEnabled)} + > + + JSON Crack AI{" "} + + Alpha + + + + )} );