diff --git a/frontends/nextjs/package-lock.json b/frontends/nextjs/package-lock.json index fb10f5486..9e7b60883 100644 --- a/frontends/nextjs/package-lock.json +++ b/frontends/nextjs/package-lock.json @@ -64,8 +64,10 @@ "eslint-plugin-react": "^7.37.5", "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.26", + "eslint-plugin-simple-import-sort": "^12.1.1", "globals": "^16.5.0", "jsdom": "^27.3.0", + "prettier": "^3.4.2", "prisma": "^7.2.0", "sass": "^1.97.1", "typescript": "~5.9.3", @@ -328,7 +330,6 @@ "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.958.0.tgz", "integrity": "sha512-ol8Sw37AToBWb6PjRuT/Wu40SrrZSA0N4F7U3yTkjUNX0lirfO1VFLZ0hZtZplVJv8GNPITbiczxQ8VjxESXxg==", "license": "Apache-2.0", - "peer": true, "dependencies": { "@aws-crypto/sha1-browser": "5.2.0", "@aws-crypto/sha256-browser": "5.2.0", @@ -1349,7 +1350,6 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=18" }, @@ -1393,7 +1393,6 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=18" } @@ -1403,8 +1402,7 @@ "resolved": "https://registry.npmjs.org/@electric-sql/pglite/-/pglite-0.3.2.tgz", "integrity": "sha512-zfWWa+V2ViDCY/cmUfRqeWY1yLto+EpxjXnZzenB1TyxsTiXaTWeZFIZw6mac52BsuQm0RjCnisjBtdBaXOI6w==", "devOptional": true, - "license": "Apache-2.0", - "peer": true + "license": "Apache-2.0" }, "node_modules/@electric-sql/pglite-socket": { "version": "0.0.6", @@ -1497,7 +1495,6 @@ "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.14.0.tgz", "integrity": "sha512-O000MLDBDdk/EohJPFUqvnp4qnHeYkVP5B0xEG0D/L7cOKP9kefu2DXn8dj74cQfsEzUqh+sr1RzFqiL1o+PpA==", "license": "MIT", - "peer": true, "dependencies": { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.13.5", @@ -1541,7 +1538,6 @@ "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.14.1.tgz", "integrity": "sha512-qEEJt42DuToa3gurlH4Qqc1kVpNq8wO8cJtDzU46TjlzWjDlsVyevtYCRijVq3SrHsROS+gVQ8Fnea108GnKzw==", "license": "MIT", - "peer": true, "dependencies": { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.13.5", @@ -2848,7 +2844,6 @@ "resolved": "https://registry.npmjs.org/@mui/material/-/material-7.3.6.tgz", "integrity": "sha512-R4DaYF3dgCQCUAkr4wW1w26GHXcf5rCmBRHVBuuvJvaGLmZdD8EjatP80Nz5JCw0KxORAzwftnHzXVnjR8HnFw==", "license": "MIT", - "peer": true, "dependencies": { "@babel/runtime": "^7.28.4", "@mui/core-downloads-tracker": "^7.3.6", @@ -2959,7 +2954,6 @@ "resolved": "https://registry.npmjs.org/@mui/system/-/system-7.3.6.tgz", "integrity": "sha512-8fehAazkHNP1imMrdD2m2hbA9sl7Ur6jfuNweh5o4l9YPty4iaZzRXqYvBCWQNwFaSHmMEj2KPbyXGp7Bt73Rg==", "license": "MIT", - "peer": true, "dependencies": { "@babel/runtime": "^7.28.4", "@mui/private-theming": "^7.3.6", @@ -3448,7 +3442,6 @@ "resolved": "https://registry.npmjs.org/@octokit/core/-/core-7.0.6.tgz", "integrity": "sha512-DhGl4xMVFGVIyMwswXeyzdL4uXD5OGILGX5N8Y+f6W7LhC1Ze2poSNrkF/fedpVDHEEZ+PHFW0vL14I+mm8K3Q==", "license": "MIT", - "peer": true, "dependencies": { "@octokit/auth-token": "^6.0.0", "@octokit/graphql": "^9.0.3", @@ -3994,7 +3987,6 @@ "integrity": "sha512-6TyEnHgd6SArQO8UO2OMTxshln3QMWBtPGrOCgs3wVEmQmwyuNtB10IZMfmYDE0riwNR1cu4q+pPcxMVtaG3TA==", "devOptional": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "playwright": "1.57.0" }, @@ -4110,6 +4102,20 @@ "url": "https://dotenvx.com" } }, + "node_modules/@prisma/config/node_modules/magicast": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.5.tgz", + "integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@babel/parser": "^7.25.4", + "@babel/types": "^7.25.4", + "source-map-js": "^1.2.0" + } + }, "node_modules/@prisma/debug": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-7.2.0.tgz", @@ -5578,7 +5584,6 @@ "integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", @@ -5734,7 +5739,6 @@ "integrity": "sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA==", "devOptional": true, "license": "MIT", - "peer": true, "dependencies": { "undici-types": "~7.16.0" } @@ -5756,7 +5760,6 @@ "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz", "integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==", "license": "MIT", - "peer": true, "dependencies": { "csstype": "^3.2.2" } @@ -5767,7 +5770,6 @@ "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", "dev": true, "license": "MIT", - "peer": true, "peerDependencies": { "@types/react": "^19.2.0" } @@ -5786,7 +5788,8 @@ "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", "license": "MIT", - "optional": true + "optional": true, + "peer": true }, "node_modules/@types/use-sync-external-store": { "version": "0.0.6", @@ -5839,7 +5842,6 @@ "integrity": "sha512-hM5faZwg7aVNa819m/5r7D0h0c9yC4DUlWAOvHAtISdFTc8xB86VmX5Xqabrama3wIPJ/q9RbGS1worb6JfnMg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.50.1", "@typescript-eslint/types": "8.50.1", @@ -6243,7 +6245,6 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -7418,7 +7419,6 @@ "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz", "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", "license": "ISC", - "peer": true, "engines": { "node": ">=12" } @@ -7576,7 +7576,6 @@ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", "license": "MIT", - "peer": true, "funding": { "type": "github", "url": "https://github.com/sponsors/kossnocorp" @@ -7799,6 +7798,7 @@ "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.7.tgz", "integrity": "sha512-WhL/YuveyGXJaerVlMYGWhvQswa7myDG17P7Vu65EWC05o8vfeNbvNf4d/BOvH99+ZW+LlQsc1GDKMa1vNK6dw==", "license": "(MPL-2.0 OR Apache-2.0)", + "peer": true, "optionalDependencies": { "@types/trusted-types": "^2.0.7" } @@ -8153,7 +8153,6 @@ "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -8282,6 +8281,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/eslint-plugin-simple-import-sort": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-12.1.1.tgz", + "integrity": "sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "eslint": ">=5.0.0" + } + }, "node_modules/eslint-scope": { "version": "8.4.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", @@ -8640,7 +8649,6 @@ "resolved": "https://registry.npmjs.org/fengari/-/fengari-0.1.5.tgz", "integrity": "sha512-0DS4Nn4rV8qyFlQCpKK8brT61EUtswynrpfFTcgLErcilBIBskSMQ86fO2WVuybr14ywyKdRjv91FiRZwnEuvQ==", "license": "MIT", - "peer": true, "dependencies": { "readline-sync": "^1.4.10", "sprintf-js": "^1.1.3", @@ -9189,7 +9197,6 @@ "integrity": "sha512-BIdolzGpDO9MQ4nu3AUuDwHZZ+KViNm+EZ75Ae55eMXMqLVhDFqEMXxtUe9Qh8hjL+pIna/frs2j6Y2yD5Ua/g==", "devOptional": true, "license": "MIT", - "peer": true, "engines": { "node": ">=16.9.0" } @@ -9942,7 +9949,6 @@ "integrity": "sha512-mjzqwWRD9Y1J1KUi7W97Gja1bwOOM5Ug0EZ6UDK3xS7j7mndrkwozHtSblfomlzyB4NepioNt+B2sOSzczVgtQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@acemir/cssom": "^0.9.28", "@asamuzakjp/dom-selector": "^6.7.6", @@ -10362,6 +10368,7 @@ "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.55.1.tgz", "integrity": "sha512-jz4x+TJNFHwHtwuV9vA9rMujcZRb0CEilTEwG2rRSpe/A7Jdkuj8xPKttCgOh+v/lkHy7HsZ64oj+q3xoAFl9A==", "license": "MIT", + "peer": true, "dependencies": { "dompurify": "3.2.7", "marked": "14.0.0" @@ -10372,6 +10379,7 @@ "resolved": "https://registry.npmjs.org/marked/-/marked-14.0.0.tgz", "integrity": "sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ==", "license": "MIT", + "peer": true, "bin": { "marked": "bin/marked.js" }, @@ -10522,7 +10530,6 @@ "resolved": "https://registry.npmjs.org/next/-/next-16.1.1.tgz", "integrity": "sha512-QI+T7xrxt1pF6SQ/JYFz95ro/mg/1Znk5vBebsWwbpejj1T0A23hO7GYEaVac9QUOT2BIMiuzm0L99ooq7k0/w==", "license": "MIT", - "peer": true, "dependencies": { "@next/env": "16.1.1", "@swc/helpers": "0.5.15", @@ -11150,6 +11157,22 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz", + "integrity": "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-format": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", @@ -11192,7 +11215,6 @@ "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "@prisma/config": "7.2.0", "@prisma/dev": "0.17.0", @@ -11391,7 +11413,6 @@ "resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz", "integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==", "license": "MIT", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -11401,7 +11422,6 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz", "integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==", "license": "MIT", - "peer": true, "dependencies": { "scheduler": "^0.27.0" }, @@ -11426,7 +11446,6 @@ "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.69.0.tgz", "integrity": "sha512-yt6ZGME9f4F6WHwevrvpAjh42HMvocuSnSIHUGycBqXIJdhqGSPQzTpGF+1NLREk/58IdPxEMfPcFCjlMhclGw==", "license": "MIT", - "peer": true, "engines": { "node": ">=18.0.0" }, @@ -11442,15 +11461,13 @@ "version": "19.2.3", "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.3.tgz", "integrity": "sha512-qJNJfu81ByyabuG7hPFEbXqNcWSU3+eVus+KJs+0ncpGfMyYdvSmxiJxbWR65lYi1I+/0HBcliO029gc4F+PnA==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/react-redux": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz", "integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==", "license": "MIT", - "peer": true, "dependencies": { "@types/use-sync-external-store": "^0.0.6", "use-sync-external-store": "^1.4.0" @@ -11557,8 +11574,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/redux-thunk": { "version": "3.1.0", @@ -11841,7 +11857,6 @@ "integrity": "sha512-uf6HoO8fy6ClsrShvMgaKUn14f2EHQLQRtpsZZLeU/Mv0Q1K5P0+x2uvH6Cub39TVVbWNSrraUhDAoFph6vh0A==", "devOptional": true, "license": "MIT", - "peer": true, "dependencies": { "chokidar": "^4.0.0", "immutable": "^5.0.2", @@ -12648,7 +12663,6 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -12927,7 +12941,6 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "devOptional": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -13096,7 +13109,6 @@ "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.0.tgz", "integrity": "sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg==", "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.27.0", "fdir": "^6.5.0", @@ -13202,7 +13214,6 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -13244,7 +13255,6 @@ "integrity": "sha512-E4t7DJ9pESL6E3I8nFjPa4xGUd3PmiWDLsDztS2qXSJWfHtbQnwAWylaBvSNY48I3vr8PTqIZlyK8TE3V3CA4Q==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@vitest/expect": "4.0.16", "@vitest/mocker": "4.0.16", diff --git a/frontends/nextjs/src/components/ui-page-renderer/UIPageRenderer.tsx b/frontends/nextjs/src/components/ui-page-renderer/UIPageRenderer.tsx index 09bbf0596..78d898678 100644 --- a/frontends/nextjs/src/components/ui-page-renderer/UIPageRenderer.tsx +++ b/frontends/nextjs/src/components/ui-page-renderer/UIPageRenderer.tsx @@ -2,7 +2,7 @@ import React from 'react' import { generateComponentTree } from '@/lib/lua/ui/generate-component-tree' -import type { UIPageData } from '@/lib/ui-pages/load-page-from-db' +import type { LuaActionHandler, UIPageData } from '@/lib/ui-pages/load-page-from-db' import type { LuaUIComponent } from '@/lib/lua/ui/types/lua-ui-package' interface UIPageRendererProps { @@ -32,7 +32,7 @@ export function UIPageRenderer({ pageData }: UIPageRendererProps) { * Context for action handlers * Components can access these via useUIPageActions hook */ -const UIPageActionsContext = React.createContext>({}) +const UIPageActionsContext = React.createContext>({}) /** * Hook to access page action handlers diff --git a/frontends/nextjs/src/components/ui/organisms/index.ts b/frontends/nextjs/src/components/ui/organisms/index.ts index bc14b477f..cb71659ac 100644 --- a/frontends/nextjs/src/components/ui/organisms/index.ts +++ b/frontends/nextjs/src/components/ui/organisms/index.ts @@ -89,8 +89,9 @@ export { NavigationSeparator, NavigationSpacer, NavigationTrigger, - useNavigationDropdown, } from './navigation/Navigation' +export type { NavigationItemType } from './navigation/utils/navigationConfig' +export { useNavigationDropdown } from './navigation/utils/navigationHelpers' // Alert Dialog export { diff --git a/frontends/nextjs/src/components/ui/organisms/navigation/Navigation.tsx b/frontends/nextjs/src/components/ui/organisms/navigation/Navigation.tsx index 49c950efc..293a4bb27 100644 --- a/frontends/nextjs/src/components/ui/organisms/navigation/Navigation.tsx +++ b/frontends/nextjs/src/components/ui/organisms/navigation/Navigation.tsx @@ -13,8 +13,6 @@ import { } from './NavigationMenuItems' import { NavigationMobileToggle } from './NavigationResponsive' import { NavigationBrand, NavigationSeparator, NavigationSpacer } from './NavigationStyling' -import { NavigationItemType } from './utils/navigationConfig' -import { useNavigationDropdown } from './utils/navigationHelpers' interface NavigationProps { children: ReactNode @@ -80,6 +78,4 @@ export { NavigationSeparator, NavigationSpacer, NavigationTrigger, - useNavigationDropdown, } -export type { NavigationItemType } diff --git a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/PaginationLink.tsx b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/PaginationLink.tsx index 4ec784389..0fae2e897 100644 --- a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/PaginationLink.tsx +++ b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/PaginationLink.tsx @@ -3,7 +3,7 @@ import { IconButton } from '@mui/material' import { forwardRef } from 'react' -import { type PaginationLinkProps, paginationSizeMap } from './paginationUtils' +import { type PaginationLinkProps, paginationSizeMap } from './paginationTypes' const PaginationLink = forwardRef( ({ children, onClick, isActive = false, disabled = false, size = 'medium', ...props }, ref) => { diff --git a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/PaginationNext.tsx b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/PaginationNext.tsx index d594fcdc1..4489ada3e 100644 --- a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/PaginationNext.tsx +++ b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/PaginationNext.tsx @@ -2,8 +2,9 @@ import { forwardRef } from 'react' +import { NextIcon } from './paginationIcons' import { PaginationLink } from './PaginationLink' -import { NextIcon, type PaginationLinkProps } from './paginationUtils' +import { type PaginationLinkProps } from './paginationTypes' const PaginationNext = forwardRef>( (props, ref) => { diff --git a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/PaginationPrevious.tsx b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/PaginationPrevious.tsx index 45b4ac5ca..da2380dc5 100644 --- a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/PaginationPrevious.tsx +++ b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/PaginationPrevious.tsx @@ -2,8 +2,9 @@ import { forwardRef } from 'react' +import { PreviousIcon } from './paginationIcons' import { PaginationLink } from './PaginationLink' -import { type PaginationLinkProps, PreviousIcon } from './paginationUtils' +import { type PaginationLinkProps } from './paginationTypes' const PaginationPrevious = forwardRef>( (props, ref) => { diff --git a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/SimplePagination.tsx b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/SimplePagination.tsx index dcac64a04..3e143ad9d 100644 --- a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/SimplePagination.tsx +++ b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/SimplePagination.tsx @@ -3,7 +3,7 @@ import { Box, IconButton, Typography } from '@mui/material' import { forwardRef } from 'react' -import { NextIcon, PreviousIcon } from './paginationUtils' +import { NextIcon, PreviousIcon } from './paginationIcons' interface SimplePaginationProps { hasPrevious: boolean diff --git a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/TablePagination.tsx b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/TablePagination.tsx index 725f9dd3e..e56869892 100644 --- a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/TablePagination.tsx +++ b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/TablePagination.tsx @@ -13,7 +13,7 @@ import { } from '@mui/material' import { forwardRef } from 'react' -import { NextIcon, PreviousIcon } from './paginationUtils' +import { NextIcon, PreviousIcon } from './paginationIcons' interface TablePaginationProps { count: number diff --git a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/index.ts b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/index.ts index 83ada71c1..accbabcb1 100644 --- a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/index.ts +++ b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/index.ts @@ -6,7 +6,7 @@ export { PaginationNext } from './PaginationNext' export { PaginationPrevious } from './PaginationPrevious' export type { PaginationProps } from './PaginationRoot' export { Pagination } from './PaginationRoot' -export type { PaginationLinkProps } from './paginationUtils' +export type { PaginationLinkProps } from './paginationTypes' export type { SimplePaginationProps } from './SimplePagination' export { SimplePagination } from './SimplePagination' export type { TablePaginationProps } from './TablePagination' diff --git a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/paginationIcons.tsx b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/paginationIcons.tsx new file mode 100644 index 000000000..ab556eb75 --- /dev/null +++ b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/paginationIcons.tsx @@ -0,0 +1,8 @@ +import ChevronLeftIcon from '@mui/icons-material/ChevronLeft' +import ChevronRightIcon from '@mui/icons-material/ChevronRight' + +const PreviousIcon = () => + +const NextIcon = () => + +export { NextIcon, PreviousIcon } diff --git a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/paginationTypes.ts b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/paginationTypes.ts new file mode 100644 index 000000000..8d364f949 --- /dev/null +++ b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/paginationTypes.ts @@ -0,0 +1,18 @@ +import { type ReactNode } from 'react' + +const paginationSizeMap = { + small: { minWidth: 28, height: 28 }, + medium: { minWidth: 36, height: 36 }, + large: { minWidth: 44, height: 44 }, +} as const + +interface PaginationLinkProps { + children: ReactNode + onClick?: () => void + isActive?: boolean + disabled?: boolean + size?: keyof typeof paginationSizeMap +} + +export { paginationSizeMap } +export type { PaginationLinkProps } diff --git a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/paginationUtils.tsx b/frontends/nextjs/src/components/ui/organisms/navigation/pagination/paginationUtils.tsx deleted file mode 100644 index e3e0f95bf..000000000 --- a/frontends/nextjs/src/components/ui/organisms/navigation/pagination/paginationUtils.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import ChevronLeftIcon from '@mui/icons-material/ChevronLeft' -import ChevronRightIcon from '@mui/icons-material/ChevronRight' -import { ReactNode } from 'react' - -interface PaginationLinkProps { - children: ReactNode - onClick?: () => void - isActive?: boolean - disabled?: boolean - size?: 'small' | 'medium' | 'large' -} - -const paginationSizeMap = { - small: { minWidth: 28, height: 28 }, - medium: { minWidth: 36, height: 36 }, - large: { minWidth: 44, height: 44 }, -} - -const PreviousIcon = () => - -const NextIcon = () => - -export { NextIcon, paginationSizeMap, PreviousIcon } -export type { PaginationLinkProps } diff --git a/frontends/nextjs/src/lib/ui-pages/load-page-from-db.ts b/frontends/nextjs/src/lib/ui-pages/load-page-from-db.ts index c742f0881..e0f1169d2 100644 --- a/frontends/nextjs/src/lib/ui-pages/load-page-from-db.ts +++ b/frontends/nextjs/src/lib/ui-pages/load-page-from-db.ts @@ -1,9 +1,11 @@ import { Database } from '@/lib/database' -import { executeLuaCode } from '@/lib/lua/functions/execution/execute-lua-code' import { createLuaEngine } from '@/lib/lua/engine/core/create-lua-engine' +import { executeLuaCode } from '@/lib/lua/functions/execution/execute-lua-code' import { normalizeLuaStructure } from '@/lib/lua/ui/normalize-lua-structure' -import type { JsonObject } from '@/types/utility-types' import type { UIPageRecord } from '@/lib/seed/import-ui-pages' +import type { JsonObject } from '@/types/utility-types' + +export type LuaActionHandler = (payload?: Record) => Promise /** * Load a UI page from database and optionally process with Lua @@ -24,7 +26,7 @@ export async function loadPageFromDB(path: string): Promise { // 2. Get associated Lua scripts if any (from actions field) let processedLayout = page.layout - const actionHandlers: Record = {} + const actionHandlers: Record = {} if (page.actions) { // Load Lua action handlers @@ -78,15 +80,15 @@ export async function loadPageFromDB(path: string): Promise { /** * Create a JavaScript wrapper for a Lua action handler */ -function createLuaActionHandler(luaCode: string, actionName: string): Function { - return async (...args: any[]) => { +function createLuaActionHandler(luaCode: string, actionName: string): LuaActionHandler { + return async (payload: Record = {}) => { const engine = createLuaEngine() try { const result = await executeLuaCode( engine.L, luaCode, - { data: args[0] || {} }, + { data: payload }, [] ) @@ -112,5 +114,5 @@ export interface UIPageData { requireAuth: boolean requiredRole?: string layout: JsonObject - actions: Record + actions: Record } diff --git a/package-lock.json b/package-lock.json index 4c57bb13c..e3983a0f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,8 +56,7 @@ "resolved": "https://registry.npmjs.org/@electric-sql/pglite/-/pglite-0.3.2.tgz", "integrity": "sha512-zfWWa+V2ViDCY/cmUfRqeWY1yLto+EpxjXnZzenB1TyxsTiXaTWeZFIZw6mac52BsuQm0RjCnisjBtdBaXOI6w==", "dev": true, - "license": "Apache-2.0", - "peer": true + "license": "Apache-2.0" }, "node_modules/@electric-sql/pglite-socket": { "version": "0.0.6", @@ -533,7 +532,8 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/decompress-response": { "version": "6.0.0", @@ -774,7 +774,6 @@ "integrity": "sha512-BIdolzGpDO9MQ4nu3AUuDwHZZ+KViNm+EZ75Ae55eMXMqLVhDFqEMXxtUe9Qh8hjL+pIna/frs2j6Y2yD5Ua/g==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=16.9.0" } @@ -1143,7 +1142,6 @@ "dev": true, "hasInstallScript": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "@prisma/config": "7.2.0", "@prisma/dev": "0.17.0", @@ -1348,7 +1346,8 @@ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/semver": { "version": "7.7.3",