Skip to content

Commit

Permalink
Merge pull request #181 from FlyingPAD/develop
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
FlyingPAD authored Oct 23, 2024
2 parents 9a639fe + e8348a7 commit d6b78a1
Show file tree
Hide file tree
Showing 149 changed files with 1,150 additions and 335 deletions.
255 changes: 138 additions & 117 deletions front/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,128 +46,149 @@ import { HiddenMenuWithFooterComponent } from './layouts/hidden-menu-with-footer
import { MediumGalleryComponent } from './pages/medium-gallery/medium-gallery.component';
import { MyAccountComponent } from './pages/my-account/my-account.component';
import { SettingsComponent } from './pages/settings/settings.component';
import { StandardLayoutComponent } from './layouts/standard-layout/standard-layout.component';

const routes: Routes =
[
// Layout : Header & Hidden Menu
{ path : '', component : LayoutCustomComponent, children :
[
{ path : '', pathMatch : 'full', redirectTo : 'home'},
{ path : 'home', component : HomeComponent, title : 'Flying PAD | Home' },
{ path : 'not-found', component : NotFoundComponent, title : 'Flying PAD | Not Found' },
{ path : 'login-error', component : UserLoginErrorComponent, title : 'Flying PAD | Login Error' },
{ path : 'register', component : UserRegisterComponent, title : 'Flying PAD | Register' },
{ path : 'medias', component : MediasComponent, title : 'Flying PAD | Medias' },
{ path : 'dashboard', component : DashboardComponent, title : 'Flying PAD | Dashboard' },
]
},
const routes: Routes =
[
// Layout : Header & Hidden Menu
{
path: '', component: LayoutCustomComponent, children:
[
{ path: '', pathMatch: 'full', redirectTo: 'home' },
{ path: 'home', component: HomeComponent, title: 'Flying PAD | Home' },
{ path: 'not-found', component: NotFoundComponent, title: 'Flying PAD | Not Found' },
{ path: 'login-error', component: UserLoginErrorComponent, title: 'Flying PAD | Login Error' },
{ path: 'register', component: UserRegisterComponent, title: 'Flying PAD | Register' },
{ path: 'medias', component: MediasComponent, title: 'Flying PAD | Medias' },
{ path: 'dashboard', component: DashboardComponent, title: 'Flying PAD | Dashboard' },
]
},

// Layout : Header, Hidden Menu & Footer
{ path : '', component : HiddenMenuWithFooterComponent, children :
[
{ path : 'about', component : AboutComponent, title : 'Flying PAD | About' },
{ path : 'medium-gallery', component : MediumGalleryComponent, title : 'Flying PAD | Medium Gallery' },
{ path : 'my-account', component : MyAccountComponent, title : 'Flying PAD | My Account' },
{ path : 'settings', component : SettingsComponent, title : 'Flying PAD | Settings' },
]
{
path: '', component: HiddenMenuWithFooterComponent, children:
[
{ path: 'about', component: AboutComponent, title: 'Flying PAD | About' },
{ path: 'medium-gallery', component: MediumGalleryComponent, title: 'Flying PAD | Medium Gallery' },
{ path: 'my-account', component: MyAccountComponent, title: 'Flying PAD | My Account' },
{ path: 'settings', component: SettingsComponent, title: 'Flying PAD | Settings' }
]
},

// Standard Layout
{
path: '', component: StandardLayoutComponent, children:
[

]
},

// Empty Layout ( for testing purpose )
{
path: '', component: LayoutEmptyComponent, children:
[
{ path: 'flow', component: FlowComponent, title: 'Flying PAD | Flow' },
]
},

// Artists
{
path: 'artists', component: LayoutCustomComponent, children:
[
{ path: 'edition', component: EditArtistsComponent, title: 'Flying PAD | Edit Artists' },
]
},

// Moods
{
path: 'moods', component: LayoutCustomComponent, children:
[
{ path: '', component: MoodsComponent, title: 'Flying PAD | Moods Gallery' },
{ path: 'mood-details', component: MoodDetailsComponent, title: 'Flying PAD | Mood Details' },
{ path: 'multi-tag-artists', component: MultiTagArtistsComponent, title: 'Flying PAD | Multi Tag Artists' },
{ path: 'multi-tag-models', component: MultiTagModelsComponent, title: 'Flying PAD | Multi Tag Models' },
{ path: 'create-mood-image', component: CreateMoodImageComponent, title: 'Flying PAD | Create Mood(s)' },
{ path: 'create-mood-video', component: CreateMoodVideoComponent, title: 'Flying PAD | Create Mood(s)' },
]
},

// Franchises
{
path: 'franchises', component: LayoutCustomComponent, children:
[
{ path: 'edition', component: EditFranchisesComponent, title: 'Flying PAD | Edit Franchises' },
]
},

// Models
{
path: 'models', component: LayoutCustomComponent, children:
[
{ path: 'edition', component: EditModelsComponent, title: 'Flying PAD | Edit Models' }
]
},

// Links
{
path: 'links', component: LayoutCustomComponent, children:
[
{ path: '', component: LinksComponent, title: 'Flying PAD | Links Gallery' },
{ path: 'edition', component: EditLinksComponent, title: 'Flying PAD | Edit Links' },
]
},

// Tags
{
path: 'tags', component: LayoutCustomComponent, children:
[
{ path: '', component: TagsComponent, title: 'Flying PAD | Tags Gallery' },
{ path: 'edition', component: EditTagsComponent, title: 'Flying PAD | Edit Tags' },
]
},

// Scripts
{
path: 'scripts', component: LayoutCustomComponent, children:
[
{ path: '', component: ScriptsComponent, title: 'Flying PAD | Scripts' },
{ path: 'introduction', component: IntroComponent, title: 'Flying PAD | Introduction' },
{ path: 'piano-reference', component: KeyRefComponent, title: 'Flying PAD | Référence' },
{ path: 'notation', component: NotationComponent, title: 'Flying PAD | La Notation Musicale' },
{ path: 'notes-fr', component: NotesComponent, title: 'Flying PAD | Les Notes' },
{ path: 'notes-en', component: NotesTradComponent, title: 'Flying PAD | Notes' },
{ path: 'notes-ex', component: NotesExComponent, title: 'Flying PAD | Notes - Exercises' },
{ path: 'pulsation', component: PulsationComponent, title: 'Flying PAD | La Pulsation' },
{ path: 'metrics-a', component: MetricsAComponent, title: 'Flying PAD | Les Métriques ( 1 )' },
{ path: 'metrics-b', component: MetricsBComponent, title: 'Flying PAD | Les Métriques ( 2 )' },
{ path: 'intervals', component: IntervalsComponent, title: 'Flying PAD | Les Intervalles' },
{ path: 'chords', component: ChordsComponent, title: 'Flying PAD | Les Accords' },
{ path: 'scales', component: ScalesComponent, title: 'Flying PAD | Les Gammes' },
{ path: 'melody', component: MelodyComponent, title: 'Flying PAD | La Mélodie' },
{ path: 'learn-music', component: LearnMusicComponent, title: 'Flying PAD | Apprendre la Musique' },
{ path: 'viewpoint', component: ViewpointComponent, title: 'Flying PAD | Point de Vue' },
]
},

// Tools
{
path: 'tools', component: LayoutCustomComponent, children:
[
{ path: '', component: ToolsComponent, title: 'Flying PAD | Tools' },
]
},

// Users
{
path: 'users', component: LayoutCustomComponent, children:
[
{ path: 'user-details', component: UserDetailsComponent, title: 'Flying PAD | User Details' },
{ path: 'user-update', component: UserUpdateComponent, title: 'Flying PAD | Update User' },
]
},

// Empty Layout ( for testing purpose )
{ path : '', component : LayoutEmptyComponent, children :
[
{ path : 'flow', component : FlowComponent, title : 'Flying PAD | Flow' },
]
},

// Artists
{ path : 'artists', component : LayoutCustomComponent, children :
[
{ path : 'edition', component : EditArtistsComponent, title : 'Flying PAD | Edit Artists' },
]
},

// Moods
{ path : 'moods', component : LayoutCustomComponent, children :
[
{ path : '', component : MoodsComponent, title : 'Flying PAD | Moods Gallery' },
{ path : 'mood-details', component : MoodDetailsComponent, title : 'Flying PAD | Mood Details' },
{ path : 'multi-tag-artists', component : MultiTagArtistsComponent, title : 'Flying PAD | Multi Tag Artists' },
{ path : 'multi-tag-models', component : MultiTagModelsComponent, title : 'Flying PAD | Multi Tag Models' },
{ path : 'create-mood-image', component : CreateMoodImageComponent, title : 'Flying PAD | Create Mood(s)' },
{ path : 'create-mood-video', component : CreateMoodVideoComponent, title : 'Flying PAD | Create Mood(s)' },
]
},

// Franchises
{ path : 'franchises', component : LayoutCustomComponent, children :
[
{ path : 'edition', component : EditFranchisesComponent, title : 'Flying PAD | Edit Franchises' },
]
},

// Models
{ path : 'models', component : LayoutCustomComponent, children :
[
{ path : 'edition', component : EditModelsComponent, title : 'Flying PAD | Edit Models' }
]
},

// Links
{ path : 'links', component : LayoutCustomComponent, children :
[
{ path : '', component : LinksComponent, title : 'Flying PAD | Links Gallery' },
{ path : 'edition', component : EditLinksComponent, title : 'Flying PAD | Edit Links' },
]
},

// Tags
{ path : 'tags', component : LayoutCustomComponent, children :
[
{ path : '', component : TagsComponent, title : 'Flying PAD | Tags Gallery' },
{ path : 'edition', component : EditTagsComponent, title : 'Flying PAD | Edit Tags' },
]
},

// Scripts
{ path : 'scripts', component : LayoutCustomComponent, children :
[
{ path : '', component : ScriptsComponent, title : 'Flying PAD | Scripts' },
{ path : 'introduction', component : IntroComponent, title : 'Flying PAD | Introduction' },
{ path : 'piano-reference', component : KeyRefComponent, title : 'Flying PAD | Référence' },
{ path : 'notation', component : NotationComponent, title : 'Flying PAD | La Notation Musicale' },
{ path : 'notes-fr', component : NotesComponent, title : 'Flying PAD | Les Notes' },
{ path : 'notes-en', component : NotesTradComponent, title : 'Flying PAD | Notes' },
{ path : 'notes-ex', component : NotesExComponent, title : 'Flying PAD | Notes - Exercises' },
{ path : 'pulsation', component : PulsationComponent, title : 'Flying PAD | La Pulsation' },
{ path : 'metrics-a', component : MetricsAComponent, title : 'Flying PAD | Les Métriques ( 1 )' },
{ path : 'metrics-b', component : MetricsBComponent, title : 'Flying PAD | Les Métriques ( 2 )' },
{ path : 'intervals', component : IntervalsComponent, title : 'Flying PAD | Les Intervalles' },
{ path : 'chords', component : ChordsComponent, title : 'Flying PAD | Les Accords' },
{ path : 'scales', component : ScalesComponent, title : 'Flying PAD | Les Gammes' },
{ path : 'melody', component : MelodyComponent, title : 'Flying PAD | La Mélodie' },
{ path : 'learn-music', component : LearnMusicComponent, title : 'Flying PAD | Apprendre la Musique' },
{ path : 'viewpoint', component : ViewpointComponent, title : 'Flying PAD | Point de Vue' },
]
},

// Tools
{ path : 'tools', component : LayoutCustomComponent, children :
[
{ path : '', component : ToolsComponent, title : 'Flying PAD | Tools' },
]
},

// Users
{ path : 'users', component : LayoutCustomComponent, children :
[
{ path : 'user-details', component : UserDetailsComponent, title : 'Flying PAD | User Details' },
{ path : 'user-update', component : UserUpdateComponent, title : 'Flying PAD | Update User' },
]
},

// Or else ...
{ path : '**', redirectTo : 'not-found' },
];
// Or else ...
{ path: '**', redirectTo: 'not-found' },
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
Expand Down
6 changes: 5 additions & 1 deletion front/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<router-outlet />
<router-outlet />

@if(gdprStatus() === undefined) {
<app-gdpr />
}
6 changes: 3 additions & 3 deletions front/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
import { UserService } from './services/user.service';
import { CustomCookieService } from './services/cookie.service';
import { AuthenticationService } from './services/authentication.service';
import { MenuCustomService } from './services/menu-custom.service';
import { CustomCookieService } from './services/system/cookie.service';
import { AuthenticationService } from './services/system/authentication.service';
import { MenuCustomService } from './services/display/menu-custom.service';

// Mock des services utilisés dans AppComponent
class MockUserService {
Expand Down
28 changes: 21 additions & 7 deletions front/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { Component, HostListener, inject, OnInit } from '@angular/core';
import { UserService } from './services/user.service';
import { CustomCookieService } from './services/cookie.service';
import { AuthenticationService } from './services/authentication.service';
import { CustomCookieService } from './services/system/cookie.service';
import { AuthenticationService } from './services/system/authentication.service';
import { Router } from '@angular/router';
import { MenuCustomService } from './services/menu-custom.service';
import { LanguageService } from './services/language.service';
import { DisplayService } from './services/display.service';
import { FullScreenService } from './services/full-screen.service';
import { ThemeService } from './services/theme.service';
import { MenuCustomService } from './services/display/menu-custom.service';
import { LanguageService } from './services/display/language.service';
import { DisplayService } from './services/display/display.service';
import { FullScreenService } from './services/display/full-screen.service';
import { ThemeService } from './services/display/theme.service';
import { GdprService } from './services/system/gdpr.service';
import { RightColumnService } from './services/display/right-column.service';

@Component({
selector: 'app-root',
Expand All @@ -17,14 +19,20 @@ import { ThemeService } from './services/theme.service';
export class AppComponent implements OnInit {
#languageService = inject(LanguageService)
#displayService = inject(DisplayService)
#rightColumnService = inject(RightColumnService)
#fullScreenService = inject(FullScreenService)
#themeService = inject(ThemeService)
#gdprService = inject(GdprService)
#authService = inject(AuthenticationService)
#userService = inject(UserService)
#cookieService = inject(CustomCookieService)
#menuCustomService = inject(MenuCustomService)
router = inject(Router)

gdprStatus = this.#gdprService.currentStatus

displayInfo = this.#displayService.displayInfo

ngOnInit(): void {
let token = this.#cookieService.retrieveToken()

Expand All @@ -35,6 +43,12 @@ export class AppComponent implements OnInit {
else {
this.#userService.setDefaultUser()
}

if(this.displayInfo().mode === 'Desktop') {
this.#rightColumnService.enableRightColumn()
} else {
this.#rightColumnService.disableRightColumn()
}
}

@HostListener('window:keydown', ['$event'])
Expand Down
8 changes: 7 additions & 1 deletion front/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ import { LocalizedDatePipe } from './pipes/localized-date.pipe';
import { GuitarTunerComponent } from './features/tools/guitar-tuner/guitar-tuner.component';
import { ChordWheelComponent } from './features/tools/chord-wheel/chord-wheel.component';
import { BottomBarLargerComponent } from './components/bottom-bar-larger/bottom-bar-larger.component';
import { GdprComponent } from './components/gdpr/gdpr.component';
import { StandardLayoutComponent } from './layouts/standard-layout/standard-layout.component';
import { LeftColumnComponent } from './components/left-column/left-column.component';

export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
Expand Down Expand Up @@ -286,7 +289,10 @@ export function HttpLoaderFactory(http: HttpClient) {
MediaDetailsFlowComponent,
FranchiseDetailsFlowComponent,
LinkCategoryDetailsFlowComponent,
LinkDetailsFlowComponent
LinkDetailsFlowComponent,
GdprComponent,
StandardLayoutComponent,
LeftColumnComponent
],
imports: [
// --- CORE :
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, EventEmitter, inject, Input, Output } from '@angular/core';
import { ImageUrlService } from '../../services/image-url.service';
import { ImageUrlService } from '../../services/display/image-url.service';

@Component({
selector: 'app-bottom-bar-larger',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, EventEmitter, HostListener, inject, Input, Output } from '@angular/core';
import { UserService } from '../../services/user.service';
import { ImageUrlService } from '../../services/image-url.service';
import { ImageUrlService } from '../../services/display/image-url.service';

@Component({
selector: 'app-bottom-bar',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, HostListener, inject } from '@angular/core';
import { ImageUrlService } from '../../services/image-url.service';
import { ImageUrlService } from '../../services/display/image-url.service';

@Component({
selector: 'app-button-top',
Expand Down
Loading

0 comments on commit d6b78a1

Please sign in to comment.