Skip to content

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
merged 22 commits into from
Jul 17, 2025
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7f4418c
test commit
SeanKelly369 Jul 15, 2025
5495f6c
List changed to showing famous computer scientists
SeanKelly369 Jul 15, 2025
26146a3
formatting smarted
SeanKelly369 Jul 16, 2025
0278661
Running on Android
SeanKelly369 Jul 16, 2025
39ab280
Removing ios and android dev dependencies in package.json
SeanKelly369 Jul 16, 2025
315a453
PersonService provided in root approach
SeanKelly369 Jul 17, 2025
1670b9e
Update apps/nativescript-starter-angular/src/app/people/people.compon…
NathanWalker Jul 17, 2025
495a337
Update apps/nativescript-starter-angular/src/app/people/people.compon…
NathanWalker Jul 17, 2025
01f0200
Title changed to "Famous Computer Scientists" and it is set to fit on…
SeanKelly369 Jul 17, 2025
0faebb0
Merge remote-tracking branch 'refs/remotes/origin/feat/list-update' i…
SeanKelly369 Jul 17, 2025
94964bb
Heading now "Computer Scientists"
SeanKelly369 Jul 17, 2025
671acb4
Update apps/nativescript-starter-angular/src/app/people/person.compon…
NathanWalker Jul 17, 2025
56d30a6
Update apps/nativescript-starter-angular/package.json
NathanWalker Jul 17, 2025
36e3ede
Update apps/nativescript-starter-angular/package.json
NathanWalker Jul 17, 2025
8b3541e
Update apps/nativescript-starter-angular/src/app/people/person-detail…
NathanWalker Jul 17, 2025
f9240c3
Update apps/nativescript-starter-angular/src/app/people/person-detail…
NathanWalker Jul 17, 2025
4fd8e33
Update apps/nativescript-starter-angular/src/app/people/person-detail…
NathanWalker Jul 17, 2025
f15f31e
Update apps/nativescript-starter-angular/src/app/people/person-detail…
NathanWalker Jul 17, 2025
c1a9af8
Update apps/nativescript-starter-angular/src/app/people/person-detail…
NathanWalker Jul 17, 2025
e9dec4b
Update apps/nativescript-starter-angular/src/app/people/person-detail…
NathanWalker Jul 17, 2025
17ee3af
Update apps/nativescript-starter-javascript/app/main-page.xml
NathanWalker Jul 17, 2025
1a04c46
Update apps/nativescript-starter-typescript/app/main-page.xml
NathanWalker Jul 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/nativescript-starter-angular/src/app/app.routes.ts
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 },
];

This file was deleted.

This file was deleted.

37 changes: 0 additions & 37 deletions apps/nativescript-starter-angular/src/app/item/item.service.ts

This file was deleted.

5 changes: 0 additions & 5 deletions apps/nativescript-starter-angular/src/app/item/item.ts

This file was deleted.

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>
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>
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';

@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;

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');
}

}
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import { Component, NO_ERRORS_SCHEMA, inject } from '@angular/core'
import { ChangeDetectionStrategy, Component, NO_ERRORS_SCHEMA, inject } from '@angular/core'
import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular'
import { Page } from '@nativescript/core'
import { ItemService } from './item.service'
import { PersonService } from './person.service'

@Component({
selector: 'ns-items',
templateUrl: './items.component.html',
selector: 'ns-people',
templateUrl: './people.component.html',
imports: [NativeScriptCommonModule, NativeScriptRouterModule],
schemas: [NO_ERRORS_SCHEMA],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ItemsComponent {
itemService = inject(ItemService)
page = inject(Page)
export class PeopleComponent {
personService = inject(PersonService);
page = inject(Page);

constructor() {
// Setup large titles on iOS
this.page.on('loaded', (args) => {
if (__IOS__) {
const navigationController: UINavigationController = this.page.frame.ios.controller
navigationController.navigationBar.prefersLargeTitles = true
const navigationController: UINavigationController = this.page.frame.ios.controller;
navigationController.navigationBar.prefersLargeTitles = true;
}
})
}
Expand Down
27 changes: 27 additions & 0 deletions apps/nativescript-starter-angular/src/app/people/person.service.ts
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);
}
}
6 changes: 6 additions & 0 deletions apps/nativescript-starter-angular/src/app/people/person.ts
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[];
}
2 changes: 1 addition & 1 deletion apps/nativescript-starter-javascript/app/main-page.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigatingTo">
<ActionBar title="My App" icon="" />
<ActionBar title="Famous Computer Scientists" icon="" />
<StackLayout class="p-4">
<Label text="Please tap me" class="text-3xl text-center" />
<Button text="TAP" tap="{{ onTap }}" class="-primary" />
Expand Down
2 changes: 1 addition & 1 deletion apps/nativescript-starter-typescript/app/main-page.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo">
<ActionBar title="My App" icon="" />
<ActionBar title="Famous Computer Scientists" icon="" />

<StackLayout class="p-4">
<Label text="Please tap me" class="text-3xl text-center" />
Expand Down
2 changes: 1 addition & 1 deletion tools/assets/App_Resources/Android/app.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

android {
defaultConfig {
minSdkVersion 17
minSdkVersion 21
generatedDensities = []
}
aaptOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
android:theme="@style/AppTheme">

<activity
android:exported="true"
android:name="com.tns.NativeScriptActivity"
android:label="@string/title_activity_kimera"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|locale|uiMode"
Expand Down