From c5e23f59392557027a5b003ec04c134c321f566c Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Sun, 28 Apr 2024 15:13:09 +0900 Subject: [PATCH 01/24] fix: yarn.lock --- app/(authenticated)/league/[id]/page.tsx | 2 +- yarn.lock | 165 ++++++++++------------- 2 files changed, 73 insertions(+), 94 deletions(-) diff --git a/app/(authenticated)/league/[id]/page.tsx b/app/(authenticated)/league/[id]/page.tsx index 1a587df..9bcbf4d 100644 --- a/app/(authenticated)/league/[id]/page.tsx +++ b/app/(authenticated)/league/[id]/page.tsx @@ -14,7 +14,7 @@ export default function LeagueTestPage() { 競技名 - + diff --git a/yarn.lock b/yarn.lock index 21b3866..917b664 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1002,16 +1002,9 @@ resolved "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz" integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== -"@babel/runtime@^7.12.5", "@babel/runtime@^7.18.3", "@babel/runtime@^7.23.2", "@babel/runtime@^7.23.9", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.7": - version "7.24.1" - resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.1.tgz" - integrity sha512-+BIznRzyqBf+2wCTxcKE3wDjfGeCoVE61KSHGpkzqrLi8qxqFwBeUFyId2cxkTmm55fzDGnm0+yCxaxygrLUnQ== - dependencies: - regenerator-runtime "^0.14.0" - -"@babel/runtime@^7.24.0", "@babel/runtime@^7.8.4": +"@babel/runtime@^7.12.5", "@babel/runtime@^7.18.3", "@babel/runtime@^7.23.2", "@babel/runtime@^7.23.9", "@babel/runtime@^7.24.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7": version "7.24.4" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.4.tgz#de795accd698007a66ba44add6cc86542aff1edd" + resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.4.tgz" integrity sha512-dkxf7+hn8mFBwKjs9bvBlArzLVxVbS8usaPUDd5p2a9JCL9tB8OaOVN1isD4+Xyk4ns89/xeOmbQvgdK7IIVdA== dependencies: regenerator-runtime "^0.14.0" @@ -1052,14 +1045,14 @@ "@dnd-kit/accessibility@^3.1.0": version "3.1.0" - resolved "https://registry.yarnpkg.com/@dnd-kit/accessibility/-/accessibility-3.1.0.tgz#1054e19be276b5f1154ced7947fc0cb5d99192e0" + resolved "https://registry.npmjs.org/@dnd-kit/accessibility/-/accessibility-3.1.0.tgz" integrity sha512-ea7IkhKvlJUv9iSHJOnxinBcoOI3ppGnnL+VDJ75O45Nss6HtZd8IdN8touXPDtASfeI2T2LImb8VOZcL47wjQ== dependencies: tslib "^2.0.0" "@dnd-kit/core@^6.1.0": version "6.1.0" - resolved "https://registry.yarnpkg.com/@dnd-kit/core/-/core-6.1.0.tgz#e81a3d10d9eca5d3b01cbf054171273a3fe01def" + resolved "https://registry.npmjs.org/@dnd-kit/core/-/core-6.1.0.tgz" integrity sha512-J3cQBClB4TVxwGo3KEjssGEXNJqGVWx17aRTZ1ob0FliR5IjYgTxl5YJbKTzA6IzrtelotH19v6y7uoIRUZPSg== dependencies: "@dnd-kit/accessibility" "^3.1.0" @@ -1068,7 +1061,7 @@ "@dnd-kit/sortable@^8.0.0": version "8.0.0" - resolved "https://registry.yarnpkg.com/@dnd-kit/sortable/-/sortable-8.0.0.tgz#086b7ac6723d4618a4ccb6f0227406d8a8862a96" + resolved "https://registry.npmjs.org/@dnd-kit/sortable/-/sortable-8.0.0.tgz" integrity sha512-U3jk5ebVXe1Lr7c2wU7SBZjcWdQP+j7peHJfCspnA81enlu88Mgd7CC8Q+pub9ubP7eKVETzJW+IBAhsqbSu/g== dependencies: "@dnd-kit/utilities" "^3.2.2" @@ -1076,7 +1069,7 @@ "@dnd-kit/utilities@^3.2.2": version "3.2.2" - resolved "https://registry.yarnpkg.com/@dnd-kit/utilities/-/utilities-3.2.2.tgz#5a32b6af356dc5f74d61b37d6f7129a4040ced7b" + resolved "https://registry.npmjs.org/@dnd-kit/utilities/-/utilities-3.2.2.tgz" integrity sha512-+MKAJEOfaBe5SmV6t34p80MMKhjvUz0vRrvVJbPT0WElzaOJ/1xs+D+KDv+tD/NE5ujfrChEcshd4fLn0wpiqg== dependencies: tslib "^2.0.0" @@ -1121,7 +1114,7 @@ resolved "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.1.tgz" integrity sha512-gJB6HLm5rYwSLI6PQa+X1t5CFGrv1J1TWG+sOyMCeKz2ojaj6Fnl/rZEspogG+cvqbt4AE/2eIyD2QfLKTBNlQ== -"@emotion/is-prop-valid@^1.2.1": +"@emotion/is-prop-valid@^1.2.2": version "1.2.2" resolved "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.2.2.tgz" integrity sha512-uNsoYd37AFmaCdXlg6EYD1KaPOaRWRByMCYzbKUX4+hhMfrxdVSelShywL4JVaAeM/eHUOSprYBQls+/neX3pw== @@ -1147,10 +1140,10 @@ "@emotion/weak-memoize" "^0.3.1" hoist-non-react-statics "^3.3.1" -"@emotion/serialize@^1.1.2", "@emotion/serialize@^1.1.3": - version "1.1.3" - resolved "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.1.3.tgz" - integrity sha512-iD4D6QVZFDhcbH0RAG1uVu1CwVLMWUkCvAqqlewO/rxf8+87yIBAlt4+AxMiiKPLs5hFc0owNk/sLLAOROw3cA== +"@emotion/serialize@^1.1.2", "@emotion/serialize@^1.1.3", "@emotion/serialize@^1.1.4": + version "1.1.4" + resolved "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.1.4.tgz" + integrity sha512-RIN04MBT8g+FnDwgvIUi8czvr1LU1alUMI05LekWB5DGyTm8cCBMCRpq3GqaiyEDRptEXOyXnvZ58GZYu4kBxQ== dependencies: "@emotion/hash" "^0.9.1" "@emotion/memoize" "^0.8.1" @@ -1164,14 +1157,14 @@ integrity sha512-0QBtGvaqtWi+nx6doRwDdBIzhNdZrXUppvTM4dtZZWEGTXL/XE/yJxLMGlDT1Gt+UHH5IX1n+jkXyytE/av7OA== "@emotion/styled@^11.11.0": - version "11.11.0" - resolved "https://registry.npmjs.org/@emotion/styled/-/styled-11.11.0.tgz" - integrity sha512-hM5Nnvu9P3midq5aaXj4I+lnSfNi7Pmd4EWk1fOZ3pxookaQTNew6bp4JaCBYM4HVFZF9g7UjJmsUmC2JlxOng== + version "11.11.5" + resolved "https://registry.npmjs.org/@emotion/styled/-/styled-11.11.5.tgz" + integrity sha512-/ZjjnaNKvuMPxcIiUkf/9SHoG4Q196DRl1w82hQ3WCsjo1IUR8uaGWrC6a87CrYAW0Kb/pK7hk8BnLgLRi9KoQ== dependencies: "@babel/runtime" "^7.18.3" "@emotion/babel-plugin" "^11.11.0" - "@emotion/is-prop-valid" "^1.2.1" - "@emotion/serialize" "^1.1.2" + "@emotion/is-prop-valid" "^1.2.2" + "@emotion/serialize" "^1.1.4" "@emotion/use-insertion-effect-with-fallbacks" "^1.0.1" "@emotion/utils" "^1.2.1" @@ -1269,9 +1262,9 @@ integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== "@humanwhocodes/object-schema@^2.0.2": - version "2.0.2" - resolved "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz" - integrity sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw== + version "2.0.3" + resolved "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz" + integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== "@img/sharp-darwin-arm64@0.33.3": version "0.33.3" @@ -1443,10 +1436,10 @@ clsx "^2.1.0" prop-types "^15.8.1" -"@mui/core-downloads-tracker@^5.15.14": - version "5.15.14" - resolved "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.15.14.tgz" - integrity sha512-on75VMd0XqZfaQW+9pGjSNiqW+ghc5E2ZSLRBXwcXl/C4YzjfyjrLPhrEpKnR9Uym9KXBvxrhoHfPcczYHweyA== +"@mui/core-downloads-tracker@^5.15.15": + version "5.15.15" + resolved "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.15.15.tgz" + integrity sha512-aXnw29OWQ6I5A47iuWEI6qSSUfH6G/aCsW9KmW3LiFqr7uXZBK4Ks+z8G+qeIub8k0T5CMqlT2q0L+ZJTMrqpg== "@mui/material-nextjs@^5.15.11": version "5.15.11" @@ -1456,14 +1449,14 @@ "@babel/runtime" "^7.23.9" "@mui/material@^5.15.14": - version "5.15.14" - resolved "https://registry.npmjs.org/@mui/material/-/material-5.15.14.tgz" - integrity sha512-kEbRw6fASdQ1SQ7LVdWR5OlWV3y7Y54ZxkLzd6LV5tmz+NpO3MJKZXSfgR0LHMP7meKsPiMm4AuzV0pXDpk/BQ== + version "5.15.15" + resolved "https://registry.npmjs.org/@mui/material/-/material-5.15.15.tgz" + integrity sha512-3zvWayJ+E1kzoIsvwyEvkTUKVKt1AjchFFns+JtluHCuvxgKcLSRJTADw37k0doaRtVAsyh8bz9Afqzv+KYrIA== dependencies: "@babel/runtime" "^7.23.9" "@mui/base" "5.0.0-beta.40" - "@mui/core-downloads-tracker" "^5.15.14" - "@mui/system" "^5.15.14" + "@mui/core-downloads-tracker" "^5.15.15" + "@mui/system" "^5.15.15" "@mui/types" "^7.2.14" "@mui/utils" "^5.15.14" "@types/react-transition-group" "^4.4.10" @@ -1492,10 +1485,10 @@ csstype "^3.1.3" prop-types "^15.8.1" -"@mui/system@^5.15.14": - version "5.15.14" - resolved "https://registry.npmjs.org/@mui/system/-/system-5.15.14.tgz" - integrity sha512-auXLXzUaCSSOLqJXmsAaq7P96VPRXg2Rrz6OHNV7lr+kB8lobUF+/N84Vd9C4G/wvCXYPs5TYuuGBRhcGbiBGg== +"@mui/system@^5.15.14", "@mui/system@^5.15.15": + version "5.15.15" + resolved "https://registry.npmjs.org/@mui/system/-/system-5.15.15.tgz" + integrity sha512-aulox6N1dnu5PABsfxVGOZffDVmlxPOVgj56HrUnJE8MCSh8lOvvkd47cebIVQQYAjpwieXQXiDPj5pwM40jTQ== dependencies: "@babel/runtime" "^7.23.9" "@mui/private-theming" "^5.15.14" @@ -1523,7 +1516,7 @@ "@mui/x-data-grid@^7.1.1": version "7.2.0" - resolved "https://registry.yarnpkg.com/@mui/x-data-grid/-/x-data-grid-7.2.0.tgz#9f908d695467fbeaa02a3d82d94172b7db7894bc" + resolved "https://registry.npmjs.org/@mui/x-data-grid/-/x-data-grid-7.2.0.tgz" integrity sha512-WKmFo0eKhj3W7Fv8u5n2XP4UcdzuJ+mEYALiMUDAYsah/hPBH9mA1miXn9DjXF3i3dxgzrTjdJemTgTJxAQZKg== dependencies: "@babel/runtime" "^7.24.0" @@ -1547,12 +1540,12 @@ "@next/swc-darwin-arm64@14.1.4": version "14.1.4" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.1.4.tgz#a3bca0dc4393ac4cf3169bbf24df63441de66bb7" + resolved "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.1.4.tgz" integrity sha512-ubmUkbmW65nIAOmoxT1IROZdmmJMmdYvXIe8211send9ZYJu+SqxSnJM4TrPj9wmL6g9Atvj0S/2cFmMSS99jg== "@next/swc-darwin-x64@14.1.4": version "14.1.4" - resolved "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.1.4.tgz" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-14.1.4.tgz#ba3683d4e2d30099f3f2864dd7349a4d9f440140" integrity sha512-b0Xo1ELj3u7IkZWAKcJPJEhBop117U78l70nfoQGo4xUSvv0PJSTaV4U9xQBLvZlnjsYkc8RwQN1HoH/oQmLlQ== "@next/swc-linux-arm64-gnu@14.1.4": @@ -1688,9 +1681,9 @@ zustand "^4.4.1" "@rushstack/eslint-patch@^1.3.3": - version "1.9.0" - resolved "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.9.0.tgz" - integrity sha512-AAWymnpvHbGty1BmgbdfbqQDboXs6xN6h2yAacO4yKVyyUUBnpYkp+P9jjPrV9zrAGw7JVVriRtGOHPInnfjZQ== + version "1.10.1" + resolved "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.10.1.tgz" + integrity sha512-S3Kq8e7LqxkA9s7HKLqXGTGck1uwis5vAXan3FnU5yw1Ec5hsSGnq4s/UCaSqABPOnOTg7zASLyst7+ohgWexg== "@svgr/babel-plugin-add-jsx-attribute@8.0.0": version "8.0.0" @@ -2031,9 +2024,9 @@ integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== "@types/node@^20": - version "20.11.30" - resolved "https://registry.npmjs.org/@types/node/-/node-20.11.30.tgz" - integrity sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw== + version "20.12.5" + resolved "https://registry.npmjs.org/@types/node/-/node-20.12.5.tgz" + integrity sha512-BD+BjQ9LS/D8ST9p5uqBxghlN+S42iuNxjsUGjeZobe/ciXzk2qb1B6IXc6AnRLS+yFJRpN2IPEHMzwspfDJNw== dependencies: undici-types "~5.26.4" @@ -2048,9 +2041,9 @@ integrity sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q== "@types/react-dom@^18": - version "18.2.22" - resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.22.tgz" - integrity sha512-fHkBXPeNtfvri6gdsMYyW+dW7RXFo6Ad09nLFK0VQWR7yGLai/Cyvyj696gbwYvBnhGtevUG9cET0pmUbMtoPQ== + version "18.2.24" + resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.24.tgz" + integrity sha512-cN6upcKd8zkGy4HU9F1+/s98Hrp6D4MOcippK4PoE8OZRngohHZpbJn1GsaDLz87MqvHNoT13nHvNqM9ocRHZg== dependencies: "@types/react" "*" @@ -2062,9 +2055,9 @@ "@types/react" "*" "@types/react@*", "@types/react@^18": - version "18.2.73" - resolved "https://registry.npmjs.org/@types/react/-/react-18.2.73.tgz" - integrity sha512-XcGdod0Jjv84HOC7N5ziY3x+qL0AfmubvKOZ9hJjJ2yd5EE+KYjWhdOjt387e9HPheHkdggF9atTifMRtyAaRA== + version "18.2.74" + resolved "https://registry.npmjs.org/@types/react/-/react-18.2.74.tgz" + integrity sha512-9AEqNZZyBx8OdZpxzQlaFEVCSFUM2YXJH46yPOiOpm078k6ZLOCcuAzGum/zK8YBwY+dbahVNbHrbgrAwIRlqw== dependencies: "@types/prop-types" "*" csstype "^3.0.2" @@ -2132,12 +2125,12 @@ acorn@^8.9.0: ag-grid-community@31.2.1, ag-grid-community@^31.2.1: version "31.2.1" - resolved "https://registry.yarnpkg.com/ag-grid-community/-/ag-grid-community-31.2.1.tgz#6031c91baa5caebccfa58a5131efc13339643e50" + resolved "https://registry.npmjs.org/ag-grid-community/-/ag-grid-community-31.2.1.tgz" integrity sha512-D+gnUQ4dHZ/EQJmupQnDqcEKiCEeuK5ZxlsIpdPKgHg/23dmW+aEdivtB9nLpSc2IEK0RUpchcSxeUT37Boo5A== ag-grid-react@^31.2.1: version "31.2.1" - resolved "https://registry.yarnpkg.com/ag-grid-react/-/ag-grid-react-31.2.1.tgz#21be0703225e4c7ad88b1b6ca13491a6d9a072c1" + resolved "https://registry.npmjs.org/ag-grid-react/-/ag-grid-react-31.2.1.tgz" integrity sha512-9UH3xxXRwZfW97oz58KboyCJl4t+zdetopieeHVcttsXX1DvGFDUIEz7A1sQaG8e1DAXLMf3IxoIPrfWheH4XA== dependencies: ag-grid-community "31.2.1" @@ -2425,12 +2418,7 @@ camelcase@^6.2.0: resolved "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001579: - version "1.0.30001600" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001600.tgz" - integrity sha512-+2S9/2JFhYmYaDpZvo0lKkfvuKIglrx68MwOBqMGHhQsNkLjB5xtc/TGoEPs+MxjSyN/72qer2g97nzR641mOQ== - -caniuse-lite@^1.0.30001587: +caniuse-lite@^1.0.30001579, caniuse-lite@^1.0.30001587: version "1.0.30001606" resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001606.tgz" integrity sha512-LPbwnW4vfpJId225pwjZJOgX1m9sGfbw/RKJvw/t0QhYOOaTXHvkjVGFGPpvwEzufrjvTlsULnVTxdy4/6cqkg== @@ -2862,9 +2850,9 @@ error-ex@^1.3.1: is-arrayish "^0.2.1" es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.23.0, es-abstract@^1.23.1, es-abstract@^1.23.2: - version "1.23.2" - resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.2.tgz" - integrity sha512-60s3Xv2T2p1ICykc7c+DNDPLDMm9t4QxCOUU0K9JxiLjM3C1zB9YVdN7tjxrFd4+AkZ8CdX1ovUga4P2+1e+/w== + version "1.23.3" + resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz" + integrity sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A== dependencies: array-buffer-byte-length "^1.0.1" arraybuffer.prototype.slice "^1.0.3" @@ -2905,11 +2893,11 @@ es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.23.0, es-abstract@^1.23 safe-regex-test "^1.0.3" string.prototype.trim "^1.2.9" string.prototype.trimend "^1.0.8" - string.prototype.trimstart "^1.0.7" + string.prototype.trimstart "^1.0.8" typed-array-buffer "^1.0.2" typed-array-byte-length "^1.0.1" typed-array-byte-offset "^1.0.2" - typed-array-length "^1.0.5" + typed-array-length "^1.0.6" unbox-primitive "^1.0.2" which-typed-array "^1.1.15" @@ -3908,7 +3896,7 @@ micromatch@^4.0.4: braces "^3.0.2" picomatch "^2.3.1" -minimatch@9.0.3, minimatch@^9.0.1: +minimatch@9.0.3: version "9.0.3" resolved "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz" integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== @@ -3922,6 +3910,13 @@ minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: dependencies: brace-expansion "^1.1.7" +minimatch@^9.0.1: + version "9.0.4" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz" + integrity sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw== + dependencies: + brace-expansion "^2.0.1" + minimist@^1.2.0, minimist@^1.2.6: version "1.2.8" resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz" @@ -4317,7 +4312,7 @@ regjsparser@^0.9.1: reselect@^4.1.8: version "4.1.8" - resolved "https://registry.yarnpkg.com/reselect/-/reselect-4.1.8.tgz#3f5dc671ea168dccdeb3e141236f69f02eaec524" + resolved "https://registry.npmjs.org/reselect/-/reselect-4.1.8.tgz" integrity sha512-ab9EmR80F/zQTMNeneUr4cv+jSwPJgIlvEmVwLerwrWVbpLlBuls9XHzIeTFy4cegU2NHBp3va0LKOzU5qFEYQ== resolve-from@^4.0.0: @@ -4518,16 +4513,7 @@ streamsearch@^1.1.0: resolved "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz" integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0: +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0: version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -4582,7 +4568,7 @@ string.prototype.trimend@^1.0.8: define-properties "^1.2.1" es-object-atoms "^1.0.0" -string.prototype.trimstart@^1.0.7: +string.prototype.trimstart@^1.0.8: version "1.0.8" resolved "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz" integrity sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg== @@ -4591,14 +4577,7 @@ string.prototype.trimstart@^1.0.7: define-properties "^1.2.1" es-object-atoms "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -4710,7 +4689,7 @@ tsconfig-paths@^3.15.0: tslib@^2.0.0, tslib@^2.0.3, tslib@^2.4.0: version "2.6.2" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" + resolved "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== type-check@^0.4.0, type-check@~0.4.0: @@ -4757,7 +4736,7 @@ typed-array-byte-offset@^1.0.2: has-proto "^1.0.3" is-typed-array "^1.1.13" -typed-array-length@^1.0.5: +typed-array-length@^1.0.6: version "1.0.6" resolved "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.6.tgz" integrity sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g== @@ -4770,9 +4749,9 @@ typed-array-length@^1.0.5: possible-typed-array-names "^1.0.0" typescript@^5: - version "5.4.3" - resolved "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz" - integrity sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg== + version "5.4.4" + resolved "https://registry.npmjs.org/typescript/-/typescript-5.4.4.tgz" + integrity sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw== unbox-primitive@^1.0.2: version "1.0.2" From d11ae3b1dd74f2f498622251267a361b21cddbd6 Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Tue, 30 Apr 2024 11:48:32 +0900 Subject: [PATCH 02/24] feat: sport list data fetch --- app/(authenticated)/locations/page.tsx | 19 +++++++++ app/(authenticated)/page.tsx | 2 +- app/(authenticated)/sports/create/page.tsx | 25 ++++++++++++ app/(authenticated)/sports/page.tsx | 41 ++++++------------- app/(authenticated)/users/csv/page.tsx | 2 +- components/layout/buttonLarge.tsx | 4 +- components/layout/cardBackground.tsx | 4 +- components/layout/navigation.tsx | 32 ++++++++++++++- components/sports/sportInfoField.tsx | 47 +++++++++++++++------- 9 files changed, 127 insertions(+), 49 deletions(-) create mode 100644 app/(authenticated)/locations/page.tsx create mode 100644 app/(authenticated)/sports/create/page.tsx diff --git a/app/(authenticated)/locations/page.tsx b/app/(authenticated)/locations/page.tsx new file mode 100644 index 0000000..e8973bb --- /dev/null +++ b/app/(authenticated)/locations/page.tsx @@ -0,0 +1,19 @@ +import {Breadcrumbs, Link, Stack, Typography} from "@mui/material"; +import CardBackground from "@/components/layout/cardBackground"; +import TeamsAgGrid from "@/components/teams/teamsTable"; + +export default function LocationPage() { + return ( + + + + 管理者のダッシュボード + + 場所管理 + + + none + + + ) +} diff --git a/app/(authenticated)/page.tsx b/app/(authenticated)/page.tsx index 25cdf74..af5cc9d 100644 --- a/app/(authenticated)/page.tsx +++ b/app/(authenticated)/page.tsx @@ -10,7 +10,7 @@ export default function Home() { 管理者のダッシュボード - + バスケットボール diff --git a/app/(authenticated)/sports/create/page.tsx b/app/(authenticated)/sports/create/page.tsx new file mode 100644 index 0000000..3b329d7 --- /dev/null +++ b/app/(authenticated)/sports/create/page.tsx @@ -0,0 +1,25 @@ +import {Stack, Breadcrumbs, Link, Typography} from "@mui/material"; +import CardBackground from "@/components/layout/cardBackground"; +import {SportInfoField} from "@/components/sports/sportInfoField"; +import {sportFactory} from "@/src/models/SportModel"; + +export default async function CreateSport() { + const sports = await sportFactory().index() + return ( + + + + 管理者のダッシュボード + + + 競技管理 + + 競技を新規作成 + + + + + + + ); +} diff --git a/app/(authenticated)/sports/page.tsx b/app/(authenticated)/sports/page.tsx index 660c827..e2a6d66 100644 --- a/app/(authenticated)/sports/page.tsx +++ b/app/(authenticated)/sports/page.tsx @@ -1,10 +1,12 @@ import {Breadcrumbs, Grid, Link, Stack, Typography} from "@mui/material"; import CardBackground from "@/components/layout/cardBackground"; -import CardLarge from "@/components/layout/cardLarge"; import {ButtonLarge} from "@/components/layout/buttonLarge"; -import {SportInfoField} from "@/components/sports/sportInfoField"; +import {sportFactory} from "@/src/models/SportModel"; -export default function SportsPage() { + +export default async function SportsPage() { + const sports = await sportFactory().index() + sports.sort((a, b) => b.weight - a.weight); return ( @@ -13,33 +15,14 @@ export default function SportsPage() { 競技管理 - - - - バスケットボール - - - ドッジビー - - - フットサル - - - ビーチボール - - - ペタンク - - - ストラックアウト - - - - + - - - + {sports + .map((sport) => ( + + {sport.name} + + ))} diff --git a/app/(authenticated)/users/csv/page.tsx b/app/(authenticated)/users/csv/page.tsx index c426f5d..f4c55cc 100644 --- a/app/(authenticated)/users/csv/page.tsx +++ b/app/(authenticated)/users/csv/page.tsx @@ -3,7 +3,7 @@ import CardBackground from "@/components/layout/cardBackground"; import {classFactory} from "@/src/models/ClassModel"; import UserCreatingAutomation from "@/components/users/csv/userCreatingAutomation"; -export default async function UsersPage() { +export default async function UsersCsv() { const classes = await classFactory().index() return ( diff --git a/components/layout/buttonLarge.tsx b/components/layout/buttonLarge.tsx index 65ac3a0..bb878b6 100644 --- a/components/layout/buttonLarge.tsx +++ b/components/layout/buttonLarge.tsx @@ -4,14 +4,16 @@ import React, {ReactNode} from "react"; type ButtonLargeProps = { img?: string; children?: ReactNode; + link?: string; } -export const ButtonLarge: React.FC = ({img, children})=> { +export const ButtonLarge: React.FC = ({img, children, link})=> { return( diff --git a/components/layout/navigation.tsx b/components/layout/navigation.tsx index 96181ec..05f3701 100644 --- a/components/layout/navigation.tsx +++ b/components/layout/navigation.tsx @@ -2,7 +2,18 @@ import * as React from 'react' import {AppBar, Box, Button, Drawer, IconButton, Stack, SvgIcon, Toolbar, Tooltip, Typography} from "@mui/material"; import Image from "next/image"; -import {HiHome, HiMegaphone, HiMiniNewspaper, HiUser, HiUserGroup, HiTableCells, HiRectangleGroup, HiTrophy, HiArrowRightOnRectangle} from "react-icons/hi2"; +import { + HiHome, + HiMegaphone, + HiMiniNewspaper, + HiUser, + HiUserGroup, + HiTableCells, + HiRectangleGroup, + HiTrophy, + HiArrowRightOnRectangle, + HiMapPin +} from "react-icons/hi2"; import {SiGithub} from "react-icons/si"; import WiderLogo from "@/components/svg/wider"; import Link from "next/link" @@ -100,7 +111,7 @@ export const Navigation = () => { - すべてのユーザーを管理 + ユーザーを管理 + + 会場 + + + 編成 - - - - From cbe3346b3ae5c454435bc2141edf8f4424272dd2 Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Fri, 3 May 2024 00:03:24 +0900 Subject: [PATCH 03/24] feat: Error page, Loading screen --- app/(authenticated)/loading.tsx | 15 ++++++++++ app/error.tsx | 53 +++++++++++++++++++++++++++++++++ app/not-found.tsx | 30 +++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 app/(authenticated)/loading.tsx create mode 100644 app/error.tsx create mode 100644 app/not-found.tsx diff --git a/app/(authenticated)/loading.tsx b/app/(authenticated)/loading.tsx new file mode 100644 index 0000000..3e448e6 --- /dev/null +++ b/app/(authenticated)/loading.tsx @@ -0,0 +1,15 @@ +import {Stack, Skeleton, Box, LinearProgress} from "@mui/material"; +import CardBackground from "@/components/layout/cardBackground"; + +export default function Loading() { + return( + + + + + + + + + ) +} \ No newline at end of file diff --git a/app/error.tsx b/app/error.tsx new file mode 100644 index 0000000..59cc6bc --- /dev/null +++ b/app/error.tsx @@ -0,0 +1,53 @@ +'use client' +import {useEffect} from "react"; +import {Stack, Skeleton, Box, LinearProgress, Typography, Button} from "@mui/material"; +import CardBackground from "@/components/layout/cardBackground"; +import Image from "next/image"; +import WiderLogo from "@/components/svg/wider"; + +export default function Error({ + error, + reset, + }: { + error: Error & { digest?: string } + reset: () => void +}) { + useEffect(() => { + // Log the error to an error reporting service + console.error(error) + }, [error]) + + return ( + + + (T . T) + 問題が発生しました + 詳細はコンソールから確認してください。繰り返し発生している場合は、開発者に連絡してください。 + + + + + + ) +} \ No newline at end of file diff --git a/app/not-found.tsx b/app/not-found.tsx new file mode 100644 index 0000000..7019de5 --- /dev/null +++ b/app/not-found.tsx @@ -0,0 +1,30 @@ +import {Stack, Typography, Button} from "@mui/material"; +import Image from "next/image"; +import WiderLogo from "@/components/svg/wider"; + +export default function NotFound(){ + return ( + + + (T . T) + 404 - Not Found + ページが存在しません。存在するはずのページで繰り返し発生している場合は、開発者に連絡してください。 + + + + + ) +} \ No newline at end of file From 60026279077dda6e376e91859b98b19796b4ece4 Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Sat, 4 May 2024 16:56:29 +0900 Subject: [PATCH 04/24] fix: updated Link components in navigation, buttonLarge --- components/layout/buttonLarge.tsx | 2 ++ components/layout/navigation.tsx | 44 ++++++++++++++++++------------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/components/layout/buttonLarge.tsx b/components/layout/buttonLarge.tsx index bb878b6..f9a62a1 100644 --- a/components/layout/buttonLarge.tsx +++ b/components/layout/buttonLarge.tsx @@ -1,5 +1,6 @@ import {Avatar, Button, Stack, Grid} from "@mui/material"; import React, {ReactNode} from "react"; +import Link from "next/link"; type ButtonLargeProps = { img?: string; @@ -13,6 +14,7 @@ export const ButtonLarge: React.FC = ({img, children, link})=> @@ -111,7 +112,7 @@ export const Navigation = () => { - ユーザーを管理 + ユーザー + @@ -141,13 +155,9 @@ export const Navigation = () => { - 競技を作成・編集 + 競技 - - - - 会場 @@ -175,7 +185,7 @@ export const Navigation = () => { - リーグを編成・管理 + リーグ - - - - - + - + From e37bf9a679e88dadb0f62b124031911fc42ad95e Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Sat, 4 May 2024 16:57:33 +0900 Subject: [PATCH 05/24] fix: removed unused imports --- app/error.tsx | 4 +--- app/not-found.tsx | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/error.tsx b/app/error.tsx index 59cc6bc..302a922 100644 --- a/app/error.tsx +++ b/app/error.tsx @@ -1,8 +1,6 @@ 'use client' import {useEffect} from "react"; -import {Stack, Skeleton, Box, LinearProgress, Typography, Button} from "@mui/material"; -import CardBackground from "@/components/layout/cardBackground"; -import Image from "next/image"; +import {Stack, Typography, Button} from "@mui/material"; import WiderLogo from "@/components/svg/wider"; export default function Error({ diff --git a/app/not-found.tsx b/app/not-found.tsx index 7019de5..35b27b9 100644 --- a/app/not-found.tsx +++ b/app/not-found.tsx @@ -1,5 +1,4 @@ import {Stack, Typography, Button} from "@mui/material"; -import Image from "next/image"; import WiderLogo from "@/components/svg/wider"; export default function NotFound(){ From fdeed85ea604e3e0323db3d3210d9d30cacfe981 Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Sat, 4 May 2024 17:14:44 +0900 Subject: [PATCH 06/24] feat: Logout --- components/auth/LogoutButton.tsx | 25 +++++++++++++++++++++++++ package.json | 2 ++ 2 files changed, 27 insertions(+) create mode 100644 components/auth/LogoutButton.tsx diff --git a/components/auth/LogoutButton.tsx b/components/auth/LogoutButton.tsx new file mode 100644 index 0000000..150221c --- /dev/null +++ b/components/auth/LogoutButton.tsx @@ -0,0 +1,25 @@ +'use client' +import {IconButton, Tooltip} from "@mui/material"; +import Cookies from "js-cookie"; +import {useRouter} from "next/navigation"; +import {HiArrowRightOnRectangle} from "react-icons/hi2"; + +export default function LogoutButton() { + const router = useRouter() + + return ( + + { + // remove cookie + Cookies.remove("access_token") + // redirect with next + router.push("/login") + }} + sx={{width:"fit-content"}} + > + + + + ); +} diff --git a/package.json b/package.json index 82dee34..08fc0f0 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@mui/x-data-grid": "^7.1.1", "ag-grid-community": "^31.2.1", "ag-grid-react": "^31.2.1", + "js-cookie": "^3.0.5", "next": "14.1.4", "react": "^18", "react-dom": "^18", @@ -29,6 +30,7 @@ }, "devDependencies": { "@svgr/webpack": "^8.1.0", + "@types/js-cookie": "^3.0.6", "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", From dfd0bc96bb3d5aea4021f51bc9867f18985faacb Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Mon, 6 May 2024 12:58:19 +0900 Subject: [PATCH 07/24] fix: dnd items can't be moved to empty container --- components/league/dndContainer.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/components/league/dndContainer.tsx b/components/league/dndContainer.tsx index e4d2a9e..ed181c6 100644 --- a/components/league/dndContainer.tsx +++ b/components/league/dndContainer.tsx @@ -25,7 +25,6 @@ const SortableContainer = ({ > - {items.map((id: string) => ( ))} From 29fa779ac032041eabc7962697342f31a639e31c Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Mon, 6 May 2024 12:59:32 +0900 Subject: [PATCH 08/24] feat: sports component data fetch --- app/(authenticated)/page.tsx | 24 +-- app/(authenticated)/sports/[id]/page.tsx | 24 +-- app/(authenticated)/sports/create/page.tsx | 5 +- app/(authenticated)/sports/page.tsx | 12 +- components/layout/buttonLarge.tsx | 1 - components/sports/sportCreator.tsx | 145 +++++++++++++ components/sports/sportEditor.tsx | 175 ++++++++++++++++ components/sports/sportInfoField.tsx | 232 --------------------- components/sports/sportsList.tsx | 23 ++ package.json | 1 + yarn.lock | 221 +++++++++++++++++++- 11 files changed, 581 insertions(+), 282 deletions(-) create mode 100644 components/sports/sportCreator.tsx create mode 100644 components/sports/sportEditor.tsx delete mode 100644 components/sports/sportInfoField.tsx create mode 100644 components/sports/sportsList.tsx diff --git a/app/(authenticated)/page.tsx b/app/(authenticated)/page.tsx index af5cc9d..42f9352 100644 --- a/app/(authenticated)/page.tsx +++ b/app/(authenticated)/page.tsx @@ -3,8 +3,11 @@ import CardBackground from "@/components/layout/cardBackground"; import {ButtonLarge} from "@/components/layout/buttonLarge"; import CardLarge from "@/components/layout/cardLarge"; import CardList from "@/components/layout/cardList"; +import SportsList from "@/components/sports/sportsList"; +import {sportFactory} from "@/src/models/SportModel"; -export default function Home() { +export default async function Home() { + const sports = await sportFactory().index() return ( @@ -12,24 +15,7 @@ export default function Home() { - - バスケットボール - - - ドッジビー - - - フットサル - - - ビーチボール - - - ペタンク - - - ストラックアウト - + diff --git a/app/(authenticated)/sports/[id]/page.tsx b/app/(authenticated)/sports/[id]/page.tsx index b063f4f..a1e8456 100644 --- a/app/(authenticated)/sports/[id]/page.tsx +++ b/app/(authenticated)/sports/[id]/page.tsx @@ -1,11 +1,13 @@ import CardBackground from "@/components/layout/cardBackground"; -import {SportInfoField} from "@/components/sports/sportInfoField"; import {Accordion, AccordionSummary, AccordionDetails, Stack, Grid, Link, Typography, Breadcrumbs} from "@mui/material"; import {ButtonLarge} from "@/components/layout/buttonLarge"; -import {HiChevronDown} from "react-icons/hi2"; import CardList from "@/components/layout/cardList"; +import {sportFactory} from "@/src/models/SportModel"; +import SportEditor from "@/components/sports/sportEditor"; -export default function SportPage() { +export default async function SportPage({params}: { params: { id: string } }) { + const sportId = parseInt(params.id, 10) + const sport = await sportFactory().show(sportId) return( @@ -15,20 +17,10 @@ export default function SportPage() { 競技管理 - 競技名 + {sport.name} - - - - 詳細を見る・編集する - - - - - + + diff --git a/app/(authenticated)/sports/create/page.tsx b/app/(authenticated)/sports/create/page.tsx index 3b329d7..0e725a1 100644 --- a/app/(authenticated)/sports/create/page.tsx +++ b/app/(authenticated)/sports/create/page.tsx @@ -1,7 +1,8 @@ import {Stack, Breadcrumbs, Link, Typography} from "@mui/material"; import CardBackground from "@/components/layout/cardBackground"; -import {SportInfoField} from "@/components/sports/sportInfoField"; +import {SportInfoField} from "@/components/sports/sportEditor"; import {sportFactory} from "@/src/models/SportModel"; +import SportCreator from "@/components/sports/sportCreator"; export default async function CreateSport() { const sports = await sportFactory().index() @@ -18,7 +19,7 @@ export default async function CreateSport() { - + ); diff --git a/app/(authenticated)/sports/page.tsx b/app/(authenticated)/sports/page.tsx index e2a6d66..a104790 100644 --- a/app/(authenticated)/sports/page.tsx +++ b/app/(authenticated)/sports/page.tsx @@ -1,12 +1,11 @@ import {Breadcrumbs, Grid, Link, Stack, Typography} from "@mui/material"; import CardBackground from "@/components/layout/cardBackground"; -import {ButtonLarge} from "@/components/layout/buttonLarge"; +import SportsList from "@/components/sports/sportsList"; import {sportFactory} from "@/src/models/SportModel"; - export default async function SportsPage() { const sports = await sportFactory().index() - sports.sort((a, b) => b.weight - a.weight); + return ( @@ -17,12 +16,7 @@ export default async function SportsPage() { - {sports - .map((sport) => ( - - {sport.name} - - ))} + diff --git a/components/layout/buttonLarge.tsx b/components/layout/buttonLarge.tsx index f9a62a1..d24f3a2 100644 --- a/components/layout/buttonLarge.tsx +++ b/components/layout/buttonLarge.tsx @@ -14,7 +14,6 @@ export const ButtonLarge: React.FC = ({img, children, link})=> + + + + + + + ) +} \ No newline at end of file diff --git a/components/sports/sportEditor.tsx b/components/sports/sportEditor.tsx new file mode 100644 index 0000000..1386b7e --- /dev/null +++ b/components/sports/sportEditor.tsx @@ -0,0 +1,175 @@ +'use client' +import React, {useRef} from "react"; +import {useAsync} from "react-use"; +import {useRouter} from "next/navigation"; +import {Sport, sportFactory} from "@/src/models/SportModel"; +import {Image, imageFactory} from "@/src/models/ImageModel"; +import {Tag, tagFactory} from "@/src/models/TagModel"; +import { + Alert, + Avatar, + Button, + Card, FormControl, + InputLabel, + MenuItem, + Select, + Snackbar, + Stack, + TextField, + TextFieldProps, + Typography +} from "@mui/material"; +import {HiCheck, HiTrash} from "react-icons/hi2"; + +export type SportEditorProps = { + sport: Sport +} + +export default function SportEditor(props: SportEditorProps) { + const router = useRouter() + const [snackOpen, setSnackOpen] = React.useState(false) + + const [tagId, setTagId] = React.useState(props.sport.tagId) + const [tags, setTags] = React.useState([]) + const [iconId, setIconId] = React.useState(props.sport.iconId) + const [images, setImages] = React.useState([]) + const nameRef = useRef(null) + const descriptionRef = useRef(null) + + useAsync(async () => { + const fetchImages = await imageFactory().index() + setImages(fetchImages) + + const fetchTags = await tagFactory().index() + setTags(fetchTags) + }) + + const handleCreate = async () => { + + await sportFactory().update(props.sport.id,{ + name: nameRef.current?.value as string, + description: descriptionRef.current?.value as string, + iconId: iconId, + weight: 0, + ruleId: 0, + tagId: tagId + }) + + router.refresh() + setSnackOpen(true) + } + + const handleSnackClose = () => { + setSnackOpen(false) + } + + return ( + <> + + + 競技の情報 + + + + + + + アイコン + + + + + タグ + + + + + + + + + + + + + 変更が保存されました + + + + ) +} \ No newline at end of file diff --git a/components/sports/sportInfoField.tsx b/components/sports/sportInfoField.tsx deleted file mode 100644 index 4a63af3..0000000 --- a/components/sports/sportInfoField.tsx +++ /dev/null @@ -1,232 +0,0 @@ -'use client' -import { - TextField, - ToggleButtonGroup, - ToggleButton, - Stack, Grid, - Card, Typography, - FormControl, - InputLabel, - Select, - MenuItem, - SelectChangeEvent, - Box, - OutlinedInput, - Chip, - useTheme, - Theme, Avatar, Button -} from "@mui/material"; -import React, {ReactNode} from "react"; -import { HiCheck } from "react-icons/hi2" -import {Sport, sportFactory} from "@/src/models/SportModel"; - -type SportInfoFieldProps = { - img?: string; - children?: ReactNode; - create: boolean; - sports: Sport[]; -} - -//タグ -const ITEM_HEIGHT = 48; -const ITEM_PADDING_TOP = 8; -const MenuProps = { - PaperProps: { - style: { - maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP, - width: 250, - }, - }, -}; - -const tags = [ - 'タグ1', - 'タグ2', -]; - -function getStyles(name: string, tagName: readonly string[], theme: Theme) { - return { - fontWeight: - tagName.indexOf(name) === -1 - ? theme.typography.fontWeightRegular - : theme.typography.fontWeightMedium, - }; -} - - -export function SportInfoField(props: SportInfoFieldProps) { - const [sportName, setSportName] = React.useState('') - //天候 - const [weather, setWeather] = React.useState(''); - const handleWeatherChange = ( - event: React.MouseEvent, - newWeather: string, - ) => { - setWeather(newWeather); - }; - - //試合形式 - const [sporttype, setSportType] = React.useState('web'); - const handleSportTypeChange = ( - event: React.MouseEvent, - newSportType: string, - ) => { - setSportType(newSportType); - }; - - //ルール - const [rule, setRule] = React.useState(''); - const handleRuleChange = (event: SelectChangeEvent) => { - setRule(event.target.value as string); - }; - - //タグ - const theme = useTheme(); - const [tagName, setTag] = React.useState([]); - const handleTagChange = (event: SelectChangeEvent) => { - const { - target: { value }, - } = event; - setTag( - typeof value === 'string' ? value.split(',') : value, - ); - }; - - const create = props.create; - - const handleSubmit = async() => { - if (create) { - await sportFactory().create({ - name: sportName, - description: "test", - iconId: 1, - weight: 1, - ruleId: 1, - tagId: 1, - }) - } - } - - - - return( - - - - 競技の情報 - - setSportName(e.target.value)} - /> - - - - - - - - - - 晴天時 - 雨天時 - - - - リーグ - トーナメント - - - - タグ - - - - - ルール - - - - - - - - - - - ) -} \ No newline at end of file diff --git a/components/sports/sportsList.tsx b/components/sports/sportsList.tsx new file mode 100644 index 0000000..fe3962f --- /dev/null +++ b/components/sports/sportsList.tsx @@ -0,0 +1,23 @@ +import {ButtonLarge} from "@/components/layout/buttonLarge"; +import {Sport} from "@/src/models/SportModel"; + +export type SportsListProps = { + sports: Sport[] +} + +export default function SportsList(props: SportsListProps) { + props.sports.sort((a, b) => b.weight - a.weight); + return ( + <> + {props.sports.map((sport) => ( + + {sport.name} + + ))} + + ) +} \ No newline at end of file diff --git a/package.json b/package.json index 08fc0f0..5827c3e 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "react": "^18", "react-dom": "^18", "react-icons": "^5.0.1", + "react-use": "^17.5.0", "reactflow": "^11.11.0", "sharp": "^0.33.3" }, diff --git a/yarn.lock b/yarn.lock index 917b664..11682ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1002,6 +1002,13 @@ resolved "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz" integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== +"@babel/runtime@^7.1.2": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.5.tgz#230946857c053a36ccc66e1dd03b17dd0c4ed02c" + integrity sha512-Nms86NXrsaeU9vbBJKni6gXiEXZ4CVpYVzEjDH9Sb8vmZ3UljyA1GSOJl/6LGPO8EHLuSF9H+IxNXHPX8QHJ4g== + dependencies: + regenerator-runtime "^0.14.0" + "@babel/runtime@^7.12.5", "@babel/runtime@^7.18.3", "@babel/runtime@^7.23.2", "@babel/runtime@^7.23.9", "@babel/runtime@^7.24.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7": version "7.24.4" resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.4.tgz" @@ -1410,7 +1417,7 @@ resolved "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz" integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== -"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.4.15": version "1.4.15" resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== @@ -2018,6 +2025,16 @@ resolved "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz" integrity sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg== +"@types/js-cookie@^2.2.6": + version "2.2.7" + resolved "https://registry.yarnpkg.com/@types/js-cookie/-/js-cookie-2.2.7.tgz#226a9e31680835a6188e887f3988e60c04d3f6a3" + integrity sha512-aLkWa0C0vO5b4Sr798E26QgOkss68Un0bLjs7u9qxzPT5CG+8DuNTffWES58YzJs3hrVAOs1wonycqEBqNJubA== + +"@types/js-cookie@^3.0.6": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@types/js-cookie/-/js-cookie-3.0.6.tgz#a04ca19e877687bd449f5ad37d33b104b71fdf95" + integrity sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ== + "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz" @@ -2113,6 +2130,11 @@ resolved "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz" integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== +"@xobotyi/scrollbar-width@^1.9.5": + version "1.9.5" + resolved "https://registry.yarnpkg.com/@xobotyi/scrollbar-width/-/scrollbar-width-1.9.5.tgz#80224a6919272f405b87913ca13b92929bdf3c4d" + integrity sha512-N8tkAACJx2ww8vFMneJmaAgmjAG1tnVBZJRLRcx061tmsLRZHSEZSLuGWnwPtunsSLvSqXQ2wfp7Mgqg1I+2dQ== + acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" @@ -2515,6 +2537,13 @@ convert-source-map@^2.0.0: resolved "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== +copy-to-clipboard@^3.3.1: + version "3.3.3" + resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz#55ac43a1db8ae639a4bd99511c148cdd1b83a1b0" + integrity sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA== + dependencies: + toggle-selection "^1.0.6" + core-js-compat@^3.31.0, core-js-compat@^3.36.1: version "3.36.1" resolved "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.36.1.tgz" @@ -2552,6 +2581,13 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.2: shebang-command "^2.0.0" which "^2.0.1" +css-in-js-utils@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/css-in-js-utils/-/css-in-js-utils-3.1.0.tgz#640ae6a33646d401fc720c54fc61c42cd76ae2bb" + integrity sha512-fJAcud6B3rRu+KHYk+Bwf+WFL2MDCJJ1XG9x137tJQ0xYxor7XziQtuGFbWNdqrvF4Tk26O3H73nfVqXt/fW1A== + dependencies: + hyphenate-style-name "^1.0.3" + css-select@^5.1.0: version "5.1.0" resolved "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz" @@ -2563,6 +2599,14 @@ css-select@^5.1.0: domutils "^3.0.1" nth-check "^2.0.1" +css-tree@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.1.3.tgz#eb4870fb6fd7707327ec95c2ff2ab09b5e8db91d" + integrity sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q== + dependencies: + mdn-data "2.0.14" + source-map "^0.6.1" + css-tree@^2.3.1: version "2.3.1" resolved "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz" @@ -2591,7 +2635,7 @@ csso@^5.0.5: dependencies: css-tree "~2.2.0" -csstype@^3.0.2, csstype@^3.1.3: +csstype@^3.0.2, csstype@^3.1.2, csstype@^3.1.3: version "3.1.3" resolved "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz" integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw== @@ -2849,6 +2893,13 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" +error-stack-parser@^2.0.6: + version "2.1.4" + resolved "https://registry.yarnpkg.com/error-stack-parser/-/error-stack-parser-2.1.4.tgz#229cb01cdbfa84440bfa91876285b94680188286" + integrity sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ== + dependencies: + stackframe "^1.3.4" + es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.23.0, es-abstract@^1.23.1, es-abstract@^1.23.2: version "1.23.3" resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz" @@ -3214,6 +3265,21 @@ fast-levenshtein@^2.0.6: resolved "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz" integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== +fast-loops@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/fast-loops/-/fast-loops-1.1.3.tgz#ce96adb86d07e7bf9b4822ab9c6fac9964981f75" + integrity sha512-8EZzEP0eKkEEVX+drtd9mtuQ+/QrlfW/5MlwcwK5Nds6EkZ/tRzEexkzUY2mIssnAyVLT+TKHuRXmFNNXYUd6g== + +fast-shallow-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fast-shallow-equal/-/fast-shallow-equal-1.0.0.tgz#d4dcaf6472440dcefa6f88b98e3251e27f25628b" + integrity sha512-HPtaa38cPgWvaCFmRNhlc6NG7pv6NUHqjPgVAkWGoB9mQMwYB27/K0CvOM5Czy+qpT3e8XJ6Q4aPAnzpNpzNaw== + +fastest-stable-stringify@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/fastest-stable-stringify/-/fastest-stable-stringify-2.0.2.tgz#3757a6774f6ec8de40c4e86ec28ea02417214c76" + integrity sha512-bijHueCGd0LqqNK9b5oCMHc0MluJAx0cwqASgbWMvkO01lCYgIhacVRLcaDz3QnyYIRNJRDwMb41VuT6pHJ91Q== + fastq@^1.6.0: version "1.17.1" resolved "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz" @@ -3472,6 +3538,11 @@ hoist-non-react-statics@^3.3.1: dependencies: react-is "^16.7.0" +hyphenate-style-name@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz#691879af8e220aea5750e8827db4ef62a54e361d" + integrity sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ== + ignore@^5.2.0: version "5.3.1" resolved "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz" @@ -3503,6 +3574,14 @@ inherits@2: resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== +inline-style-prefixer@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/inline-style-prefixer/-/inline-style-prefixer-7.0.0.tgz#991d550735d42069f528ac1bcdacd378d1305442" + integrity sha512-I7GEdScunP1dQ6IM2mQWh6v0mOYdYmH3Bp31UecKdrcUgcURTcctSe1IECdUznSHKSmsHtjrT3CwCPI1pyxfUQ== + dependencies: + css-in-js-utils "^3.1.0" + fast-loops "^1.1.3" + internal-slot@^1.0.7: version "1.0.7" resolved "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz" @@ -3727,6 +3806,16 @@ jackspeak@^2.3.5: optionalDependencies: "@pkgjs/parseargs" "^0.11.0" +js-cookie@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8" + integrity sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ== + +js-cookie@^3.0.5: + version "3.0.5" + resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-3.0.5.tgz#0b7e2fd0c01552c58ba86e0841f94dc2557dcdbc" + integrity sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw== + "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" @@ -3873,6 +3962,11 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +mdn-data@2.0.14: + version "2.0.14" + resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.14.tgz#7113fc4281917d63ce29b43446f701e68c25ba50" + integrity sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow== + mdn-data@2.0.28: version "2.0.28" resolved "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz" @@ -3937,6 +4031,20 @@ ms@^2.1.1: resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +nano-css@^5.6.1: + version "5.6.1" + resolved "https://registry.yarnpkg.com/nano-css/-/nano-css-5.6.1.tgz#964120cb1af6cccaa6d0717a473ccd876b34c197" + integrity sha512-T2Mhc//CepkTa3X4pUhKgbEheJHYAxD0VptuqFhDbGMUWVV2m+lkNiW/Ieuj35wrfC8Zm0l7HvssQh7zcEttSw== + dependencies: + "@jridgewell/sourcemap-codec" "^1.4.15" + css-tree "^1.1.2" + csstype "^3.1.2" + fastest-stable-stringify "^2.0.2" + inline-style-prefixer "^7.0.0" + rtl-css-js "^1.16.1" + stacktrace-js "^2.0.2" + stylis "^4.3.0" + nanoid@^3.3.6: version "3.3.7" resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz" @@ -4225,6 +4333,31 @@ react-transition-group@^4.4.5: loose-envify "^1.4.0" prop-types "^15.6.2" +react-universal-interface@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/react-universal-interface/-/react-universal-interface-0.6.2.tgz#5e8d438a01729a4dbbcbeeceb0b86be146fe2b3b" + integrity sha512-dg8yXdcQmvgR13RIlZbTRQOoUrDciFVoSBZILwjE2LFISxZZ8loVJKAkuzswl5js8BHda79bIb2b84ehU8IjXw== + +react-use@^17.5.0: + version "17.5.0" + resolved "https://registry.yarnpkg.com/react-use/-/react-use-17.5.0.tgz#1fae45638828a338291efa0f0c61862db7ee6442" + integrity sha512-PbfwSPMwp/hoL847rLnm/qkjg3sTRCvn6YhUZiHaUa3FA6/aNoFX79ul5Xt70O1rK+9GxSVqkY0eTwMdsR/bWg== + dependencies: + "@types/js-cookie" "^2.2.6" + "@xobotyi/scrollbar-width" "^1.9.5" + copy-to-clipboard "^3.3.1" + fast-deep-equal "^3.1.3" + fast-shallow-equal "^1.0.0" + js-cookie "^2.2.1" + nano-css "^5.6.1" + react-universal-interface "^0.6.2" + resize-observer-polyfill "^1.5.1" + screenfull "^5.1.0" + set-harmonic-interval "^1.0.1" + throttle-debounce "^3.0.1" + ts-easing "^0.2.0" + tslib "^2.1.0" + react@^18: version "18.2.0" resolved "https://registry.npmjs.org/react/-/react-18.2.0.tgz" @@ -4315,6 +4448,11 @@ reselect@^4.1.8: resolved "https://registry.npmjs.org/reselect/-/reselect-4.1.8.tgz" integrity sha512-ab9EmR80F/zQTMNeneUr4cv+jSwPJgIlvEmVwLerwrWVbpLlBuls9XHzIeTFy4cegU2NHBp3va0LKOzU5qFEYQ== +resize-observer-polyfill@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464" + integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg== + resolve-from@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz" @@ -4355,6 +4493,13 @@ rimraf@^3.0.2: dependencies: glob "^7.1.3" +rtl-css-js@^1.16.1: + version "1.16.1" + resolved "https://registry.yarnpkg.com/rtl-css-js/-/rtl-css-js-1.16.1.tgz#4b48b4354b0ff917a30488d95100fbf7219a3e80" + integrity sha512-lRQgou1mu19e+Ya0LsTvKrVJ5TYUbqCVPAiImX3UfLTenarvPUl1QFdvu5Z3PYmHT9RCcwIfbjRQBntExyj3Zg== + dependencies: + "@babel/runtime" "^7.1.2" + run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz" @@ -4388,6 +4533,11 @@ scheduler@^0.23.0: dependencies: loose-envify "^1.1.0" +screenfull@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/screenfull/-/screenfull-5.2.0.tgz#6533d524d30621fc1283b9692146f3f13a93d1ba" + integrity sha512-9BakfsO2aUQN2K9Fdbj87RJIEZ82Q9IGim7FqM5OsebfoFC6ZHXgDq/KvniuLTPdeM8wY2o6Dj3WQ7KeQCj3cA== + semver@^6.3.1: version "6.3.1" resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" @@ -4422,6 +4572,11 @@ set-function-name@^2.0.1, set-function-name@^2.0.2: functions-have-names "^1.2.3" has-property-descriptors "^1.0.2" +set-harmonic-interval@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/set-harmonic-interval/-/set-harmonic-interval-1.0.1.tgz#e1773705539cdfb80ce1c3d99e7f298bb3995249" + integrity sha512-AhICkFV84tBP1aWqPwLZqFvAwqEoVA9kxNMniGEUvzOlm4vLmOFLiTT3UZ6bziJTy4bOVpzWGTfSCbmaayGx8g== + sharp@^0.33.3: version "0.33.3" resolved "https://registry.npmjs.org/sharp/-/sharp-0.33.3.tgz" @@ -4503,17 +4658,57 @@ source-map-js@^1.0.1, source-map-js@^1.0.2: resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz" integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg== +source-map@0.5.6: + version "0.5.6" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" + integrity sha512-MjZkVp0NHr5+TPihLcadqnlVoGIoWo4IBHptutGh9wI3ttUYvCG26HkSuDi+K6lsZ25syXJXcctwgyVCt//xqA== + source-map@^0.5.7: version "0.5.7" resolved "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz" integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ== +source-map@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +stack-generator@^2.0.5: + version "2.0.10" + resolved "https://registry.yarnpkg.com/stack-generator/-/stack-generator-2.0.10.tgz#8ae171e985ed62287d4f1ed55a1633b3fb53bb4d" + integrity sha512-mwnua/hkqM6pF4k8SnmZ2zfETsRUpWXREfA/goT8SLCV4iOFa4bzOX2nDipWAZFPTjLvQB82f5yaodMVhK0yJQ== + dependencies: + stackframe "^1.3.4" + +stackframe@^1.3.4: + version "1.3.4" + resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.3.4.tgz#b881a004c8c149a5e8efef37d51b16e412943310" + integrity sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw== + +stacktrace-gps@^3.0.4: + version "3.1.2" + resolved "https://registry.yarnpkg.com/stacktrace-gps/-/stacktrace-gps-3.1.2.tgz#0c40b24a9b119b20da4525c398795338966a2fb0" + integrity sha512-GcUgbO4Jsqqg6RxfyTHFiPxdPqF+3LFmQhm7MgCuYQOYuWyqxo5pwRPz5d/u6/WYJdEnWfK4r+jGbyD8TSggXQ== + dependencies: + source-map "0.5.6" + stackframe "^1.3.4" + +stacktrace-js@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/stacktrace-js/-/stacktrace-js-2.0.2.tgz#4ca93ea9f494752d55709a081d400fdaebee897b" + integrity sha512-Je5vBeY4S1r/RnLydLl0TBTi3F2qdfWmYsGvtfZgEI+SCprPppaIhQf5nGcal4gI4cGpCV/duLcAzT1np6sQqg== + dependencies: + error-stack-parser "^2.0.6" + stack-generator "^2.0.5" + stacktrace-gps "^3.0.4" + streamsearch@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz" integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== "string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0: + name string-width-cjs version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -4613,6 +4808,11 @@ stylis@4.2.0: resolved "https://registry.npmjs.org/stylis/-/stylis-4.2.0.tgz" integrity sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw== +stylis@^4.3.0: + version "4.3.2" + resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.3.2.tgz#8f76b70777dd53eb669c6f58c997bf0a9972e444" + integrity sha512-bhtUjWd/z6ltJiQwg0dUfxEJ+W+jdqQd8TbWLWyeIJHlnsqmGLRFFd8e5mA0AZi/zx90smXRlN66YMTcaSFifg== + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz" @@ -4660,6 +4860,11 @@ text-table@^0.2.0: resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== +throttle-debounce@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/throttle-debounce/-/throttle-debounce-3.0.1.tgz#32f94d84dfa894f786c9a1f290e7a645b6a19abb" + integrity sha512-dTEWWNu6JmeVXY0ZYoPuH5cRIwc0MeGbJwah9KUNYSJwommQpCzTySTpEe8Gs1J23aeWEuAobe4Ag7EHVt/LOg== + to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz" @@ -4672,11 +4877,21 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +toggle-selection@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32" + integrity sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ== + ts-api-utils@^1.0.1: version "1.3.0" resolved "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz" integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== +ts-easing@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/ts-easing/-/ts-easing-0.2.0.tgz#c8a8a35025105566588d87dbda05dd7fbfa5a4ec" + integrity sha512-Z86EW+fFFh/IFB1fqQ3/+7Zpf9t2ebOAxNI/V6Wo7r5gqiqtxmgTlQ1qbqQcjLKYeSHPTsEmvlJUDg/EuL0uHQ== + tsconfig-paths@^3.15.0: version "3.15.0" resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz" @@ -4687,7 +4902,7 @@ tsconfig-paths@^3.15.0: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^2.0.0, tslib@^2.0.3, tslib@^2.4.0: +tslib@^2.0.0, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.4.0: version "2.6.2" resolved "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== From 1a50019d3a2ac5b87bd41134f9ba6960e3124d36 Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Mon, 6 May 2024 13:03:59 +0900 Subject: [PATCH 09/24] fix: refactor --- app/(authenticated)/page.tsx | 3 +-- app/(authenticated)/sports/[id]/page.tsx | 4 ++-- app/(authenticated)/sports/create/page.tsx | 5 +---- components/layout/buttonLarge.tsx | 1 - components/layout/navigation.tsx | 1 - components/league/dndContainer.tsx | 1 - 6 files changed, 4 insertions(+), 11 deletions(-) diff --git a/app/(authenticated)/page.tsx b/app/(authenticated)/page.tsx index 42f9352..888ea31 100644 --- a/app/(authenticated)/page.tsx +++ b/app/(authenticated)/page.tsx @@ -1,6 +1,5 @@ -import {Breadcrumbs, Grid, Link, Stack, Typography} from "@mui/material"; +import {Breadcrumbs, Grid, Stack, Typography} from "@mui/material"; import CardBackground from "@/components/layout/cardBackground"; -import {ButtonLarge} from "@/components/layout/buttonLarge"; import CardLarge from "@/components/layout/cardLarge"; import CardList from "@/components/layout/cardList"; import SportsList from "@/components/sports/sportsList"; diff --git a/app/(authenticated)/sports/[id]/page.tsx b/app/(authenticated)/sports/[id]/page.tsx index a1e8456..c58d478 100644 --- a/app/(authenticated)/sports/[id]/page.tsx +++ b/app/(authenticated)/sports/[id]/page.tsx @@ -1,5 +1,5 @@ import CardBackground from "@/components/layout/cardBackground"; -import {Accordion, AccordionSummary, AccordionDetails, Stack, Grid, Link, Typography, Breadcrumbs} from "@mui/material"; +import {Stack, Grid, Link, Typography, Breadcrumbs} from "@mui/material"; import {ButtonLarge} from "@/components/layout/buttonLarge"; import CardList from "@/components/layout/cardList"; import {sportFactory} from "@/src/models/SportModel"; @@ -14,7 +14,7 @@ export default async function SportPage({params}: { params: { id: string } }) { 管理者のダッシュボード - + 競技管理 {sport.name} diff --git a/app/(authenticated)/sports/create/page.tsx b/app/(authenticated)/sports/create/page.tsx index 0e725a1..da80118 100644 --- a/app/(authenticated)/sports/create/page.tsx +++ b/app/(authenticated)/sports/create/page.tsx @@ -1,18 +1,15 @@ import {Stack, Breadcrumbs, Link, Typography} from "@mui/material"; import CardBackground from "@/components/layout/cardBackground"; -import {SportInfoField} from "@/components/sports/sportEditor"; -import {sportFactory} from "@/src/models/SportModel"; import SportCreator from "@/components/sports/sportCreator"; export default async function CreateSport() { - const sports = await sportFactory().index() return ( 管理者のダッシュボード - + 競技管理 競技を新規作成 diff --git a/components/layout/buttonLarge.tsx b/components/layout/buttonLarge.tsx index d24f3a2..bb878b6 100644 --- a/components/layout/buttonLarge.tsx +++ b/components/layout/buttonLarge.tsx @@ -1,6 +1,5 @@ import {Avatar, Button, Stack, Grid} from "@mui/material"; import React, {ReactNode} from "react"; -import Link from "next/link"; type ButtonLargeProps = { img?: string; diff --git a/components/layout/navigation.tsx b/components/layout/navigation.tsx index 2873793..198a2e1 100644 --- a/components/layout/navigation.tsx +++ b/components/layout/navigation.tsx @@ -11,7 +11,6 @@ import { HiTableCells, HiRectangleGroup, HiTrophy, - HiArrowRightOnRectangle, HiMapPin, HiIdentification } from "react-icons/hi2"; import {SiGithub} from "react-icons/si"; diff --git a/components/league/dndContainer.tsx b/components/league/dndContainer.tsx index ed181c6..a1e6a3e 100644 --- a/components/league/dndContainer.tsx +++ b/components/league/dndContainer.tsx @@ -2,7 +2,6 @@ import { useDroppable } from "@dnd-kit/core"; import { rectSortingStrategy, SortableContext } from "@dnd-kit/sortable"; import SortableItem from "./dndSortableItem"; import {Card, Stack, Typography} from "@mui/material"; -import PlaceHolder from "@/components/league/dndPlaceHolder"; const SortableContainer = ({ id, From 554ffa16596aa00eba75b2b7f71491f468644145 Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Mon, 6 May 2024 13:04:31 +0900 Subject: [PATCH 10/24] fix : bug in dnd( Changes by owner) --- components/league/leagueDnd.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/league/leagueDnd.tsx b/components/league/leagueDnd.tsx index 94f84ba..00d616c 100644 --- a/components/league/leagueDnd.tsx +++ b/components/league/leagueDnd.tsx @@ -12,7 +12,7 @@ import { UniqueIdentifier, DragStartEvent, DragOverEvent, - DragEndEvent, + DragEndEvent, rectIntersection, } from "@dnd-kit/core"; import {arrayMove, sortableKeyboardCoordinates} from "@dnd-kit/sortable"; import SortableContainer from "./dndContainer"; @@ -162,7 +162,8 @@ const LeagueDnd: React.FC = () => { Date: Mon, 6 May 2024 17:14:02 +0900 Subject: [PATCH 11/24] fix: navigation button vertical padding --- components/layout/navigation.tsx | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/components/layout/navigation.tsx b/components/layout/navigation.tsx index 198a2e1..9674d2b 100644 --- a/components/layout/navigation.tsx +++ b/components/layout/navigation.tsx @@ -21,6 +21,7 @@ import LogoutButton from "@/components/auth/LogoutButton"; export const Navigation = () => { const drawerWidth = 303; + const buttonPadding = 1.3; return ( <> @@ -29,7 +30,7 @@ export const Navigation = () => { sx={{ zIndex: (theme) => theme.zIndex.drawer + 1, background:"rgba(62,78,179,0.8)", - backdropFilter: 'blur(4px)', + backdropFilter: 'blur(30px)', }}> @@ -52,13 +53,13 @@ export const Navigation = () => { [`& .MuiDrawer-paper`]: { width: drawerWidth, boxSizing: 'border-box' }, }} > - + 全体 + } + {key !== 'All' && + + } + + + ))} + {/* Dialog */} + + {listToRemove}を削除しますか? + + + 削除すると、{listToRemove}に入っていたチームはチーム一覧に戻されます。 + + + 削除したリーグは復元できません。よろしいですか? + + + + + + + + + + リーグが削除されました。 + + {/* DragOverlay */} {activeId ? : null} ); -}; - -export default LeagueDnd; +}; \ No newline at end of file From 443b9b2b5786bcf3e73f7dbc2ebf3a607bfa7f41 Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Tue, 7 May 2024 00:48:51 +0900 Subject: [PATCH 16/24] feat: fetch data in league Dnd --- app/(authenticated)/league/[id]/page.tsx | 2 +- components/league/dndItem.tsx | 57 +++++++++++++-- components/league/leagueDnd.tsx | 93 +++++++++++++++++------- 3 files changed, 121 insertions(+), 31 deletions(-) diff --git a/app/(authenticated)/league/[id]/page.tsx b/app/(authenticated)/league/[id]/page.tsx index e44654b..b7ac2dd 100644 --- a/app/(authenticated)/league/[id]/page.tsx +++ b/app/(authenticated)/league/[id]/page.tsx @@ -18,7 +18,7 @@ export default async function LeagueTestPage({params}: { params: { id: string } {sport.name} - + ); diff --git a/components/league/dndItem.tsx b/components/league/dndItem.tsx index ddc6561..e467823 100644 --- a/components/league/dndItem.tsx +++ b/components/league/dndItem.tsx @@ -1,16 +1,64 @@ import { UniqueIdentifier } from "@dnd-kit/core"; import {Card, Stack, Typography} from "@mui/material"; +import { useEffect, useState } from 'react'; +import {classFactory} from "@/src/models/ClassModel"; +import {Team, teamFactory} from "@/src/models/TeamModel"; + +export type ItemProps = { + id: UniqueIdentifier + team?: Team +} + +export default function Item(props: ItemProps) { + const {id} = props; + const emptyTeam: Team = { + id: 0, + name: '', + description: '', + classId: 0, + teamTagId: 0, + userIds: [], + enteredGameIds: [], + createdAt: '', + updatedAt: '', + }; + + const [team, setTeam] = useState(emptyTeam); + const [className, setClassName] = useState(''); + + useEffect(() => { + const fetchTeam = async () => { + const fetchedTeam = await teamFactory().show(Number(id)); + setTeam(fetchedTeam); + }; + + fetchTeam(); + }, [id]); + + useEffect(() => { + const fetchClassName = async () => { + const fetchedClass = await classFactory().show(team.classId); + setClassName(fetchedClass.name); + }; + + if (team.classId) { + fetchClassName(); + } + }, [team]); + + if (!team) { + return null; + } -const Item = ({ id }: { id: UniqueIdentifier }) => { return ( - チーム{id} + {team.name} クラス - M1 + {className} 経験者 @@ -19,5 +67,4 @@ const Item = ({ id }: { id: UniqueIdentifier }) => { ); -}; -export default Item; \ No newline at end of file +}; \ No newline at end of file diff --git a/components/league/leagueDnd.tsx b/components/league/leagueDnd.tsx index 32fc339..ea1cca7 100644 --- a/components/league/leagueDnd.tsx +++ b/components/league/leagueDnd.tsx @@ -9,7 +9,7 @@ import { Stack, Alert, Snackbar, Typography } from "@mui/material"; -import React, {useState} from 'react'; +import React, {useState, useEffect} from 'react'; import { DndContext, DragOverlay, @@ -27,23 +27,56 @@ import SortableContainer from "./dndContainer"; import Item from "./dndItem"; import {Team, teamFactory} from "@/src/models/TeamModel"; +import {gameFactory} from "@/src/models/GameModel"; import {Sport} from "@/src/models/SportModel"; import {HiPlus, HiTrash} from "react-icons/hi2"; +import {useAsync} from "react-use"; export type LeagueDndProps = { + sportId: number sport: Sport } export default function LeagueDnd(props: LeagueDndProps) { + const {sportId} = props; + // ドラッグ&ドロップでソート可能なリスト const [items, setItems] = useState<{ [key: string]: string[]; }>({ - All: ["1", "2", "3", "4", "5", "6", "7", "8", "9"], + All: [], }); + useEffect(() => { + const fetchGameEntries = async () => { + const games = await gameFactory().index(); + const sportGames = games.filter(game => game.sportId === sportId); + for (const game of sportGames) { + const entries = await gameFactory().getGameEntries(game.id); + setItems(prevItems => ({ + ...prevItems, + All: entries.map(entry => entry.id.toString()), + })); + } + }; + + fetchGameEntries(); + }, [sportId]); + const addNewList = () => { + // アルファベットの文字列を作成 + const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + // 現在のリストの数をアルファベットのインデックスとして使用 + const nextIndex = Object.keys(items).length - 1; // -1 because we already have 'All' list + + // リストの数が26を超えるか、次の文字が存在しない場合は新しいリストを追加しない + if (nextIndex >= 26 || !alphabet[nextIndex]) { + alert("これ以上リーグを作成できません") + return; + } + + const nextLetter = alphabet[nextIndex]; setItems(prevItems => ({ ...prevItems, - [`リーグ${Object.keys(prevItems).length}`]: [], + [`リーグ${nextLetter}`]: [], })); }; @@ -230,30 +263,40 @@ export default function LeagueDnd(props: LeagueDndProps) { {Object.keys(items).map((key) => ( {key == 'All' && - + <> + + + } {key !== 'All' && - + <> + + + } - ))} {/* Dialog */} @@ -291,7 +334,7 @@ export default function LeagueDnd(props: LeagueDndProps) { variant="filled" sx={{ width: '100%' }} > - リーグが削除されました。 + {listToRemove}が削除されました。 {/* DragOverlay */} From 263bf123254424dddddea8b86b8ae8264d6f9fd3 Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Tue, 7 May 2024 10:10:11 +0900 Subject: [PATCH 17/24] fix: league cannot be added after deleting one --- components/league/dndContainer.tsx | 10 +++++----- components/league/dndItem.tsx | 12 ++++++------ components/league/leagueDnd.tsx | 31 ++++++++++++++++++++++++++---- 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/components/league/dndContainer.tsx b/components/league/dndContainer.tsx index a1e6a3e..0cc1875 100644 --- a/components/league/dndContainer.tsx +++ b/components/league/dndContainer.tsx @@ -1,7 +1,7 @@ import { useDroppable } from "@dnd-kit/core"; import { rectSortingStrategy, SortableContext } from "@dnd-kit/sortable"; import SortableItem from "./dndSortableItem"; -import {Card, Stack, Typography} from "@mui/material"; +import {Box, Card, Stack, Typography} from "@mui/material"; const SortableContainer = ({ id, @@ -16,13 +16,13 @@ const SortableContainer = ({ id, }); return ( -
- {label} + + {/*{label}*/}
- + {items.map((id: string) => ( @@ -31,7 +31,7 @@ const SortableContainer = ({
-
+ ); }; diff --git a/components/league/dndItem.tsx b/components/league/dndItem.tsx index e467823..6525ed9 100644 --- a/components/league/dndItem.tsx +++ b/components/league/dndItem.tsx @@ -51,18 +51,18 @@ export default function Item(props: ItemProps) { } return ( - + {team.name} - - + + クラス - {className} + {className} - + 経験者 - 1 + 1 diff --git a/components/league/leagueDnd.tsx b/components/league/leagueDnd.tsx index ea1cca7..f566fcc 100644 --- a/components/league/leagueDnd.tsx +++ b/components/league/leagueDnd.tsx @@ -90,7 +90,24 @@ export default function LeagueDnd(props: LeagueDndProps) { } // 指定された配列を削除 delete newItems[key]; - return newItems; + + // アルファベットの文字列を作成 + const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + let index = 0; + + // 新しいオブジェクトを作成し、削除したリスト以外のすべてのリストをコピーします + const reorderedItems = Object.keys(newItems).reduce<{ [key: string]: string[]; }>((obj, listKey) => { + if (listKey !== 'All') { + // 新しい名前を割り当てます(アルファベット順) + obj[`リーグ${alphabet[index]}`] = newItems[listKey]; + index++; + } else { + obj[listKey] = newItems[listKey]; + } + return obj; + }, {}); + + return reorderedItems; }); }; @@ -261,14 +278,16 @@ export default function LeagueDnd(props: LeagueDndProps) { onDragEnd={handleDragEnd} > {Object.keys(items).map((key) => ( - + {key == 'All' && <> + 未登録チーム @@ -282,11 +301,15 @@ export default function LeagueDnd(props: LeagueDndProps) { } {key !== 'All' && <> + {key} Date: Tue, 7 May 2024 10:17:15 +0900 Subject: [PATCH 18/24] fix: refactor --- app/(authenticated)/league/[id]/page.tsx | 2 +- app/(authenticated)/league/page.tsx | 1 - components/league/dndContainer.tsx | 2 +- components/league/dndItem.tsx | 4 ++-- components/league/dndSortableItem.tsx | 1 - components/league/leagueDnd.tsx | 5 +---- 6 files changed, 5 insertions(+), 10 deletions(-) diff --git a/app/(authenticated)/league/[id]/page.tsx b/app/(authenticated)/league/[id]/page.tsx index b7ac2dd..4347fa5 100644 --- a/app/(authenticated)/league/[id]/page.tsx +++ b/app/(authenticated)/league/[id]/page.tsx @@ -12,7 +12,7 @@ export default async function LeagueTestPage({params}: { params: { id: string } 管理者のダッシュボード - + リーグ管理 {sport.name} diff --git a/app/(authenticated)/league/page.tsx b/app/(authenticated)/league/page.tsx index f66d0d5..f39e61e 100644 --- a/app/(authenticated)/league/page.tsx +++ b/app/(authenticated)/league/page.tsx @@ -1,6 +1,5 @@ import {Stack, Grid, Typography, Link, Breadcrumbs} from "@mui/material"; import CardBackground from "@/components/layout/cardBackground"; -import {ButtonLarge} from "@/components/layout/buttonLarge"; import {sportFactory} from "@/src/models/SportModel"; import LeagueSportsList from "@/components/league/leagueSportsList"; diff --git a/components/league/dndContainer.tsx b/components/league/dndContainer.tsx index 0cc1875..2dfc084 100644 --- a/components/league/dndContainer.tsx +++ b/components/league/dndContainer.tsx @@ -1,7 +1,7 @@ import { useDroppable } from "@dnd-kit/core"; import { rectSortingStrategy, SortableContext } from "@dnd-kit/sortable"; import SortableItem from "./dndSortableItem"; -import {Box, Card, Stack, Typography} from "@mui/material"; +import {Box, Card, Stack} from "@mui/material"; const SortableContainer = ({ id, diff --git a/components/league/dndItem.tsx b/components/league/dndItem.tsx index 6525ed9..eba3b89 100644 --- a/components/league/dndItem.tsx +++ b/components/league/dndItem.tsx @@ -32,7 +32,7 @@ export default function Item(props: ItemProps) { setTeam(fetchedTeam); }; - fetchTeam(); + void fetchTeam(); }, [id]); useEffect(() => { @@ -42,7 +42,7 @@ export default function Item(props: ItemProps) { }; if (team.classId) { - fetchClassName(); + void fetchClassName(); } }, [team]); diff --git a/components/league/dndSortableItem.tsx b/components/league/dndSortableItem.tsx index a624c43..575fd0b 100644 --- a/components/league/dndSortableItem.tsx +++ b/components/league/dndSortableItem.tsx @@ -1,7 +1,6 @@ import { useSortable } from "@dnd-kit/sortable"; import { UniqueIdentifier } from "@dnd-kit/core"; import Item from "./dndItem"; -import {Card} from "@mui/material"; const SortableItem = ({ id }: { id: UniqueIdentifier }) => { const { attributes, listeners, setNodeRef, transform, transition } = diff --git a/components/league/leagueDnd.tsx b/components/league/leagueDnd.tsx index f566fcc..f7846e9 100644 --- a/components/league/leagueDnd.tsx +++ b/components/league/leagueDnd.tsx @@ -4,7 +4,6 @@ import { Dialog, DialogTitle, DialogContent, - DialogContentText, DialogActions, Stack, Alert, Snackbar, Typography @@ -26,11 +25,9 @@ import {arrayMove, sortableKeyboardCoordinates} from "@dnd-kit/sortable"; import SortableContainer from "./dndContainer"; import Item from "./dndItem"; -import {Team, teamFactory} from "@/src/models/TeamModel"; import {gameFactory} from "@/src/models/GameModel"; import {Sport} from "@/src/models/SportModel"; import {HiPlus, HiTrash} from "react-icons/hi2"; -import {useAsync} from "react-use"; export type LeagueDndProps = { sportId: number @@ -58,7 +55,7 @@ export default function LeagueDnd(props: LeagueDndProps) { } }; - fetchGameEntries(); + void fetchGameEntries(); }, [sportId]); const addNewList = () => { From d47f327d927be2aa6c6b3bf65d7db3d6a5c00c5c Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Tue, 7 May 2024 10:51:25 +0900 Subject: [PATCH 19/24] fix: build failure (missing key in leagueDnd) --- components/league/leagueDnd.tsx | 3 +- yarn.lock | 74 +++++++++++++++------------------ 2 files changed, 34 insertions(+), 43 deletions(-) diff --git a/components/league/leagueDnd.tsx b/components/league/leagueDnd.tsx index f7846e9..6e78b2d 100644 --- a/components/league/leagueDnd.tsx +++ b/components/league/leagueDnd.tsx @@ -275,7 +275,7 @@ export default function LeagueDnd(props: LeagueDndProps) { onDragEnd={handleDragEnd} > {Object.keys(items).map((key) => ( - + {key == 'All' && <> 未登録チーム @@ -289,7 +289,6 @@ export default function LeagueDnd(props: LeagueDndProps) { リーグ追加 Date: Wed, 8 May 2024 21:14:00 +0900 Subject: [PATCH 20/24] fix: errors --- components/league/dndItem.tsx | 16 +++++++++++++++- components/league/leagueDnd.tsx | 21 +++++++++++++++++---- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/components/league/dndItem.tsx b/components/league/dndItem.tsx index eba3b89..cfd34d0 100644 --- a/components/league/dndItem.tsx +++ b/components/league/dndItem.tsx @@ -25,6 +25,20 @@ export default function Item(props: ItemProps) { const [team, setTeam] = useState(emptyTeam); const [className, setClassName] = useState(''); + const [experience, setExperience] = useState(0); + + useEffect(() => { + try { + const descriptionData = JSON.parse(team.description); + if (descriptionData.value) { + setExperience(descriptionData.value); + } else { + setExperience(0); + } + } catch (error) { + setExperience(0); + } + }, [team]); useEffect(() => { const fetchTeam = async () => { @@ -62,7 +76,7 @@ export default function Item(props: ItemProps) { 経験者 - 1 + {experience} diff --git a/components/league/leagueDnd.tsx b/components/league/leagueDnd.tsx index 6e78b2d..c0c75e6 100644 --- a/components/league/leagueDnd.tsx +++ b/components/league/leagueDnd.tsx @@ -6,7 +6,7 @@ import { DialogContent, DialogActions, Stack, - Alert, Snackbar, Typography + Alert, Snackbar, Typography, Tooltip } from "@mui/material"; import React, {useState, useEffect} from 'react'; import { @@ -56,6 +56,17 @@ export default function LeagueDnd(props: LeagueDndProps) { }; void fetchGameEntries(); + + const fetchGames = async () => { + const games = await gameFactory().index(); + const sportGames = games.filter(game => game.sportId === sportId); + const gameItems: Record = sportGames.reduce((obj: Record, game) => { + obj[game.name] = []; + return obj; + }, { 'All': [] } as Record); + setItems(gameItems); + }; + fetchGames(); }, [sportId]); const addNewList = () => { @@ -73,7 +84,7 @@ export default function LeagueDnd(props: LeagueDndProps) { const nextLetter = alphabet[nextIndex]; setItems(prevItems => ({ ...prevItems, - [`リーグ${nextLetter}`]: [], + [`${nextLetter}リーグ`]: [], })); }; @@ -96,7 +107,7 @@ export default function LeagueDnd(props: LeagueDndProps) { const reorderedItems = Object.keys(newItems).reduce<{ [key: string]: string[]; }>((obj, listKey) => { if (listKey !== 'All') { // 新しい名前を割り当てます(アルファベット順) - obj[`リーグ${alphabet[index]}`] = newItems[listKey]; + obj[`${alphabet[index]}リーグ`] = newItems[listKey]; index++; } else { obj[listKey] = newItems[listKey]; @@ -297,7 +308,9 @@ export default function LeagueDnd(props: LeagueDndProps) { } {key !== 'All' && <> - {key} + + {key} + @@ -336,10 +430,10 @@ export default function LeagueDnd(props: LeagueDndProps) { open={openDialog} onClose={handleCloseDialog} > - {listToRemove}を削除しますか? + {listToRemove}を削除しますか? - 削除すると、{listToRemove}に入っていたチームはチーム一覧に戻されます。 + 削除すると、{listToRemove}に入っていたチームはチーム一覧に戻されます。 削除したリーグは復元できません。よろしいですか? @@ -354,6 +448,7 @@ export default function LeagueDnd(props: LeagueDndProps) { + {/* League Remove Snackbar */} + {/* League Move Snackbar */} + + + 変更を保存しました + + {/* DragOverlay */} {activeId ? : null} diff --git a/yarn.lock b/yarn.lock index 4cbe3b2..04bf46a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5100,7 +5100,8 @@ wrappy@1: "xlsx@https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz": version "0.20.2" - resolved "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz#0f64eeed3f1a46e64724620c3553f2dbd3cd2d7d" + resolved "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz" + integrity sha512-+nKZ39+nvK7Qq6i0PvWWRA4j/EkfWOtkP/YhMtupm+lJIiHxUrgTr1CcKv1nBk1rHtkRRQ3O2+Ih/q/sA+FXZA== yallist@^3.0.2: version "3.1.1" From 99b4290c5b3bebf0c087722e0e0bc0e1c54a6085 Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Sun, 12 May 2024 22:52:17 +0900 Subject: [PATCH 23/24] fix: leagueDnd save changes using difference --- components/league/leagueDnd.tsx | 194 ++++++++++++++++++++------------ 1 file changed, 122 insertions(+), 72 deletions(-) diff --git a/components/league/leagueDnd.tsx b/components/league/leagueDnd.tsx index 0bc33c1..ade890b 100644 --- a/components/league/leagueDnd.tsx +++ b/components/league/leagueDnd.tsx @@ -112,46 +112,99 @@ export default function LeagueDnd(props: LeagueDndProps) { weight: 0, tagId: null }); - setMoveSnackOpen(false) - setMoveSnackOpen(true) }; const removeList = async (key: string) => { const games = await gameFactory().index(); - setItems(prevItems => { - const newItems = {...prevItems}; - // 削除する配列の中に値があるか確認 - if (newItems[key].length > 0) { - // 値がある場合、その値をAll配列に追加 - newItems['All'] = [...newItems['All'], ...newItems[key]]; - } - // 指定された配列を削除 - delete newItems[key]; + // Find the game to delete + const gameToDelete = games.find(game => game.name === key); - // アルファベットの文字列を作成 - const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - let index = 0; - - // 新しいオブジェクトを作成し、削除したリスト以外のすべてのリストをコピーします - const reorderedItems = Object.keys(newItems).reduce<{ [key: string]: string[]; }>((obj, listKey) => { - if (listKey !== 'All') { - // 新しい名前を割り当てます(アルファベット順) - const prefix = props.sport.tagId === 1 ? '晴天時' : props.sport.tagId === 2 ? '雨天時' : ''; - obj[`${prefix}${alphabet[index]}リーグ`] = newItems[listKey]; - index++; - } else { - obj[listKey] = newItems[listKey]; + if (gameToDelete) { + // Delete the game + await gameFactory().delete(gameToDelete.id); + + setItems(prevItems => { + const newItems = {...prevItems}; + + // Move the teams from the deleted game to the 'All' list + if (newItems[key].length > 0) { + newItems['All'] = [...newItems['All'], ...newItems[key]]; } - return obj; - }, {}); - return reorderedItems; - }); + // Delete the game from the list + delete newItems[key]; - const gameToDelete = games.find(game => game.name === listToRemove); - if (gameToDelete) { - await gameFactory().delete(gameToDelete.id); + // Create a new object and copy all lists except the deleted one + const reorderedItems = Object.keys(newItems).sort().reduce<{ [key: string]: string[]; }>((obj, listKey) => { + obj[listKey] = newItems[listKey]; + return obj; + }, {}); + + return reorderedItems; + }); + + setDelSnackOpen(true); + } else { + console.error(`Game with name ${key} not found.`); + } + }; + + const updateGames = async () => { + // Fetch games and teams from the server + const games = await gameFactory().index(); + const teams = await teamFactory().index(); + + // Compare the current state with the server state and update if necessary + for (const [key, value] of Object.entries(items)) { + if (key !== 'All') { + const game = games.find(game => game.name === key && game.sportId === props.sport.id); + + // Check if the game is not undefined + if (!game) { + console.error(`Game with name ${key} not found.`); + continue; + } + + const serverTeams = teams.filter(team => team.enteredGameIds.includes(game.id)); + + // Check if the teams in the server match with the current state + const isSame = value.length === serverTeams.length && value.every((teamId, index) => serverTeams[index]?.id.toString() === teamId); + + // If not, update the game with the current state + if (!isSame) { + await gameFactory().update(game.id, { + name: key, + sportId: props.sport.id, + description: props.sport.name, + type: "league", + calculationType: "total_score", + weight: 0, + tagId: null + }); + + // Find teams that are no longer in the array and remove them + const teamsToRemove = serverTeams.filter(serverTeam => !value.includes(serverTeam.id.toString())); + for (const team of teamsToRemove) { + try { + await gameFactory().removeGameEntry(game.id, team.id); + } catch (error) { + console.error(`Failed to remove team with id ${team.id} from game with id ${game.id}. Error: ${error}`); + } + } + + // Add new teams to the game + for (const teamId of value) { + // Check if the team is not in the list of teams to remove + if (!teamsToRemove.some(team => team.id.toString() === teamId)) { + await gameFactory().addGameEntries(game.id, [parseInt(teamId)]); + } + } + + setMoveSnackMessage(`${teamsToRemove.length}チームが${key}から削除されました。`) + setMoveSnackOpen(true) + } + } } }; @@ -160,6 +213,7 @@ export default function LeagueDnd(props: LeagueDndProps) { const [listToRemove, setListToRemove] = useState(""); const [delSnackOpen, setDelSnackOpen] = useState(false) const [moveSnackOpen, setMoveSnackOpen] = useState(false) + const [moveSnackMessage, setMoveSnackMessage] = useState("") const [newListName, setNewListName] = useState('') const handleDelSnackClose = () => { @@ -185,7 +239,6 @@ export default function LeagueDnd(props: LeagueDndProps) { const handleRemoveList = () => { removeList(listToRemove); setOpenDialog(false); - setDelSnackOpen(true); }; const handleListNameChange = (key: string) => { @@ -210,9 +263,9 @@ export default function LeagueDnd(props: LeagueDndProps) { //各コンテナ取得関数 const findContainer = (id: UniqueIdentifier) => { - console.log(`id: ${id.toString()}`) + // console.log(`id: ${id.toString()}`) if (id in items) { - console.log("id in items") + // console.log("id in items") return id; } @@ -220,12 +273,12 @@ export default function LeagueDnd(props: LeagueDndProps) { items[key].includes(id.toString()) ); - if (!container) { - console.log("Not found id") - } - else { - console.log("keys(items).find()") - } + // if (!container) { + // console.log("Not found id") + // } + // else { + // console.log("keys(items).find()") + // } return container }; @@ -252,7 +305,7 @@ export default function LeagueDnd(props: LeagueDndProps) { // container1,container2,container3,container4のいずれかを持つ const activeContainer = findContainer(id); const overContainer = findContainer(over?.id); - console.log("Over1", id, over?.id.toString()) + // console.log("Over1", id, over?.id.toString()) if ( !activeContainer || @@ -271,7 +324,7 @@ export default function LeagueDnd(props: LeagueDndProps) { // 配列のインデックス取得 const activeIndex = activeItems.indexOf(id); const overIndex = overItems.indexOf(overId.toString()); - console.log ("Over2", id, overId.toString()) + // console.log ("Over2", id, overId.toString()) let newIndex; if (overId in prev) { @@ -301,35 +354,32 @@ export default function LeagueDnd(props: LeagueDndProps) { // ドラッグ終了時に発火する関数 const handleDragEnd = async (event: DragEndEvent) => { - console.log("ドラックエンド!") - const games = await gameFactory().index(); - const gamesToDelete = games.filter(game => game.sportId === props.sport.id); - - // Delete games that match the sportId - for (const game of gamesToDelete) { - await gameFactory().delete(game.id); - } - - // Create new games and add teams to them - for (const [key, value] of Object.entries(items)) { - if (key !== 'All') { - const newGame = await gameFactory().create({ - name: key, - sportId: props.sport.id, - description: props.sport.name, - type: "league", - calculationType: "total_score", - weight: 0, - tagId: null - }); - - for (const teamId of value) { - await gameFactory().addGameEntries(newGame.id, [parseInt(teamId)]); - } - } - } - setMoveSnackOpen(false) - setMoveSnackOpen(true) + await updateGames(); + // const games = await gameFactory().index(); + // const gamesToDelete = games.filter(game => game.sportId === props.sport.id); + // // Delete all games + // for (const game of gamesToDelete) { + // await gameFactory().delete(game.id); + // } + // + // // Create new games and add teams to them + // for (const [key, value] of Object.entries(items)) { + // if (key !== 'All') { + // const newGame = await gameFactory().create({ + // name: key, + // sportId: props.sport.id, + // description: props.sport.name, + // type: "league", + // calculationType: "total_score", + // weight: 0, + // tagId: null + // }); + // + // for (const teamId of value) { + // await gameFactory().addGameEntries(newGame.id, [parseInt(teamId)]); + // } + // } + // } const {active, over} = event; //ドラッグしたリソースのid const id = active.id.toString(); @@ -477,7 +527,7 @@ export default function LeagueDnd(props: LeagueDndProps) { variant="filled" sx={{ width: '100%' }} > - 変更を保存しました + {moveSnackMessage} {/* DragOverlay */} From 6611841c90a988da2e9ea20d0ada6c47948d3c5b Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Mon, 13 May 2024 00:21:00 +0900 Subject: [PATCH 24/24] fix: leagueDnd game rename feature, new game naming feature --- components/league/leagueDnd.tsx | 278 ++++++++++++++++++++++---------- 1 file changed, 194 insertions(+), 84 deletions(-) diff --git a/components/league/leagueDnd.tsx b/components/league/leagueDnd.tsx index ade890b..123a77d 100644 --- a/components/league/leagueDnd.tsx +++ b/components/league/leagueDnd.tsx @@ -9,7 +9,7 @@ import { Alert, Snackbar, Typography, Tooltip, TextField } from "@mui/material"; -import {HiPlus, HiTrash} from "react-icons/hi2"; +import {HiCheck, HiPlus, HiTrash, HiXMark} from "react-icons/hi2"; import { DndContext, DragOverlay, @@ -87,33 +87,6 @@ export default function LeagueDnd(props: LeagueDndProps) { void fetchGames(); }, [sportId]); - const addNewList = async () => { - const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - const nextIndex = Object.keys(items).length - 1; - - if (nextIndex >= 26 || !alphabet[nextIndex]) { - alert("これ以上リーグを作成できません") - return; - } - - const nextLetter = alphabet[nextIndex]; - const prefix = props.sport.tagId === 1 ? '晴天時' : props.sport.tagId === 2 ? '雨天時' : ''; - setItems(prevItems => ({ - ...prevItems, - [`${prefix}${nextLetter}リーグ`]: [], - })); - - const newGame = await gameFactory().create({ - name: `${prefix}${nextLetter}リーグ`, - sportId: props.sport.id, - description: props.sport.name, - type: "league", - calculationType: "total_score", - weight: 0, - tagId: null - }); - }; - const removeList = async (key: string) => { const games = await gameFactory().index(); @@ -201,7 +174,7 @@ export default function LeagueDnd(props: LeagueDndProps) { } } - setMoveSnackMessage(`${teamsToRemove.length}チームが${key}から削除されました。`) + setMoveSnackMessage(`変更が保存されました。`) setMoveSnackOpen(true) } } @@ -214,7 +187,107 @@ export default function LeagueDnd(props: LeagueDndProps) { const [delSnackOpen, setDelSnackOpen] = useState(false) const [moveSnackOpen, setMoveSnackOpen] = useState(false) const [moveSnackMessage, setMoveSnackMessage] = useState("") - const [newListName, setNewListName] = useState('') + const [openRenameDialog, setOpenRenameDialog] = useState(false); + const [gameToRename, setGameToRename] = useState(""); + const [newGameName, setNewGameName] = useState(""); + const [openNewGameDialog, setOpenNewGameDialog] = useState(false); + const [addGameName, setAddGameName] = useState(""); + const [newErrorMessage, setNewErrorMessage] = useState(""); + const [editErrorMessage, setEditErrorMessage] = useState(""); + +// Open the dialog + const handleOpenNewGameDialog = () => { + setOpenNewGameDialog(true); + }; + +// Close the dialog + const handleCloseNewGameDialog = () => { + setOpenNewGameDialog(false); + }; + +// Create a new game and close the dialog + const handleCreateNewGame = async () => { + // Fetch all games + const games = await gameFactory().index(); + + // Check if the new game name already exists + if (games.some(game => game.name === addGameName && game.sportId === props.sport.id)) { + setNewErrorMessage("この名前は既に存在します。"); + return; + } + + // Create the new game + const newGame = await gameFactory().create({ + name: addGameName, + sportId: props.sport.id, + description: props.sport.name, + type: "league", + calculationType: "total_score", + weight: 0, + tagId: null + }); + + // Add the new game to the items + setItems(prevItems => ({ + ...prevItems, + [addGameName]: [], + })); + + // Reset the new game name and close the dialog + setAddGameName(""); + setOpenNewGameDialog(false); + setNewErrorMessage(""); // Reset the error message + }; + +// Open the dialog + const handleOpenRenameDialog = (key: string) => { + setGameToRename(key); + setNewGameName(key); // Set the new game name to the current game name + setOpenRenameDialog(true); + }; + +// Close the dialog + const handleCloseRenameDialog = () => { + setOpenRenameDialog(false); + }; + +// Rename the game and close the dialog + const handleRenameGame = async () => { + // Fetch the game to update + const games = await gameFactory().index(); + const gameToUpdate = games.find(game => game.name === gameToRename && game.sportId === props.sport.id); + + if (games.some(game => game.name === newGameName && game.sportId === props.sport.id)) { + setEditErrorMessage("この名前は既に存在します。"); + return; + } + if (gameToUpdate) { + // Update the game name + await gameFactory().update(gameToUpdate.id, + { + name: newGameName, + description: gameToUpdate.description, + sportId: gameToUpdate.sportId, + type: gameToUpdate.type, + calculationType: gameToUpdate.calculationType, + weight: gameToUpdate.weight, + tagId: gameToUpdate.tagId + } + ); + } else { + console.error(`Game with name ${gameToRename} not found.`); + } + + setItems(prevItems => { + const newItems = {...prevItems}; + newItems[newGameName] = newItems[gameToRename]; + delete newItems[gameToRename]; + return newItems; + }); + + setOpenRenameDialog(false); + setEditErrorMessage(""); // Reset the error message + }; const handleDelSnackClose = () => { setDelSnackOpen(false) @@ -241,15 +314,6 @@ export default function LeagueDnd(props: LeagueDndProps) { setOpenDialog(false); }; - const handleListNameChange = (key: string) => { - setItems(prevItems => { - const newItems = {...prevItems}; - newItems[newListName] = newItems[key]; - delete newItems[key]; - return newItems; - }); - }; - //リストのリソースid(リストの値) const [activeId, setActiveId] = useState(); @@ -263,9 +327,7 @@ export default function LeagueDnd(props: LeagueDndProps) { //各コンテナ取得関数 const findContainer = (id: UniqueIdentifier) => { - // console.log(`id: ${id.toString()}`) if (id in items) { - // console.log("id in items") return id; } @@ -273,13 +335,6 @@ export default function LeagueDnd(props: LeagueDndProps) { items[key].includes(id.toString()) ); - // if (!container) { - // console.log("Not found id") - // } - // else { - // console.log("keys(items).find()") - // } - return container }; @@ -355,31 +410,7 @@ export default function LeagueDnd(props: LeagueDndProps) { // ドラッグ終了時に発火する関数 const handleDragEnd = async (event: DragEndEvent) => { await updateGames(); - // const games = await gameFactory().index(); - // const gamesToDelete = games.filter(game => game.sportId === props.sport.id); - // // Delete all games - // for (const game of gamesToDelete) { - // await gameFactory().delete(game.id); - // } - // - // // Create new games and add teams to them - // for (const [key, value] of Object.entries(items)) { - // if (key !== 'All') { - // const newGame = await gameFactory().create({ - // name: key, - // sportId: props.sport.id, - // description: props.sport.name, - // type: "league", - // calculationType: "total_score", - // weight: 0, - // tagId: null - // }); - // - // for (const teamId of value) { - // await gameFactory().addGameEntries(newGame.id, [parseInt(teamId)]); - // } - // } - // } + const {active, over} = event; //ドラッグしたリソースのid const id = active.id.toString(); @@ -438,7 +469,7 @@ export default function LeagueDnd(props: LeagueDndProps) { size={"small"} variant={"contained"} startIcon={} - onClick={addNewList} + onClick={handleOpenNewGameDialog} sx={{maxWidth:"168px", width:"100%"}} > リーグ追加 @@ -455,16 +486,26 @@ export default function LeagueDnd(props: LeagueDndProps) { {key} - + + + + {listToRemove}を削除しますか? @@ -498,6 +541,73 @@ export default function LeagueDnd(props: LeagueDndProps) { + {/* "New Game" Dialog */} + + 新しいリーグを作成します + + + リーグにつける名前を決めましょう + + setAddGameName(event.target.value)} + error={!!newErrorMessage} // Show the error if the error message is not empty + helperText={newErrorMessage} + /> + + + + + + + {/* Rename Dialog */} + + リーグ名を変更します + + + 新しい名前は何にしますか? + + setNewGameName(event.target.value)} + error={!!editErrorMessage} // Show the error if the error message is not empty + helperText={editErrorMessage} + /> + + + + + + {/* League Remove Snackbar */}