diff --git a/bun.lockb b/bun.lockb index e069a49d..bb9cffcf 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/common/consts.ts b/common/consts.ts index 17098809..bb92cc12 100644 --- a/common/consts.ts +++ b/common/consts.ts @@ -10,4 +10,20 @@ export const DAY_TO_JAPANESE_MAP = new Map([ ["sun", "日"], ]); -export const ACTIVE_DAYS = ["mon", "tue", "wed", "thu", "fri", "sat"] as const; +export const ACTIVE_DAYS = ["mon", "tue", "wed", "thu", "fri"] as const; + +export const sortSlots = ( + slots: { + day: "mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun" | "other"; + period: number; + }[], +) => { + const order = ["mon", "tue", "wed", "thu", "fri", "sat", "sun", "other"]; + return slots.sort((a, b) => { + const dayComparison = order.indexOf(a.day) - order.indexOf(b.day); + if (dayComparison !== 0) { + return dayComparison; + } + return a.period - b.period; + }); +}; diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 6ddf1e62..00000000 --- a/package-lock.json +++ /dev/null @@ -1,1313 +0,0 @@ -{ - "name": "course-mate", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "course-mate", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "zod": "^3.23.8" - }, - "devDependencies": { - "@biomejs/biome": "^1.9.1", - "@types/bun": "^1.1.10", - "cspell": "^8.14.4", - "lefthook": "^1.8.4", - "typescript": "^5.6.2" - } - }, - "node_modules/@biomejs/biome": { - "version": "1.9.4", - "dev": true, - "hasInstallScript": true, - "license": "MIT OR Apache-2.0", - "bin": { - "biome": "bin/biome" - }, - "engines": { - "node": ">=14.21.3" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/biome" - }, - "optionalDependencies": { - "@biomejs/cli-darwin-arm64": "1.9.4", - "@biomejs/cli-darwin-x64": "1.9.4", - "@biomejs/cli-linux-arm64": "1.9.4", - "@biomejs/cli-linux-arm64-musl": "1.9.4", - "@biomejs/cli-linux-x64": "1.9.4", - "@biomejs/cli-linux-x64-musl": "1.9.4", - "@biomejs/cli-win32-arm64": "1.9.4", - "@biomejs/cli-win32-x64": "1.9.4" - } - }, - "node_modules/@biomejs/cli-darwin-arm64": { - "version": "1.9.4", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT OR Apache-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=14.21.3" - } - }, - "node_modules/@cspell/cspell-bundled-dicts": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspell/dict-ada": "^4.0.5", - "@cspell/dict-al": "^1.0.3", - "@cspell/dict-aws": "^4.0.7", - "@cspell/dict-bash": "^4.1.8", - "@cspell/dict-companies": "^3.1.7", - "@cspell/dict-cpp": "^6.0.1", - "@cspell/dict-cryptocurrencies": "^5.0.3", - "@cspell/dict-csharp": "^4.0.5", - "@cspell/dict-css": "^4.0.16", - "@cspell/dict-dart": "^2.2.4", - "@cspell/dict-django": "^4.1.3", - "@cspell/dict-docker": "^1.1.11", - "@cspell/dict-dotnet": "^5.0.8", - "@cspell/dict-elixir": "^4.0.6", - "@cspell/dict-en_us": "^4.3.26", - "@cspell/dict-en-common-misspellings": "^2.0.7", - "@cspell/dict-en-gb": "1.1.33", - "@cspell/dict-filetypes": "^3.0.8", - "@cspell/dict-flutter": "^1.0.3", - "@cspell/dict-fonts": "^4.0.3", - "@cspell/dict-fsharp": "^1.0.4", - "@cspell/dict-fullstack": "^3.2.3", - "@cspell/dict-gaming-terms": "^1.0.8", - "@cspell/dict-git": "^3.0.3", - "@cspell/dict-golang": "^6.0.16", - "@cspell/dict-google": "^1.0.4", - "@cspell/dict-haskell": "^4.0.4", - "@cspell/dict-html": "^4.0.10", - "@cspell/dict-html-symbol-entities": "^4.0.3", - "@cspell/dict-java": "^5.0.10", - "@cspell/dict-julia": "^1.0.4", - "@cspell/dict-k8s": "^1.0.9", - "@cspell/dict-latex": "^4.0.3", - "@cspell/dict-lorem-ipsum": "^4.0.3", - "@cspell/dict-lua": "^4.0.6", - "@cspell/dict-makefile": "^1.0.3", - "@cspell/dict-markdown": "^2.0.7", - "@cspell/dict-monkeyc": "^1.0.9", - "@cspell/dict-node": "^5.0.5", - "@cspell/dict-npm": "^5.1.11", - "@cspell/dict-php": "^4.0.13", - "@cspell/dict-powershell": "^5.0.13", - "@cspell/dict-public-licenses": "^2.0.11", - "@cspell/dict-python": "^4.2.12", - "@cspell/dict-r": "^2.0.4", - "@cspell/dict-ruby": "^5.0.7", - "@cspell/dict-rust": "^4.0.9", - "@cspell/dict-scala": "^5.0.6", - "@cspell/dict-software-terms": "^4.1.13", - "@cspell/dict-sql": "^2.1.8", - "@cspell/dict-svelte": "^1.0.5", - "@cspell/dict-swift": "^2.0.4", - "@cspell/dict-terraform": "^1.0.6", - "@cspell/dict-typescript": "^3.1.11", - "@cspell/dict-vue": "^3.0.3" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/@cspell/cspell-json-reporter": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspell/cspell-types": "8.16.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/@cspell/cspell-pipe": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/@cspell/cspell-resolver": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "global-directory": "^4.0.1" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/@cspell/cspell-service-bus": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/@cspell/cspell-types": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/@cspell/dict-ada": { - "version": "4.0.5", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-al": { - "version": "1.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-aws": { - "version": "4.0.7", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-bash": { - "version": "4.1.8", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-companies": { - "version": "3.1.7", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-cpp": { - "version": "6.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-cryptocurrencies": { - "version": "5.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-csharp": { - "version": "4.0.5", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-css": { - "version": "4.0.16", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-dart": { - "version": "2.2.4", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-data-science": { - "version": "2.0.5", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-django": { - "version": "4.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-docker": { - "version": "1.1.11", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-dotnet": { - "version": "5.0.8", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-elixir": { - "version": "4.0.6", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-en_us": { - "version": "4.3.27", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-en-common-misspellings": { - "version": "2.0.7", - "dev": true, - "license": "CC BY-SA 4.0" - }, - "node_modules/@cspell/dict-en-gb": { - "version": "1.1.33", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-filetypes": { - "version": "3.0.8", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-flutter": { - "version": "1.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-fonts": { - "version": "4.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-fsharp": { - "version": "1.0.4", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-fullstack": { - "version": "3.2.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-gaming-terms": { - "version": "1.0.8", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-git": { - "version": "3.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-golang": { - "version": "6.0.17", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-google": { - "version": "1.0.4", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-haskell": { - "version": "4.0.4", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-html": { - "version": "4.0.10", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-html-symbol-entities": { - "version": "4.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-java": { - "version": "5.0.10", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-julia": { - "version": "1.0.4", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-k8s": { - "version": "1.0.9", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-latex": { - "version": "4.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-lorem-ipsum": { - "version": "4.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-lua": { - "version": "4.0.6", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-makefile": { - "version": "1.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-markdown": { - "version": "2.0.7", - "dev": true, - "license": "MIT", - "peerDependencies": { - "@cspell/dict-css": "^4.0.16", - "@cspell/dict-html": "^4.0.10", - "@cspell/dict-html-symbol-entities": "^4.0.3", - "@cspell/dict-typescript": "^3.1.11" - } - }, - "node_modules/@cspell/dict-monkeyc": { - "version": "1.0.9", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-node": { - "version": "5.0.5", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-npm": { - "version": "5.1.13", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-php": { - "version": "4.0.13", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-powershell": { - "version": "5.0.13", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-public-licenses": { - "version": "2.0.11", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-python": { - "version": "4.2.12", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspell/dict-data-science": "^2.0.5" - } - }, - "node_modules/@cspell/dict-r": { - "version": "2.0.4", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-ruby": { - "version": "5.0.7", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-rust": { - "version": "4.0.10", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-scala": { - "version": "5.0.6", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-software-terms": { - "version": "4.1.17", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-sql": { - "version": "2.1.8", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-svelte": { - "version": "1.0.5", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-swift": { - "version": "2.0.4", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-terraform": { - "version": "1.0.6", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-typescript": { - "version": "3.1.11", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dict-vue": { - "version": "3.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspell/dynamic-import": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "import-meta-resolve": "^4.1.0" - }, - "engines": { - "node": ">=18.0" - } - }, - "node_modules/@cspell/filetypes": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/@cspell/strong-weak-map": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/@cspell/url": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18.0" - } - }, - "node_modules/@types/bun": { - "version": "1.1.13", - "dev": true, - "license": "MIT", - "dependencies": { - "bun-types": "1.1.34" - } - }, - "node_modules/@types/node": { - "version": "20.12.14", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@types/ws": { - "version": "8.5.13", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/array-timsort": { - "version": "1.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/braces": { - "version": "3.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/bun-types": { - "version": "1.1.34", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "~20.12.8", - "@types/ws": "~8.5.10" - } - }, - "node_modules/callsites": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/chalk": { - "version": "5.3.0", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/chalk-template": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^5.2.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/chalk/chalk-template?sponsor=1" - } - }, - "node_modules/clear-module": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "parent-module": "^2.0.0", - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/commander": { - "version": "12.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/comment-json": { - "version": "4.2.5", - "dev": true, - "license": "MIT", - "dependencies": { - "array-timsort": "^1.0.3", - "core-util-is": "^1.0.3", - "esprima": "^4.0.1", - "has-own-prop": "^2.0.0", - "repeat-string": "^1.6.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/core-util-is": { - "version": "1.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/cspell": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspell/cspell-json-reporter": "8.16.0", - "@cspell/cspell-pipe": "8.16.0", - "@cspell/cspell-types": "8.16.0", - "@cspell/dynamic-import": "8.16.0", - "@cspell/url": "8.16.0", - "chalk": "^5.3.0", - "chalk-template": "^1.1.0", - "commander": "^12.1.0", - "cspell-dictionary": "8.16.0", - "cspell-gitignore": "8.16.0", - "cspell-glob": "8.16.0", - "cspell-io": "8.16.0", - "cspell-lib": "8.16.0", - "fast-json-stable-stringify": "^2.1.0", - "file-entry-cache": "^9.1.0", - "get-stdin": "^9.0.0", - "semver": "^7.6.3", - "tinyglobby": "^0.2.10" - }, - "bin": { - "cspell": "bin.mjs", - "cspell-esm": "bin.mjs" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/streetsidesoftware/cspell?sponsor=1" - } - }, - "node_modules/cspell-config-lib": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspell/cspell-types": "8.16.0", - "comment-json": "^4.2.5", - "yaml": "^2.6.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/cspell-dictionary": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspell/cspell-pipe": "8.16.0", - "@cspell/cspell-types": "8.16.0", - "cspell-trie-lib": "8.16.0", - "fast-equals": "^5.0.1" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/cspell-gitignore": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspell/url": "8.16.0", - "cspell-glob": "8.16.0", - "cspell-io": "8.16.0", - "find-up-simple": "^1.0.0" - }, - "bin": { - "cspell-gitignore": "bin.mjs" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/cspell-glob": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspell/url": "8.16.0", - "micromatch": "^4.0.8" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/cspell-grammar": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspell/cspell-pipe": "8.16.0", - "@cspell/cspell-types": "8.16.0" - }, - "bin": { - "cspell-grammar": "bin.mjs" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/cspell-io": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspell/cspell-service-bus": "8.16.0", - "@cspell/url": "8.16.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/cspell-lib": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspell/cspell-bundled-dicts": "8.16.0", - "@cspell/cspell-pipe": "8.16.0", - "@cspell/cspell-resolver": "8.16.0", - "@cspell/cspell-types": "8.16.0", - "@cspell/dynamic-import": "8.16.0", - "@cspell/filetypes": "8.16.0", - "@cspell/strong-weak-map": "8.16.0", - "@cspell/url": "8.16.0", - "clear-module": "^4.1.2", - "comment-json": "^4.2.5", - "cspell-config-lib": "8.16.0", - "cspell-dictionary": "8.16.0", - "cspell-glob": "8.16.0", - "cspell-grammar": "8.16.0", - "cspell-io": "8.16.0", - "cspell-trie-lib": "8.16.0", - "env-paths": "^3.0.0", - "fast-equals": "^5.0.1", - "gensequence": "^7.0.0", - "import-fresh": "^3.3.0", - "resolve-from": "^5.0.0", - "vscode-languageserver-textdocument": "^1.0.12", - "vscode-uri": "^3.0.8", - "xdg-basedir": "^5.1.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/cspell-trie-lib": { - "version": "8.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspell/cspell-pipe": "8.16.0", - "@cspell/cspell-types": "8.16.0", - "gensequence": "^7.0.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/env-paths": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "dev": true, - "license": "BSD-2-Clause", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/fast-equals": { - "version": "5.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/fdir": { - "version": "6.4.2", - "dev": true, - "license": "MIT", - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/file-entry-cache": { - "version": "9.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "flat-cache": "^5.0.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/fill-range": { - "version": "7.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-up-simple": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat-cache": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "flatted": "^3.3.1", - "keyv": "^4.5.4" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/flatted": { - "version": "3.3.2", - "dev": true, - "license": "ISC" - }, - "node_modules/gensequence": { - "version": "7.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/get-stdin": { - "version": "9.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/global-directory": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ini": "4.1.1" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/has-own-prop": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/import-fresh": { - "version": "3.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-fresh/node_modules/parent-module": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/import-fresh/node_modules/resolve-from": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/import-meta-resolve": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/ini": { - "version": "4.1.1", - "dev": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/json-buffer": { - "version": "3.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/keyv": { - "version": "4.5.4", - "dev": true, - "license": "MIT", - "dependencies": { - "json-buffer": "3.0.1" - } - }, - "node_modules/lefthook": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/lefthook/-/lefthook-1.8.4.tgz", - "integrity": "sha512-XNyMaTWNRuADOaocYiHidgNkNDz8SCekpdNJ7lqceFcBT2zjumnb28/o7IMaNROpLBZdQkLkJXSeaQWGqn3kog==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "bin": { - "lefthook": "bin/index.js" - }, - "optionalDependencies": { - "lefthook-darwin-arm64": "1.8.4", - "lefthook-darwin-x64": "1.8.4", - "lefthook-freebsd-arm64": "1.8.4", - "lefthook-freebsd-x64": "1.8.4", - "lefthook-linux-arm64": "1.8.4", - "lefthook-linux-x64": "1.8.4", - "lefthook-openbsd-arm64": "1.8.4", - "lefthook-openbsd-x64": "1.8.4", - "lefthook-windows-arm64": "1.8.4", - "lefthook-windows-x64": "1.8.4" - } - }, - "node_modules/lefthook-darwin-arm64": { - "version": "1.8.4", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/lefthook-darwin-x64": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/lefthook-darwin-x64/-/lefthook-darwin-x64-1.8.4.tgz", - "integrity": "sha512-QLRsqK9aTMRcVW8qz4pzI2OWnGCEcaEPJlIiFjwstYsS+wfkooxOS0UkfVMjy+QoGgEcki+cxF/FoY7lE7DDtw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/lefthook-freebsd-arm64": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/lefthook-freebsd-arm64/-/lefthook-freebsd-arm64-1.8.4.tgz", - "integrity": "sha512-chnQ1m/Cmn9c0sLdk5HL2SToE5LBJv5uQMdH1IGRRcw+nEqWqrMnDXvM75caiJAyjmUGvPH3czKTJDzTFV1E+A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/lefthook-freebsd-x64": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/lefthook-freebsd-x64/-/lefthook-freebsd-x64-1.8.4.tgz", - "integrity": "sha512-KQi+WBUdnGLnK0rHOR58kbMH5TDVN1ZjZLu66Pv9FCG7Y7shR1qtaTXu+wmxdRhMvaLeQIXRsUEPjNRC66yMmA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/lefthook-linux-arm64": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/lefthook-linux-arm64/-/lefthook-linux-arm64-1.8.4.tgz", - "integrity": "sha512-CXNcqIskLwTwQARidGdFqmNxpvOU3jsWPK4KA7pq2+QmlWJ64w98ebMvNBoUmRUCXqzmUm7Udf/jpfz2fobewQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/lefthook-linux-x64": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/lefthook-linux-x64/-/lefthook-linux-x64-1.8.4.tgz", - "integrity": "sha512-pVNITkFBxUCEtamWSM/res2Gd48+m9YKbNyIBndAuZVC5pKV5aGKZy2DNq6PWUPYiUDPx+7hoAtCJg/tlAiqhw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/lefthook-openbsd-arm64": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/lefthook-openbsd-arm64/-/lefthook-openbsd-arm64-1.8.4.tgz", - "integrity": "sha512-l+i/Dg5X36kYzhpMGSPE3rMbWy1KSytbLB9lY1PmxYb6LRH6iQTYIoxvLabVUwSBPSq8HtIFa50+bvC5+scfVA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ] - }, - "node_modules/lefthook-openbsd-x64": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/lefthook-openbsd-x64/-/lefthook-openbsd-x64-1.8.4.tgz", - "integrity": "sha512-CqhDDPPX8oHzMLgNi/Reba823DRzj+eMNWQ8axvSiIG+zmG1w20xZH5QSs/mD3tjrND90yfDd90mWMt181qPyA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ] - }, - "node_modules/lefthook-windows-arm64": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/lefthook-windows-arm64/-/lefthook-windows-arm64-1.8.4.tgz", - "integrity": "sha512-dvpvorICmVjmw29Aiczg7DcaSzkd86bEBomiGq4UsAEk3+7ExLrlWJDLFsI6xLjMKmTxy+F7eXb2uDtuFC1N4g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/lefthook-windows-x64": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/lefthook-windows-x64/-/lefthook-windows-x64-1.8.4.tgz", - "integrity": "sha512-e+y8Jt4/7PnoplhOuK48twjGVJEsU4T3J5kxD4mWfl6Cbit0YSn4bme9nW41eqCqTUqOm+ky29XlfnPHFX5ZNA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/micromatch": { - "version": "4.0.8", - "dev": true, - "license": "MIT", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/micromatch/node_modules/picomatch": { - "version": "2.3.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/parent-module": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "callsites": "^3.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/picomatch": { - "version": "4.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/repeat-string": { - "version": "1.6.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/resolve-from": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/semver": { - "version": "7.6.3", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/tinyglobby": { - "version": "0.2.10", - "dev": true, - "license": "MIT", - "dependencies": { - "fdir": "^6.4.2", - "picomatch": "^4.0.2" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/typescript": { - "version": "5.7.2", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/undici-types": { - "version": "5.26.5", - "dev": true, - "license": "MIT" - }, - "node_modules/vscode-languageserver-textdocument": { - "version": "1.0.12", - "dev": true, - "license": "MIT" - }, - "node_modules/vscode-uri": { - "version": "3.0.8", - "dev": true, - "license": "MIT" - }, - "node_modules/xdg-basedir": { - "version": "5.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/yaml": { - "version": "2.6.1", - "dev": true, - "license": "ISC", - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/zod": { - "version": "3.23.8", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - } - } -} diff --git a/server/src/seeds/test-data/data.ts b/server/src/seeds/test-data/data.ts index 64dd2dd4..55dd14f1 100644 --- a/server/src/seeds/test-data/data.ts +++ b/server/src/seeds/test-data/data.ts @@ -73,27 +73,27 @@ export const courses = [ { id: "10001", name: "国語八列", - teacher: "足助太郎", + teacher: "八十島漕郎", }, { id: "10002", name: "数学八列", - teacher: "足助太郎", + teacher: "八十島漕郎", }, { id: "10003", name: "英語八列", - teacher: "足助太郎", + teacher: "八十島漕郎", }, { id: "10004", name: "理科八列", - teacher: "足助太郎", + teacher: "八十島漕郎", }, { id: "10005", name: "社会八列", - teacher: "足助太郎", + teacher: "八十島漕郎", }, ]; diff --git a/web/app/edit/courses/page.tsx b/web/app/edit/courses/page.tsx index e55e6ec7..61dcc88a 100644 --- a/web/app/edit/courses/page.tsx +++ b/web/app/edit/courses/page.tsx @@ -12,16 +12,16 @@ export default function EditCourses() { const error = state.current === "error" ? state.error : null; return ( -
+

授業編集

{loading ? ( ) : error ? (

Error: {error.message}

) : data ? ( - <> +
- +
) : (

データがありません。

)} diff --git a/web/app/edit/layout.tsx b/web/app/edit/layout.tsx index bc1ad10f..be75caf1 100644 --- a/web/app/edit/layout.tsx +++ b/web/app/edit/layout.tsx @@ -8,9 +8,9 @@ export default function EditPageLayout({ }) { return ( -
-
- {children} +
+
+
{children}
); diff --git a/web/app/home/components/PersonDetailedMenu.tsx b/web/app/home/components/PersonDetailedMenu.tsx new file mode 100644 index 00000000..fde360d2 --- /dev/null +++ b/web/app/home/components/PersonDetailedMenu.tsx @@ -0,0 +1,153 @@ +import { DAY_TO_JAPANESE_MAP, sortSlots } from "common/consts"; +import type { UserWithCoursesAndSubjects } from "common/types"; +import { useState } from "react"; +import { MdClose } from "react-icons/md"; +import { MdOpenInNew } from "react-icons/md"; +import { MdArrowBack } from "react-icons/md"; +import NonEditableCoursesTable from "~/components/course/NonEditableCoursesTable"; + +type Props = { + onClose: () => void; + displayedUser: UserWithCoursesAndSubjects; + currentUser: UserWithCoursesAndSubjects; +}; + +export default function PersonDetailedMenu({ + onClose, + displayedUser, + currentUser, +}: Props) { + const [menuStatus, setMenuStatus] = useState<"detailedInfo" | "coursesTable">( + "detailedInfo", + ); + + return ( + +
+
+
+
+ +

+ {displayedUser.name}の + {menuStatus === "detailedInfo" ? "詳細情報" : "時間割表"} +

+ +
+
+
+ {menuStatus === "detailedInfo" ? ( +
+
+ 名前 +

{displayedUser.name}

+
+
+
+ 性別 +

{displayedUser.gender}

+
+
+
+ 自己紹介 +

{displayedUser.intro}

+
+
+
+
+ 講義 + +
+
+ {displayedUser.courses.map( + (course) => + course.name && ( +
c.id === course.id) + ? "bg-[#FFF1BF]" + : "bg-[#F7FCFF]" + }`} + > + + {sortSlots(course.slots) + .map( + (slot) => + `${DAY_TO_JAPANESE_MAP.get(slot.day)}${slot.period}`, + ) + .join("・")} + + + {course.name} ({course.teacher}){" "} + + {course.id} +
+ ), + )} +
+
+
+
+ 興味分野 +
+ {displayedUser.interestSubjects.map( + (subject) => + subject.name && ( + s.id === subject.id, + ) + ? "bg-[#FFF1BF]" + : "bg-[#F7FCFF]" + }`} + > + #{subject.name} + + ), + )} +
+
+
+ ) : ( +
+
+ +
+
+ +
+
+ )} +
+
+ ); +} diff --git a/web/app/home/page.tsx b/web/app/home/page.tsx index b4824bdf..b2d4a8eb 100644 --- a/web/app/home/page.tsx +++ b/web/app/home/page.tsx @@ -11,11 +11,13 @@ import { Card } from "~/components/Card"; import { DraggableCard } from "~/components/DraggableCard"; import FullScreenCircularProgress from "~/components/common/FullScreenCircularProgress"; import { NavigateByAuthState } from "~/components/common/NavigateByAuthState"; +import PersonDetailedMenu from "./components/PersonDetailedMenu"; export default function Home() { const { data, error } = useRecommended(); const controls = useAnimation(); const [clickedButton, setClickedButton] = useState(""); + const [openDetailedMenu, setOpenDetailedMenu] = useState(false); const { state: { data: currentUser }, } = useAboutMe(); @@ -88,34 +90,54 @@ export default function Home() {
{displayedUser && ( -
- {nextUser && ( -
-
- + <> +
+ {nextUser && ( +
+
+ +
+ + +
- - - + )} + +
+ } + /> + } + />
- )} -
- } /> - } - />
-
+ {openDetailedMenu && ( + { + setOpenDetailedMenu(false); + }} + displayedUser={displayedUser} + currentUser={currentUser} + /> + )} + )}
diff --git a/web/app/signup/page.tsx b/web/app/signup/page.tsx index e4d541bb..47d14a1a 100644 --- a/web/app/signup/page.tsx +++ b/web/app/signup/page.tsx @@ -77,9 +77,11 @@ function Registration() { export default function RegistrationPage() { return ( -
+
- +
+ +
); diff --git a/web/app/signup/steps/components/MockCardFront.tsx b/web/app/signup/steps/components/MockCardFront.tsx new file mode 100644 index 00000000..6f7cfe23 --- /dev/null +++ b/web/app/signup/steps/components/MockCardFront.tsx @@ -0,0 +1,63 @@ +import type { UserWithCoursesAndSubjects } from "common/types"; +import UserAvatar from "~/components/human/avatar"; + +// TODO: CardFront との統合 +export default function MockCardFront({ + displayedUser, +}: { + displayedUser: Omit< + UserWithCoursesAndSubjects, + "courses" | "interestSubjects" + >; +}) { + return ( +
+
+ +
+

{displayedUser.name}

+

{displayedUser.grade}

+

{displayedUser.faculty}

+

{displayedUser.department}

+
+
+ +
+

{displayedUser.intro}

+
+ + {/*
+
+
+ {isHiddenInterestExist && ( +
+ And More +
+ )} +
+ +
+
+ {isHiddenCourseExist && ( +
+ And More +
+ )} +
+
*/} +
+ ); +} diff --git a/web/app/signup/steps/step1_profile.tsx b/web/app/signup/steps/step1_profile.tsx index 8c55a48f..485bffde 100644 --- a/web/app/signup/steps/step1_profile.tsx +++ b/web/app/signup/steps/step1_profile.tsx @@ -1,172 +1,167 @@ -import { useState } from "react"; +import { useEffect } from "react"; -import { - Box, - FormControl, - InputLabel, - MenuItem, - Select, - TextField, - Typography, -} from "@mui/material"; -import type { SelectChangeEvent } from "@mui/material"; -import { parseStep1UserSchema } from "common/zod/methods"; import type { Step1User } from "common/zod/types"; import type { StepProps } from "~/app/signup/common"; import { facultiesAndDepartments } from "~/app/signup/data"; -export default function Step1({ onSave, prev, caller }: StepProps) { - const [name, setName] = useState(prev?.name ?? ""); - const [gender, setGender] = useState(prev?.gender ?? "その他"); - const [grade, setGrade] = useState(prev?.grade ?? ""); - const [faculty, setFaculty] = useState(prev?.faculty ?? ""); - const [department, setDepartment] = useState(prev?.department ?? ""); - const [intro, setIntro] = useState(prev?.intro ?? ""); - const [errorMessage, setErrorMessage] = useState(""); - - async function save() { - try { - const data: Step1User = { - name: name.trim(), - grade: grade, - gender: gender, - faculty: faculty, - department: department, - intro: intro.trim(), - }; - parseStep1UserSchema(data); - onSave(data); - } catch (error) { - if (error instanceof Error) { - let errorMessages: string; - try { - const parsedError = JSON.parse(error.message); - if (Array.isArray(parsedError)) { - errorMessages = parsedError.map((err) => err.message).join(", "); - } else { - errorMessages = error.message; - } - } catch { - errorMessages = error.message; - } - - // エラーメッセージをセット - setErrorMessage(errorMessages); - } else { - console.log("unknown error:", error); - setErrorMessage("入力に誤りがあります。"); - } - } - } +import { zodResolver } from "@hookform/resolvers/zod"; +import { Step1UserSchema } from "common/zod/schemas"; +import { type FieldError, type SubmitHandler, useForm } from "react-hook-form"; - const handleFacultyChange = (event: SelectChangeEvent) => { - setFaculty(event.target.value); - }; - - const handleDepartmentChange = (event: SelectChangeEvent) => { - setDepartment(event.target.value); +const faculties = Object.keys(facultiesAndDepartments); +export default function Step1({ onSave, prev, caller }: StepProps) { + const { + register, + handleSubmit, + watch, + setValue, + resetField, + formState: { errors }, + } = useForm({ + resolver: zodResolver(Step1UserSchema), + defaultValues: prev ?? { + name: "", + gender: "", + grade: "", + faculty: "", + department: "", + intro: "", + }, + }); + const onSubmit: SubmitHandler = async (data) => { + onSave(data); }; + const selectedFaculty = watch("faculty"); + useEffect(() => { + if (selectedFaculty) { + const defaultDepartment = facultiesAndDepartments[selectedFaculty][0]; + setValue("department", defaultDepartment); + } else { + resetField("department"); + } + }, [selectedFaculty, setValue, resetField]); return ( <> - - - アカウント設定 - - - - setName(e.target.value)} - label="名前" - autoComplete="off" - /> - - - 性別 - + + + + + + + + - 男性 - 女性 - その他 - 秘密 - - - - 学年 - + + {faculties.map((fac) => ( + + ))} + + + - 1年生 (B1) - 2年生 (B2) - 3年生 (B3) - 4年生 (B4) - 修士1年 (M1) - 修士2年 (M2) - - - - 学部 - - - - 学科 (先に学部を選択して下さい) - + + - {faculty && - facultiesAndDepartments[faculty].map((dep) => ( - - {dep} - - ))} - - - - setIntro(e.target.value)} - /> - - {errorMessage && ( - - {errorMessage} - - )} - - - - - - +