Import des sources angular à partir de 'headup_app'

This commit is contained in:
Rampeur
2025-08-11 23:26:29 +02:00
parent 7dcb426ef5
commit 0a6cbc0c00
335 changed files with 64362 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
import { DatePipe } from '@angular/common';
import { trigger, state, style, animate, transition } from '@angular/animations';
import { Component, DestroyRef, inject, OnInit } from '@angular/core';
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { MatCardModule } from '@angular/material/card';
import { MatDividerModule } from '@angular/material/divider';
import { Observable, Subscription } from 'rxjs';
import { ListErrorsComponent, } from 'src/app/components/shared';
import { Errors, Jump } from 'src/app/core/models';
import { JumpsService } from 'src/app/core/services';
@Component({
selector: 'app-home',
standalone: true,
imports: [
DatePipe,
MatCardModule, MatDividerModule,
ListErrorsComponent
],
templateUrl: './home.component.html',
styleUrl: './home.component.scss',
animations: [
trigger('flyInOut', [
state('in', style({ transform: 'translateY(0)' })),
transition('void => *', [
style({ transform: 'translateY(-100%)' }),
animate(200)
]),
transition('* => void', [
style({ transform: 'translateY(100%)' }),
animate(200)
])
])
]
})
export class HomeComponent implements OnInit {
private _lastjump: Subscription = new Subscription();
private _lastjump$: Observable<Jump> = new Observable();
public title = 'Home';
public errors: Errors = { errors: {} };
public lastJump: Jump = {} as Jump;
public destroyRef = inject(DestroyRef);
public now = new Date();
public isJumpDay = false;
constructor(
private _jumpsService: JumpsService
) { }
ngOnInit() {
this._lastjump$ = this._jumpsService.getLastJump().pipe(takeUntilDestroyed(this.destroyRef));
this._lastjump = this._lastjump$.subscribe((jump) => {
this.lastJump = jump;
this.isJumpDay = this._isToday(new Date(this.lastJump.date));
});
}
private _isToday(someDate: Date) {
return someDate.getDate() == this.now.getDate() &&
someDate.getMonth() == this.now.getMonth() &&
someDate.getFullYear() == this.now.getFullYear()
}
}