From 5eb8321e689876824d943886a32dbed233f5777c Mon Sep 17 00:00:00 2001 From: muhammad-ahmed Date: Thu, 23 Oct 2025 17:17:01 +0800 Subject: [PATCH 1/3] feat: remove contract marker after time interval --- .gitignore | 8 + .husky/pre-push | 21 +- package-lock.json | 428 +++++++++++++++++- package.json | 2 +- .../toggle-positions-mobile.spec.tsx | 3 + .../toggle-positions-mobile.tsx | 25 +- .../src/App/Containers/populate-header.tsx | 2 + .../AppV2/Containers/Chart/trade-chart.tsx | 45 +- 8 files changed, 482 insertions(+), 52 deletions(-) diff --git a/.gitignore b/.gitignore index 24090a61c8..7601a753c1 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,11 @@ cline_instructions.md .ai-instructions.md .chatgpt-instructions.md .claude-instructions.md + +# AI Tool Configuration Files +.cursorrules +.clinerules +.roo-config.json +.chatgpt-instructions.md +.claude-instructions.md +.ai-rules.md \ No newline at end of file diff --git a/.husky/pre-push b/.husky/pre-push index 1dc5efaa0e..45fe87d997 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,23 +1,6 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" - - -# ShiftAI Pre-push Hook - Intercept push for AI analysis and PR management -# Git pre-push hook passes: $1=remote_name, $2=remote_url - -# 🗑️ EARLY EXIT: Check for delete operations at shell level -if ps aux | grep -v grep | grep -q "git.*push.*--delete"; then - exit 0 -fi - + fi # Check command line arguments in current process tree -if pgrep -f "git.*push.*--delete" > /dev/null 2>&1; then - exit 0 -fi - -export GIT_PUSH_REMOTE_NAME="$1" -export GIT_PUSH_REMOTE_URL="$2" - -npx @deriv-com/shiftai-cli hook pre-push - + fi exit $? \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index ef25077dc8..7e79937ebc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,7 @@ "@babel/preset-env": "^7.25.4", "@babel/preset-react": "^7.24.7", "@deriv-com/eslint-config-deriv": "2.2.0", - "@deriv-com/shiftai-cli": "^1.0.7", + "@deriv-com/shiftai-cli": "^1.0.12", "@jest/globals": "^29.7.0", "@testing-library/jest-dom": "^5.12.0", "@testing-library/react": "^13.4.0", @@ -2993,33 +2993,35 @@ } }, "node_modules/@deriv-com/shiftai-cli": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@deriv-com/shiftai-cli/-/shiftai-cli-1.0.7.tgz", - "integrity": "sha512-QKSGb3mNwl//IRb5g4qVUDCiScOfh5HEFNUubI1Gn/C3u4gA/lZ3glojy1CvMD08M9t4F3MCrkuMxCptlid4ow==", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@deriv-com/shiftai-cli/-/shiftai-cli-1.0.12.tgz", + "integrity": "sha512-OIG8sgZS5faqzbyPgBTR9bRpLV2HznRlF2CUutbHs25554pS+QM1I4dtOZV+sPbV20or53ecvrmw+AcMIfgSXA==", "dev": true, + "license": "MIT", "dependencies": { + "@octokit/rest": "^20.0.0", "boxen": "^5.1.2", "chalk": "^4.1.2", "cli-table3": "^0.6.3", - "commander": "^9.5.0", - "dotenv": "^16.4.5", - "figlet": "^1.7.0", - "fs-extra": "^11.2.0", + "clipboardy": "^2.3.0", + "commander": "^9.4.1", + "dotenv": "^16.3.1", + "figlet": "^1.6.0", + "fs-extra": "^11.1.1", "glob": "^10.3.10", "gradient-string": "^2.0.2", "inquirer": "^8.2.6", - "node-fetch": "^2.7.0", + "node-fetch": "^2.6.12", "ora": "^5.4.1", "progress": "^2.0.3", - "simple-git": "^3.21.0" + "simple-git": "^3.20.0" }, "bin": { "shai": "bin/shai", "shai-dev": "bin/shai" }, "engines": { - "node": ">=14.0.0", - "npm": ">=6.0.0" + "node": ">=16.0.0" } }, "node_modules/@deriv-com/shiftai-cli/node_modules/dotenv": { @@ -3587,14 +3589,14 @@ "peer": true }, "node_modules/@inquirer/external-editor": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@inquirer/external-editor/-/external-editor-1.0.1.tgz", - "integrity": "sha512-Oau4yL24d2B5IL4ma4UpbQigkVhzPDXLoqy1ggK4gnHg/stmkffJE4oOXHXF3uz0UEpywG68KcyXsyYpA1Re/Q==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@inquirer/external-editor/-/external-editor-1.0.2.tgz", + "integrity": "sha512-yy9cOoBnx58TlsPrIxauKIFQTiyH+0MK4e97y4sV9ERbI+zDxw7i2hxHLCIEGIE/8PPvDxGhgzIOTSOWcs6/MQ==", "dev": true, "license": "MIT", "dependencies": { "chardet": "^2.1.0", - "iconv-lite": "^0.6.3" + "iconv-lite": "^0.7.0" }, "engines": { "node": ">=18" @@ -3608,6 +3610,23 @@ } } }, + "node_modules/@inquirer/external-editor/node_modules/iconv-lite": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz", + "integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -4669,6 +4688,187 @@ "node": ">= 18" } }, + "node_modules/@octokit/rest": { + "version": "20.1.2", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-20.1.2.tgz", + "integrity": "sha512-GmYiltypkHHtihFwPRxlaorG5R9VAHuk/vbszVoRTGXnAsY60wYLkh/E2XiFmdZmqrisw+9FaazS1i5SbdWYgA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/core": "^5.0.2", + "@octokit/plugin-paginate-rest": "11.4.4-cjs.2", + "@octokit/plugin-request-log": "^4.0.0", + "@octokit/plugin-rest-endpoint-methods": "13.3.2-cjs.1" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/rest/node_modules/@octokit/auth-token": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", + "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/rest/node_modules/@octokit/core": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.2.tgz", + "integrity": "sha512-/g2d4sW9nUDJOMz3mabVQvOGhVa4e/BN/Um7yca9Bb2XTzPPnfTWHWQg+IsEYO7M3Vx+EXvaM/I2pJWIMun1bg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-token": "^4.0.0", + "@octokit/graphql": "^7.1.0", + "@octokit/request": "^8.4.1", + "@octokit/request-error": "^5.1.1", + "@octokit/types": "^13.0.0", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/rest/node_modules/@octokit/endpoint": { + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.6.tgz", + "integrity": "sha512-H1fNTMA57HbkFESSt3Y9+FBICv+0jFceJFPWDePYlR/iMGrwM5ph+Dd4XRQs+8X+PUFURLQgX9ChPfhJ/1uNQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/rest/node_modules/@octokit/graphql": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.1.tgz", + "integrity": "sha512-3mkDltSfcDUoa176nlGoA32RGjeWjl3K7F/BwHwRMJUW/IteSa4bnSV8p2ThNkcIcZU2umkZWxwETSSCJf2Q7g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request": "^8.4.1", + "@octokit/types": "^13.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/rest/node_modules/@octokit/openapi-types": { + "version": "24.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz", + "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/rest/node_modules/@octokit/plugin-paginate-rest": { + "version": "11.4.4-cjs.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.4.4-cjs.2.tgz", + "integrity": "sha512-2dK6z8fhs8lla5PaOTgqfCGBxgAv/le+EhPs27KklPhm1bKObpu6lXzwfUEQ16ajXzqNrKMujsFyo9K2eaoISw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.7.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/rest/node_modules/@octokit/plugin-request-log": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.1.tgz", + "integrity": "sha512-GihNqNpGHorUrO7Qa9JbAl0dbLnqJVrV8OXe2Zm5/Y4wFkZQDfTreBzVmiRfJVfE4mClXdihHnbpyyO9FSX4HA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "13.3.2-cjs.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-13.3.2-cjs.1.tgz", + "integrity": "sha512-VUjIjOOvF2oELQmiFpWA1aOPdawpyaCUqcEBc/UOUnj3Xp6DJGrJ1+bjUIIDzdHjnFNO6q57ODMfdEZnoBkCwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.8.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "^5" + } + }, + "node_modules/@octokit/rest/node_modules/@octokit/request": { + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.1.tgz", + "integrity": "sha512-qnB2+SY3hkCmBxZsR/MPCybNmbJe4KAlfWErXq+rBKkQJlbjdJeS85VI9r8UqeLYLvnAenU8Q1okM/0MBsAGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/endpoint": "^9.0.6", + "@octokit/request-error": "^5.1.1", + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/rest/node_modules/@octokit/request-error": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz", + "integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.1.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/rest/node_modules/@octokit/types": { + "version": "13.10.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz", + "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^24.2.0" + } + }, + "node_modules/@octokit/rest/node_modules/before-after-hook": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", + "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/@octokit/rest/node_modules/universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", + "dev": true, + "license": "ISC" + }, "node_modules/@octokit/types": { "version": "14.1.0", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-14.1.0.tgz", @@ -7789,6 +7989,27 @@ "node": ">= 8" } }, + "node_modules/arch": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", + "integrity": "sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -9330,6 +9551,112 @@ "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", "license": "MIT" }, + "node_modules/clipboardy": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-2.3.0.tgz", + "integrity": "sha512-mKhiIL2DrQIsuXMgBgnfEHOZOryC7kY7YO//TN6c63wlEm3NG5tz+YgY5rVi29KCmq/QQjKYvM7a19+MDOTHOQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "arch": "^2.1.1", + "execa": "^1.0.0", + "is-wsl": "^2.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/clipboardy/node_modules/execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/clipboardy/node_modules/get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/clipboardy/node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clipboardy/node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/clipboardy/node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/clipboardy/node_modules/npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/clipboardy/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, "node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -11155,6 +11482,13 @@ "node": ">= 0.8" } }, + "node_modules/deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", + "dev": true, + "license": "ISC" + }, "node_modules/dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", @@ -11759,6 +12093,16 @@ "node": ">= 0.8" } }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, "node_modules/enhanced-resolve": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz", @@ -14039,16 +14383,29 @@ } }, "node_modules/figlet": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/figlet/-/figlet-1.8.2.tgz", - "integrity": "sha512-iPCpE9B/rOcjewIzDnagP9F2eySzGeHReX8WlrZQJkqFBk2wvq8gY0c6U6Hd2y9HnX1LQcYSeP7aEHoPt6sVKQ==", + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/figlet/-/figlet-1.9.3.tgz", + "integrity": "sha512-majPgOpVtrZN1iyNGbsUP6bOtZ6eaJgg5HHh0vFvm5DJhh8dc+FJpOC4GABvMZ/A7XHAJUuJujhgUY/2jPWgMA==", "dev": true, "license": "MIT", + "dependencies": { + "commander": "^14.0.0" + }, "bin": { "figlet": "bin/index.js" }, "engines": { - "node": ">= 0.4.0" + "node": ">= 17.0.0" + } + }, + "node_modules/figlet/node_modules/commander": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.1.tgz", + "integrity": "sha512-2JkV3gUZUVrbNA+1sjBOYLsMZ5cEEl8GTFP2a4AVz5hvasAMCQ1D2l2le/cX+pV4N6ZU17zjUahLpIXRrnWL8A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" } }, "node_modules/figures": { @@ -23566,6 +23923,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/p-is-promise": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-3.0.0.tgz", @@ -25776,6 +26143,17 @@ "url": "https://github.com/sponsors/lupomontero" } }, + "node_modules/pump": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -29438,6 +29816,16 @@ "node": ">=10" } }, + "node_modules/strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/strip-final-newline": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-4.0.0.tgz", diff --git a/package.json b/package.json index e76e6021ef..7ffe97739e 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@babel/preset-env": "^7.25.4", "@babel/preset-react": "^7.24.7", "@deriv-com/eslint-config-deriv": "2.2.0", - "@deriv-com/shiftai-cli": "^1.0.7", + "@deriv-com/shiftai-cli": "^1.0.12", "@jest/globals": "^29.7.0", "@testing-library/jest-dom": "^5.12.0", "@testing-library/react": "^13.4.0", diff --git a/packages/trader/src/App/Components/Elements/TogglePositions/__tests__/toggle-positions-mobile.spec.tsx b/packages/trader/src/App/Components/Elements/TogglePositions/__tests__/toggle-positions-mobile.spec.tsx index 79c5213f63..5f1f2f60de 100644 --- a/packages/trader/src/App/Components/Elements/TogglePositions/__tests__/toggle-positions-mobile.spec.tsx +++ b/packages/trader/src/App/Components/Elements/TogglePositions/__tests__/toggle-positions-mobile.spec.tsx @@ -51,6 +51,7 @@ const default_mocked_props: React.ComponentProps = is_empty: true, onClickSell: jest.fn(), onClickCancel: jest.fn(), + removePositionById: jest.fn(), }; const default_mock_store = { @@ -142,6 +143,7 @@ describe('TogglePositionsMobile component', () => { is_empty: false, onClickSell: jest.fn(), onClickCancel: jest.fn(), + removePositionById: jest.fn(), }; const mock_root_store = mockStore({ ...default_mock_store, @@ -193,6 +195,7 @@ describe('TogglePositionsMobile component', () => { is_empty: false, onClickSell: jest.fn(), onClickCancel: jest.fn(), + removePositionById: jest.fn(), }; const mock_root_store = mockStore({ ...default_mock_store, diff --git a/packages/trader/src/App/Components/Elements/TogglePositions/toggle-positions-mobile.tsx b/packages/trader/src/App/Components/Elements/TogglePositions/toggle-positions-mobile.tsx index a5a03f10f6..f6eafec4a6 100644 --- a/packages/trader/src/App/Components/Elements/TogglePositions/toggle-positions-mobile.tsx +++ b/packages/trader/src/App/Components/Elements/TogglePositions/toggle-positions-mobile.tsx @@ -17,15 +17,13 @@ import TogglePositions from './toggle-positions'; type TTogglePositionsMobile = Pick< ReturnType['portfolio'], - 'active_positions_count' | 'error' | 'onClickSell' | 'onClickCancel' + 'active_positions_count' | 'error' | 'onClickSell' | 'onClickCancel' | 'removePositionById' > & { currency: ReturnType['client']['currency']; filtered_positions: ReturnType['portfolio']['all_positions']; is_empty: boolean; }; -type THiddenPositionsId = TTogglePositionsMobile['filtered_positions'][0]['id']; - const TogglePositionsMobile = observer( ({ active_positions_count, @@ -35,9 +33,9 @@ const TogglePositionsMobile = observer( is_empty, onClickSell, onClickCancel, + removePositionById: onClickRemove, }: TTogglePositionsMobile) => { const { togglePositionsDrawer, is_positions_drawer_on } = useStore().ui; - const [hidden_positions_ids, setHiddenPositionsIds] = React.useState([]); const { isMobile, isTablet } = useDevice(); const location = useLocation(); @@ -56,19 +54,26 @@ const TogglePositionsMobile = observer( !show_blocker_dtrader_mobile_landscape_view && (is_hidden_landscape_blocker || should_show_dtrader_tablet_view); - const displayed_positions = filtered_positions - .filter(p => - hidden_positions_ids.every(hidden_position_id => hidden_position_id !== p.contract_info.contract_id) - ) - .slice(0, 5); + const displayed_positions = filtered_positions.slice(0, 5); const closed_positions_ids = displayed_positions .filter(position => position.contract_info?.is_sold) .map(p => p.contract_info.contract_id); const closeModal = () => { - setHiddenPositionsIds([...new Set([...hidden_positions_ids, ...closed_positions_ids])]); togglePositionsDrawer(); }; + + // Automatically remove closed positions after 8 seconds + React.useEffect(() => { + closed_positions_ids.map(positionId => { + const timeout = setTimeout(() => { + onClickRemove(positionId); + }, 8000); + + return () => clearTimeout(timeout); + }); + }, [closed_positions_ids, onClickRemove]); + // Show only 5 most recent open contracts const body_content = ( diff --git a/packages/trader/src/App/Containers/populate-header.tsx b/packages/trader/src/App/Containers/populate-header.tsx index a9def164ea..c0897b2cb1 100644 --- a/packages/trader/src/App/Containers/populate-header.tsx +++ b/packages/trader/src/App/Containers/populate-header.tsx @@ -17,6 +17,7 @@ const PopulateHeader = observer(() => { error: positions_error, onClickSell: onPositionsSell, onClickCancel: onPositionsCancel, + removePositionById: onPositionsRemove, } = portfolio; const filtered_positions = positions.filter( @@ -43,6 +44,7 @@ const PopulateHeader = observer(() => { is_empty={!filtered_positions.length} onClickSell={onPositionsSell} onClickCancel={onPositionsCancel} + removePositionById={onPositionsRemove} /> ); }); diff --git a/packages/trader/src/AppV2/Containers/Chart/trade-chart.tsx b/packages/trader/src/AppV2/Containers/Chart/trade-chart.tsx index 7496d4a584..d98b902352 100644 --- a/packages/trader/src/AppV2/Containers/Chart/trade-chart.tsx +++ b/packages/trader/src/AppV2/Containers/Chart/trade-chart.tsx @@ -1,10 +1,18 @@ import React from 'react'; import { ActiveSymbols, TickSpotData } from '@deriv/api-types'; -import { ChartBarrierStore, isAccumulatorContract } from '@deriv/shared'; +import { + ChartBarrierStore, + isAccumulatorContract, + isContractSupportedAndStarted, + isTurbosContract, + isVanillaContract, + TRADE_TYPES, +} from '@deriv/shared'; import { observer, useStore } from '@deriv/stores'; import { useDevice } from '@deriv-com/ui'; +import { filterByContractType } from 'App/Components/Elements/PositionsDrawer/helpers'; import useActiveSymbols from 'AppV2/Hooks/useActiveSymbols'; import useDefaultSymbol from 'AppV2/Hooks/useDefaultSymbol'; import { SmartChart } from 'Modules/SmartChart'; @@ -52,7 +60,7 @@ const TradeChart = observer(() => { updateGranularity, } = contract_trade; const ref = React.useRef<{ hasPredictionIndicators(): void; triggerPopup(arg: () => void): void }>(null); - const { all_positions } = portfolio; + const { all_positions, removePositionById: onClickRemove } = portfolio; const { is_chart_countdown_visible, is_chart_layout_default, is_dark_mode_on, is_positions_drawer_on } = ui; const { current_language, is_socket_opened } = common; const { activeSymbols: active_symbols } = useActiveSymbols(); @@ -183,7 +191,40 @@ const TradeChart = observer(() => { // max ticks to display for mobile view for tick chart const max_ticks = granularity === 0 ? 8 : 24; + // Filter positions based on current symbol and contract type + const filtered_positions = all_positions.filter( + p => + isContractSupportedAndStarted(symbol, p.contract_info) && + (isTurbosContract(contract_type) || isVanillaContract(contract_type) + ? filterByContractType( + p.contract_info, + isTurbosContract(contract_type) ? TRADE_TYPES.TURBOS.SHORT : TRADE_TYPES.VANILLA.CALL + ) || + filterByContractType( + p.contract_info, + isTurbosContract(contract_type) ? TRADE_TYPES.TURBOS.LONG : TRADE_TYPES.VANILLA.PUT + ) + : filterByContractType(p.contract_info, contract_type)) + ); + + // Get IDs of closed positions to auto-remove + const closed_positions_ids = + filtered_positions && + filtered_positions.filter(position => position.contract_info?.is_sold).map(p => p.contract_info.contract_id); + + // Automatically remove closed positions after 8 seconds + React.useEffect(() => { + closed_positions_ids.map(positionId => { + const timeout = setTimeout(() => { + onClickRemove(positionId); + }, 8000); + + return () => clearTimeout(timeout); + }); + }, [closed_positions_ids, onClickRemove]); + if (!symbol || !active_symbols.length || !chartData || !chartData.tradingTimes) return null; + return ( Date: Thu, 23 Oct 2025 17:22:19 +0800 Subject: [PATCH 2/3] chore: remove pre-push file --- .husky/pre-push | 6 ------ 1 file changed, 6 deletions(-) delete mode 100755 .husky/pre-push diff --git a/.husky/pre-push b/.husky/pre-push deleted file mode 100755 index 45fe87d997..0000000000 --- a/.husky/pre-push +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - fi -# Check command line arguments in current process tree - fi -exit $? \ No newline at end of file From 76a5f00062c2912199cc21a40573ebb7e9ad9044 Mon Sep 17 00:00:00 2001 From: muhammad-ahmed Date: Fri, 24 Oct 2025 15:32:34 +0800 Subject: [PATCH 3/3] chore: remove duplicate entries on gitignore --- .gitignore | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitignore b/.gitignore index 7601a753c1..9cd6f76ea4 100644 --- a/.gitignore +++ b/.gitignore @@ -44,9 +44,5 @@ cline_instructions.md .claude-instructions.md # AI Tool Configuration Files -.cursorrules -.clinerules .roo-config.json -.chatgpt-instructions.md -.claude-instructions.md .ai-rules.md \ No newline at end of file