diff --git a/geneit_app/.gitignore b/geneit_app/.gitignore index 4d29575..800f3a8 100644 --- a/geneit_app/.gitignore +++ b/geneit_app/.gitignore @@ -10,6 +10,7 @@ # production /build +/dist # misc .DS_Store diff --git a/geneit_app/package-lock.json b/geneit_app/package-lock.json index 9898f1a..9e70aee 100644 --- a/geneit_app/package-lock.json +++ b/geneit_app/package-lock.json @@ -28,7 +28,6 @@ "@vitejs/plugin-react": "^4.2.1", "date-and-time": "^3.0.1", "email-validator": "^2.0.4", - "family-chart": "^0.0.0-beta-1", "filesize": "^10.0.9", "jspdf": "^2.5.1", "react": "^18.2.0", @@ -2431,7 +2430,9 @@ "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/convert-source-map": { "version": "2.0.0", @@ -2501,314 +2502,6 @@ "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", "license": "MIT" }, - "node_modules/d3": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/d3/-/d3-6.7.0.tgz", - "integrity": "sha512-hNHRhe+yCDLUG6Q2LwvR/WdNFPOJQ5VWqsJcwIYVeI401+d2/rrCjxSXkiAdIlpx7/73eApFB4Olsmh3YN7a6g==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-array": "2", - "d3-axis": "2", - "d3-brush": "2", - "d3-chord": "2", - "d3-color": "2", - "d3-contour": "2", - "d3-delaunay": "5", - "d3-dispatch": "2", - "d3-drag": "2", - "d3-dsv": "2", - "d3-ease": "2", - "d3-fetch": "2", - "d3-force": "2", - "d3-format": "2", - "d3-geo": "2", - "d3-hierarchy": "2", - "d3-interpolate": "2", - "d3-path": "2", - "d3-polygon": "2", - "d3-quadtree": "2", - "d3-random": "2", - "d3-scale": "3", - "d3-scale-chromatic": "2", - "d3-selection": "2", - "d3-shape": "2", - "d3-time": "2", - "d3-time-format": "3", - "d3-timer": "2", - "d3-transition": "2", - "d3-zoom": "2" - } - }, - "node_modules/d3-array": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz", - "integrity": "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==", - "license": "BSD-3-Clause", - "dependencies": { - "internmap": "^1.0.0" - } - }, - "node_modules/d3-axis": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-2.1.0.tgz", - "integrity": "sha512-z/G2TQMyuf0X3qP+Mh+2PimoJD41VOCjViJzT0BHeL/+JQAofkiWZbWxlwFGb1N8EN+Cl/CW+MUKbVzr1689Cw==", - "license": "BSD-3-Clause" - }, - "node_modules/d3-brush": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-2.1.0.tgz", - "integrity": "sha512-cHLLAFatBATyIKqZOkk/mDHUbzne2B3ZwxkzMHvFTCZCmLaXDpZRihQSn8UNXTkGD/3lb/W2sQz0etAftmHMJQ==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-dispatch": "1 - 2", - "d3-drag": "2", - "d3-interpolate": "1 - 2", - "d3-selection": "2", - "d3-transition": "2" - } - }, - "node_modules/d3-chord": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-chord/-/d3-chord-2.0.0.tgz", - "integrity": "sha512-D5PZb7EDsRNdGU4SsjQyKhja8Zgu+SHZfUSO5Ls8Wsn+jsAKUUGkcshLxMg9HDFxG3KqavGWaWkJ8EpU8ojuig==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-path": "1 - 2" - } - }, - "node_modules/d3-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-2.0.0.tgz", - "integrity": "sha512-SPXi0TSKPD4g9tw0NMZFnR95XVgUZiBH+uUTqQuDu1OsE2zomHU7ho0FISciaPvosimixwHFl3WHLGabv6dDgQ==", - "license": "BSD-3-Clause" - }, - "node_modules/d3-contour": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-contour/-/d3-contour-2.0.0.tgz", - "integrity": "sha512-9unAtvIaNk06UwqBmvsdHX7CZ+NPDZnn8TtNH1myW93pWJkhsV25JcgnYAu0Ck5Veb1DHiCv++Ic5uvJ+h50JA==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-array": "2" - } - }, - "node_modules/d3-delaunay": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-5.3.0.tgz", - "integrity": "sha512-amALSrOllWVLaHTnDLHwMIiz0d1bBu9gZXd1FiLfXf8sHcX9jrcj81TVZOqD4UX7MgBZZ07c8GxzEgBpJqc74w==", - "license": "ISC", - "dependencies": { - "delaunator": "4" - } - }, - "node_modules/d3-dispatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-2.0.0.tgz", - "integrity": "sha512-S/m2VsXI7gAti2pBoLClFFTMOO1HTtT0j99AuXLoGFKO6deHDdnv6ZGTxSTTUTgO1zVcv82fCOtDjYK4EECmWA==", - "license": "BSD-3-Clause" - }, - "node_modules/d3-drag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-2.0.0.tgz", - "integrity": "sha512-g9y9WbMnF5uqB9qKqwIIa/921RYWzlUDv9Jl1/yONQwxbOfszAWTCm8u7HOTgJgRDXiRZN56cHT9pd24dmXs8w==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-dispatch": "1 - 2", - "d3-selection": "2" - } - }, - "node_modules/d3-dsv": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-2.0.0.tgz", - "integrity": "sha512-E+Pn8UJYx9mViuIUkoc93gJGGYut6mSDKy2+XaPwccwkRGlR+LO97L2VCCRjQivTwLHkSnAJG7yo00BWY6QM+w==", - "license": "BSD-3-Clause", - "dependencies": { - "commander": "2", - "iconv-lite": "0.4", - "rw": "1" - }, - "bin": { - "csv2json": "bin/dsv2json", - "csv2tsv": "bin/dsv2dsv", - "dsv2dsv": "bin/dsv2dsv", - "dsv2json": "bin/dsv2json", - "json2csv": "bin/json2dsv", - "json2dsv": "bin/json2dsv", - "json2tsv": "bin/json2dsv", - "tsv2csv": "bin/dsv2dsv", - "tsv2json": "bin/dsv2json" - } - }, - "node_modules/d3-ease": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-2.0.0.tgz", - "integrity": "sha512-68/n9JWarxXkOWMshcT5IcjbB+agblQUaIsbnXmrzejn2O82n3p2A9R2zEB9HIEFWKFwPAEDDN8gR0VdSAyyAQ==", - "license": "BSD-3-Clause" - }, - "node_modules/d3-fetch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-fetch/-/d3-fetch-2.0.0.tgz", - "integrity": "sha512-TkYv/hjXgCryBeNKiclrwqZH7Nb+GaOwo3Neg24ZVWA3MKB+Rd+BY84Nh6tmNEMcjUik1CSUWjXYndmeO6F7sw==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-dsv": "1 - 2" - } - }, - "node_modules/d3-force": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-2.1.1.tgz", - "integrity": "sha512-nAuHEzBqMvpFVMf9OX75d00OxvOXdxY+xECIXjW6Gv8BRrXu6gAWbv/9XKrvfJ5i5DCokDW7RYE50LRoK092ew==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-dispatch": "1 - 2", - "d3-quadtree": "1 - 2", - "d3-timer": "1 - 2" - } - }, - "node_modules/d3-format": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-2.0.0.tgz", - "integrity": "sha512-Ab3S6XuE/Q+flY96HXT0jOXcM4EAClYFnRGY5zsjRGNy6qCYrQsMffs7cV5Q9xejb35zxW5hf/guKw34kvIKsA==", - "license": "BSD-3-Clause" - }, - "node_modules/d3-geo": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-2.0.2.tgz", - "integrity": "sha512-8pM1WGMLGFuhq9S+FpPURxic+gKzjluCD/CHTuUF3mXMeiCo0i6R0tO1s4+GArRFde96SLcW/kOFRjoAosPsFA==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-array": "^2.5.0" - } - }, - "node_modules/d3-hierarchy": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-2.0.0.tgz", - "integrity": "sha512-SwIdqM3HxQX2214EG9GTjgmCc/mbSx4mQBn+DuEETubhOw6/U3fmnji4uCVrmzOydMHSO1nZle5gh6HB/wdOzw==", - "license": "BSD-3-Clause" - }, - "node_modules/d3-interpolate": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-2.0.1.tgz", - "integrity": "sha512-c5UhwwTs/yybcmTpAVqwSFl6vrQ8JZJoT5F7xNFK9pymv5C0Ymcc9/LIJHtYIggg/yS9YHw8i8O8tgb9pupjeQ==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-color": "1 - 2" - } - }, - "node_modules/d3-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-2.0.0.tgz", - "integrity": "sha512-ZwZQxKhBnv9yHaiWd6ZU4x5BtCQ7pXszEV9CU6kRgwIQVQGLMv1oiL4M+MK/n79sYzsj+gcgpPQSctJUsLN7fA==", - "license": "BSD-3-Clause" - }, - "node_modules/d3-polygon": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-polygon/-/d3-polygon-2.0.0.tgz", - "integrity": "sha512-MsexrCK38cTGermELs0cO1d79DcTsQRN7IWMJKczD/2kBjzNXxLUWP33qRF6VDpiLV/4EI4r6Gs0DAWQkE8pSQ==", - "license": "BSD-3-Clause" - }, - "node_modules/d3-quadtree": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-2.0.0.tgz", - "integrity": "sha512-b0Ed2t1UUalJpc3qXzKi+cPGxeXRr4KU9YSlocN74aTzp6R/Ud43t79yLLqxHRWZfsvWXmbDWPpoENK1K539xw==", - "license": "BSD-3-Clause" - }, - "node_modules/d3-random": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-2.2.2.tgz", - "integrity": "sha512-0D9P8TRj6qDAtHhRQn6EfdOtHMfsUWanl3yb/84C4DqpZ+VsgfI5iTVRNRbELCfNvRfpMr8OrqqUTQ6ANGCijw==", - "license": "BSD-3-Clause" - }, - "node_modules/d3-scale": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-3.3.0.tgz", - "integrity": "sha512-1JGp44NQCt5d1g+Yy+GeOnZP7xHo0ii8zsQp6PGzd+C1/dl0KGsp9A7Mxwp+1D1o4unbTTxVdU/ZOIEBoeZPbQ==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-array": "^2.3.0", - "d3-format": "1 - 2", - "d3-interpolate": "1.2.0 - 2", - "d3-time": "^2.1.1", - "d3-time-format": "2 - 3" - } - }, - "node_modules/d3-scale-chromatic": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-2.0.0.tgz", - "integrity": "sha512-LLqy7dJSL8yDy7NRmf6xSlsFZ6zYvJ4BcWFE4zBrOPnQERv9zj24ohnXKRbyi9YHnYV+HN1oEO3iFK971/gkzA==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-color": "1 - 2", - "d3-interpolate": "1 - 2" - } - }, - "node_modules/d3-selection": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-2.0.0.tgz", - "integrity": "sha512-XoGGqhLUN/W14NmaqcO/bb1nqjDAw5WtSYb2X8wiuQWvSZUsUVYsOSkOybUrNvcBjaywBdYPy03eXHMXjk9nZA==", - "license": "BSD-3-Clause" - }, - "node_modules/d3-shape": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-2.1.0.tgz", - "integrity": "sha512-PnjUqfM2PpskbSLTJvAzp2Wv4CZsnAgTfcVRTwW03QR3MkXF8Uo7B1y/lWkAsmbKwuecto++4NlsYcvYpXpTHA==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-path": "1 - 2" - } - }, - "node_modules/d3-time": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-2.1.1.tgz", - "integrity": "sha512-/eIQe/eR4kCQwq7yxi7z4c6qEXf2IYGcjoWB5OOQy4Tq9Uv39/947qlDcN2TLkiTzQWzvnsuYPB9TrWaNfipKQ==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-array": "2" - } - }, - "node_modules/d3-time-format": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-3.0.0.tgz", - "integrity": "sha512-UXJh6EKsHBTjopVqZBhFysQcoXSv/5yLONZvkQ5Kk3qbwiUYkdX17Xa1PT6U1ZWXGGfB1ey5L8dKMlFq2DO0Ag==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-time": "1 - 2" - } - }, - "node_modules/d3-timer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-2.0.0.tgz", - "integrity": "sha512-TO4VLh0/420Y/9dO3+f9abDEFYeCUr2WZRlxJvbp4HPTQcSylXNiL6yZa9FIUvV1yRiFufl1bszTCLDqv9PWNA==", - "license": "BSD-3-Clause" - }, - "node_modules/d3-transition": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-2.0.0.tgz", - "integrity": "sha512-42ltAGgJesfQE3u9LuuBHNbGrI/AJjNL2OAUdclE70UE6Vy239GCBEYD38uBPoLeNsOhFStGpPI0BAOV+HMxog==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-color": "1 - 2", - "d3-dispatch": "1 - 2", - "d3-ease": "1 - 2", - "d3-interpolate": "1 - 2", - "d3-timer": "1 - 2" - }, - "peerDependencies": { - "d3-selection": "2" - } - }, - "node_modules/d3-zoom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-2.0.0.tgz", - "integrity": "sha512-fFg7aoaEm9/jf+qfstak0IYpnesZLiMX6GZvXtUSdv8RH2o4E2qeelgdU09eKS6wGuiGMfcnMI0nTIqWzRHGpw==", - "license": "BSD-3-Clause", - "dependencies": { - "d3-dispatch": "1 - 2", - "d3-drag": "2", - "d3-interpolate": "1 - 2", - "d3-selection": "2", - "d3-transition": "2" - } - }, "node_modules/date-and-time": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/date-and-time/-/date-and-time-3.0.3.tgz", @@ -2895,12 +2588,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/delaunator": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-4.0.1.tgz", - "integrity": "sha512-WNPWi1IRKZfCt/qIDMfERkDp93+iZEmOxN2yy4Jg+Xhv8SLk2UTqqbe1sfiipn0and9QrE914/ihdx82Y/Giag==", - "license": "ISC" - }, "node_modules/diff-sequences": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz", @@ -3034,15 +2721,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/family-chart": { - "version": "0.0.0-beta-1", - "resolved": "https://registry.npmjs.org/family-chart/-/family-chart-0.0.0-beta-1.tgz", - "integrity": "sha512-3YqXXum40xQBPagXan4Hpg71cO09FB5BVm2S/AUOggvF1x6/4PDlwRkZTDJ6OkbZNlR7GnyD2zphUgTfE2FTVg==", - "license": "ISC", - "dependencies": { - "d3": "6" - } - }, "node_modules/fflate": { "version": "0.4.8", "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.4.8.tgz", @@ -3272,18 +2950,6 @@ "node": ">=8.0.0" } }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -3323,12 +2989,6 @@ "node": ">= 0.4" } }, - "node_modules/internmap": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/internmap/-/internmap-1.0.1.tgz", - "integrity": "sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==", - "license": "ISC" - }, "node_modules/is-arguments": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", @@ -4277,18 +3937,6 @@ "node": ">= 0.8.15" } }, - "node_modules/rw": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", - "integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==", - "license": "BSD-3-Clause" - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "license": "MIT" - }, "node_modules/scheduler": { "version": "0.23.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", diff --git a/geneit_app/package.json b/geneit_app/package.json index 15aff34..6393d77 100644 --- a/geneit_app/package.json +++ b/geneit_app/package.json @@ -24,7 +24,6 @@ "@vitejs/plugin-react": "^4.2.1", "date-and-time": "^3.0.1", "email-validator": "^2.0.4", - "family-chart": "^0.0.0-beta-1", "filesize": "^10.0.9", "jspdf": "^2.5.1", "react": "^18.2.0", diff --git a/geneit_app/src/@types/family_chart.d.ts b/geneit_app/src/@types/family_chart.d.ts deleted file mode 100644 index 272e3bf..0000000 --- a/geneit_app/src/@types/family_chart.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -declare module "family-chart" { - type f3data = any; - type f3tree = any; - - interface f3Rels { - spouses?: string[]; - father?: string; - mother?: string; - children?: string[]; - } - - interface f3DataData { - gender: "M" | "F"; - avatar?: string; - dead: boolean; - birthday?: string; - deathday?: string; - first_name: string; - last_name: string; - dateOfWedding?: string; - wedding_state?: string; - } - - interface f3Data { - id: string; - rels: f3Rels; - data: f3DataData; - } - - type f3State = { - data: f3Data[]; - main_id?: any; - tree?: f3tree; - node_separation?: number; - level_separation?: number; - }; - - interface f3Update { - tree: (props) => void; - mainId: (mainId) => void; - data: (data: f3data) => void; - } - - interface f3Store { - state: f3State; - update: f3update; - getData: () => f3data; - getTree: () => f3tree; - setOnUpdate: (cb: (props) => void) => void; - methods: any; - } - - function createStore(initial_state: f3State): f3Store; - - function CalculateTree({ - data_stash, - main_id = null, - is_vertical = true, - node_separation = 250, - level_separation = 150, - }); - - function d3AnimationView(p: { - store: f3Store; - cont: HTMLElement | null; - Card?: any; - }); - - const handlers: any; - - type F3elements = { - Card: (props: { - store: f3Store; - svg: HTMLElement; - mini_tree: boolean; - link_break: boolean; - cardEditForm?: boolean; - card_dim: { - w: number; - h: number; - text_x: number; - text_y: number; - img_w: number; - img_h: number; - img_x: number; - img_y: number; - }; - card_display: ((data: f3Data) => string)[]; - }) => F3CardBuilder; - }; - - type F3CardBuilder = (p: { node; d }) => HTMLElement; - - const elements: F3elements; -} diff --git a/geneit_app/src/routes/family/FamilyMemberTreeRoute.tsx b/geneit_app/src/routes/family/FamilyMemberTreeRoute.tsx index 8939e74..faa24b6 100644 --- a/geneit_app/src/routes/family/FamilyMemberTreeRoute.tsx +++ b/geneit_app/src/routes/family/FamilyMemberTreeRoute.tsx @@ -31,7 +31,6 @@ import { SimpleFamilyTree } from "../../widgets/simple_family_tree/SimpleFamilyT enum CurrTab { BasicTree, SimpleTree, - AdvancedTree, } enum TreeMode { @@ -148,7 +147,6 @@ export function FamilyMemberTreeRoute(): React.ReactElement { > - {/**/} @@ -156,14 +154,8 @@ export function FamilyMemberTreeRoute(): React.ReactElement { {currTab === CurrTab.BasicTree ? ( - ) : currTab === CurrTab.SimpleTree ? ( - ) : ( - <>unimplemented /**/ + )} diff --git a/geneit_app/src/widgets/complex_family_tree/ComplexFamilyTree.tsx b/geneit_app/src/widgets/complex_family_tree/ComplexFamilyTree.tsx deleted file mode 100644 index 75e6736..0000000 --- a/geneit_app/src/widgets/complex_family_tree/ComplexFamilyTree.tsx +++ /dev/null @@ -1,339 +0,0 @@ -import { mdiXml } from "@mdi/js"; -import Icon from "@mdi/react"; -import PictureAsPdfIcon from "@mui/icons-material/PictureAsPdf"; -import { IconButton, Tooltip } from "@mui/material"; -import "family-chart"; -import { jsPDF } from "jspdf"; -import React from "react"; -import "svg2pdf.js"; -import { Couple } from "../../api/CoupleApi"; -import { Member, fmtDate } from "../../api/MemberApi"; -import { useDarkTheme } from "../../hooks/context_providers/DarkThemeProvider"; -import { - FamilyTreeNode, - getAvailableMembers, - treeHeight, - treeWidth, -} from "../../utils/family_tree"; -import { downloadBlob } from "../../utils/files_utils"; -import "./family-chart.css"; - -export function ComplexFamilyTree(p: { - tree: FamilyTreeNode; - isUp: boolean; - depth: number; -}): React.ReactElement { - const darkTheme = useDarkTheme(); - console.log(f3); - const applyTree = (container: HTMLDivElement) => { - if (!container) return; - - const store = f3.createStore({ - data: treeToF3Data(p.tree, p.isUp, p.depth), - node_separation: 250, - level_separation: 150, - }); - const view = f3.d3AnimationView({ - store, - cont: container, - }); - const Card = f3.elements.Card({ - store, - svg: view.svg, - card_dim: { - w: 210, - h: 120, - text_x: 5, - text_y: 75, - img_w: 60, - img_h: 70, - img_x: 5, - img_y: 5, - }, - card_display: [ - (d) => - `${d.data.first_name || ""} ${d.data.last_name || ""} ${ - d.data.dead ? "✝" : "" - }`, - (d) => { - let birthDeath = []; - if (d.data.birthday) birthDeath.push(d.data.birthday); - if (d.data.deathday) birthDeath.push(d.data.deathday); - - let s = birthDeath.join(" -> "); - - if (d.data.wedding_state || d.data.dateOfWedding) { - let weddingInfo = []; - if (d.data.wedding_state) weddingInfo.push(d.data.wedding_state); - if (d.data.dateOfWedding) - weddingInfo.push("Mariage : " + d.data.dateOfWedding); - s += ` ${weddingInfo.join( - " - " - )}`; - } - - return s; - }, - ], - mini_tree: true, - link_break: false, - }); - - // Patch generated card - const PatchedCard: f3.F3CardBuilder = (p) => { - const res = Card(p); - - // Patch card colors for PDF export - res - .querySelector(".card-male") - ?.querySelector(".card-body-rect") - ?.setAttribute("fill", "#add8e6"); - res - .querySelector(".card-female") - ?.querySelector(".card-body-rect") - ?.setAttribute("fill", "#ffb6c1"); - - return res; - }; - - view.setCard(PatchedCard); - store.setOnUpdate((props) => view.update(props || {})); - store.update.tree({ initial: false, transition_time: 0 }); - }; - - const doExport = async (onlySVG: boolean) => { - const docWidth = treeWidth(p.tree) * 65; - const docHeight = treeHeight(p.tree) * 60; - console.info(`Tree w=${treeWidth(p.tree)} h=${treeHeight(p.tree)}`); - - // Clone the SVG to manipulate it - const container = document.createElement("div"); - container.classList.add("f3", "f3-export"); - container.style.width = docWidth + "px"; - container.style.height = docHeight + "px"; - document.body.appendChild(container); - applyTree(container); - - const target = container.children[0]; - - await new Promise((res) => setTimeout(() => res(null), 100)); - - // SVG manipulations (adaptations to export) - let dstSVG = target.innerHTML.replaceAll( - `UNKNOWN<`, `fill="#000">INCONNU<`); - - dstSVG = dstSVG.replaceAll( - `class="card-outline`, - `fill="transparent" class="card-outline` - ); - - dstSVG = dstSVG.replaceAll("✝", " "); - - // Download in SVG format - if (onlySVG) { - // Fix background color (first rect background) - dstSVG = dstSVG.replace( - `fill="transparent">`, - `fill="white">` - ); - - const blob = new Blob([`${dstSVG}`], { - type: "image/svg+xml", - }); - - downloadBlob(blob, "ArbreGenealogique.svg"); - - return; - } - - // Download in PDF format - //navigator.clipboard.writeText(dstSVG); - target.innerHTML = dstSVG; - - const doc = new jsPDF({ - orientation: "l", - format: [docHeight, docWidth], - }); - - await doc.svg(target, { - height: docHeight, - width: docWidth, - }); - - container.remove(); - - // Save the created pdf - doc.save("ArbreGenealogique.pdf"); - }; - - const exportPDF = () => doExport(false); - - const exportSVG = () => doExport(true); - - return ( -
-
- - - - - - - - - - -
-
-
- ); -} - -function treeToF3Data( - node: FamilyTreeNode, - isUp: boolean, - depth: number -): f3.f3Data[] { - const availableMembers = getAvailableMembers(node, depth); - - const list: f3.f3Data[] = []; - if (isUp) treeToF3DataUpRecurse(node, list, availableMembers); - else treeToF3DataDownRecurse(node, list, availableMembers); - return list; -} - -function memberData(m: Member, c?: Couple): f3.f3DataData { - return { - first_name: m.first_name ?? "_", - last_name: m.last_name ?? "_", - gender: m.sex ?? "M", - avatar: m.thumbnailURL ?? undefined, - dead: m.dead, - birthday: m.dateOfBirth ? fmtDate(m.dateOfBirth) : undefined, - deathday: m.dateOfDeath ? fmtDate(m.dateOfDeath) : undefined, - wedding_state: c?.stateFr, - dateOfWedding: c?.dateOfWedding ? fmtDate(c?.dateOfWedding) : undefined, - }; -} - -function treeToF3DataUpRecurse( - node: FamilyTreeNode, - array: f3.f3Data[], - availableMembers: Set, - child?: number, - spouses?: number[] -) { - if (!availableMembers.has(node.member.id)) return; - - array.push({ - data: memberData(node.member), - id: node.member.id.toString(), - rels: { - father: - node.member.father && availableMembers.has(node.member.father) - ? node.member.father.toString() - : undefined, - mother: - node.member.mother && availableMembers.has(node.member.mother) - ? node.member.mother.toString() - : undefined, - - spouses: spouses - ?.filter((c) => c !== node.member.id) - .map((c) => c.toString()), - children: child ? [child.toString()] : undefined, - }, - }); - - const parentSpouses = node.down?.map((c) => c.member.id); - - node.down?.forEach((d) => - treeToF3DataUpRecurse( - d, - array, - availableMembers, - node.member.id, - parentSpouses - ) - ); -} - -function treeToF3DataDownRecurse( - node: FamilyTreeNode, - array: f3.f3Data[], - availableMembers: Set -) { - if (!availableMembers.has(node.member.id)) return; - - // Get all members ids - let children = node?.down?.map((c) => c.member.id) ?? []; - node.couples?.map((c) => c.down.forEach((m) => children.push(m.member.id))); - - children = children.filter((c) => availableMembers.has(c)); - - array.push({ - data: memberData(node.member), - id: node.member.id.toString(), - rels: { - father: - node.member.father && availableMembers.has(node.member.father) - ? node.member.father.toString() - : undefined, - mother: - node.member.mother && availableMembers.has(node.member.mother) - ? node.member.mother.toString() - : undefined, - - spouses: node.couples - ?.filter((s) => availableMembers.has(s.member.id)) - .map((c) => c.member.id.toString()), - children: children.map((c) => c.toString()), - }, - }); - - node?.down?.forEach((e) => - treeToF3DataDownRecurse(e, array, availableMembers) - ); - - if (node.couples) { - for (const c of node.couples) { - if (!availableMembers.has(c.member.id)) continue; - array.push({ - data: memberData(c.member, c.couple), - id: c.member.id.toString(), - rels: { - father: - c.member.father && availableMembers.has(c.member.father) - ? c.member.father.toString() - : undefined, - mother: - c.member.mother && availableMembers.has(c.member.mother) - ? c.member.mother.toString() - : undefined, - spouses: [node.member.id.toString()], - children: c.down - .filter((c) => availableMembers.has(c.member.id)) - .map((c) => c.member.id.toString()), - }, - }); - - c.down.forEach((e) => - treeToF3DataDownRecurse(e, array, availableMembers) - ); - } - } -} diff --git a/geneit_app/src/widgets/complex_family_tree/family-chart.css b/geneit_app/src/widgets/complex_family_tree/family-chart.css deleted file mode 100644 index 08be3ec..0000000 --- a/geneit_app/src/widgets/complex_family_tree/family-chart.css +++ /dev/null @@ -1,111 +0,0 @@ -.f3 { - height: 700px; - max-height: calc(100vh - 80px); - width: 900px; - max-width: 100%; - margin: auto; - position: relative; -} - -.f3 .cursor-pointer { - cursor: pointer; -} - -.f3 svg.main_svg { - width: 100%; - height: 100%; - /*background-color: #3b5560;*/ - color: #3b5560; -} -.f3 svg.main_svg text { - fill: currentColor; -} -.f3 rect.card-female, -.f3 .card-female .card-body-rect, -.f3 .card-female .text-overflow-mask { - fill: lightpink; -} -.f3 rect.card-male, -.f3 .card-male .card-body-rect, -.f3 .card-male .text-overflow-mask { - fill: lightblue; -} -.f3 .card-genderless .card-body-rect, -.f3 .card-genderless .text-overflow-mask { - fill: lightgray; -} -.f3 .card_add .card-body-rect { - fill: #3b5560; - stroke-width: 4px; - stroke: #fff; - cursor: pointer; -} -.f3 g.card_add text { - fill: #fff; -} -.f3 .card-main { - stroke: #000; -} -.f3 .card_family_tree rect { - transition: 0.3s; -} -.f3 .card_family_tree:hover rect { - transform: scale(1.1); -} -.f3 .card_add_relative { - cursor: pointer; - color: #fff; - transition: 0.3s; -} -.f3 .card_add_relative circle { - fill: rgba(0, 0, 0, 0); -} -.f3 .card_add_relative:hover { - color: black; -} -.f3 .card_edit.pencil_icon { - color: #fff; - transition: 0.3s; -} -.f3 .card_edit.pencil_icon:hover { - color: black; -} -.f3 .card_break_link, -.f3 .link_upper, -.f3 .link_lower, -.f3 .link_particles { - transform-origin: 50% 50%; - transition: 1s; -} -.f3 .card_break_link { - color: #fff; -} -.f3 .card_break_link.closed .link_upper { - transform: translate(-140.5px, 655.6px); -} -.f3 .card_break_link.closed .link_upper g { - transform: rotate(-58deg); -} -.f3 .card_break_link.closed .link_particles { - transform: scale(0); -} -.f3 .input-field input { - height: 2.5rem !important; -} -.f3 .input-field > label:not(.label-icon).active { - -webkit-transform: translateY(-8px) scale(0.8); - transform: translateY(-8px) scale(0.8); -} - -.f3-light .link { - stroke: black; -} - -.f3-export { - position: fixed; - top: 0px; - left: 0px; - /*width: 3508px; - height: 2480px;*/ - opacity: 0; -} diff --git a/geneit_app/upload_bucket.sh b/geneit_app/upload_bucket.sh index 2b4245f..2409e4e 100644 --- a/geneit_app/upload_bucket.sh +++ b/geneit_app/upload_bucket.sh @@ -13,4 +13,4 @@ if [ ! "$DRONE_COMMIT_BRANCH" == "master" ]; then exit 0 fi -cd build && aws --endpoint-url https://s3.communiquons.org s3 sync . s3://geneit-app +cd dist && aws --endpoint-url https://s3.communiquons.org s3 sync . s3://geneit-app diff --git a/geneit_app/vite.config.ts b/geneit_app/vite.config.ts index 81c543f..61c21e6 100644 --- a/geneit_app/vite.config.ts +++ b/geneit_app/vite.config.ts @@ -1,7 +1,6 @@ import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; import viteTsconfigPaths from "vite-tsconfig-paths"; -import { resolve } from "path"; export default defineConfig({ // depending on your application, base can also be "/" @@ -13,9 +12,4 @@ export default defineConfig({ // this sets a default port to 3000 port: 3000, }, - resolve: { - alias: { - "family-chart": resolve(__dirname, "src"), - }, - }, });