Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
588182b
scaffolding old proj
ChiaraZuccaro Dec 4, 2025
9a7086f
created new app in angular 21
ChiaraZuccaro Dec 4, 2025
87e3781
added new favicon + updated ReadMe + added license
ChiaraZuccaro Dec 4, 2025
098893e
init routes + pages
ChiaraZuccaro Dec 4, 2025
0978362
components pages
ChiaraZuccaro Dec 4, 2025
13c5a68
created home route + component
ChiaraZuccaro Dec 4, 2025
02968d2
deleted app.html == useless
ChiaraZuccaro Dec 4, 2025
f4ad8c4
feat(): added reset style cross-browser
ChiaraZuccaro Dec 4, 2025
c5fd8ce
feat(): es lint enabled on run server
ChiaraZuccaro Dec 4, 2025
6686bc1
feat(): init hero section
ChiaraZuccaro Dec 4, 2025
1ca7650
feat(): added prefix for eslint error
ChiaraZuccaro Dec 4, 2025
f6f805c
feat(): added logo svg to init animation
ChiaraZuccaro Dec 4, 2025
32db01a
fix(): app-root to opis-root
ChiaraZuccaro Dec 5, 2025
85c26c5
lang it
ChiaraZuccaro Dec 5, 2025
37ac641
feat(): logo substitution
ChiaraZuccaro Dec 8, 2025
ee2b783
feat(): letters logo animated
ChiaraZuccaro Dec 8, 2025
45f574d
format files post run
ChiaraZuccaro Dec 9, 2025
95eeb70
feat(): animated grafic bars
ChiaraZuccaro Dec 9, 2025
868c5c8
format(): logo + completed
ChiaraZuccaro Dec 12, 2025
32483e1
feat(): created env with node
ChiaraZuccaro Dec 12, 2025
c009d93
feat(): recreated original interfaces
ChiaraZuccaro Dec 12, 2025
29d1fea
feat(): no env pushed
ChiaraZuccaro Dec 12, 2025
fd9dde8
feat(): init homepage
ChiaraZuccaro Dec 12, 2025
bf41eba
feat(): mappati i dipartimenti per icone
ChiaraZuccaro Dec 13, 2025
4d594de
feat(): created palette + home btns adapted
ChiaraZuccaro Dec 14, 2025
b462a13
rename(): department page
ChiaraZuccaro Dec 14, 2025
90afdda
feat(): created card department
ChiaraZuccaro Dec 14, 2025
2c68381
new style years section
ChiaraZuccaro Dec 14, 2025
fe8ae00
feat(): add default icon
ChiaraZuccaro Dec 14, 2025
9fc25f7
feat(): added color palette for user selection
ChiaraZuccaro Dec 14, 2025
0476675
feat(): styled departments section
ChiaraZuccaro Dec 14, 2025
0891160
enh(): resource in service
ChiaraZuccaro Dec 14, 2025
e025e48
enh(): years section as component
ChiaraZuccaro Dec 14, 2025
a534af1
fix(): test all components import from vite (it, expect, describe)
ChiaraZuccaro Dec 14, 2025
d718160
test(): implemented home test file
ChiaraZuccaro Dec 14, 2025
f1749bb
formatted files
ChiaraZuccaro Dec 16, 2025
5e87efa
fix(): info department saved on localStorage + fix(): detail url + fe…
ChiaraZuccaro Dec 16, 2025
24d06dd
feat(): department page logic implemented
ChiaraZuccaro Dec 16, 2025
a9e34d1
feat() deleted old_proj directory
ChiaraZuccaro Dec 17, 2025
0618784
style(): title department page
ChiaraZuccaro Dec 17, 2025
2dad4a3
fix(): width of border title department
ChiaraZuccaro Dec 17, 2025
a6f4bb7
changed palette
ChiaraZuccaro Dec 20, 2025
47aa7ee
feat(): added font
ChiaraZuccaro Dec 20, 2025
9acb691
feat(): init cds flow + added loader + delay
ChiaraZuccaro Dec 20, 2025
c75257a
feat(): created icon component
ChiaraZuccaro Dec 26, 2025
3c6adc1
feat(): style on cds list
ChiaraZuccaro Dec 26, 2025
350bcf6
fix(): width list container
ChiaraZuccaro Dec 26, 2025
d369114
feat(): scaffolding for sections, added directory and created cds sel…
ChiaraZuccaro Dec 26, 2025
fd549aa
feat(): added fn that call both api cds schedeOpis and teachings
ChiaraZuccaro Dec 27, 2025
3e68bd1
feat(): ng add ng2-charts
ChiaraZuccaro Dec 27, 2025
6b8443b
test(): cds-selection + department
ChiaraZuccaro Dec 27, 2025
9ae34ee
format with prettier
ChiaraZuccaro Dec 27, 2025
85fcb38
test(): scaffolding for service testing
ChiaraZuccaro Jan 4, 2026
3e7cd45
feat(): added api questions
ChiaraZuccaro Jan 4, 2026
169b7c6
feat(): init cds selected
ChiaraZuccaro Jan 4, 2026
431b704
feat(): introduced statistics calculation for graph
ChiaraZuccaro Jan 4, 2026
2f4f112
feat(): cache on api /domande
ChiaraZuccaro Jan 4, 2026
52873b6
formattati i files
ChiaraZuccaro Jan 8, 2026
8f76761
feat(): centralized duration animation of logo
ChiaraZuccaro Jan 8, 2026
b6e56c6
feat(): animation logo cached
ChiaraZuccaro Jan 8, 2026
b1e13ee
fix(): delay scroll and results
ChiaraZuccaro Jan 8, 2026
2d6d66e
feat(): update ReadMe with version node
ChiaraZuccaro Jan 8, 2026
e3d300a
Update src/app/pages/home/home.html
ChiaraZuccaro Jan 16, 2026
b1de4c9
Update src/app/services/questions/questions.service.ts
ChiaraZuccaro Jan 16, 2026
bdb7ab9
no imports logo-animated
ChiaraZuccaro Jan 16, 2026
050cba9
return type retrieveQuestions
ChiaraZuccaro Jan 16, 2026
ff780a4
Update src/app/ui/sections/cds-selected-section/cds-selected-section.…
ChiaraZuccaro Jan 16, 2026
ae6c96b
Fixed version
ChiaraZuccaro Jan 16, 2026
5976afc
refactor: fixed versions
ChiaraZuccaro Jan 16, 2026
9b282e8
refactor(cds-selected-section.ts + year-section.ts): added changeDete…
ChiaraZuccaro Jan 16, 2026
bdaa246
refactor(department.ts): access modifiers from public to protected + …
ChiaraZuccaro Jan 16, 2026
3b14ae1
refactor(homepage.ts): changeDetection + access modifiers from public…
ChiaraZuccaro Jan 16, 2026
29120ad
refactor: added return type in fns in all services
ChiaraZuccaro Jan 16, 2026
5feb538
refactor(dep-card.ts): access modifiers from public to protected + re…
ChiaraZuccaro Jan 16, 2026
f73c3de
refactor(icon.ts): access modifiers from public to readonly
ChiaraZuccaro Jan 16, 2026
2be446a
refactor(logo-animated.ts): access modifiers + changeDetection + retu…
ChiaraZuccaro Jan 16, 2026
a330e59
refactor(loader.ts): added changeDetection
ChiaraZuccaro Jan 16, 2026
7750bf7
fix(dep-card.ts): removed protected, added readonly on department input
ChiaraZuccaro Jan 16, 2026
ed2ce05
enh(graph.service.ts): used key from destructuring obj
ChiaraZuccaro Jan 16, 2026
31fe57c
fix(department.ts): no empty obj as department interface, used null +…
ChiaraZuccaro Jan 16, 2026
d02920e
refactor(department.ts): access modifier from public to protected for…
ChiaraZuccaro Jan 16, 2026
e59eea3
refactor(department.ts): followed suggestion of access modifier on de…
ChiaraZuccaro Jan 16, 2026
6676481
refactor(home.ts): added readonly as suggestion on PR
ChiaraZuccaro Jan 16, 2026
78aade5
refactor(info.ts): name convention + changeDetection
ChiaraZuccaro Jan 16, 2026
d7194c1
refactor: closing tag for components in home.html, department.html an…
ChiaraZuccaro Jan 16, 2026
7866151
feat: add rule on creating new component, changeDetection
ChiaraZuccaro Jan 16, 2026
60f5f0b
refactor: substitute enums with consts
ChiaraZuccaro Jan 16, 2026
f8bf977
feat: add eslint rules, fix unit-tests, ignore some lint rules, we wi…
Helias Jan 17, 2026
2920adb
Merge branch 'UNICT-DMI:development' into development
ChiaraZuccaro Jan 17, 2026
976932e
refactor: updating ReadMe with info of set-env
ChiaraZuccaro Jan 18, 2026
a97c8ee
refactor: ReadMe
ChiaraZuccaro Jan 18, 2026
24b6ae3
refactor: ReadMe
ChiaraZuccaro Jan 18, 2026
a362b1f
format and lint applied
ChiaraZuccaro Jan 18, 2026
82edd2a
feat: ci workflows
ChiaraZuccaro Jan 18, 2026
755a09d
fix: coverage for test
ChiaraZuccaro Jan 18, 2026
e762c77
fix: coverage for test
ChiaraZuccaro Jan 18, 2026
594e605
scaffolding: created scripts folder
ChiaraZuccaro Jan 18, 2026
8f15bfd
feat: check coverage test in pipeline
ChiaraZuccaro Jan 18, 2026
10a2785
Merge branch 'development' of https://github.com/ChiaraZuccaro/OPIS-M…
ChiaraZuccaro Jan 18, 2026
43c7c37
fix: deploy.yml workflow
ChiaraZuccaro Jan 18, 2026
9589ee9
fix: no branch for lint.yml and tests.yml
ChiaraZuccaro Jan 21, 2026
96ffe95
fix: coverage test from vitest.config file
ChiaraZuccaro Jan 21, 2026
275af69
Merge branch 'cds-graphs' into development
ChiaraZuccaro Jan 21, 2026
5d4671a
feat: logo svg on ReadME
ChiaraZuccaro Jan 21, 2026
084c11d
fix: img logo ReadMe
ChiaraZuccaro Jan 21, 2026
b1193f2
fix: artifacts version for pipeline
ChiaraZuccaro Jan 21, 2026
6a64aa5
Merge branch 'cds-graphs' into development
ChiaraZuccaro Jan 21, 2026
3e4b5a7
fix: type error for file environment
ChiaraZuccaro Jan 21, 2026
5def790
fix: pipeline test
ChiaraZuccaro Jan 21, 2026
7877612
fix: path absolute for environment.ts
ChiaraZuccaro Jan 21, 2026
5a3902b
Merge branch 'cds-graphs' into development
ChiaraZuccaro Jan 21, 2026
0f178ff
test: working thresholds limit
ChiaraZuccaro Jan 21, 2026
f89444b
test: working thresholds limit
ChiaraZuccaro Jan 21, 2026
de441e6
Merge branch 'UNICT-DMI:development' into development
ChiaraZuccaro Jan 24, 2026
0357872
refactor(cds.service.ts): extraction schedules in a side function
ChiaraZuccaro Feb 1, 2026
50f9daa
enh: renaming file type deps-name
ChiaraZuccaro Feb 1, 2026
b93ec01
refactor(cds.service.ts): grouped schede by a side function, feat: co…
ChiaraZuccaro Feb 1, 2026
af5ad03
feat: example graph working
ChiaraZuccaro Feb 1, 2026
cbdcb0b
feat: format data for CDS stats general
ChiaraZuccaro Feb 1, 2026
1ead905
feat: cds general stats working on line chart
ChiaraZuccaro Feb 4, 2026
236c05e
format: run command
ChiaraZuccaro Feb 4, 2026
4fb772e
fix(graph.ts): lint error template
ChiaraZuccaro Feb 4, 2026
6f9ee18
feat: build + deploy pipeline
ChiaraZuccaro Feb 4, 2026
5ddffac
fix: missing return type on graph component
ChiaraZuccaro Feb 5, 2026
f73ec9c
enh: created type for Record means per year + added type on map colors
ChiaraZuccaro Feb 5, 2026
44f7d0f
enh: no cast as AcademicYear thanks to util that help to have typed d…
ChiaraZuccaro Feb 5, 2026
4ae05b8
fix: test job
ChiaraZuccaro Feb 5, 2026
5d49f97
format: npm run format
ChiaraZuccaro Feb 5, 2026
75a5bb9
fix: lint errors on cds-selection.spec
ChiaraZuccaro Feb 5, 2026
fd9f54e
fix: ordered jobs in pipeline
ChiaraZuccaro Feb 5, 2026
b5826fc
fix: workflows
ChiaraZuccaro Feb 5, 2026
8c7ef30
fix: uses alternative method to order workflow on pr
ChiaraZuccaro Feb 5, 2026
b962567
fix: unique workflow for all jobs in order
ChiaraZuccaro Feb 5, 2026
50ca6ba
fix: build failure
ChiaraZuccaro Feb 5, 2026
4d4ecb1
refactor: renaming directory shared components
ChiaraZuccaro Feb 7, 2026
cef6675
enh: dynamic dimension on icon comoponent
ChiaraZuccaro Feb 7, 2026
c01c703
feat: header nav
ChiaraZuccaro Feb 7, 2026
480e9ff
feat: header on app + feat: formula component init
ChiaraZuccaro Feb 7, 2026
199fc18
feat: dynamic contributors on footer
ChiaraZuccaro Feb 7, 2026
954a226
fix: size icon default
ChiaraZuccaro Feb 7, 2026
b9cadb9
feat: mapped real name
ChiaraZuccaro Feb 7, 2026
ba6c1d0
fix: path route
ChiaraZuccaro Feb 7, 2026
03cba1a
feat: footer completed
ChiaraZuccaro Feb 7, 2026
3377240
feat: github icon svg format
ChiaraZuccaro Feb 7, 2026
5c3c35c
fix: now footer always on bottom
ChiaraZuccaro Feb 8, 2026
50fe9fd
feat: top scrolling on change route
ChiaraZuccaro Feb 8, 2026
6646bf3
fix: github icon svg injection take dimension
ChiaraZuccaro Feb 8, 2026
af59c0c
fix: color svg github
ChiaraZuccaro Feb 8, 2026
94d8f45
format pre PR
ChiaraZuccaro Feb 8, 2026
e75bf30
feat: rule on eslint for row template and style on ts file
ChiaraZuccaro Feb 8, 2026
a5957d0
fix: lint errors
ChiaraZuccaro Feb 8, 2026
f723c65
fix: run tests
ChiaraZuccaro Feb 8, 2026
4f21cb5
Merge branch 'development' into header-footer
ChiaraZuccaro Feb 8, 2026
d77ce1a
enh(github.service): access modifer on getRepoContributors
ChiaraZuccaro Feb 9, 2026
3a5f192
enh(icon-registry.service): access modifier on load method
ChiaraZuccaro Feb 9, 2026
10d7d8d
enh(icon.ts): access modifier on variable safeSvgIcon
ChiaraZuccaro Feb 9, 2026
e2ea9ae
fix: footer dimensions
ChiaraZuccaro Feb 9, 2026
841d2ac
format footer
ChiaraZuccaro Feb 9, 2026
ee76666
enh(icon.ts): non-null deleted
ChiaraZuccaro Feb 9, 2026
88231ec
chore: remove footer spacing
Helias Feb 9, 2026
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
7 changes: 7 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
"style": "camelCase"
}
],
"@angular-eslint/component-max-inline-declarations": [
"warn",
{
"template": 6,
"styles": 6
}
],
"@angular-eslint/component-selector": [
"error",
{
Expand Down
1 change: 1 addition & 0 deletions public/icons/github-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/logo-header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion scripts/set-env.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ dotenv.config({ path: path.resolve(__dirname, '../.env') });

const envFilePath = path.resolve(__dirname, '../src/environment.ts');
const output = `export const env = {
api_url: "https://api-opis.unictdev.org/api/v2"
api_url: "https://api-opis.unictdev.org/api/v2",
github_api_url: "https://api.github.com/repos/UNICT-DMI"
};`;
fs.writeFileSync(envFilePath, output);

Expand Down
10 changes: 8 additions & 2 deletions src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/core';
import { provideRouter } from '@angular/router';
import { provideRouter, withInMemoryScrolling } from '@angular/router';
import { routes } from './app.routes';
import { provideCharts, withDefaultRegisterables } from 'ng2-charts';

export const appConfig: ApplicationConfig = {
providers: [
provideBrowserGlobalErrorListeners(),
provideRouter(routes),
provideRouter(
routes,
withInMemoryScrolling({
scrollPositionRestoration: 'top',
anchorScrolling: 'enabled',
}),
),
provideCharts(withDefaultRegisterables()),
],
};
11 changes: 6 additions & 5 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { Routes } from '@angular/router';
import { DepartmentPageComponent } from './pages/department/department';
import { InfoPageComponent } from './pages/info/info';
import { HomePageComponent } from './pages/home/home';
import { FormulaComponent } from './pages/formula/formula';

export const routes: Routes = [
{ path: 'home', component: HomePageComponent },
{ path: ':depsName', component: DepartmentPageComponent },
{ path: '', component: HomePageComponent },
{ path: 'formula', component: FormulaComponent },
{ path: 'info', component: InfoPageComponent },
{ path: '**', redirectTo: '/home' },
// { path: 'formula', },
// { path: 'signup', },
// { path: 'login', }
// { path: 'signup', },
{ path: 'department/:depsName', component: DepartmentPageComponent },
{ path: '**', redirectTo: '', pathMatch: 'full' },
];
9 changes: 9 additions & 0 deletions src/app/app.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
:host {
display: flex;
flex-direction: column;
min-height: 100vh;
}

.opis-app {
flex: 1 0 auto;
}
2 changes: 2 additions & 0 deletions src/app/app.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { TestBed } from '@angular/core/testing';
import { describe, it, expect } from 'vitest';
import { App } from './app';
import { provideRouter } from '@angular/router';

describe('App', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [App],
providers: [provideRouter([])],
}).compileComponents();
});

Expand Down
10 changes: 8 additions & 2 deletions src/app/app.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { Footer } from '@sections/footer/footer';
import { HeaderNav } from '@sections/header-nav/header-nav';

@Component({
selector: 'opis-root',
imports: [RouterOutlet],
template: '<router-outlet />',
imports: [HeaderNav, RouterOutlet, Footer],
template: ` <opis-header-nav />
<main class="opis-app">
<router-outlet />
</main>
<opis-footer />`,
styleUrl: './app.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
Expand Down
9 changes: 9 additions & 0 deletions src/app/custom_types/icon-dimension.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export type IconDimension =
| '1-5rem'
| '2rem'
| '2-5rem'
| '3rem'
| '3-5rem'
| '4rem'
| '4-5rem'
| '5rem';
37 changes: 37 additions & 0 deletions src/app/interfaces/github.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export interface CacheEntry<T> {
timestamp: number;
data: T;
}

export interface GithubUser {
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
user_view_type: string;
site_admin: boolean;
contributions: number;
}

export interface GitUserView {
nick: string;
contributions: number;
email?: string;
linkedin?: string;
telegram?: string;
name?: string;
github_profile?: string;
}
10 changes: 10 additions & 0 deletions src/app/interfaces/header-nav-interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { IconDimension } from '@c_types/icon-dimension.type';

export interface NavItem {
label: string;
route: string;
icon?: {
name: string;
dimension: IconDimension;
};
}
6 changes: 3 additions & 3 deletions src/app/pages/department/department.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ import { RouterLink } from '@angular/router';
import { CdsService } from '@services/cds/cds.service';
import { CDS } from '@interfaces/cds.interface';
import { NO_CHOICE_CDS } from '@values/no-choice-cds';
import { Loader } from '@components/loader/loader';
import { Icon } from '@components/icon/icon';
import { CdsSelectedSection } from '@sections/cds-selected-section/cds-selected-section';
import { QuestionService } from '@services/questions/questions.service';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { IconComponent } from '@shared-ui/icon/icon';
import { Loader } from '@shared-ui/loader/loader';

@Component({
selector: 'opis-department',
imports: [RouterLink, Loader, Icon, CdsSelectedSection],
imports: [RouterLink, Loader, IconComponent, CdsSelectedSection],
templateUrl: './department.html',
styleUrl: './department.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down
1 change: 1 addition & 0 deletions src/app/pages/formula/formula.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>formula works!</p>
Empty file.
21 changes: 21 additions & 0 deletions src/app/pages/formula/formula.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormulaComponent } from './formula';

describe('Formula', () => {
let component: FormulaComponent;
let fixture: ComponentFixture<FormulaComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [FormulaComponent],
}).compileComponents();

fixture = TestBed.createComponent(FormulaComponent);
component = fixture.componentInstance;
await fixture.whenStable();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
10 changes: 10 additions & 0 deletions src/app/pages/formula/formula.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';

@Component({
selector: 'opis-formula',
imports: [],
templateUrl: './formula.html',
styleUrl: './formula.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class FormulaComponent {}
4 changes: 2 additions & 2 deletions src/app/pages/home/home.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ChangeDetectionStrategy, Component, computed, inject, OnDestroy } from '@angular/core';
import { DepCard } from '@cards/dep-card/dep-card';
import { LogoAnimated } from '@components/logo-animated/logo-animated';
import { DepartmentsService } from '@services/departments/departments.service';
import { Loader } from '@components/loader/loader';
import { YearSection } from '@sections/year-section/year-section';
import { Loader } from '@shared-ui/loader/loader';
import { LogoAnimated } from '@shared-ui/logo-animated/logo-animated';

@Component({
selector: 'opis-home',
Expand Down
53 changes: 53 additions & 0 deletions src/app/services/github/github.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { HttpClient } from '@angular/common/http';
import { inject, Injectable, signal } from '@angular/core';
import { env } from '@env';
import { CacheEntry, GithubUser, GitUserView } from '@interfaces/github.interface';
import { REAL_NAME } from '@values/real-name-contributors.value';
import { lastValueFrom } from 'rxjs';

@Injectable({ providedIn: 'root' })
export class GitHubService {
private readonly REPO_NAME = 'OPIS-Manager';
private readonly BASE_URL = env.github_api_url + '/' + this.REPO_NAME;
private readonly _http = inject(HttpClient);

private cacheTTL = 0.5 * 60 * 60 * 1000; // 30 min

readonly contributors = signal<GitUserView[]>([]);

async getRepoContributors(): Promise<GitUserView[]> {
const cacheKey = `contributors_${this.REPO_NAME}`;
const cachedRaw = localStorage.getItem(cacheKey);
const now = Date.now();

if (cachedRaw) {
try {
const cached = JSON.parse(cachedRaw) as CacheEntry<GitUserView[]>;
if (now - cached.timestamp < this.cacheTTL) {
return cached.data;
}
} catch {
console.warn('No cache founded or expired, calling api');
}
}

const url = `${this.BASE_URL}/contributors`;
try {
const contributors = await lastValueFrom(this._http.get<GithubUser[]>(url));
const noBots = contributors.filter((user) => !user.login.includes('bot'));
const mapped = noBots.map((user) => ({
nick: user.login ?? 'Unknown',
name: REAL_NAME.get(user.login.toLowerCase()) ?? '',
contributions: user.contributions ?? 0,
github_profile: user.html_url,
}));

const sorted = mapped.sort((userA, userB) => userB.contributions - userA.contributions);
localStorage.setItem(cacheKey, JSON.stringify({ timestamp: now, data: sorted }));
return sorted;
} catch (err) {
console.error(`Errore nel recuperare i contributors di ${this.REPO_NAME}`, err);
return [];
}
}
}
22 changes: 22 additions & 0 deletions src/app/services/icon-registry/icon-registry.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { inject, Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable, shareReplay, map } from 'rxjs';

@Injectable({ providedIn: 'root' })
export class IconRegistryService {
private readonly _http = inject(HttpClient);
private readonly cache = new Map<'github' | 'linkedin', Observable<string>>();

load(name: 'github' | 'linkedin'): Observable<string> {
if (!this.cache.has(name)) {
const request$ = this._http.get(`/icons/${name}-icon.svg`, { responseType: 'text' }).pipe(
map((svg) => svg.trim()),
shareReplay(1),
);

this.cache.set(name, request$);
}

return this.cache.get(name)!;
}
}
2 changes: 1 addition & 1 deletion src/app/ui/cards/dep-card/dep-card.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<article class="cards department" [id]="department().unict_id">
<a (click)="saveInfo()" [routerLink]="detailUrl">
<a (click)="saveInfo()" [routerLink]="'department/' + detailUrl">
<div class="wrappers-icon">
<opis-icon [iconName]="department().icon ?? ''" />
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/app/ui/cards/dep-card/dep-card.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ChangeDetectionStrategy, Component, input, OnInit } from '@angular/core';
import { RouterLink } from '@angular/router';
import { Icon } from '@components/icon/icon';
import { Department } from '@interfaces/department.interface';
import { IconComponent } from '@shared-ui/icon/icon';

@Component({
selector: 'opis-dep-card',
imports: [RouterLink, Icon],
imports: [RouterLink, IconComponent],
templateUrl: './dep-card.html',
styleUrl: './dep-card.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down
23 changes: 0 additions & 23 deletions src/app/ui/components/icon/icon.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

@if (infoCds.status() === ERR_STATUS) {
<div class="error">
<opis-icon iconName="report_off" [isBig]="true" />
<opis-icon iconName="report_off" dimension="5rem" />
<h2>Qualcosa è andato storto :/</h2>
</div>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import {
inject,
ResourceStatus,
} from '@angular/core';
import { Graph } from '@components/graph/graph';
import { Icon } from '@components/icon/icon';
import { Loader } from '@components/loader/loader';
import { CdsService } from '@services/cds/cds.service';
import { Graph } from '@shared-ui/graph/graph';
import { IconComponent } from '@shared-ui/icon/icon';
import { Loader } from '@shared-ui/loader/loader';

@Component({
selector: 'opis-cds-selected-section',
imports: [Icon, Loader, Graph],
imports: [IconComponent, Loader, Graph],
templateUrl: './cds-selected-section.html',
styleUrl: './cds-selected-section.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down
Loading