-
-
Notifications
You must be signed in to change notification settings - Fork 4
Feat/list update #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
NathanWalker
merged 22 commits into
NativeScript:main
from
SeanKelly369:feat/list-update
Jul 17, 2025
Merged
Feat/list update #19
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7f4418c
test commit
SeanKelly369 5495f6c
List changed to showing famous computer scientists
SeanKelly369 26146a3
formatting smarted
SeanKelly369 0278661
Running on Android
SeanKelly369 39ab280
Removing ios and android dev dependencies in package.json
SeanKelly369 315a453
PersonService provided in root approach
SeanKelly369 1670b9e
Update apps/nativescript-starter-angular/src/app/people/people.compon…
NathanWalker 495a337
Update apps/nativescript-starter-angular/src/app/people/people.compon…
NathanWalker 01f0200
Title changed to "Famous Computer Scientists" and it is set to fit on…
SeanKelly369 0faebb0
Merge remote-tracking branch 'refs/remotes/origin/feat/list-update' i…
SeanKelly369 94964bb
Heading now "Computer Scientists"
SeanKelly369 671acb4
Update apps/nativescript-starter-angular/src/app/people/person.compon…
NathanWalker 56d30a6
Update apps/nativescript-starter-angular/package.json
NathanWalker 36e3ede
Update apps/nativescript-starter-angular/package.json
NathanWalker 8b3541e
Update apps/nativescript-starter-angular/src/app/people/person-detail…
NathanWalker f9240c3
Update apps/nativescript-starter-angular/src/app/people/person-detail…
NathanWalker 4fd8e33
Update apps/nativescript-starter-angular/src/app/people/person-detail…
NathanWalker f15f31e
Update apps/nativescript-starter-angular/src/app/people/person-detail…
NathanWalker c1a9af8
Update apps/nativescript-starter-angular/src/app/people/person-detail…
NathanWalker e9dec4b
Update apps/nativescript-starter-angular/src/app/people/person-detail…
NathanWalker 17ee3af
Update apps/nativescript-starter-javascript/app/main-page.xml
NathanWalker 1a04c46
Update apps/nativescript-starter-typescript/app/main-page.xml
NathanWalker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { Routes } from '@angular/router'; | ||
import { ItemsComponent } from './item/items.component'; | ||
import { ItemDetailComponent } from './item/item-detail.component'; | ||
import { PeopleComponent } from './people/person.component'; | ||
import { PersonDetailComponent } from './people/person-detail.component'; | ||
|
||
export const routes: Routes = [ | ||
{ path: '', redirectTo: '/items', pathMatch: 'full' }, | ||
{ path: 'items', component: ItemsComponent }, | ||
{ path: 'item/:id', component: ItemDetailComponent }, | ||
{ path: 'items', component: PeopleComponent }, | ||
{ path: 'item/:id', component: PersonDetailComponent }, | ||
]; |
9 changes: 0 additions & 9 deletions
9
apps/nativescript-starter-angular/src/app/item/item-detail.component.html
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
apps/nativescript-starter-angular/src/app/item/item-detail.component.ts
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
apps/nativescript-starter-angular/src/app/item/item.service.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
7 changes: 4 additions & 3 deletions
7
...angular/src/app/item/items.component.html → ...ular/src/app/people/people.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
<ActionBar title="My App"> </ActionBar> | ||
|
||
<ActionBar title="Computer Scientists"></ActionBar> | ||
|
||
<GridLayout> | ||
<ListView [items]="itemService.items()"> | ||
<ListView [items]="personService.items()"> | ||
<ng-template let-item="item"> | ||
<StackLayout [nsRouterLink]="['/item', item.id]"> | ||
<Label [text]="item.name" class="text-lg text-gray-500 p-4"></Label> | ||
</StackLayout> | ||
</ng-template> | ||
</ListView> | ||
</GridLayout> | ||
</GridLayout> |
29 changes: 29 additions & 0 deletions
29
apps/nativescript-starter-angular/src/app/people/person-detail.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<ActionBar title="Details"> | ||
@if (isAndroid) { | ||
<StackLayout orientation="horizontal" horizontalAlignment="left"> | ||
<Label text="< Back" color="#1976d2" (tap)="goBack()" style="font-size: 18; margin-left: 4"></Label> | ||
<Label text="Details" color="#333" style="font-size: 20; font-weight:600; margin-left: 30"></Label> | ||
</StackLayout> | ||
} | ||
</ActionBar> | ||
|
||
<FlexboxLayout flexDirection="column"> | ||
<FlexboxLayout class="m-4"> | ||
<Label class="text-3xl text-gray-400" [text]="person()?.id + '. '"></Label> | ||
<Label class="text-3xl" [text]="person()?.name"></Label> | ||
</FlexboxLayout> | ||
|
||
<StackLayout class="text-xl m-2 ml-6"> | ||
<Label class="mb-2" fontWeight="700" text="Nationality:"></Label> | ||
<Label textWrap="true" [text]="person()?.nationality"></Label> | ||
</StackLayout> | ||
|
||
<StackLayout class="text-xl m-2"> | ||
<Label class="m-2 ml-4" fontWeight="700" text="Notable Achievements:"></Label> | ||
<Label | ||
class="text-xl m-2 ml-4" | ||
[text]="formatAchievements(person()?.notableAchievements)" | ||
textWrap="true"> | ||
</Label> | ||
</StackLayout> | ||
</FlexboxLayout> |
40 changes: 40 additions & 0 deletions
40
apps/nativescript-starter-angular/src/app/people/person-detail.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { ChangeDetectionStrategy, Component, NO_ERRORS_SCHEMA, OnInit, inject, signal } from '@angular/core'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
import { NativeScriptCommonModule, RouterExtensions } from '@nativescript/angular'; | ||
import { Person } from './person'; | ||
import { PersonService } from './person.service'; | ||
import { isAndroid } from '@nativescript/core'; | ||
NathanWalker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@Component({ | ||
selector: 'ns-person-detail', | ||
templateUrl: './person-detail.component.html', | ||
imports: [NativeScriptCommonModule], | ||
schemas: [NO_ERRORS_SCHEMA], | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class PersonDetailComponent implements OnInit { | ||
personService = inject(PersonService); | ||
routerExtensions = inject(RouterExtensions); | ||
route = inject(ActivatedRoute); | ||
person = signal<Person>(null); | ||
isAndroid = isAndroid; | ||
NathanWalker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
ngOnInit(): void { | ||
const id = +this.route.snapshot.params.id; | ||
this.person.set(this.personService.getPerson(id)); | ||
|
||
// log the person to the console | ||
console.log(this.person()); | ||
} | ||
|
||
|
||
goBack() { | ||
this.routerExtensions.back(); | ||
} | ||
|
||
formatAchievements(achievements: string[] | undefined | null): string { | ||
if (!achievements || !Array.isArray(achievements)) return ''; | ||
return achievements.map( (a, index) => (index + 1) + '. ' + a.trim()).join('\n'); | ||
} | ||
|
||
} |
19 changes: 10 additions & 9 deletions
19
...r-angular/src/app/item/items.component.ts → ...ngular/src/app/people/person.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
apps/nativescript-starter-angular/src/app/people/person.service.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Injectable, signal } from '@angular/core'; | ||
import { Person } from './person'; | ||
|
||
@Injectable({providedIn: 'root'}) | ||
export class PersonService { | ||
items = signal<Person[]>([ | ||
{ id: 1, name: 'Alan Turing', nationality: 'British', notableAchievements: ['WW2 code breaking', 'Father of theoretical computer science and AI' ] }, | ||
{ id: 2, name: 'Grace Hopper', nationality: 'American', notableAchievements: ['COBOL development', 'Navy commander', 'Implementation of computer systems and components testing'] }, | ||
{ id: 3, name: 'Donal Knuth', nationality: 'American', notableAchievements: [ 'Author of The Art of Computer Programming', 'Created TeX typesetting system' ] }, | ||
{ id: 4, name: 'Ada Lovelace', nationality: 'British', notableAchievements: [ 'First computer programmer', 'Worked on Analytical Engine' ]}, | ||
{ id: 5, name: 'John von Neumann', nationality: 'Hungarian/American', notableAchievements: [ 'Von Neumann architecture', 'Game theory', 'Contributed to EDVAC' ] }, | ||
{ id: 6, name: 'Tim Berners-Lee', nationality: 'British', notableAchievements: [ 'Inventor of the World Wide Web' ] }, | ||
{ id: 7, name: 'Edsger Dijkstra', nationality: 'Dutch', notableAchievements: [ 'Shortest path algorithm', 'Structured programming advocate' ] }, | ||
{ id: 8, name: 'Linus Torvalds', nationality: 'Finnish-American', notableAchievements: ['Creator of Linux kernel', 'Creator of Git'] }, | ||
{ id: 9, name: 'John McCarthy', nationality: 'American', notableAchievements: ['Coined term "Artificial Intelligence"', 'Created LISP programming language'] }, | ||
{ id: 10, name: 'Dennis Ritchie', nationality: 'American', notableAchievements: ['Creator of C programming language', 'Co-creator of Unix'] }, | ||
{ id: 11, name: 'Bjarne Stroustrup', nationality: 'Danish', notableAchievements: [ 'Creator of C++ programming language' ] }, | ||
{ id: 12, name: 'Steve Wozniak', nationality: 'American', notableAchievements: ['Co-founder of Apple', 'Designer of Apple I & II', 'Pioneer of personal computing'] }, | ||
{ id: 13, name: 'Tommy Flowers', nationality: 'British', notableAchievements: ['Designer of Colossus', 'Pioneer in electronic computing'] }, | ||
{ id: 14, name: 'John Backus', nationality: 'American', notableAchievements: ['Created FORTRAN', 'Developed Backus-Naur form(BNF) notation'] }, | ||
{ id: 15, name: 'Niklaus Wirth', nationality: 'Swiss', notableAchievements: ['Creator of Pascal, Modula, Oberon languages', 'Software engineering pioneer'] }, | ||
]); | ||
|
||
getPerson(id: number): Person { | ||
return this.items().find((person) => person.id === id); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface Person { | ||
id: number; | ||
name: string; | ||
nationality: string; | ||
notableAchievements: string[]; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
|
||
android { | ||
defaultConfig { | ||
minSdkVersion 17 | ||
minSdkVersion 21 | ||
generatedDensities = [] | ||
} | ||
aaptOptions { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.