Migrating repo

This commit is contained in:
Chris Bell 2025-03-03 16:58:25 -06:00
commit 73d70f83d2
33 changed files with 16262 additions and 0 deletions

17
.editorconfig Normal file
View File

@ -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
.gitignore vendored Normal file
View File

@ -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
.vscode/extensions.json vendored Normal file
View File

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

20
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,20 @@
{
// 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"
}
]
}

42
.vscode/tasks.json vendored Normal file
View File

@ -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"
}
}
}
}
]
}

2
README.md Normal file
View File

@ -0,0 +1,2 @@
Student ID: 011167632
Angular Version: 19.0.1

98
angular.json Normal file
View File

@ -0,0 +1,98 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"d280-project": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/d280-project",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"assets": [
"src/assets",
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "2MB",
"maximumError": "4MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2MB",
"maximumError": "4MB"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "d280-project:build:production"
},
"development": {
"buildTarget": "d280-project: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",
"assets": [
"src/assets",
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"scripts": []
}
}
}
}
}
}

15095
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

38
package.json Normal file
View File

@ -0,0 +1,38 @@
{
"name": "d280-project",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^19.0.0",
"@angular/common": "^19.0.0",
"@angular/compiler": "^19.0.0",
"@angular/core": "^19.0.0",
"@angular/forms": "^19.0.0",
"@angular/platform-browser": "^19.0.0",
"@angular/platform-browser-dynamic": "^19.0.0",
"@angular/router": "^19.0.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.15.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^19.0.1",
"@angular/cli": "^19.0.1",
"@angular/compiler-cli": "^19.0.0",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.4.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.6.2"
}
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

View File

@ -0,0 +1 @@
<router-outlet />

View File

@ -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 'd280-project' title`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('d280-project');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, d280-project');
});
});

13
src/app/app.component.ts Normal file
View File

@ -0,0 +1,13 @@
import {Component} from '@angular/core';
import {RouterOutlet} from '@angular/router';
@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet],
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'd280-project';
}

13
src/app/app.config.ts Normal file
View File

@ -0,0 +1,13 @@
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';
import { provideHttpClient, HttpClient } from '@angular/common/http';
import { routes } from './app.routes';
export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes),
provideHttpClient(),
HttpClient
]
};

7
src/app/app.routes.ts Normal file
View File

@ -0,0 +1,7 @@
import { Routes } from '@angular/router';
import { MapViewComponent } from './map-view/map-view.component';
export const routes: Routes = [
{path: '', redirectTo: '/map', pathMatch: 'full'},
{path: 'map', component: MapViewComponent}
];

View File

@ -0,0 +1,14 @@
svg path {
fill: black;
transition: fill 0.3s ease;
cursor: crosshair;
}
svg path:hover {
fill: #0099aa;
transition: fill 0.3s ease;
}
svg {
margin: 5%;
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { InteractiveMapComponent } from './interactive-map.component';
describe('InteractiveMapComponent', () => {
let component: InteractiveMapComponent;
let fixture: ComponentFixture<InteractiveMapComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [InteractiveMapComponent]
})
.compileComponents();
fixture = TestBed.createComponent(InteractiveMapComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,43 @@
import {Component, EventEmitter, Output} from '@angular/core';
import { WorldBankService } from '../world-bank.service';
import {HttpClient} from '@angular/common/http';
@Component({
selector: 'interactive-map',
imports: [],
templateUrl: './interactive-map.component.html',
styleUrl: './interactive-map.component.css'
})
export class InteractiveMapComponent {
@Output() countryDataUpdated = new EventEmitter<any>();
selectedId: string = "";
countryData: any = null;
constructor(private http: HttpClient, private worldBankService: WorldBankService) {}
onMouseOver(event: MouseEvent) {
const target = event.target as SVGPathElement;
if (target && target.id) {
this.selectedId = target.id;
this.fetchCountryData(this.selectedId);
}
console.log(`Hovering over: ${this.selectedId}`);
}
fetchCountryData(id: string) {
this.worldBankService.getCountryData(id).subscribe(
(
data) => {
this.countryData = data[1][0];
this.countryDataUpdated.emit(this.countryData);
console.log(this.countryData);
},
error => {
console.error(`Error fetching country data: ${error}`);
}
);
}
}

View File

@ -0,0 +1,61 @@
#content {
height: 100vh;
display: flex;
flex-direction: column;
}
#header {
width: 100vw;
height: 5%;
background-color: #006699;
display: flex;
justify-content: center;
align-items: center;
}
#footer {
width: 100vw;
height: 3%;
background-color: #006699;
display: flex;
justify-content: center;
align-items: center;
}
.flex-container {
display: flex;
flex-direction: row;
height: 100%;
width: 100%;
margin: 0;
}
#map-container {
flex: 1;
text-align: center;
align-content: center
}
#data-container {
flex: 0.5;
padding: 30px;
align-content: center;
background-color: #006699;
}
#data-container ul {
list-style-type: none;
}
#data-container ul li {
margin-bottom: 10px;
font-size: x-large;
}
#map-container interactive-map {
width: 100%;
height: auto;
}

View File

@ -0,0 +1,24 @@
<div id="content">
<div id="header">
<h1>Interactive Country Map</h1>
</div>
<div class="flex-container">
<div id="map-container">
<interactive-map (countryDataUpdated)="onCountryDataUpdated($event)"></interactive-map>
</div>
<div id="data-container">
<ul *ngIf="countryData">
<li>Country Name: {{ countryData.name }}</li>
<li>Country Capital: {{ countryData.capitalCity }}</li>
<li>Country Region: {{ countryData.region.value }}</li>
<li>Income Level: {{ countryData.incomeLevel.value }}</li>
<li>Country Code: {{ countryData.iso2Code }}</li>
<li>Latitude and Longitude: {{ countryData.latitude }}, {{ countryData.longitude }}</li>
</ul>
</div>
</div>
<div id="footer"></div>
</div>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MapViewComponent } from './map-view.component';
describe('MapViewComponent', () => {
let component: MapViewComponent;
let fixture: ComponentFixture<MapViewComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [MapViewComponent]
})
.compileComponents();
fixture = TestBed.createComponent(MapViewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,20 @@
import {Component} from '@angular/core';
import {InteractiveMapComponent} from '../interactive-map/interactive-map.component';
import {CommonModule} from '@angular/common';
@Component({
selector: 'app-map-view',
imports: [
InteractiveMapComponent,
CommonModule
],
templateUrl: './map-view.component.html',
styleUrls: ['./map-view.component.css']
})
export class MapViewComponent {
countryData: any = null;
onCountryDataUpdated(data: any) {
this.countryData = data;
}
}

View File

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { WorldBankService } from './world-bank.service';
describe('WorldBankService', () => {
let service: WorldBankService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(WorldBankService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,18 @@
import { Injectable } from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class WorldBankService {
private apiUrl: string = "https://api.worldbank.org/v2/country";
constructor(private http: HttpClient) { }
public getCountryData(id: string): Observable<any> {
const url = `${this.apiUrl}/${id}?format=json`;
return this.http.get(url);
}
}

258
src/assets/mapimage.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 1.2 MiB

13
src/index.html Normal file
View File

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D280Project</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>

6
src/main.ts Normal file
View File

@ -0,0 +1,6 @@
import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';
bootstrapApplication(AppComponent, appConfig)
.catch((err) => console.error(err));

4
src/styles.css Normal file
View File

@ -0,0 +1,4 @@
body, html {
margin: 0;
padding: 0;
}

15
tsconfig.app.json Normal file
View File

@ -0,0 +1,15 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts"
],
"include": [
"src/**/*.d.ts"
]
}

27
tsconfig.json Normal file
View File

@ -0,0 +1,27 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"isolatedModules": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"moduleResolution": "bundler",
"importHelpers": true,
"target": "ES2022",
"module": "ES2022"
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}

15
tsconfig.spec.json Normal file
View File

@ -0,0 +1,15 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
},
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}