Browse Source

- Begin the convertion over to an -EAN stack

master
Quildra 1 year ago
parent
commit
722c29994e
  1. 1
      .gitignore
  2. 42
      .vscode/launch.json
  3. 37
      .vscode/tasks.json
  4. 0
      origin-dex-api/.env
  5. 3207
      origin-dex-api/package-lock.json
  6. 28
      origin-dex-api/package.json
  7. 143
      origin-dex-api/src/server.ts
  8. 14
      origin-dex-api/tsconfig.json
  9. 17
      origin-dex/.editorconfig
  10. 42
      origin-dex/.gitignore
  11. 4
      origin-dex/.vscode/extensions.json
  12. 31
      origin-dex/.vscode/launch.json
  13. 42
      origin-dex/.vscode/tasks.json
  14. 27
      origin-dex/README.md
  15. 117
      origin-dex/angular.json
  16. 14141
      origin-dex/package-lock.json
  17. 47
      origin-dex/package.json
  18. BIN
      origin-dex/public/favicon.ico
  19. 57
      origin-dex/server.ts
  20. 336
      origin-dex/src/app/app.component.html
  21. 0
      origin-dex/src/app/app.component.scss
  22. 29
      origin-dex/src/app/app.component.spec.ts
  23. 101
      origin-dex/src/app/app.component.ts
  24. 11
      origin-dex/src/app/app.config.server.ts
  25. 20
      origin-dex/src/app/app.config.ts
  26. 31
      origin-dex/src/app/app.routes.ts
  27. 22
      origin-dex/src/app/core/guards/auth.guard.ts
  28. 21
      origin-dex/src/app/core/interceptors/auth.interceptor.ts
  29. 29
      origin-dex/src/app/core/models/plan.model.ts
  30. 32
      origin-dex/src/app/core/models/pokemon.model.ts
  31. 5
      origin-dex/src/app/core/models/user.model.ts
  32. 82
      origin-dex/src/app/core/services/auth.service.ts
  33. 56
      origin-dex/src/app/core/services/plan.service.ts
  34. 82
      origin-dex/src/app/core/services/pokemon.service.ts
  35. 0
      origin-dex/src/app/core/services/storage.service.ts
  36. 23
      origin-dex/src/app/core/utils/pfic-utils.ts
  37. 17
      origin-dex/src/app/features/auth/auth.routes.ts
  38. 137
      origin-dex/src/app/features/auth/login/login.component.ts
  39. 155
      origin-dex/src/app/features/auth/register/register.component.ts
  40. 150
      origin-dex/src/app/features/plan/plan-game/plan-game.component.ts
  41. 319
      origin-dex/src/app/features/plan/plan-pokemon/plan-pokemon.component.ts
  42. 66
      origin-dex/src/app/features/plan/plan.component.ts
  43. 186
      origin-dex/src/app/features/pokemon/pokemon-carousel/pokemon-carousel.component.ts
  44. 173
      origin-dex/src/app/features/pokemon/pokemon-cell/pokemon-cell.component.ts
  45. 228
      origin-dex/src/app/features/pokemon/pokemon-details/pokemon-details.component.ts
  46. 149
      origin-dex/src/app/features/pokemon/pokemon-grid/pokemon-grid.component.ts
  47. 30
      origin-dex/src/app/features/pokemon/pokemon.model.ts
  48. 52
      origin-dex/src/app/shared/directives/lazy-img.directive.ts
  49. BIN
      origin-dex/src/assets/images/marks/Arceus_mark_HOME.png
  50. BIN
      origin-dex/src/assets/images/marks/BDSP_icon_HOME.png
  51. BIN
      origin-dex/src/assets/images/marks/Black_clover_HOME.png
  52. BIN
      origin-dex/src/assets/images/marks/Blue_pentagon_HOME.png
  53. BIN
      origin-dex/src/assets/images/marks/GB_icon_HOME.png
  54. BIN
      origin-dex/src/assets/images/marks/GO_icon_HOME.png
  55. BIN
      origin-dex/src/assets/images/marks/Galar_symbol_HOME.png
  56. BIN
      origin-dex/src/assets/images/marks/Let's_Go_icon_HOME.png
  57. BIN
      origin-dex/src/assets/images/marks/Markless_icon_HOME.png
  58. BIN
      origin-dex/src/assets/images/marks/Paldea_icon_HOME.png
  59. BIN
      origin-dex/src/assets/images/pokeball_color.png
  60. BIN
      origin-dex/src/assets/images/pokemon/0001-01-000-0.png
  61. BIN
      origin-dex/src/assets/images/pokemon/0002-01-000-0.png
  62. BIN
      origin-dex/src/assets/images/pokemon/0003-01-000-1.png
  63. BIN
      origin-dex/src/assets/images/pokemon/0003-01-000-2.png
  64. BIN
      origin-dex/src/assets/images/pokemon/0003-01-001-0.png
  65. BIN
      origin-dex/src/assets/images/pokemon/0003-01-002-0.png
  66. BIN
      origin-dex/src/assets/images/pokemon/0004-01-000-0.png
  67. BIN
      origin-dex/src/assets/images/pokemon/0005-01-000-0.png
  68. BIN
      origin-dex/src/assets/images/pokemon/0006-01-000-0.png
  69. BIN
      origin-dex/src/assets/images/pokemon/0006-01-001-0.png
  70. BIN
      origin-dex/src/assets/images/pokemon/0006-01-002-0.png
  71. BIN
      origin-dex/src/assets/images/pokemon/0006-01-003-0.png
  72. BIN
      origin-dex/src/assets/images/pokemon/0007-01-000-0.png
  73. BIN
      origin-dex/src/assets/images/pokemon/0008-01-000-0.png
  74. BIN
      origin-dex/src/assets/images/pokemon/0009-01-000-0.png
  75. BIN
      origin-dex/src/assets/images/pokemon/0009-01-001-0.png
  76. BIN
      origin-dex/src/assets/images/pokemon/0009-01-002-0.png
  77. BIN
      origin-dex/src/assets/images/pokemon/0010-01-000-0.png
  78. BIN
      origin-dex/src/assets/images/pokemon/0011-01-000-0.png
  79. BIN
      origin-dex/src/assets/images/pokemon/0012-01-000-1.png
  80. BIN
      origin-dex/src/assets/images/pokemon/0012-01-000-2.png
  81. BIN
      origin-dex/src/assets/images/pokemon/0012-01-001-0.png
  82. BIN
      origin-dex/src/assets/images/pokemon/0013-01-000-0.png
  83. BIN
      origin-dex/src/assets/images/pokemon/0014-01-000-0.png
  84. BIN
      origin-dex/src/assets/images/pokemon/0015-01-000-0.png
  85. BIN
      origin-dex/src/assets/images/pokemon/0015-01-001-0.png
  86. BIN
      origin-dex/src/assets/images/pokemon/0016-01-000-0.png
  87. BIN
      origin-dex/src/assets/images/pokemon/0017-01-000-0.png
  88. BIN
      origin-dex/src/assets/images/pokemon/0018-01-000-0.png
  89. BIN
      origin-dex/src/assets/images/pokemon/0018-01-001-0.png
  90. BIN
      origin-dex/src/assets/images/pokemon/0019-01-000-1.png
  91. BIN
      origin-dex/src/assets/images/pokemon/0019-01-000-2.png
  92. BIN
      origin-dex/src/assets/images/pokemon/0019-01-001-0.png
  93. BIN
      origin-dex/src/assets/images/pokemon/0019-07-001-0.png
  94. BIN
      origin-dex/src/assets/images/pokemon/0020-01-000-1.png
  95. BIN
      origin-dex/src/assets/images/pokemon/0020-01-000-2.png
  96. BIN
      origin-dex/src/assets/images/pokemon/0020-01-001-0.png
  97. BIN
      origin-dex/src/assets/images/pokemon/0020-07-001-0.png
  98. BIN
      origin-dex/src/assets/images/pokemon/0021-01-000-0.png
  99. BIN
      origin-dex/src/assets/images/pokemon/0022-01-000-0.png
  100. BIN
      origin-dex/src/assets/images/pokemon/0023-01-000-0.png

1
.gitignore

@ -7,3 +7,4 @@ __pycache__/
ui_feedback.log
logs/qt_log.log
logs/default.log
node_modules/

42
.vscode/launch.json

@ -0,0 +1,42 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File with Arguments",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"args": "${command:pickArgs}",
"subProcess": true, // Enable debugging in threads
"justMyCode": false // Disable to allow debugging into all modules
},
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}/origin-dex",
"runtimeExecutable": "C:\\Program Files\\Vivaldi\\Application\\vivaldi.exe",
"sourceMaps": true,
"runtimeArgs": [
"--remote-debugging-port=9222",
"--user-data-dir=${workspaceFolder}/origin-dex/DevProfile"
],
"sourceMapPathOverrides": {
"webpack:///./src/*": "${webRoot}/src/*",
"webpack:///src/*": "${webRoot}/src/*",
"webpack:///*": "*",
"/./*": "${webRoot}/*",
"/src/*": "${webRoot}/src/*",
"/*": "*",
"/./~/*": "${webRoot}/node_modules/*"
},
"port": 9222,
"trace": true,
}
]
}

37
.vscode/tasks.json

@ -0,0 +1,37 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"isBackground": true,
"presentation": {
"focus": true,
"panel": "dedicated"
},
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": {
"owner": "typescript",
"source": "ts",
"applyTo": "closedDocuments",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
}
]
}

0
origin-dex-api/.env

3207
origin-dex-api/package-lock.json

File diff suppressed because it is too large

28
origin-dex-api/package.json

@ -0,0 +1,28 @@
{
"name": "origin-dex-api",
"version": "1.0.0",
"main": "dist/server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node dist/server.js",
"dev": "ts-node-dev src/server.ts",
"build": "tsc"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.21.1",
"sqlite": "^5.0.1",
"sqlite3": "^5.1.6"
},
"devDependencies": {
"@types/cors": "^2.8.17",
"@types/express": "^5.0.0",
"@types/node": "^22.8.6",
"ts-node-dev": "^2.0.0",
"typescript": "^5.6.3"
}
}

143
origin-dex-api/src/server.ts

@ -0,0 +1,143 @@
import express from 'express';
import cors from 'cors';
import sqlite3 from 'sqlite3';
import { open } from 'sqlite';
const app = express();
const port = process.env.PORT || 5000;
// Middleware
app.use(cors());
app.use(express.json());
// Database connection
const dbPromise = open({
filename: '../pokemon_forms.db', // Adjust path to your database file
driver: sqlite3.Database
});
function processPokemonData(pokemonData: any[]): any[][] {
const pokemonList: any[][] = [];
let current_group: any[] = [];
let current_dex_number = 0;
let current_generation = 0;
let pokemon_forms: any[] = [];
for (const pokemon of pokemonData) {
if (pokemon.national_dex !== current_dex_number) {
if (pokemon_forms.length > 0) {
for (const form of pokemon_forms) {
current_group.push(form);
if (current_group.length === 30) {
pokemonList.push([...current_group]);
current_group = [];
}
}
pokemon_forms = [];
}
current_dex_number = pokemon.national_dex;
if (!pokemon.form_name) {
if (current_generation === null || pokemon.generation !== current_generation) {
if (current_group.length > 0) {
while (current_group.length < 30) {
current_group.push(null);
}
pokemonList.push([...current_group]);
current_group = [];
}
current_generation = pokemon.generation || 0;
}
}
}
pokemon_forms.push(pokemon);
}
// Handle remaining pokemon forms
for (const form of pokemon_forms) {
current_group.push(form);
if (current_group.length === 30) {
pokemonList.push([...current_group]);
current_group = [];
}
}
// Handle the last group
if (current_group.length > 0) {
while (current_group.length < 30) {
current_group.push(null);
}
pokemonList.push([...current_group]);
}
return pokemonList;
}
// Routes
app.get('/api/pokemon', async (req, res) => {
try {
const db = await dbPromise;
const pokemon = await db.all(`
SELECT
pf.national_dex, pf.name, pf.form_name, pf.PFIC, pf.generation,
ps.storable_in_home, m.icon_path, m.name as mark_name
FROM pokemon_forms pf
JOIN pokemon_storage ps ON pf.PFIC = ps.PFIC
JOIN form_marks fm ON pf.PFIC = fm.pfic
JOIN marks m ON fm.mark_id = m.id
WHERE ps.storable_in_home = 1
ORDER BY pf.PFIC
`);
const processedData = processPokemonData(pokemon);
res.json(processedData);
} catch (err) {
console.error('Error fetching pokemon:', err);
res.status(500).json({ error: 'Internal server error' });
}
});
app.get('/api/pokemon/:pfic/details', async (req, res) => {
try {
const db = await dbPromise;
const { pfic } = req.params;
const details = await db.get(`
SELECT pf.name, pf.form_name, pf.national_dex, pf.generation,
ps.storable_in_home, pf.is_baby_form
FROM pokemon_forms pf
LEFT JOIN pokemon_storage ps ON pf.PFIC = ps.PFIC
WHERE pf.PFIC = ?
`, pfic);
const encounters = await db.all(`
SELECT g.name as game_name, e.location, e.day, e.time,
e.dual_slot, e.static_encounter_count, e.static_encounter,
e.extra_text, e.stars, e.rods, e.fishing
FROM encounters e
JOIN games g ON e.game_id = g.id
WHERE e.pfic = ?
ORDER BY g.name, e.location
`, pfic);
res.json({ ...details, encounters });
} catch (err) {
console.error('Error fetching pokemon details:', err);
res.status(500).json({ error: 'Internal server error' });
}
});
app.get('/api/pokemon/caught', async (req, res) => {
// This will need to be implemented with your user authentication system
res.json([]);
});
app.post('/api/pokemon/caught/:pfic', async (req, res) => {
// This will need to be implemented with your user authentication system
res.json({ status: 'caught' });
});
app.listen(port, () => {
console.log(`Server running on port ${port}`);
});

14
origin-dex-api/tsconfig.json

@ -0,0 +1,14 @@
{
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}

17
origin-dex/.editorconfig

@ -0,0 +1,17 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
ij_typescript_use_double_quotes = false
[*.md]
max_line_length = off
trim_trailing_whitespace = false

42
origin-dex/.gitignore

@ -0,0 +1,42 @@
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
# Compiled output
/dist
/tmp
/out-tsc
/bazel-out
# Node
/node_modules
npm-debug.log
yarn-error.log
# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings
# System files
.DS_Store
Thumbs.db

4
origin-dex/.vscode/extensions.json

@ -0,0 +1,4 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": ["angular.ng-template"]
}

31
origin-dex/.vscode/launch.json

@ -0,0 +1,31 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ng serve",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: start",
"url": "http://localhost:4200/"
},
{
"name": "ng test",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: test",
"url": "http://localhost:9876/debug.html"
},
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}",
"sourceMaps": true,
"sourceMapPathOverrides": {
"webpack:///./src/*": "${webRoot}/src/*"
}
}
]
}

42
origin-dex/.vscode/tasks.json

@ -0,0 +1,42 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
},
{
"type": "npm",
"script": "test",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
}
]
}

27
origin-dex/README.md

@ -0,0 +1,27 @@
# OriginDex
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.2.11.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.

117
origin-dex/angular.json

@ -0,0 +1,117 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"origin-dex": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"sourceMap": true,
"optimization": false,
"outputPath": "dist/origin-dex",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
{
"glob": "**/*",
"input": "public"
},
"src/assets"
],
"styles": [
"@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss"
],
"scripts": [],
"server": "src/main.server.ts",
"prerender": true,
"ssr": {
"entry": "server.ts"
}
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kB",
"maximumError": "4kB"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.development.ts"
}
]
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "origin-dex:build:production"
},
"development": {
"buildTarget": "origin-dex:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
}
}
}
}
}

14141
origin-dex/package-lock.json

File diff suppressed because it is too large

47
origin-dex/package.json

@ -0,0 +1,47 @@
{
"name": "origin-dex",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"serve:ssr:origin-dex": "node dist/origin-dex/server/server.mjs"
},
"private": true,
"dependencies": {
"@angular/animations": "^18.2.10",
"@angular/cdk": "^18.2.11",
"@angular/common": "^18.2.0",
"@angular/compiler": "^18.2.0",
"@angular/core": "^18.2.0",
"@angular/forms": "^18.2.0",
"@angular/material": "^18.2.11",
"@angular/platform-browser": "^18.2.0",
"@angular/platform-browser-dynamic": "^18.2.0",
"@angular/platform-server": "^18.2.0",
"@angular/router": "^18.2.0",
"@angular/ssr": "^18.2.11",
"@auth0/angular-jwt": "^5.2.0",
"express": "^4.18.2",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.10"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.2.11",
"@angular/cli": "^18.2.11",
"@angular/compiler-cli": "^18.2.0",
"@types/express": "^4.17.17",
"@types/jasmine": "~5.1.0",
"@types/node": "^18.18.0",
"jasmine-core": "~5.2.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.5.2"
}
}

BIN
origin-dex/public/favicon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

57
origin-dex/server.ts

@ -0,0 +1,57 @@
import { APP_BASE_HREF } from '@angular/common';
import { CommonEngine } from '@angular/ssr';
import express from 'express';
import { fileURLToPath } from 'node:url';
import { dirname, join, resolve } from 'node:path';
import bootstrap from './src/main.server';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express();
const serverDistFolder = dirname(fileURLToPath(import.meta.url));
const browserDistFolder = resolve(serverDistFolder, '../browser');
const indexHtml = join(serverDistFolder, 'index.server.html');
const commonEngine = new CommonEngine();
server.set('view engine', 'html');
server.set('views', browserDistFolder);
// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });
// Serve static files from /browser
server.get('**', express.static(browserDistFolder, {
maxAge: '1y',
index: 'index.html',
}));
// All regular routes use the Angular engine
server.get('**', (req, res, next) => {
const { protocol, originalUrl, baseUrl, headers } = req;
commonEngine
.render({
bootstrap,
documentFilePath: indexHtml,
url: `${protocol}://${headers.host}${originalUrl}`,
publicPath: browserDistFolder,
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
})
.then((html) => res.send(html))
.catch((err) => next(err));
});
return server;
}
function run(): void {
const port = process.env['PORT'] || 4000;
// Start up the Node server
const server = app();
server.listen(port, () => {
console.log(`Node Express server listening on http://localhost:${port}`);
});
}
run();

336
origin-dex/src/app/app.component.html

@ -0,0 +1,336 @@
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<!-- * * * * * * * * * * * The content below * * * * * * * * * * * -->
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<!-- * * * * * * * * * Delete the template below * * * * * * * * * -->
<!-- * * * * * * * to get started with your project! * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<style>
:host {
--bright-blue: oklch(51.01% 0.274 263.83);
--electric-violet: oklch(53.18% 0.28 296.97);
--french-violet: oklch(47.66% 0.246 305.88);
--vivid-pink: oklch(69.02% 0.277 332.77);
--hot-red: oklch(61.42% 0.238 15.34);
--orange-red: oklch(63.32% 0.24 31.68);
--gray-900: oklch(19.37% 0.006 300.98);
--gray-700: oklch(36.98% 0.014 302.71);
--gray-400: oklch(70.9% 0.015 304.04);
--red-to-pink-to-purple-vertical-gradient: linear-gradient(
180deg,
var(--orange-red) 0%,
var(--vivid-pink) 50%,
var(--electric-violet) 100%
);
--red-to-pink-to-purple-horizontal-gradient: linear-gradient(
90deg,
var(--orange-red) 0%,
var(--vivid-pink) 50%,
var(--electric-violet) 100%
);
--pill-accent: var(--bright-blue);
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
"Segoe UI Symbol";
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
h1 {
font-size: 3.125rem;
color: var(--gray-900);
font-weight: 500;
line-height: 100%;
letter-spacing: -0.125rem;
margin: 0;
font-family: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
"Segoe UI Symbol";
}
p {
margin: 0;
color: var(--gray-700);
}
main {
width: 100%;
min-height: 100%;
display: flex;
justify-content: center;
align-items: center;
padding: 1rem;
box-sizing: inherit;
position: relative;
}
.angular-logo {
max-width: 9.2rem;
}
.content {
display: flex;
justify-content: space-around;
width: 100%;
max-width: 700px;
margin-bottom: 3rem;
}
.content h1 {
margin-top: 1.75rem;
}
.content p {
margin-top: 1.5rem;
}
.divider {
width: 1px;
background: var(--red-to-pink-to-purple-vertical-gradient);
margin-inline: 0.5rem;
}
.pill-group {
display: flex;
flex-direction: column;
align-items: start;
flex-wrap: wrap;
gap: 1.25rem;
}
.pill {
display: flex;
align-items: center;
--pill-accent: var(--bright-blue);
background: color-mix(in srgb, var(--pill-accent) 5%, transparent);
color: var(--pill-accent);
padding-inline: 0.75rem;
padding-block: 0.375rem;
border-radius: 2.75rem;
border: 0;
transition: background 0.3s ease;
font-family: var(--inter-font);
font-size: 0.875rem;
font-style: normal;
font-weight: 500;
line-height: 1.4rem;
letter-spacing: -0.00875rem;
text-decoration: none;
}
.pill:hover {
background: color-mix(in srgb, var(--pill-accent) 15%, transparent);
}
.pill-group .pill:nth-child(6n + 1) {
--pill-accent: var(--bright-blue);
}
.pill-group .pill:nth-child(6n + 2) {
--pill-accent: var(--french-violet);
}
.pill-group .pill:nth-child(6n + 3),
.pill-group .pill:nth-child(6n + 4),
.pill-group .pill:nth-child(6n + 5) {
--pill-accent: var(--hot-red);
}
.pill-group svg {
margin-inline-start: 0.25rem;
}
.social-links {
display: flex;
align-items: center;
gap: 0.73rem;
margin-top: 1.5rem;
}
.social-links path {
transition: fill 0.3s ease;
fill: var(--gray-400);
}
.social-links a:hover svg path {
fill: var(--gray-900);
}
@media screen and (max-width: 650px) {
.content {
flex-direction: column;
width: max-content;
}
.divider {
height: 1px;
width: 100%;
background: var(--red-to-pink-to-purple-horizontal-gradient);
margin-block: 1.5rem;
}
}
</style>
<main class="main">
<div class="content">
<div class="left-side">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 982 239"
fill="none"
class="angular-logo"
>
<g clip-path="url(#a)">
<path
fill="url(#b)"
d="M388.676 191.625h30.849L363.31 31.828h-35.758l-56.215 159.797h30.848l13.174-39.356h60.061l13.256 39.356Zm-65.461-62.675 21.602-64.311h1.227l21.602 64.311h-44.431Zm126.831-7.527v70.202h-28.23V71.839h27.002v20.374h1.392c2.782-6.71 7.2-12.028 13.255-15.956 6.056-3.927 13.584-5.89 22.503-5.89 8.264 0 15.465 1.8 21.684 5.318 6.137 3.518 10.964 8.673 14.319 15.382 3.437 6.71 5.074 14.81 4.992 24.383v76.175h-28.23v-71.92c0-8.019-2.046-14.237-6.219-18.819-4.173-4.5-9.819-6.791-17.102-6.791-4.91 0-9.328 1.063-13.174 3.272-3.846 2.128-6.792 5.237-9.001 9.328-2.046 4.009-3.191 8.918-3.191 14.728ZM589.233 239c-10.147 0-18.82-1.391-26.103-4.091-7.282-2.7-13.092-6.382-17.511-10.964-4.418-4.582-7.528-9.655-9.164-15.219l25.448-6.136c1.145 2.372 2.782 4.663 4.991 6.954 2.209 2.291 5.155 4.255 8.837 5.81 3.683 1.554 8.428 2.291 14.074 2.291 8.019 0 14.647-1.964 19.884-5.81 5.237-3.845 7.856-10.227 7.856-19.064v-22.665h-1.391c-1.473 2.946-3.601 5.892-6.383 9.001-2.782 3.109-6.464 5.645-10.965 7.691-4.582 2.046-10.228 3.109-17.101 3.109-9.165 0-17.511-2.209-25.039-6.545-7.446-4.337-13.42-10.883-17.757-19.474-4.418-8.673-6.628-19.473-6.628-32.565 0-13.091 2.21-24.301 6.628-33.383 4.419-9.082 10.311-15.955 17.839-20.7 7.528-4.746 15.874-7.037 25.039-7.037 7.037 0 12.846 1.145 17.347 3.518 4.582 2.373 8.182 5.236 10.883 8.51 2.7 3.272 4.746 6.382 6.137 9.327h1.554v-19.8h27.821v121.749c0 10.228-2.454 18.737-7.364 25.447-4.91 6.709-11.538 11.7-20.048 15.055-8.509 3.355-18.165 4.991-28.884 4.991Zm.245-71.266c5.974 0 11.047-1.473 15.302-4.337 4.173-2.945 7.446-7.118 9.573-12.519 2.21-5.482 3.274-12.027 3.274-19.637 0-7.609-1.064-14.155-3.274-19.8-2.127-5.646-5.318-10.064-9.491-13.255-4.174-3.11-9.329-4.746-15.384-4.746s-11.537 1.636-15.792 4.91c-4.173 3.272-7.365 7.772-9.492 13.418-2.128 5.727-3.191 12.191-3.191 19.392 0 7.2 1.063 13.745 3.273 19.228 2.127 5.482 5.318 9.736 9.573 12.764 4.174 3.027 9.41 4.582 15.629 4.582Zm141.56-26.51V71.839h28.23v119.786h-27.412v-21.273h-1.227c-2.7 6.709-7.119 12.191-13.338 16.446-6.137 4.255-13.747 6.382-22.748 6.382-7.855 0-14.81-1.718-20.783-5.237-5.974-3.518-10.72-8.591-14.075-15.382-3.355-6.709-5.073-14.891-5.073-24.464V71.839h28.312v71.921c0 7.609 2.046 13.664 6.219 18.083 4.173 4.5 9.655 6.709 16.365 6.709 4.173 0 8.183-.982 12.111-3.028 3.927-2.045 7.118-5.072 9.655-9.082 2.537-4.091 3.764-9.164 3.764-15.218Zm65.707-109.395v159.796h-28.23V31.828h28.23Zm44.841 162.169c-7.61 0-14.402-1.391-20.457-4.091-6.055-2.7-10.883-6.791-14.32-12.109-3.518-5.319-5.237-11.946-5.237-19.801 0-6.791 1.228-12.355 3.765-16.773 2.536-4.419 5.891-7.937 10.228-10.637 4.337-2.618 9.164-4.664 14.647-6.055 5.4-1.391 11.046-2.373 16.856-3.027 7.037-.737 12.683-1.391 17.102-1.964 4.337-.573 7.528-1.555 9.574-2.782 1.963-1.309 3.027-3.273 3.027-5.973v-.491c0-5.891-1.718-10.391-5.237-13.664-3.518-3.191-8.51-4.828-15.056-4.828-6.955 0-12.356 1.473-16.447 4.5-4.009 3.028-6.71 6.546-8.183 10.719l-26.348-3.764c2.046-7.282 5.483-13.336 10.31-18.328 4.746-4.909 10.638-8.59 17.511-11.045 6.955-2.455 14.565-3.682 22.912-3.682 5.809 0 11.537.654 17.265 2.045s10.965 3.6 15.711 6.71c4.746 3.109 8.51 7.282 11.455 12.6 2.864 5.318 4.337 11.946 4.337 19.883v80.184h-27.166v-16.446h-.9c-1.719 3.355-4.092 6.464-7.201 9.328-3.109 2.864-6.955 5.237-11.619 6.955-4.828 1.718-10.229 2.536-16.529 2.536Zm7.364-20.701c5.646 0 10.556-1.145 14.729-3.354 4.173-2.291 7.364-5.237 9.655-9.001 2.292-3.763 3.355-7.854 3.355-12.273v-14.155c-.9.737-2.373 1.391-4.5 2.046-2.128.654-4.419 1.145-7.037 1.636-2.619.491-5.155.9-7.692 1.227-2.537.328-4.746.655-6.628.901-4.173.572-8.019 1.472-11.292 2.781-3.355 1.31-5.973 3.11-7.855 5.401-1.964 2.291-2.864 5.318-2.864 8.918 0 5.237 1.882 9.164 5.728 11.782 3.682 2.782 8.51 4.091 14.401 4.091Zm64.643 18.328V71.839h27.412v19.965h1.227c2.21-6.955 5.974-12.274 11.292-16.038 5.319-3.763 11.456-5.645 18.329-5.645 1.555 0 3.355.082 5.237.163 1.964.164 3.601.328 4.91.573v25.938c-1.227-.41-3.109-.819-5.646-1.146a58.814 58.814 0 0 0-7.446-.49c-5.155 0-9.738 1.145-13.829 3.354-4.091 2.209-7.282 5.236-9.655 9.164-2.373 3.927-3.519 8.427-3.519 13.5v70.448h-28.312ZM222.077 39.192l-8.019 125.923L137.387 0l84.69 39.192Zm-53.105 162.825-57.933 33.056-57.934-33.056 11.783-28.556h92.301l11.783 28.556ZM111.039 62.675l30.357 73.803H80.681l30.358-73.803ZM7.937 165.115 0 39.192 84.69 0 7.937 165.115Z"
/>
<path
fill="url(#c)"
d="M388.676 191.625h30.849L363.31 31.828h-35.758l-56.215 159.797h30.848l13.174-39.356h60.061l13.256 39.356Zm-65.461-62.675 21.602-64.311h1.227l21.602 64.311h-44.431Zm126.831-7.527v70.202h-28.23V71.839h27.002v20.374h1.392c2.782-6.71 7.2-12.028 13.255-15.956 6.056-3.927 13.584-5.89 22.503-5.89 8.264 0 15.465 1.8 21.684 5.318 6.137 3.518 10.964 8.673 14.319 15.382 3.437 6.71 5.074 14.81 4.992 24.383v76.175h-28.23v-71.92c0-8.019-2.046-14.237-6.219-18.819-4.173-4.5-9.819-6.791-17.102-6.791-4.91 0-9.328 1.063-13.174 3.272-3.846 2.128-6.792 5.237-9.001 9.328-2.046 4.009-3.191 8.918-3.191 14.728ZM589.233 239c-10.147 0-18.82-1.391-26.103-4.091-7.282-2.7-13.092-6.382-17.511-10.964-4.418-4.582-7.528-9.655-9.164-15.219l25.448-6.136c1.145 2.372 2.782 4.663 4.991 6.954 2.209 2.291 5.155 4.255 8.837 5.81 3.683 1.554 8.428 2.291 14.074 2.291 8.019 0 14.647-1.964 19.884-5.81 5.237-3.845 7.856-10.227 7.856-19.064v-22.665h-1.391c-1.473 2.946-3.601 5.892-6.383 9.001-2.782 3.109-6.464 5.645-10.965 7.691-4.582 2.046-10.228 3.109-17.101 3.109-9.165 0-17.511-2.209-25.039-6.545-7.446-4.337-13.42-10.883-17.757-19.474-4.418-8.673-6.628-19.473-6.628-32.565 0-13.091 2.21-24.301 6.628-33.383 4.419-9.082 10.311-15.955 17.839-20.7 7.528-4.746 15.874-7.037 25.039-7.037 7.037 0 12.846 1.145 17.347 3.518 4.582 2.373 8.182 5.236 10.883 8.51 2.7 3.272 4.746 6.382 6.137 9.327h1.554v-19.8h27.821v121.749c0 10.228-2.454 18.737-7.364 25.447-4.91 6.709-11.538 11.7-20.048 15.055-8.509 3.355-18.165 4.991-28.884 4.991Zm.245-71.266c5.974 0 11.047-1.473 15.302-4.337 4.173-2.945 7.446-7.118 9.573-12.519 2.21-5.482 3.274-12.027 3.274-19.637 0-7.609-1.064-14.155-3.274-19.8-2.127-5.646-5.318-10.064-9.491-13.255-4.174-3.11-9.329-4.746-15.384-4.746s-11.537 1.636-15.792 4.91c-4.173 3.272-7.365 7.772-9.492 13.418-2.128 5.727-3.191 12.191-3.191 19.392 0 7.2 1.063 13.745 3.273 19.228 2.127 5.482 5.318 9.736 9.573 12.764 4.174 3.027 9.41 4.582 15.629 4.582Zm141.56-26.51V71.839h28.23v119.786h-27.412v-21.273h-1.227c-2.7 6.709-7.119 12.191-13.338 16.446-6.137 4.255-13.747 6.382-22.748 6.382-7.855 0-14.81-1.718-20.783-5.237-5.974-3.518-10.72-8.591-14.075-15.382-3.355-6.709-5.073-14.891-5.073-24.464V71.839h28.312v71.921c0 7.609 2.046 13.664 6.219 18.083 4.173 4.5 9.655 6.709 16.365 6.709 4.173 0 8.183-.982 12.111-3.028 3.927-2.045 7.118-5.072 9.655-9.082 2.537-4.091 3.764-9.164 3.764-15.218Zm65.707-109.395v159.796h-28.23V31.828h28.23Zm44.841 162.169c-7.61 0-14.402-1.391-20.457-4.091-6.055-2.7-10.883-6.791-14.32-12.109-3.518-5.319-5.237-11.946-5.237-19.801 0-6.791 1.228-12.355 3.765-16.773 2.536-4.419 5.891-7.937 10.228-10.637 4.337-2.618 9.164-4.664 14.647-6.055 5.4-1.391 11.046-2.373 16.856-3.027 7.037-.737 12.683-1.391 17.102-1.964 4.337-.573 7.528-1.555 9.574-2.782 1.963-1.309 3.027-3.273 3.027-5.973v-.491c0-5.891-1.718-10.391-5.237-13.664-3.518-3.191-8.51-4.828-15.056-4.828-6.955 0-12.356 1.473-16.447 4.5-4.009 3.028-6.71 6.546-8.183 10.719l-26.348-3.764c2.046-7.282 5.483-13.336 10.31-18.328 4.746-4.909 10.638-8.59 17.511-11.045 6.955-2.455 14.565-3.682 22.912-3.682 5.809 0 11.537.654 17.265 2.045s10.965 3.6 15.711 6.71c4.746 3.109 8.51 7.282 11.455 12.6 2.864 5.318 4.337 11.946 4.337 19.883v80.184h-27.166v-16.446h-.9c-1.719 3.355-4.092 6.464-7.201 9.328-3.109 2.864-6.955 5.237-11.619 6.955-4.828 1.718-10.229 2.536-16.529 2.536Zm7.364-20.701c5.646 0 10.556-1.145 14.729-3.354 4.173-2.291 7.364-5.237 9.655-9.001 2.292-3.763 3.355-7.854 3.355-12.273v-14.155c-.9.737-2.373 1.391-4.5 2.046-2.128.654-4.419 1.145-7.037 1.636-2.619.491-5.155.9-7.692 1.227-2.537.328-4.746.655-6.628.901-4.173.572-8.019 1.472-11.292 2.781-3.355 1.31-5.973 3.11-7.855 5.401-1.964 2.291-2.864 5.318-2.864 8.918 0 5.237 1.882 9.164 5.728 11.782 3.682 2.782 8.51 4.091 14.401 4.091Zm64.643 18.328V71.839h27.412v19.965h1.227c2.21-6.955 5.974-12.274 11.292-16.038 5.319-3.763 11.456-5.645 18.329-5.645 1.555 0 3.355.082 5.237.163 1.964.164 3.601.328 4.91.573v25.938c-1.227-.41-3.109-.819-5.646-1.146a58.814 58.814 0 0 0-7.446-.49c-5.155 0-9.738 1.145-13.829 3.354-4.091 2.209-7.282 5.236-9.655 9.164-2.373 3.927-3.519 8.427-3.519 13.5v70.448h-28.312ZM222.077 39.192l-8.019 125.923L137.387 0l84.69 39.192Zm-53.105 162.825-57.933 33.056-57.934-33.056 11.783-28.556h92.301l11.783 28.556ZM111.039 62.675l30.357 73.803H80.681l30.358-73.803ZM7.937 165.115 0 39.192 84.69 0 7.937 165.115Z"
/>
</g>
<defs>
<radialGradient
id="c"
cx="0"
cy="0"
r="1"
gradientTransform="rotate(118.122 171.182 60.81) scale(205.794)"
gradientUnits="userSpaceOnUse"
>
<stop stop-color="#FF41F8" />
<stop offset=".707" stop-color="#FF41F8" stop-opacity=".5" />
<stop offset="1" stop-color="#FF41F8" stop-opacity="0" />
</radialGradient>
<linearGradient
id="b"
x1="0"
x2="982"
y1="192"
y2="192"
gradientUnits="userSpaceOnUse"
>
<stop stop-color="#F0060B" />
<stop offset="0" stop-color="#F0070C" />
<stop offset=".526" stop-color="#CC26D5" />
<stop offset="1" stop-color="#7702FF" />
</linearGradient>
<clipPath id="a"><path fill="#fff" d="M0 0h982v239H0z" /></clipPath>
</defs>
</svg>
<h1>Hello, {{ title }}</h1>
<p>Congratulations! Your app is running. 🎉</p>
</div>
<div class="divider" role="separator" aria-label="Divider"></div>
<div class="right-side">
<div class="pill-group">
@for (item of [
{ title: 'Explore the Docs', link: 'https://angular.dev' },
{ title: 'Learn with Tutorials', link: 'https://angular.dev/tutorials' },
{ title: 'CLI Docs', link: 'https://angular.dev/tools/cli' },
{ title: 'Angular Language Service', link: 'https://angular.dev/tools/language-service' },
{ title: 'Angular DevTools', link: 'https://angular.dev/tools/devtools' },
]; track item.title) {
<a
class="pill"
[href]="item.link"
target="_blank"
rel="noopener"
>
<span>{{ item.title }}</span>
<svg
xmlns="http://www.w3.org/2000/svg"
height="14"
viewBox="0 -960 960 960"
width="14"
fill="currentColor"
>
<path
d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z"
/>
</svg>
</a>
}
</div>
<div class="social-links">
<a
href="https://github.com/angular/angular"
aria-label="Github"
target="_blank"
rel="noopener"
>
<svg
width="25"
height="24"
viewBox="0 0 25 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
alt="Github"
>
<path
d="M12.3047 0C5.50634 0 0 5.50942 0 12.3047C0 17.7423 3.52529 22.3535 8.41332 23.9787C9.02856 24.0946 9.25414 23.7142 9.25414 23.3871C9.25414 23.0949 9.24389 22.3207 9.23876 21.2953C5.81601 22.0377 5.09414 19.6444 5.09414 19.6444C4.53427 18.2243 3.72524 17.8449 3.72524 17.8449C2.61064 17.082 3.81137 17.0973 3.81137 17.0973C5.04697 17.1835 5.69604 18.3647 5.69604 18.3647C6.79321 20.2463 8.57636 19.7029 9.27978 19.3881C9.39052 18.5924 9.70736 18.0499 10.0591 17.7423C7.32641 17.4347 4.45429 16.3765 4.45429 11.6618C4.45429 10.3185 4.9311 9.22133 5.72065 8.36C5.58222 8.04931 5.16694 6.79833 5.82831 5.10337C5.82831 5.10337 6.85883 4.77319 9.2121 6.36459C10.1965 6.09082 11.2424 5.95546 12.2883 5.94931C13.3342 5.95546 14.3801 6.09082 15.3644 6.36459C17.7023 4.77319 18.7328 5.10337 18.7328 5.10337C19.3942 6.79833 18.9789 8.04931 18.8559 8.36C19.6403 9.22133 20.1171 10.3185 20.1171 11.6618C20.1171 16.3888 17.2409 17.4296 14.5031 17.7321C14.9338 18.1012 15.3337 18.8559 15.3337 20.0084C15.3337 21.6552 15.3183 22.978 15.3183 23.3779C15.3183 23.7009 15.5336 24.0854 16.1642 23.9623C21.0871 22.3484 24.6094 17.7341 24.6094 12.3047C24.6094 5.50942 19.0999 0 12.3047 0Z"
/>
</svg>
</a>
<a
href="https://twitter.com/angular"
aria-label="Twitter"
target="_blank"
rel="noopener"
>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
alt="Twitter"
>
<path
d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"
/>
</svg>
</a>
<a
href="https://www.youtube.com/channel/UCbn1OgGei-DV7aSRo_HaAiw"
aria-label="Youtube"
target="_blank"
rel="noopener"
>
<svg
width="29"
height="20"
viewBox="0 0 29 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
alt="Youtube"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M27.4896 1.52422C27.9301 1.96749 28.2463 2.51866 28.4068 3.12258C29.0004 5.35161 29.0004 10 29.0004 10C29.0004 10 29.0004 14.6484 28.4068 16.8774C28.2463 17.4813 27.9301 18.0325 27.4896 18.4758C27.0492 18.9191 26.5 19.2389 25.8972 19.4032C23.6778 20 14.8068 20 14.8068 20C14.8068 20 5.93586 20 3.71651 19.4032C3.11363 19.2389 2.56449 18.9191 2.12405 18.4758C1.68361 18.0325 1.36732 17.4813 1.20683 16.8774C0.613281 14.6484 0.613281 10 0.613281 10C0.613281 10 0.613281 5.35161 1.20683 3.12258C1.36732 2.51866 1.68361 1.96749 2.12405 1.52422C2.56449 1.08095 3.11363 0.76113 3.71651 0.596774C5.93586 0 14.8068 0 14.8068 0C14.8068 0 23.6778 0 25.8972 0.596774C26.5 0.76113 27.0492 1.08095 27.4896 1.52422ZM19.3229 10L11.9036 5.77905V14.221L19.3229 10Z"
/>
</svg>
</a>
</div>
</div>
</div>
</main>
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<!-- * * * * * * * * * * * The content above * * * * * * * * * * * * -->
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * * -->
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<!-- * * * * * * * * * * End of Placeholder * * * * * * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<router-outlet />

0
origin-dex/src/app/app.component.scss

29
origin-dex/src/app/app.component.spec.ts

@ -0,0 +1,29 @@
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AppComponent],
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have the 'origin-dex' title`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('origin-dex');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, origin-dex');
});
});

101
origin-dex/src/app/app.component.ts

@ -0,0 +1,101 @@
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterOutlet, RouterLink, RouterLinkActive } from '@angular/router';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatButtonModule } from '@angular/material/button';
import { MatTabsModule } from '@angular/material/tabs';
import { AuthService } from './core/services/auth.service';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatListModule } from '@angular/material/list';
@Component({
selector: 'app-root',
standalone: true,
imports: [
CommonModule,
RouterOutlet,
RouterLink,
RouterLinkActive,
MatToolbarModule,
MatButtonModule,
MatTabsModule,
MatSidenavModule,
MatListModule
],
template: `
<mat-toolbar color="primary">
<span>OriginDex</span>
<span class="spacer"></span>
<ng-container *ngIf="auth.isAuthenticated$ | async; else loginButtons">
<span>Welcome, {{ auth.currentUser?.username }}!</span>
<button mat-button (click)="auth.logout()">Logout</button>
</ng-container>
<ng-template #loginButtons>
<button mat-button routerLink="/auth/login">Login</button>
<button mat-button routerLink="/auth/register">Register</button>
</ng-template>
</mat-toolbar>
<mat-sidenav-container class="content-container">
<mat-sidenav mode="side" opened>
<mat-nav-list>
<a mat-list-item routerLink="/storage" routerLinkActive="active">
Storage
</a>
<a mat-list-item routerLink="/storage-carousel" routerLinkActive="active">
Storage Carousel
</a>
<a mat-list-item routerLink="/efficiency" routerLinkActive="active">
Efficiency Plan
</a>
</mat-nav-list>
</mat-sidenav>
<mat-sidenav-content>
<div class="content">
<router-outlet></router-outlet>
</div>
</mat-sidenav-content>
</mat-sidenav-container>
`,
styles: [`
.spacer {
flex: 1 1 auto;
}
mat-toolbar {
margin-bottom: 0;
}
.content-container {
height: calc(100vh - 64px);
}
mat-sidenav {
width: 200px;
background: #f5f5f5;
border-right: 1px solid #ddd;
}
.content {
padding: 20px;
height: 100%;
overflow: auto;
}
.active {
background: rgba(0, 0, 0, 0.04);
color: #3f51b5;
}
mat-nav-list {
padding-top: 0;
}
mat-nav-list a {
height: 48px;
}
`]
})
export class AppComponent {
constructor(public auth: AuthService) {}
}

11
origin-dex/src/app/app.config.server.ts

@ -0,0 +1,11 @@
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
import { provideServerRendering } from '@angular/platform-server';
import { appConfig } from './app.config';
const serverConfig: ApplicationConfig = {
providers: [
provideServerRendering()
]
};
export const config = mergeApplicationConfig(appConfig, serverConfig);

20
origin-dex/src/app/app.config.ts

@ -0,0 +1,20 @@
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { provideRouter, withDebugTracing } from '@angular/router';
import { provideHttpClient, withInterceptors, withFetch } from '@angular/common/http';
import { provideAnimations } from '@angular/platform-browser/animations';
import { authInterceptor } from './core/interceptors/auth.interceptor';
import { routes } from './app.routes';
import { provideClientHydration } from '@angular/platform-browser';
export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes, withDebugTracing()),
provideClientHydration(),
provideHttpClient(
withFetch(),
withInterceptors([authInterceptor])
),
provideAnimations()
]
};

31
origin-dex/src/app/app.routes.ts

@ -0,0 +1,31 @@
import { Routes } from '@angular/router';
import { AuthGuard } from './core/guards/auth.guard';
export const routes: Routes = [
{
path: 'storage',
loadComponent: () => import('./features/pokemon/pokemon-grid/pokemon-grid.component')
.then(m => m.PokemonGridComponent)
},
{
path: 'storage-carousel', // Add new route
loadComponent: () => import('./features/pokemon/pokemon-carousel/pokemon-carousel.component')
.then(m => m.PokemonCarouselComponent)
},
{
path: 'auth',
loadChildren: () => import('./features/auth/auth.routes')
.then(m => m.AUTH_ROUTES)
},
{
path: 'efficiency',
loadComponent: () => import('./features/plan/plan-game/plan-game.component')
.then(m => m.PlanGameComponent),
canActivate: [AuthGuard]
},
{
path: '',
redirectTo: 'storage',
pathMatch: 'full'
}
];

22
origin-dex/src/app/core/guards/auth.guard.ts

@ -0,0 +1,22 @@
import { inject } from '@angular/core';
import { Router, CanActivateFn } from '@angular/router';
import { AuthService } from '../services/auth.service';
import { map } from 'rxjs/operators';
export const AuthGuard: CanActivateFn = (route, state) => {
const router = inject(Router);
const authService = inject(AuthService);
return authService.isAuthenticated$.pipe(
map(isAuthenticated => {
if (isAuthenticated) {
return true;
}
router.navigate(['/auth/login'], {
queryParams: { returnUrl: state.url }
});
return false;
})
);
};

21
origin-dex/src/app/core/interceptors/auth.interceptor.ts

@ -0,0 +1,21 @@
import { HttpInterceptorFn, HttpRequest, HttpHandlerFn } from '@angular/common/http';
import { inject } from '@angular/core';
import { AuthService } from '../services/auth.service';
export const authInterceptor: HttpInterceptorFn = (
req: HttpRequest<unknown>,
next: HttpHandlerFn
) => {
const authService = inject(AuthService);
if (authService.currentUser?.token) {
const authReq = req.clone({
setHeaders: {
Authorization: `Bearer ${authService.currentUser.token}`
}
});
return next(authReq);
}
return next(req);
};

29
origin-dex/src/app/core/models/plan.model.ts

@ -0,0 +1,29 @@
export interface GamePlan {
game_name: string;
game_id: number;
pokemon: PlanPokemon[];
}
export interface PlanPokemon {
pfic: string;
name: string;
form_name?: string;
catch_count: number;
evolve_to: EvolutionTarget[];
breed_for: BreedingTarget[];
}
export interface EvolutionTarget {
pfic: string;
name: string;
form_name?: string;
method: string;
count: number;
}
export interface BreedingTarget {
pfic: string;
name: string;
form_name?: string;
count: number;
}

32
origin-dex/src/app/core/models/pokemon.model.ts

@ -0,0 +1,32 @@
export interface Pokemon {
PFIC: string;
Name: string;
Form: string | null;
NationalDex: number;
Generation?: number;
StorableInHome?: boolean;
IsBabyForm?: boolean;
Encounters?: PokemonEncounter[];
MarkIcon?: string;
MarkName?: string;
Image?: string;
IsDefault?: boolean;
IsCaught?: boolean;
}
export interface PokemonEncounter {
form: string;
game: string;
game_id: number;
location: string;
day?: string;
time?: string;
dual_slot?: boolean;
static_encounter?: boolean;
static_encounter_count?: number;
extra_text?: string;
stars?: number;
fishing?: boolean;
rods?: string;
starter?: boolean;
}

5
origin-dex/src/app/core/models/user.model.ts

@ -0,0 +1,5 @@
export interface User {
id: number;
username: string;
token?: string;
}

82
origin-dex/src/app/core/services/auth.service.ts

@ -0,0 +1,82 @@
import { Injectable, PLATFORM_ID, inject } from '@angular/core';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { BehaviorSubject, Observable, throwError } from 'rxjs';
import { map, tap, catchError } from 'rxjs/operators';
import { Router } from '@angular/router';
import { User } from '../models/user.model';
import { environment } from '../../../environments/environment.development';
import { isPlatformBrowser } from '@angular/common';
@Injectable({
providedIn: 'root'
})
export class AuthService {
private currentUserSubject = new BehaviorSubject<User | null>(null);
public currentUser$: Observable<User | null>;
public isAuthenticated$: Observable<boolean>;
private platformId = inject(PLATFORM_ID);
constructor(
private http: HttpClient,
private router: Router
) {
let storedUser: User | null = null;
if (isPlatformBrowser(this.platformId)) {
const storedUserStr = localStorage.getItem('currentUser');
if (storedUserStr) {
try {
storedUser = JSON.parse(storedUserStr);
} catch (e) {
console.error('Error parsing stored user:', e);
}
}
}
this.currentUserSubject = new BehaviorSubject<User | null>(storedUser);
this.currentUser$ = this.currentUserSubject.asObservable();
this.isAuthenticated$ = this.currentUser$.pipe(
map(user => !!user)
);
}
login(username: string, password: string): Observable<User> {
return this.http.post<User>(`${environment.apiUrl}/auth/login`, { username, password })
.pipe(
tap(user => {
if (isPlatformBrowser(this.platformId)) {
localStorage.setItem('currentUser', JSON.stringify(user));
}
this.currentUserSubject.next(user);
})
);
}
logout(): void {
if (isPlatformBrowser(this.platformId)) {
localStorage.removeItem('currentUser');
}
this.currentUserSubject.next(null);
this.router.navigate(['/']);
}
register(username: string, password: string): Observable<any> {
return this.http.post(`${environment.apiUrl}/auth/register`, { username, password });
}
public get currentUser(): User | null {
return this.currentUserSubject.value;
}
private handleError(error: HttpErrorResponse) {
let errorMessage = 'An error occurred';
if (error.error instanceof ErrorEvent) {
// Client-side error
errorMessage = error.error.message;
} else {
// Server-side error
errorMessage = error.error?.message || `Error Code: ${error.status}`;
}
return throwError(() => new Error(errorMessage));
}
}

56
origin-dex/src/app/core/services/plan.service.ts

@ -0,0 +1,56 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable, Subject, take } from 'rxjs';
import { environment } from '../../../environments/environment.development';
import { GamePlan } from '../models/plan.model';
@Injectable({
providedIn: 'root'
})
export class PlanService {
private caughtPokemon = new Set<string>();
private gameUpdates = new Subject<{gameId: number, total: number}>();
gameUpdates$ = this.gameUpdates.asObservable();
constructor(private http: HttpClient) {}
getPlan(): Observable<GamePlan[]> {
return this.http.get<GamePlan[]>(`${environment.apiUrl}/plan`);
}
updateCaughtStatus(pfic: string, caught: boolean) {
if (caught) {
this.caughtPokemon.add(pfic);
} else {
this.caughtPokemon.delete(pfic);
}
// Trigger recalculation of affected games
this.recalculateAffectedGames(pfic);
}
private recalculateAffectedGames(pfic: string) {
// This would need to check all games for the affected Pokemon
// and update their totals accordingly
this.getPlan().pipe(take(1)).subscribe(games => {
games.forEach(game => {
const affectedPokemon = game.pokemon.find(p =>
p.pfic === pfic ||
p.evolve_to.some(e => e.pfic === pfic) ||
p.breed_for.some(b => b.pfic === pfic)
);
if (affectedPokemon) {
this.gameUpdates.next({
gameId: game.game_id,
total: this.calculateGameTotal(game)
});
}
});
});
}
private calculateGameTotal(game: GamePlan): number {
return game.pokemon.reduce((total, pokemon) => total + pokemon.catch_count, 0);
}
}

82
origin-dex/src/app/core/services/pokemon.service.ts

@ -0,0 +1,82 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { map, Observable, shareReplay } from 'rxjs';
import { Pokemon, PokemonEncounter } from '../models/pokemon.model';
import { environment } from '../../../environments/environment.development';
import { comparePfics } from '../utils/pfic-utils';
@Injectable({
providedIn: 'root'
})
export class PokemonService {
private apiUrl = environment.apiUrl;
private pokemonCache: Observable<(Pokemon | null)[][]> | null = null;
constructor(private http: HttpClient) { }
getPokemonList(): Observable<(Pokemon | null)[][]> {
if (this.pokemonCache) {
return this.pokemonCache;
}
this.pokemonCache = this.http.get<(any | null)[][]>(`${this.apiUrl}/pokemon`).pipe(
map(groups => groups.map(group =>
group.map(pokemon => pokemon ? {
PFIC: pokemon.PFIC,
Name: pokemon.name,
Form: pokemon.form_name,
NationalDex: pokemon.national_dex,
Generation: pokemon.generation,
StorableInHome: pokemon.storable_in_home,
IsBabyForm: pokemon.is_baby_form,
Encounters: pokemon.encounters || [],
MarkIcon: pokemon.icon_path,
MarkName: pokemon.mark_name,
Image: this.getPokemonImageUrl(pokemon.PFIC),
IsDefault: pokemon.is_default || false,
IsCaught: false
} as Pokemon : null)
)),
shareReplay(1)
);
return this.pokemonCache;
}
getPokemonDetails(pfic: string): Observable<PokemonEncounter[]> {
return this.http.get<PokemonEncounter[]>(`${this.apiUrl}/pokemon/${pfic}`);
}
toggleCatch(pfic: string): Observable<{status: string, pfic: string}> {
return this.http.post<{status: string, pfic: string}>(
`${this.apiUrl}/toggle_catch/${pfic}`,
{}
);
}
getCaughtPokemon(): Observable<string[]> {
return this.http.get<string[]>(`${this.apiUrl}/get_caught_pokemon`);
}
private caughtPokemon = new Set<string>();
isTargetCompleted(pfic: string): boolean {
return this.caughtPokemon.has(pfic);
}
updateCaughtStatus(pfic: string, caught: boolean) {
if (caught) {
this.caughtPokemon.add(pfic);
} else {
this.caughtPokemon.delete(pfic);
}
}
getPokemonImageUrl(pfic: string): string {
return `/assets/images/pokemon/${pfic}.png`;
}
getMarkImageUrl(markName: string): string {
return `/assets/images/marks/${markName}.png`;
}
}

0
origin-dex/src/app/core/services/storage.service.ts

23
origin-dex/src/app/core/utils/pfic-utils.ts

@ -0,0 +1,23 @@
export function parsePfic(pfic: string): (string | number)[] {
return pfic.split('-').map(part => isNaN(Number(part)) ? part : Number(part));
}
export function comparePfics(pfic1: string, pfic2: string): number {
const parts1 = parsePfic(pfic1);
const parts2 = parsePfic(pfic2);
// Compare each part
for (let i = 0; i < Math.min(parts1.length, parts2.length); i++) {
if (parts1[i] !== parts2[i]) {
// If both parts are numbers, do numeric comparison
if (typeof parts1[i] === 'number' && typeof parts2[i] === 'number') {
return parts1[i] as number - (parts2[i] as number);
}
// If either part is a string, do string comparison
return String(parts1[i]).localeCompare(String(parts2[i]));
}
}
// If all parts match up to the shortest length, shorter PFICs come first
return parts1.length - parts2.length;
}

17
origin-dex/src/app/features/auth/auth.routes.ts

@ -0,0 +1,17 @@
import { Routes } from '@angular/router';
export const AUTH_ROUTES: Routes = [
{
path: 'login',
loadComponent: () => import('./login/login.component').then(m => m.LoginComponent)
},
{
path: 'register',
loadComponent: () => import('./register/register.component').then(m => m.RegisterComponent)
},
{
path: '',
redirectTo: 'login',
pathMatch: 'full'
}
];

137
origin-dex/src/app/features/auth/login/login.component.ts

@ -0,0 +1,137 @@
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterLink, Router, ActivatedRoute } from '@angular/router';
import { FormBuilder, FormGroup, Validators, ReactiveFormsModule } from '@angular/forms';
import { MatCardModule } from '@angular/material/card';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatButtonModule } from '@angular/material/button';
import { AuthService } from '../../../core/services/auth.service';
@Component({
selector: 'app-login',
standalone: true,
imports: [
CommonModule,
RouterLink,
ReactiveFormsModule,
MatCardModule,
MatFormFieldModule,
MatInputModule,
MatButtonModule
],
template: `
<div class="auth-container">
<mat-card>
<mat-card-header>
<mat-card-title>Login</mat-card-title>
</mat-card-header>
<mat-card-content>
<form [formGroup]="loginForm" (ngSubmit)="onSubmit()">
<mat-form-field appearance="outline">
<mat-label>Username</mat-label>
<input matInput formControlName="username" required>
<mat-error *ngIf="loginForm.get('username')?.errors?.['required']">
Username is required
</mat-error>
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Password</mat-label>
<input matInput type="password" formControlName="password" required>
<mat-error *ngIf="loginForm.get('password')?.errors?.['required']">
Password is required
</mat-error>
</mat-form-field>
<div class="error-message" *ngIf="error">
{{ error }}
</div>
<div class="form-actions">
<button mat-raised-button color="primary" type="submit" [disabled]="loginForm.invalid || loading">
{{ loading ? 'Logging in...' : 'Login' }}
</button>
<a mat-button routerLink="/auth/register">Need an account?</a>
</div>
</form>
</mat-card-content>
</mat-card>
</div>
`,
styles: [`
.auth-container {
display: flex;
justify-content: center;
align-items: center;
min-height: calc(100vh - 64px);
padding: 20px;
}
mat-card {
max-width: 400px;
width: 100%;
}
mat-card-header {
margin-bottom: 20px;
}
form {
display: flex;
flex-direction: column;
gap: 16px;
}
.form-actions {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 16px;
}
.error-message {
color: #f44336;
font-size: 0.875rem;
margin-top: -8px;
}
`]
})
export class LoginComponent {
loginForm: FormGroup;
loading = false;
error = '';
constructor(
private formBuilder: FormBuilder,
private authService: AuthService,
private router: Router,
private route: ActivatedRoute
) {
this.loginForm = this.formBuilder.group({
username: ['', Validators.required],
password: ['', Validators.required]
});
}
onSubmit() {
if (this.loginForm.invalid) return;
this.loading = true;
this.error = '';
const { username, password } = this.loginForm.value;
this.authService.login(username, password).subscribe({
next: () => {
const returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
this.router.navigateByUrl(returnUrl);
},
error: err => {
this.error = err.error?.message || 'Login failed';
this.loading = false;
}
});
}
}

155
origin-dex/src/app/features/auth/register/register.component.ts

@ -0,0 +1,155 @@
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterLink, Router } from '@angular/router';
import { FormBuilder, FormGroup, Validators, ReactiveFormsModule } from '@angular/forms';
import { MatCardModule } from '@angular/material/card';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatButtonModule } from '@angular/material/button';
import { AuthService } from '../../../core/services/auth.service';
@Component({
selector: 'app-register',
standalone: true,
imports: [
CommonModule,
RouterLink,
ReactiveFormsModule,
MatCardModule,
MatFormFieldModule,
MatInputModule,
MatButtonModule
],
template: `
<div class="auth-container">
<mat-card>
<mat-card-header>
<mat-card-title>Register</mat-card-title>
</mat-card-header>
<mat-card-content>
<form [formGroup]="registerForm" (ngSubmit)="onSubmit()">
<mat-form-field appearance="outline">
<mat-label>Username</mat-label>
<input matInput formControlName="username" required>
<mat-error *ngIf="registerForm.get('username')?.errors?.['required']">
Username is required
</mat-error>
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Password</mat-label>
<input matInput type="password" formControlName="password" required>
<mat-error *ngIf="registerForm.get('password')?.errors?.['required']">
Password is required
</mat-error>
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Confirm Password</mat-label>
<input matInput type="password" formControlName="confirmPassword" required>
<mat-error *ngIf="registerForm.get('confirmPassword')?.errors?.['required']">
Please confirm your password
</mat-error>
<mat-error *ngIf="registerForm.errors?.['passwordMismatch']">
Passwords do not match
</mat-error>
</mat-form-field>
<div class="error-message" *ngIf="error">
{{ error }}
</div>
<div class="form-actions">
<button mat-raised-button color="primary" type="submit" [disabled]="registerForm.invalid || loading">
{{ loading ? 'Registering...' : 'Register' }}
</button>
<a mat-button routerLink="/auth/login">Already have an account?</a>
</div>
</form>
</mat-card-content>
</mat-card>
</div>
`,
styles: [`
.auth-container {
display: flex;
justify-content: center;
align-items: center;
min-height: calc(100vh - 64px);
padding: 20px;
}
mat-card {
max-width: 400px;
width: 100%;
}
mat-card-header {
margin-bottom: 20px;
}
form {
display: flex;
flex-direction: column;
gap: 16px;
}
.form-actions {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 16px;
}
.error-message {
color: #f44336;
font-size: 0.875rem;
margin-top: -8px;
}
`]
})
export class RegisterComponent {
registerForm: FormGroup;
loading = false;
error = '';
constructor(
private formBuilder: FormBuilder,
private authService: AuthService,
private router: Router
) {
this.registerForm = this.formBuilder.group({
username: ['', Validators.required],
password: ['', Validators.required],
confirmPassword: ['', Validators.required]
}, { validators: this.passwordMatchValidator });
}
passwordMatchValidator(group: FormGroup) {
const password = group.get('password')?.value;
const confirmPassword = group.get('confirmPassword')?.value;
return password === confirmPassword ? null : { passwordMismatch: true };
}
onSubmit() {
if (this.registerForm.invalid) return;
this.loading = true;
this.error = '';
const { username, password } = this.registerForm.value;
this.authService.register(username, password).subscribe({
next: () => {
this.router.navigate(['/auth/login'], {
queryParams: { registered: true }
});
},
error: err => {
this.error = err.error?.message || 'Registration failed';
this.loading = false;
}
});
}
}

150
origin-dex/src/app/features/plan/plan-game/plan-game.component.ts

@ -0,0 +1,150 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { FormsModule } from '@angular/forms';
import { PlanPokemonComponent } from '../plan-pokemon/plan-pokemon.component';
import { GamePlan, PlanPokemon } from '../../../core/models/plan.model';
interface StatusUpdateEvent {
pfic?: string;
caught?: boolean;
gameId?: number;
total?: number;
}
@Component({
selector: 'app-plan-game',
standalone: true,
imports: [
CommonModule,
MatExpansionModule,
MatFormFieldModule,
MatInputModule,
FormsModule,
PlanPokemonComponent
],
template: `
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
{{ game.game_name }}
</mat-panel-title>
<mat-panel-description>
Catch: {{ getTotalCatchCount() }}
</mat-panel-description>
</mat-expansion-panel-header>
<div class="search-container">
<mat-form-field appearance="outline" class="search-field">
<mat-label>Search Pokémon</mat-label>
<input matInput [(ngModel)]="searchTerm" (input)="filterPokemon()">
</mat-form-field>
</div>
<div class="game-sections">
<div class="active-section">
<app-plan-pokemon
*ngFor="let pokemon of filteredPokemon"
[pokemon]="pokemon"
(statusUpdate)="onPokemonStatusUpdate($event)"
></app-plan-pokemon>
</div>
<div class="completed-section" *ngIf="completedPokemon.length > 0">
<h3 class="section-title">Completed</h3>
<app-plan-pokemon
*ngFor="let pokemon of completedPokemon"
[pokemon]="pokemon"
(statusUpdate)="onPokemonStatusUpdate($event)"
></app-plan-pokemon>
</div>
</div>
</mat-expansion-panel>
`,
styles: [`
.search-container {
margin-bottom: 16px;
}
.search-field {
width: 100%;
}
.game-sections {
display: flex;
flex-direction: column;
gap: 24px;
}
.completed-section {
border-top: 2px solid #eee;
padding-top: 16px;
}
.section-title {
color: #4CAF50;
margin: 0 0 16px 0;
font-size: 1.2em;
}
`]
})
export class PlanGameComponent {
@Input() game!: GamePlan;
@Output() statusUpdate = new EventEmitter<StatusUpdateEvent>();
searchTerm = '';
filteredPokemon: typeof this.game.pokemon = [];
completedPokemon: typeof this.game.pokemon = [];
ngOnInit() {
this.filterPokemon();
}
filterPokemon() {
const term = this.searchTerm.toLowerCase();
const filtered = this.game.pokemon.filter(pokemon => {
const nameMatch = pokemon.name.toLowerCase().includes(term);
const formMatch = pokemon.form_name?.toLowerCase().includes(term);
return nameMatch || formMatch;
});
this.completedPokemon = filtered.filter(p => p.catch_count === 0);
this.filteredPokemon = filtered.filter(p => p.catch_count > 0);
}
getTotalCatchCount(): number {
return this.game.pokemon.reduce((sum, pokemon) => sum + pokemon.catch_count, 0);
}
onPokemonStatusUpdate(event: {pfic: string, caught: boolean}) {
this.statusUpdate.emit(event);
this.filterPokemon(); // Refresh the lists
}
updateGameTotal(change: number) {
const currentTotal = this.getTotalCatchCount();
// Emit the new total to update the header
this.statusUpdate.emit({
gameId: this.game.game_id,
total: currentTotal + change
});
}
moveToCompletedSection(pokemon: PlanPokemon) {
const index = this.filteredPokemon.findIndex(p => p.pfic === pokemon.pfic);
if (index > -1) {
const [movedPokemon] = this.filteredPokemon.splice(index, 1);
this.completedPokemon.push(movedPokemon);
}
}
moveToActiveSection(pokemon: PlanPokemon) {
const index = this.completedPokemon.findIndex(p => p.pfic === pokemon.pfic);
if (index > -1) {
const [movedPokemon] = this.completedPokemon.splice(index, 1);
this.filteredPokemon.push(movedPokemon);
}
}
}

319
origin-dex/src/app/features/plan/plan-pokemon/plan-pokemon.component.ts

@ -0,0 +1,319 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatIconModule } from '@angular/material/icon';
import { MatChipsModule } from '@angular/material/chips';
import { MatTooltipModule } from '@angular/material/tooltip';
import { PlanPokemon } from '../../../core/models/plan.model';
import { LazyImgDirective } from '../../../shared/directives/lazy-img.directive';
import { PokemonService } from '../../../core/services/pokemon.service';
// Define an interface for the status update event
interface PokemonStatusEvent {
pfic: string;
caught: boolean;
completed?: boolean; // Make completed optional
}
@Component({
selector: 'app-plan-pokemon',
standalone: true,
imports: [
CommonModule,
MatExpansionModule,
MatIconModule,
MatChipsModule,
MatTooltipModule,
LazyImgDirective
],
template: `
<mat-expansion-panel
class="pokemon-panel"
[expanded]="hasTargets"
[disabled]="!hasTargets"
>
<mat-expansion-panel-header>
<div class="pokemon-header">
<img
lazyImg
[src]="pokemonService.getPokemonImageUrl(pokemon.pfic)"
[alt]="pokemon.name"
class="pokemon-thumbnail"
[class.grayscale]="pokemon.catch_count === 0"
>
<div class="pokemon-info">
<div class="pokemon-name">
{{ pokemon.name }}
<span *ngIf="pokemon.form_name" class="form-name">
({{ pokemon.form_name }})
</span>
</div>
<div class="catch-info">
<img
src="/assets/images/pokeball_color.png"
[class.grayscale]="pokemon.catch_count === 0"
class="pokeball-icon"
(click)="toggleCatch($event)"
[matTooltip]="'Need: ' + pokemon.catch_count"
>
<span class="catch-count">{{ pokemon.catch_count }}</span>
</div>
</div>
</div>
</mat-expansion-panel-header>
<div class="targets-grid" *ngIf="hasTargets">
<ng-container *ngIf="pokemon.evolve_to.length > 0">
<div class="target-section">
<h4>Evolution Targets</h4>
<div class="target-cards">
<div
*ngFor="let target of pokemon.evolve_to"
class="target-card"
[class.completed]="isTargetCompleted(target.pfic)"
>
<img
lazyImg
[src]="pokemonService.getPokemonImageUrl(target.pfic)"
[alt]="target.name"
class="target-image"
[class.grayscale]="isTargetCompleted(target.pfic)"
>
<div class="target-details">
<div class="target-name">
{{ target.name }}
<span *ngIf="target.form_name">({{ target.form_name }})</span>
</div>
<mat-chip-listbox>
<mat-chip>{{ target.method }}</mat-chip>
<mat-chip color="primary" selected>Need: {{ target.count }}</mat-chip>
</mat-chip-listbox>
</div>
</div>
</div>
</div>
</ng-container>
<ng-container *ngIf="pokemon.breed_for.length > 0">
<div class="target-section">
<h4>Breeding Targets</h4>
<div class="target-cards">
<div
*ngFor="let target of pokemon.breed_for"
class="target-card"
[class.completed]="isTargetCompleted(target.pfic)"
>
<img
lazyImg
[src]="pokemonService.getPokemonImageUrl(target.pfic)"
[alt]="target.name"
class="target-image"
[class.grayscale]="isTargetCompleted(target.pfic)"
>
<div class="target-details">
<div class="target-name">
{{ target.name }}
<span *ngIf="target.form_name">({{ target.form_name }})</span>
</div>
<mat-chip-listbox>
<mat-chip>Breed</mat-chip>
<mat-chip color="primary" selected>Need: {{ target.count }}</mat-chip>
</mat-chip-listbox>
</div>
</div>
</div>
</div>
</ng-container>
</div>
</mat-expansion-panel>
`,
styles: [`
.pokemon-panel {
margin-bottom: 8px;
}
.pokemon-header {
display: flex;
align-items: center;
gap: 16px;
width: 100%;
}
.pokemon-thumbnail {
width: 48px;
height: 48px;
object-fit: contain;
}
.pokemon-info {
display: flex;
justify-content: space-between;
align-items: center;
flex-grow: 1;
}
.pokemon-name {
font-weight: 500;
font-size: 1.1em;
}
.form-name {
color: #666;
font-size: 0.9em;
margin-left: 4px;
}
.catch-info {
display: flex;
align-items: center;
gap: 8px;
}
.pokeball-icon {
width: 24px;
height: 24px;
cursor: pointer;
transition: filter 0.3s ease;
}
.grayscale {
filter: grayscale(100%);
}
.catch-count {
font-weight: 500;
color: #4CAF50;
}
.targets-grid {
padding: 16px 8px;
display: flex;
flex-direction: column;
gap: 24px;
}
.target-section {
h4 {
margin: 0 0 12px 0;
color: #666;
}
}
.target-cards {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 16px;
}
.target-card {
display: flex;
align-items: center;
gap: 12px;
padding: 8px;
border: 1px solid #eee;
border-radius: 8px;
transition: background-color 0.3s ease;
&:hover {
background-color: #f5f5f5;
}
&.completed {
background-color: #f0f0f0;
}
}
.target-image {
width: 64px;
height: 64px;
object-fit: contain;
}
.target-details {
display: flex;
flex-direction: column;
gap: 8px;
}
.target-name {
font-weight: 500;
span {
color: #666;
font-size: 0.9em;
}
}
mat-chip-list {
display: flex;
gap: 4px;
}
`]
})
export class PlanPokemonComponent {
@Input() pokemon!: PlanPokemon;
@Output() statusUpdate = new EventEmitter<PokemonStatusEvent>();
constructor(public pokemonService: PokemonService) {}
get hasTargets(): boolean {
return this.pokemon.evolve_to.length > 0 || this.pokemon.breed_for.length > 0;
}
isTargetCompleted(pfic: string): boolean {
// This should be connected to your caught Pokemon service/state
return false; // Placeholder
}
toggleCatch(event: MouseEvent) {
event.stopPropagation();
this.statusUpdate.emit({
pfic: this.pokemon.pfic,
caught: this.pokemon.catch_count > 0
});
}
calculateTotalNeeded(): number {
let total = 1; // Initial catch
let breedCount = 0;
let evolveCount = 0;
// Calculate breeding needs
if (this.pokemon.breed_for.length > 0) {
breedCount = 1; // We only need one for breeding, regardless of how many we breed
}
// Calculate evolution needs
this.pokemon.evolve_to.forEach(target => {
if (!this.isTargetCompleted(target.pfic)) {
evolveCount += target.count;
}
});
return total + breedCount + evolveCount;
}
updateCatchCount() {
const newCount = this.calculateTotalNeeded();
if (newCount !== this.pokemon.catch_count) {
this.pokemon.catch_count = newCount;
if (newCount === 0) {
// Emit event to move to completed section
this.statusUpdate.emit({
pfic: this.pokemon.pfic,
caught: true,
completed: true
});
} else if (newCount > 0 && this.pokemon.catch_count === 0) {
// Emit event to move back to active section
this.statusUpdate.emit({
pfic: this.pokemon.pfic,
caught: false,
completed: false
});
}
}
}
}

66
origin-dex/src/app/features/plan/plan.component.ts

@ -0,0 +1,66 @@
import { Component, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { FormsModule } from '@angular/forms';
import { PlanGameComponent } from './plan-game/plan-game.component';
import { PlanService } from '../../core/services/plan.service';
import { GamePlan } from '../../core/models/plan.model';
@Component({
selector: 'app-plan',
standalone: true,
imports: [
CommonModule,
MatExpansionModule,
MatFormFieldModule,
MatInputModule,
FormsModule,
PlanGameComponent
],
template: `
<div class="plan-container">
<div class="games-accordion">
<app-plan-game
*ngFor="let game of gamePlans"
[game]="game"
(statusUpdate)="onPokemonStatusUpdate($event)"
></app-plan-game>
</div>
</div>
`,
styles: [`
.plan-container {
padding: 20px;
max-width: 1200px;
margin: 0 auto;
}
.games-accordion {
display: flex;
flex-direction: column;
gap: 16px;
}
`]
})
export class PlanComponent implements OnInit {
gamePlans: GamePlan[] = [];
constructor(private planService: PlanService) {}
ngOnInit() {
this.loadPlan();
}
private loadPlan() {
this.planService.getPlan().subscribe(
plan => this.gamePlans = plan
);
}
onPokemonStatusUpdate(event: { pfic: string, caught: boolean }) {
// Handle status updates that might affect other games' plans
this.loadPlan(); // Reload the full plan to ensure consistency
}
}

186
origin-dex/src/app/features/pokemon/pokemon-carousel/pokemon-carousel.component.ts

@ -0,0 +1,186 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatCardModule } from '@angular/material/card';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { PokemonService } from '../../../core/services/pokemon.service';
import { Pokemon } from '../../../core/models/pokemon.model';
import { PokemonCellComponent } from '../pokemon-cell/pokemon-cell.component';
import { PokemonDetailsComponent } from '../pokemon-details/pokemon-details.component';
@Component({
selector: 'app-pokemon-carousel',
standalone: true,
imports: [
CommonModule,
MatCardModule,
MatIconModule,
MatButtonModule,
PokemonCellComponent,
PokemonDetailsComponent
],
template: `
<div class="carousel-container">
<button mat-icon-button class="nav-button prev"
[disabled]="currentBoxIndex === 0"
(click)="previousBox()">
<mat-icon>chevron_left</mat-icon>
</button>
<div class="pokemon-box-container">
<mat-card class="pokemon-box">
<div class="box-title">Box {{ (currentBoxIndex + 1).toString().padStart(3, '0') }}</div>
<div class="pokemon-grid">
<app-pokemon-cell
*ngFor="let pokemon of currentGroup"
[pokemon]="pokemon"
(caught)="onPokemonCaught($event)"
(selected)="onPokemonSelected($event)"
></app-pokemon-cell>
</div>
</mat-card>
</div>
<button mat-icon-button class="nav-button next"
[disabled]="currentBoxIndex === pokemonGroups.length - 1"
(click)="nextBox()">
<mat-icon>chevron_right</mat-icon>
</button>
</div>
<div class="box-navigation">
<span>Box {{ currentBoxIndex + 1 }} of {{ pokemonGroups.length }}</span>
</div>
<app-pokemon-details
*ngIf="selectedPokemon"
[pokemon]="selectedPokemon"
[isOpen]="!!selectedPokemon"
(closed)="selectedPokemon = null"
></app-pokemon-details>
`,
styles: [`
.carousel-container {
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
position: relative;
height: calc(100vh - 200px);
}
.pokemon-box-container {
flex: 1;
max-width: 800px;
position: relative;
}
.pokemon-box {
background-color: white;
border: 2px solid #ccc;
border-radius: 10px;
padding: 20px;
position: relative;
width: 100%;
box-sizing: border-box;
}
.box-title {
background-color: #4CAF50;
color: white;
padding: 5px 15px;
border-radius: 15px 15px 0 0;
position: absolute;
top: -30px;
left: 20px;
font-weight: bold;
}
.pokemon-grid {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: 10px;
}
.nav-button {
margin: 0 20px;
&.prev { left: 0; }
&.next { right: 0; }
&:disabled {
opacity: 0.5;
}
}
.box-navigation {
text-align: center;
padding: 10px;
font-size: 1.1em;
color: #666;
}
`],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class PokemonCarouselComponent implements OnInit {
pokemonGroups: (Pokemon | null)[][] = [];
currentBoxIndex = 0;
selectedPokemon: Pokemon | null = null;
caughtPokemon = new Set<string>();
get currentGroup(): (Pokemon | null)[] {
return this.pokemonGroups[this.currentBoxIndex] || [];
}
constructor(
private pokemonService: PokemonService,
private cdr: ChangeDetectorRef
) {}
ngOnInit() {
this.loadPokemon();
}
private loadPokemon() {
this.pokemonService.getPokemonList().subscribe({
next: (groups) => {
this.pokemonGroups = groups;
this.cdr.markForCheck();
},
error: (error) => {
console.error('Error loading Pokemon:', error);
this.cdr.markForCheck();
}
});
}
nextBox() {
if (this.currentBoxIndex < this.pokemonGroups.length - 1) {
this.currentBoxIndex++;
this.cdr.markForCheck();
}
}
previousBox() {
if (this.currentBoxIndex > 0) {
this.currentBoxIndex--;
this.cdr.markForCheck();
}
}
onPokemonCaught(pfic: string) {
this.pokemonService.toggleCatch(pfic).subscribe(
response => {
if (response.status === 'caught') {
this.caughtPokemon.add(pfic);
} else {
this.caughtPokemon.delete(pfic);
}
this.cdr.markForCheck();
}
);
}
onPokemonSelected(pokemon: Pokemon) {
this.selectedPokemon = pokemon;
this.cdr.markForCheck();
}
}

173
origin-dex/src/app/features/pokemon/pokemon-cell/pokemon-cell.component.ts

@ -0,0 +1,173 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatTooltipModule } from '@angular/material/tooltip';
import { Pokemon } from '../../../core/models/pokemon.model';
import { LazyImgDirective } from '../../../shared/directives/lazy-img.directive';
import { PokemonService } from '../../../core/services/pokemon.service';
@Component({
selector: 'app-pokemon-cell',
standalone: true,
imports: [
CommonModule,
MatTooltipModule,
LazyImgDirective
],
template: `
<div
*ngIf="pokemon; else emptyCell"
class="pokemon-cell"
(click)="selected.emit(pokemon)"
>
<div class="pokemon-name">{{ pokemon.Name }}</div>
<img
lazyImg
[src]="pokemonService.getPokemonImageUrl(pokemon.PFIC)"
[alt]="pokemon.Name"
class="pokemon-image"
>
<div class="pokemon-form">
{{ pokemon.Form !== 'Default' ? pokemon.Form : '-----' }}
</div>
<div class="pokemon-info">
<div class="pokeball-container">
<img
src="/assets/images/pokeball_color.png"
[class.grayscale]="!pokemon.IsCaught"
class="pokeball-icon"
(click)="onPokeballClick($event)"
>
</div>
<div class="pokemon-number">#{{ pokemon.NationalDex.toString().padStart(4, '0') }}</div>
<div *ngIf="pokemon.MarkIcon" class="origin-mark-container">
<img
[src]="'/assets/' + pokemon.MarkIcon"
class="origin-mark"
[matTooltip]="pokemon.MarkName || ''"
>
</div>
</div>
</div>
<ng-template #emptyCell>
<div class="pokemon-cell empty"></div>
</ng-template>
`,
styles: [`
.pokemon-cell {
background-color: #f9f9f9;
border: 1px solid #ddd;
border-radius: 10px;
padding: 10px;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
cursor: pointer;
height: 180px;
}
.pokemon-cell.empty {
background-color: #e0e0e0;
cursor: default;
}
.pokemon-name {
font-weight: bold;
font-size: 0.8em;
margin-bottom: 5px;
height: 2.4em; /* Allows for 2 lines of text */
display: flex;
align-items: center;
justify-content: center;
width: 100%;
}
.pokemon-image {
width: 96px;
height: 96px;
object-fit: contain;
background-color: #f9f9f9; /* Light gray background for placeholder */
}
.pokemon-form {
min-height: 2.4em;
line-height: 1.2em;
font-style: italic;
font-size: 0.7em;
margin-top: 5px;
}
.pokemon-info {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
margin-top: 5px;
position: relative;
}
.pokemon-number {
color: #777;
font-size: 0.7em;
margin-top: 5px;
}
.pokemon-number {
color: #777;
font-size: 0.7em;
text-align: center;
width: 100%;
}
.origin-mark {
width: 20px;
height: 20px;
object-fit: contain;
filter: invert(100%);
}
/* Optional: Add a background circle for better visibility */
.origin-mark-container {
background-color: rgba(0, 0, 0, 0.1);
border-radius: 50%;
padding: 2px;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
right: 0;
bottom: 0;
}
.pokeball-container {
position: absolute;
left: 0;
bottom: 0;
}
.pokeball-icon {
width: 20px;
height: 20px;
object-fit: contain;
cursor: pointer;
transition: filter 0.3s ease;
}
.pokeball-icon.grayscale {
filter: grayscale(100%);
}
`]
})
export class PokemonCellComponent {
@Input() pokemon: Pokemon | null = null;
@Output() caught = new EventEmitter<string>();
@Output() selected = new EventEmitter<Pokemon>();
constructor(public pokemonService: PokemonService) {}
onPokeballClick(event: MouseEvent) {
event.stopPropagation();
if (this.pokemon) {
this.caught.emit(this.pokemon.PFIC);
this.pokemon.IsCaught = !this.pokemon.IsCaught;
}
}
}

228
origin-dex/src/app/features/pokemon/pokemon-details/pokemon-details.component.ts

@ -0,0 +1,228 @@
import { Component, Input, Output, EventEmitter, SimpleChanges } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { Pokemon, PokemonEncounter } from '../../../core/models/pokemon.model';
import { PokemonService } from '../../../core/services/pokemon.service';
import { Observable } from 'rxjs';
@Component({
selector: 'app-pokemon-details',
standalone: true,
imports: [
CommonModule,
MatButtonModule,
MatIconModule
],
template: `
<div class="details-panel" [class.open]="isOpen">
<div class="details-header">
<h2>
{{ formatPokemonTitle(pokemon) }}
</h2>
<button mat-icon-button (click)="closed.emit()">
<mat-icon>close</mat-icon>
</button>
</div>
<div class="details-content">
<img
[src]="'/assets/images/pokemon/' + pokemon?.Image"
[alt]="pokemon?.Name"
class="pokemon-detail-image"
>
<div class="encounters-section">
<h3>Encounters</h3>
<ng-container *ngIf="encounters$ | async as encounters">
<div *ngFor="let gameGroup of groupEncountersByGame(encounters)" class="game-encounters">
<button
class="collapsible"
(click)="toggleCollapsible($event)"
[class.active]="isCollapsibleActive"
>
{{ gameGroup.game }}
<span class="toggle-icon"></span>
</button>
<div class="encounter-list">
<div *ngFor="let encounter of gameGroup.encounters" class="encounter-item">
<p>
{{ encounter.location }}
<ng-container *ngIf="encounter.day || encounter.time">
({{ encounter.day || '' }} {{ encounter.time || '' }})
</ng-container>
</p>
<div class="encounter-tags">
<span *ngIf="encounter.static_encounter" class="tag">Static</span>
<span *ngIf="encounter.fishing" class="tag">Fishing</span>
<span *ngIf="encounter.starter" class="tag">Starter</span>
</div>
</div>
</div>
</div>
</ng-container>
</div>
</div>
</div>
`,
styles: [`
.details-panel {
width: 300px;
background-color: white;
padding: 20px;
box-shadow: -2px 0 5px rgba(0,0,0,0.1);
position: fixed;
top: 0;
right: -340px;
bottom: 0;
transition: right 0.3s ease-in-out;
overflow-y: auto;
z-index: 1000;
}
.details-panel.open {
right: 0;
}
.details-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
h2 {
margin: 0;
font-size: 1.5em;
}
}
.pokemon-detail-image {
width: 200px;
height: 200px;
object-fit: contain;
margin: 0 auto 20px;
display: block;
}
.game-encounters {
margin-bottom: 10px;
}
.collapsible {
background-color: #f1f1f1;
color: #444;
cursor: pointer;
padding: 10px;
width: 100%;
text-align: left;
border: none;
border-radius: 5px;
display: flex;
justify-content: space-between;
align-items: center;
transition: background-color 0.3s;
&:hover {
background-color: #ddd;
}
&.active {
background-color: #e0e0e0;
}
}
.encounter-list {
display: none;
padding: 10px;
background-color: white;
}
.encounter-item {
padding: 8px;
border-bottom: 1px solid #eee;
&:last-child {
border-bottom: none;
}
p {
margin: 0 0 5px 0;
}
}
.encounter-tags {
display: flex;
gap: 5px;
flex-wrap: wrap;
}
.tag {
background-color: #e0e0e0;
padding: 2px 8px;
border-radius: 12px;
font-size: 0.8em;
color: #666;
}
`]
})
export class PokemonDetailsComponent {
@Input() pokemon: Pokemon | null = null;
@Input() isOpen = false;
@Output() closed = new EventEmitter<void>();
encounters$: Observable<PokemonEncounter[]>;
isCollapsibleActive = false;
constructor(private pokemonService: PokemonService) {
this.encounters$ = this.pokemonService.getPokemonDetails(this.pokemon?.PFIC || '');
}
ngOnInit() {
if (this.pokemon) {
this.encounters$ = this.pokemonService.getPokemonDetails(this.pokemon.PFIC);
}
}
ngOnChanges(changes: SimpleChanges) {
if (changes['pokemon'] && this.pokemon) {
this.encounters$ = this.pokemonService.getPokemonDetails(this.pokemon.PFIC);
}
}
groupEncountersByGame(encounters: PokemonEncounter[]) {
return encounters.reduce((groups, encounter) => {
const group = groups.find(g => g.game === encounter.game);
if (group) {
group.encounters.push(encounter);
} else {
groups.push({
game: encounter.game,
encounters: [encounter]
});
}
return groups;
}, [] as Array<{game: string, encounters: PokemonEncounter[]}>);
}
toggleCollapsible(event: Event) {
const button = event.currentTarget as HTMLButtonElement;
button.classList.toggle('active');
const content = button.nextElementSibling as HTMLElement;
if (content.style.display === 'block') {
content.style.display = 'none';
button.querySelector('.toggle-icon')!.textContent = '▼';
} else {
content.style.display = 'block';
button.querySelector('.toggle-icon')!.textContent = '▲';
}
}
formatPokemonTitle(pokemon: Pokemon | null): string {
if (!pokemon) return '';
const id = pokemon.NationalDex.toString().padStart(4, '0');
const form = pokemon.Form !== 'Default' ? ` (${pokemon.Form})` : '';
return `#${id} - ${pokemon.Name}${form}`;
}
}

149
origin-dex/src/app/features/pokemon/pokemon-grid/pokemon-grid.component.ts

@ -0,0 +1,149 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatCardModule } from '@angular/material/card';
import { ScrollingModule } from '@angular/cdk/scrolling';
import { PokemonService } from '../../../core/services/pokemon.service';
import { Pokemon } from '../../../core/models/pokemon.model';
import { PokemonCellComponent } from '../pokemon-cell/pokemon-cell.component';
import { PokemonDetailsComponent } from '../pokemon-details/pokemon-details.component';
@Component({
selector: 'app-pokemon-grid',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
CommonModule,
MatCardModule,
ScrollingModule,
PokemonCellComponent,
PokemonDetailsComponent
],
template: `
<div class="pokemon-boxes">
<cdk-virtual-scroll-viewport itemSize="400" class="viewport">
<mat-card *ngFor="let group of pokemonGroups; let i = index" class="pokemon-box">
<div class="box-title">Box {{ (i + 1).toString().padStart(3, '0') }}</div>
<div class="pokemon-grid">
<app-pokemon-cell
*ngFor="let pokemon of group"
[pokemon]="pokemon"
(caught)="onPokemonCaught($event)"
(selected)="onPokemonSelected($event)"
></app-pokemon-cell>
</div>
</mat-card>
</cdk-virtual-scroll-viewport>
</div>
<app-pokemon-details
*ngIf="selectedPokemon"
[pokemon]="selectedPokemon"
[isOpen]="!!selectedPokemon"
(closed)="selectedPokemon = null"
></app-pokemon-details>
`,
styles: [`
.pokemon-boxes {
height: calc(100vh - 100px); /* Adjust based on your layout */
overflow: hidden;
padding: 20px;
transition: margin-right 0.3s ease-in-out;
display: flex;
flex-direction: column;
align-items: center;
}
.viewport {
height: 100%;
width: 100%;
}
.pokemon-box {
background-color: white;
border: 2px solid #ccc;
border-radius: 10px;
margin: 0 10px 30px;
padding: 20px;
position: relative;
width: calc(100% - 20px);
max-width: 800px;
box-sizing: border-box;
}
.box-title {
background-color: #4CAF50;
color: white;
padding: 5px 15px;
border-radius: 15px 15px 0 0;
position: absolute;
top: -30px;
left: 20px;
font-weight: bold;
}
.pokemon-grid {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: 10px;
}
`]
})
export class PokemonGridComponent implements OnInit {
pokemonGroups: (Pokemon | null)[][] = [];
selectedPokemon: Pokemon | null = null;
caughtPokemon = new Set<string>();
constructor(
private pokemonService: PokemonService,
private cdr: ChangeDetectorRef
) {}
ngOnInit() {
this.loadPokemon();
//this.loadCaughtPokemon();
}
private loadPokemon() {
//this.pokemonService.getPokemonList().subscribe(
// groups => this.pokemonGroups = groups
//);
console.time('loadPokemon'); // Add performance measurement
this.pokemonService.getPokemonList().subscribe({
next: (groups) => {
this.pokemonGroups = groups;
this.cdr.markForCheck(); // Manually trigger change detection
console.timeEnd('loadPokemon'); // Measure how long it took
},
error: (error) => {
console.error('Error loading Pokemon:', error);
this.cdr.markForCheck();
}
});
}
private loadCaughtPokemon() {
this.pokemonService.getCaughtPokemon().subscribe(
caught => {
this.caughtPokemon = new Set(caught);
}
);
}
onPokemonCaught(pfic: string) {
this.pokemonService.toggleCatch(pfic).subscribe(
response => {
if (response.status === 'caught') {
this.caughtPokemon.add(pfic);
} else {
this.caughtPokemon.delete(pfic);
}
}
);
}
onPokemonSelected(pokemon: Pokemon) {
this.selectedPokemon = pokemon;
this.cdr.markForCheck();
}
}

30
origin-dex/src/app/features/pokemon/pokemon.model.ts

@ -0,0 +1,30 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { MatCardModule } from '@angular/material/card';
import { MatIconModule } from '@angular/material/icon';
import { MatTooltipModule } from '@angular/material/tooltip';
import { PokemonGridComponent } from './pokemon-grid/pokemon-grid.component';
import { PokemonCellComponent } from './pokemon-cell/pokemon-cell.component';
import { PokemonDetailsComponent } from './pokemon-details/pokemon-details.component';
import { LazyImgDirective } from '../../shared/directives/lazy-img.directive';
@NgModule({
declarations: [
PokemonGridComponent,
PokemonCellComponent,
PokemonDetailsComponent,
LazyImgDirective
],
imports: [
CommonModule,
MatCardModule,
MatIconModule,
MatTooltipModule,
RouterModule.forChild([
{ path: '', component: PokemonGridComponent }
])
]
})
export class PokemonModule { }

52
origin-dex/src/app/shared/directives/lazy-img.directive.ts

@ -0,0 +1,52 @@
import { Directive, ElementRef, Input, OnInit, PLATFORM_ID, inject } from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
@Directive({
selector: '[lazyImg]',
standalone: true
})
export class LazyImgDirective {
private platformId = inject(PLATFORM_ID);
private _src = '';
@Input()
set src(value: string) {
this._src = value;
if (isPlatformBrowser(this.platformId)) {
this.setupLazyLoading();
} else {
// For SSR, set the src directly
this.el.nativeElement.src = value;
}
}
constructor(private el: ElementRef<HTMLImageElement>) {}
ngOnInit() {
if (isPlatformBrowser(this.platformId)) {
this.setupLazyLoading();
}
}
private setupLazyLoading() {
if ('IntersectionObserver' in window) {
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
this.loadImage();
observer.unobserve(this.el.nativeElement);
}
});
});
observer.observe(this.el.nativeElement);
} else {
// Fallback for browsers that don't support IntersectionObserver
this.loadImage();
}
}
private loadImage() {
this.el.nativeElement.src = this._src;
}
}

BIN
origin-dex/src/assets/images/marks/Arceus_mark_HOME.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
origin-dex/src/assets/images/marks/BDSP_icon_HOME.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

BIN
origin-dex/src/assets/images/marks/Black_clover_HOME.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 B

BIN
origin-dex/src/assets/images/marks/Blue_pentagon_HOME.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

BIN
origin-dex/src/assets/images/marks/GB_icon_HOME.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

BIN
origin-dex/src/assets/images/marks/GO_icon_HOME.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
origin-dex/src/assets/images/marks/Galar_symbol_HOME.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
origin-dex/src/assets/images/marks/Let's_Go_icon_HOME.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 959 B

BIN
origin-dex/src/assets/images/marks/Markless_icon_HOME.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

BIN
origin-dex/src/assets/images/marks/Paldea_icon_HOME.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
origin-dex/src/assets/images/pokeball_color.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
origin-dex/src/assets/images/pokemon/0001-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
origin-dex/src/assets/images/pokemon/0002-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
origin-dex/src/assets/images/pokemon/0003-01-000-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
origin-dex/src/assets/images/pokemon/0003-01-000-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
origin-dex/src/assets/images/pokemon/0003-01-001-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
origin-dex/src/assets/images/pokemon/0003-01-002-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
origin-dex/src/assets/images/pokemon/0004-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
origin-dex/src/assets/images/pokemon/0005-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
origin-dex/src/assets/images/pokemon/0006-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
origin-dex/src/assets/images/pokemon/0006-01-001-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
origin-dex/src/assets/images/pokemon/0006-01-002-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
origin-dex/src/assets/images/pokemon/0006-01-003-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
origin-dex/src/assets/images/pokemon/0007-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
origin-dex/src/assets/images/pokemon/0008-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
origin-dex/src/assets/images/pokemon/0009-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
origin-dex/src/assets/images/pokemon/0009-01-001-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
origin-dex/src/assets/images/pokemon/0009-01-002-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
origin-dex/src/assets/images/pokemon/0010-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
origin-dex/src/assets/images/pokemon/0011-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

BIN
origin-dex/src/assets/images/pokemon/0012-01-000-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
origin-dex/src/assets/images/pokemon/0012-01-000-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
origin-dex/src/assets/images/pokemon/0012-01-001-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
origin-dex/src/assets/images/pokemon/0013-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

BIN
origin-dex/src/assets/images/pokemon/0014-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
origin-dex/src/assets/images/pokemon/0015-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
origin-dex/src/assets/images/pokemon/0015-01-001-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
origin-dex/src/assets/images/pokemon/0016-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
origin-dex/src/assets/images/pokemon/0017-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
origin-dex/src/assets/images/pokemon/0018-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
origin-dex/src/assets/images/pokemon/0018-01-001-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
origin-dex/src/assets/images/pokemon/0019-01-000-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
origin-dex/src/assets/images/pokemon/0019-01-000-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
origin-dex/src/assets/images/pokemon/0019-01-001-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

BIN
origin-dex/src/assets/images/pokemon/0019-07-001-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

BIN
origin-dex/src/assets/images/pokemon/0020-01-000-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
origin-dex/src/assets/images/pokemon/0020-01-000-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
origin-dex/src/assets/images/pokemon/0020-01-001-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
origin-dex/src/assets/images/pokemon/0020-07-001-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
origin-dex/src/assets/images/pokemon/0021-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
origin-dex/src/assets/images/pokemon/0022-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
origin-dex/src/assets/images/pokemon/0023-01-000-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save