feat(doc-item): Vereinfachung der Darstellung von Änderungsinformationen durch neue Utility-Methode
- Ersetzte die separate Verwendung von `changedWho` und `changedWhen` durch die neue Methode `getChangedInfo()` in der Klasse `Doc`. - Aktualisiertes Symbol für `addedWho` von ‚gridicons:add‘ zu ‚mdi:user‘.
This commit is contained in:
parent
93fec2051b
commit
960c4db1ac
@ -16,6 +16,17 @@ export class Doc {
|
|||||||
changedWhen?: Date;
|
changedWhen?: Date;
|
||||||
changedWho?: string;
|
changedWho?: string;
|
||||||
|
|
||||||
|
getChangedInfo(separator: string = " | "): string | null {
|
||||||
|
const who = this.changedWho?.trim();
|
||||||
|
const when = this.changedWhen?.toLocaleDateString('de-DE');
|
||||||
|
|
||||||
|
if (!who && !when) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [who, when].filter(Boolean).join(separator);
|
||||||
|
}
|
||||||
|
|
||||||
get extension(): string | undefined {
|
get extension(): string | undefined {
|
||||||
const parts = this.name.split('.');
|
const parts = this.name.split('.');
|
||||||
if (parts.length > 1 && parts[parts.length - 1].trim() !== '') {
|
if (parts.length > 1 && parts[parts.length - 1].trim() !== '') {
|
||||||
|
|||||||
@ -77,9 +77,8 @@ export function DocItem({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{[
|
{[
|
||||||
{ data: doc.addedWho, icon: 'gridicons:add' },
|
{ data: doc.addedWho, icon: 'mdi:user' },
|
||||||
{ data: doc.changedWho, icon: 'material-symbols:change-circle-rounded' },
|
{ data: doc.getChangedInfo(', '), icon: 'material-symbols:change-circle-rounded' }
|
||||||
{ data: doc.changedWhen?.toLocaleDateString('de-DE'), icon: 'material-symbols:change-circle-rounded' },
|
|
||||||
].filter(info => info.data).map((info, _index) => (
|
].filter(info => info.data).map((info, _index) => (
|
||||||
<Box
|
<Box
|
||||||
key={_index}
|
key={_index}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user