From 232e2571153e96866cbc86e5f3c48448d9f71f11 Mon Sep 17 00:00:00 2001 From: Hugo Vandenbroucke-Menu Date: Tue, 3 Dec 2024 18:55:53 -0500 Subject: [PATCH 1/4] Add expanded rows --- .../table-viewer/table-viewer.component.html | 22 ++++++++++++++++--- .../table-viewer/table-viewer.component.scss | 19 ++++++++++++++++ .../table-viewer/table-viewer.component.ts | 12 +++++++++- 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/app/components/table-viewer/table-viewer.component.html b/src/app/components/table-viewer/table-viewer.component.html index e34fa2a..bf111a8 100644 --- a/src/app/components/table-viewer/table-viewer.component.html +++ b/src/app/components/table-viewer/table-viewer.component.html @@ -20,8 +20,8 @@

settings Aide & Options
- +
+ + + + + - + + diff --git a/src/app/components/table-viewer/table-viewer.component.scss b/src/app/components/table-viewer/table-viewer.component.scss index e4800ea..187e996 100644 --- a/src/app/components/table-viewer/table-viewer.component.scss +++ b/src/app/components/table-viewer/table-viewer.component.scss @@ -148,6 +148,11 @@ tr { background-color: black; } +tr:hover { + background-color: #222222; +} + + .url-icon { color: $old-mauve; } @@ -156,6 +161,20 @@ tr { color: $old-mauve; } +tr.expanded-detail-row { + height: 0; +} + +.expanded-element-detail { + overflow: hidden; + display: flex; +} + +.expanded-element-description { + padding: 16px; + // color: $old-mauve; +} + // End .end-text { diff --git a/src/app/components/table-viewer/table-viewer.component.ts b/src/app/components/table-viewer/table-viewer.component.ts index c5e9716..8df35bd 100644 --- a/src/app/components/table-viewer/table-viewer.component.ts +++ b/src/app/components/table-viewer/table-viewer.component.ts @@ -11,17 +11,27 @@ import { DataManagerService, DataSong } from 'src/app/services/data-manager.serv import { LocalStorageService } from 'src/app/services/local-storage.service'; import { MatDialog } from '@angular/material/dialog'; import { HelpWindowComponent } from '../help-window/help-window.component'; +import { animate, state, style, transition, trigger } from '@angular/animations'; @Component({ selector: 'app-table-viewer', templateUrl: './table-viewer.component.html', - styleUrls: ['./table-viewer.component.scss'] + styleUrls: ['./table-viewer.component.scss'], + animations: [ + trigger('detailExpand', [ + state('collapsed', style({height: '0px', minHeight: '0'})), + state('expanded', style({height: '*'})), + transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')), + ]), + ], }) export class TableViewerComponent implements AfterViewInit { displayedColumns: string[]; dataSource: MatTableDataSource; + expandedElement?: DataSong; + selectedColumns: FormControl; selectedColumnsList: string[]; From 0d509fbbd38927293be1068e952ee77e29878491 Mon Sep 17 00:00:00 2001 From: Hugo Vandenbroucke-Menu Date: Tue, 3 Dec 2024 20:57:32 -0500 Subject: [PATCH 2/4] add song optionnal parameters in expanded row --- .../table-viewer/table-viewer.component.html | 17 ++++++++++------- .../table-viewer/table-viewer.component.scss | 2 +- .../table-viewer/table-viewer.component.ts | 7 +++++++ src/app/constants/local-storage.ts | 2 +- src/app/constants/table.ts | 3 +-- src/app/services/data-manager.service.ts | 2 +- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/app/components/table-viewer/table-viewer.component.html b/src/app/components/table-viewer/table-viewer.component.html index bf111a8..7f2b3e5 100644 --- a/src/app/components/table-viewer/table-viewer.component.html +++ b/src/app/components/table-viewer/table-viewer.component.html @@ -50,12 +50,6 @@

- - - - - @@ -91,7 +85,16 @@

- {{element.title}} + ID : {{element.id}}
+ Titre : {{element.title}}
+ Titre Alternatifs : {{parseSongProperty(element.altTitles)}}
+ Auteur : {{element.author}}
+ Album : {{parseSongProperty(element.album)}}
+ Genres : {{parseSongProperty(element.genres)}}
+ Langues : {{parseSongProperty(element.languages)}}
+ Année de sortie : {{parseSongProperty(element.releaseYear)}}
+ Date d'ajout : {{parseSongProperty(element.addedDate, 10)}}
+ Plateforme : {{platformToString(element.platform)}}
diff --git a/src/app/components/table-viewer/table-viewer.component.scss b/src/app/components/table-viewer/table-viewer.component.scss index 187e996..e377b3b 100644 --- a/src/app/components/table-viewer/table-viewer.component.scss +++ b/src/app/components/table-viewer/table-viewer.component.scss @@ -150,6 +150,7 @@ tr { tr:hover { background-color: #222222; + cursor: pointer; } @@ -172,7 +173,6 @@ tr.expanded-detail-row { .expanded-element-description { padding: 16px; - // color: $old-mauve; } // End diff --git a/src/app/components/table-viewer/table-viewer.component.ts b/src/app/components/table-viewer/table-viewer.component.ts index 8df35bd..d12db27 100644 --- a/src/app/components/table-viewer/table-viewer.component.ts +++ b/src/app/components/table-viewer/table-viewer.component.ts @@ -120,4 +120,11 @@ export class TableViewerComponent implements AfterViewInit { this.dialog.open(HelpWindowComponent); } + parseSongProperty(property: any, length?: number): any | string { + if (property === undefined) return "/"; + if (Array.isArray(property)) return property.join(", "); + if (typeof property === "string" && length) return property.substring(0, length); + return property; + } + } diff --git a/src/app/constants/local-storage.ts b/src/app/constants/local-storage.ts index aff17d1..1903f50 100644 --- a/src/app/constants/local-storage.ts +++ b/src/app/constants/local-storage.ts @@ -1,6 +1,6 @@ import { DEFAULT_COLUMNS_ORDER } from "./table" -export const LOCAL_STORAGE_VERSION = "v3"; +export const LOCAL_STORAGE_VERSION = "v4"; export enum LocalStorageKey { TABLE_COLUMN_ORDER = "mellotron.setting.tableColumnOrder", diff --git a/src/app/constants/table.ts b/src/app/constants/table.ts index 87f174d..0d8ead0 100644 --- a/src/app/constants/table.ts +++ b/src/app/constants/table.ts @@ -8,13 +8,12 @@ export const COLUMN_NAMES_MAP: Record = { user: 'Utilisateur', cstName: 'Constitution', date: 'Date', - platform: 'Plateforme', url: 'URL', }; export const DEFAULT_COLUMNS_ORDER = Object.keys(COLUMN_NAMES_MAP); -export const NON_FILTER_KEYS = ['isWinner', 'platform', 'url']; +export const NON_FILTER_KEYS = ['isWinner', 'url']; export function filterPredicateFunction(currentKeys: string[]) { return (data: DataSong, filter: string): boolean => { diff --git a/src/app/services/data-manager.service.ts b/src/app/services/data-manager.service.ts index d0c4728..3684195 100644 --- a/src/app/services/data-manager.service.ts +++ b/src/app/services/data-manager.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { EMPTY_SONG, Song, SongPlatform } from 'chelys'; +import { EMPTY_SONG, Song } from 'chelys'; import { ALL_CONSTITUTIONS_DATA, DataConstitution } from '../constants/constitutions'; import names from '../../assets/names.json' From 395e0a6d4de2c0896d0486885d9027f46831fe68 Mon Sep 17 00:00:00 2001 From: hvdbm Date: Wed, 4 Dec 2024 02:03:48 +0000 Subject: [PATCH 3/4] Update usernames --- src/assets/names.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/names.json b/src/assets/names.json index d35ac5c..363e3d1 100644 --- a/src/assets/names.json +++ b/src/assets/names.json @@ -1 +1 @@ -{"0xlRv92l2uV5RPBOaehCi08r9fQ2":"Nicky Mammouth","3OvnjaJEQfhz9FfizrSKE9vH23p2":"Le frère de Galadriel","E47Et0CSruO4x705pmp5tldzbK23":"Skully","EzKZMQbdAGYxyNbdLG7clcc8fcP2":"Touillette man","MFyRF6jk8kNxWf9shdHTlkpMmRt1":"Mr Lucky Goes Latin","O2HvFnVl9fVem27XZpSTSbSWsOL2":"I am very Bidon","UbbtyL9L1DfTDRDULtNYb8OvVrg2":"alex","bVuUaytBfDZXxfKFjg5hAzxlmbK2":"Noé Archiviste","gvb2XFss0fQgKOXEuq1eIne4sdI2":"Soda Stream","iImCc2DtcOSmUCEDkpZThfmTTko2":"Skaven Lord","jafbSws5qOMtuM7jj6NWQ2QTEsl2":"MICOLA","k0p39UgcBWQcAA6bV59eWNVRa3U2":"TableauBits","qnQiMpOFk9Y8iA1f5qRt0hIEVe13":"Busa (à la retraite)","v6Zc3x12BsVNJTyk5U00vvqhsmx2":"Poussin","zFJuPem5jXU4eZSvo1de82LlF1W2":"pamplemousse","JvVTL2HLvTcIDlekbIVs0sShzW33":"ilona"} \ No newline at end of file +{"0xlRv92l2uV5RPBOaehCi08r9fQ2":"Nicky","3OvnjaJEQfhz9FfizrSKE9vH23p2":"Le frère de Galadriel","E47Et0CSruO4x705pmp5tldzbK23":"Skully","EzKZMQbdAGYxyNbdLG7clcc8fcP2":"Touillette man","JvVTL2HLvTcIDlekbIVs0sShzW33":"ilona","MFyRF6jk8kNxWf9shdHTlkpMmRt1":"Mr Lucky Goes Latin","O2HvFnVl9fVem27XZpSTSbSWsOL2":"I am very Bidon","UbbtyL9L1DfTDRDULtNYb8OvVrg2":"alex","bVuUaytBfDZXxfKFjg5hAzxlmbK2":"Noé Archiviste","gvb2XFss0fQgKOXEuq1eIne4sdI2":"Soda Stream","iImCc2DtcOSmUCEDkpZThfmTTko2":"Skaven Lord","jafbSws5qOMtuM7jj6NWQ2QTEsl2":"MICOLA","k0p39UgcBWQcAA6bV59eWNVRa3U2":"TableauBits","qnQiMpOFk9Y8iA1f5qRt0hIEVe13":"Busa (à la retraite)","v6Zc3x12BsVNJTyk5U00vvqhsmx2":"Poussin","zFJuPem5jXU4eZSvo1de82LlF1W2":"pamplemousse"} \ No newline at end of file From 179c6e500ade11485d663612b885e1237cf9bf0e Mon Sep 17 00:00:00 2001 From: Hugo Vandenbroucke-Menu Date: Wed, 4 Dec 2024 17:31:18 -0500 Subject: [PATCH 4/4] fix comments --- .../components/table-viewer/table-viewer.component.html | 5 +++-- src/app/components/table-viewer/table-viewer.component.ts | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/components/table-viewer/table-viewer.component.html b/src/app/components/table-viewer/table-viewer.component.html index 7f2b3e5..7159336 100644 --- a/src/app/components/table-viewer/table-viewer.component.html +++ b/src/app/components/table-viewer/table-viewer.component.html @@ -93,8 +93,9 @@

Genres : {{parseSongProperty(element.genres)}}
Langues : {{parseSongProperty(element.languages)}}
Année de sortie : {{parseSongProperty(element.releaseYear)}}
- Date d'ajout : {{parseSongProperty(element.addedDate, 10)}}
- Plateforme : {{platformToString(element.platform)}} + Date d'ajout : {{parseSongProperty(generateDate(element.addedDate))}}
+ Plateforme : {{platformToString(element.platform)}}
+ URL : {{element.url}} diff --git a/src/app/components/table-viewer/table-viewer.component.ts b/src/app/components/table-viewer/table-viewer.component.ts index d12db27..cbd4544 100644 --- a/src/app/components/table-viewer/table-viewer.component.ts +++ b/src/app/components/table-viewer/table-viewer.component.ts @@ -120,11 +120,16 @@ export class TableViewerComponent implements AfterViewInit { this.dialog.open(HelpWindowComponent); } - parseSongProperty(property: any, length?: number): any | string { + parseSongProperty(property: any): any | string { if (property === undefined) return "/"; if (Array.isArray(property)) return property.join(", "); if (typeof property === "string" && length) return property.substring(0, length); + if (property instanceof Date) return property.toLocaleDateString() + ' ' + property.toLocaleTimeString(); return property; } + generateDate(date: string): Date { + return new Date(date); + } + }

@@ -85,8 +85,24 @@

{{row.date}} +
+
+ {{element.title}} +
+
+
{{row.author}} Plateforme {{platformToString(row.platform)}} Constitution