Improve Author status details in UI

This commit is contained in:
Lasidar
2025-03-28 04:46:55 -04:00
committed by GitHub
parent 6406ed6289
commit 2a3e7f8dae
5 changed files with 40 additions and 11 deletions

View File

@@ -1,5 +1,7 @@
import ModelBase from 'App/ModelBase'; import ModelBase from 'App/ModelBase';
export type AuthorStatus = 'continuing' | 'ended';
interface Author extends ModelBase { interface Author extends ModelBase {
added: string; added: string;
genres: string[]; genres: string[];
@@ -10,6 +12,7 @@ interface Author extends ModelBase {
metadataProfileId: number; metadataProfileId: number;
rootFolderPath: string; rootFolderPath: string;
sortName: string; sortName: string;
status: AuthorStatus;
tags: number[]; tags: number[];
authorName: string; authorName: string;
isSaving?: boolean; isSaving?: boolean;

View File

@@ -0,0 +1,21 @@
import { AuthorStatus } from 'Author/Author';
import { icons } from 'Helpers/Props';
import translate from 'Utilities/String/translate';
export function getAuthorStatusDetails(status: AuthorStatus) {
let statusDetails = {
icon: icons.AUTHOR_CONTINUING,
title: translate('StatusEndedContinuing'),
message: translate('ContinuingMoreBooksAreExpected'),
};
if (status === 'ended') {
statusDetails = {
icon: icons.AUTHOR_ENDED,
title: translate('StatusEndedEnded'),
message: translate('ContinuingNoAdditionalBooksAreExpected'),
};
}
return statusDetails;
}

View File

@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import TextTruncate from 'react-text-truncate'; import TextTruncate from 'react-text-truncate';
import AuthorPoster from 'Author/AuthorPoster'; import AuthorPoster from 'Author/AuthorPoster';
import { getAuthorStatusDetails } from 'Author/AuthorStatus';
import HeartRating from 'Components/HeartRating'; import HeartRating from 'Components/HeartRating';
import Icon from 'Components/Icon'; import Icon from 'Components/Icon';
import Label from 'Components/Label'; import Label from 'Components/Label';
@@ -87,11 +88,11 @@ class AuthorDetailsHeader extends Component {
titleWidth titleWidth
} = this.state; } = this.state;
const statusDetails = getAuthorStatusDetails(status);
const fanartUrl = getFanartUrl(images); const fanartUrl = getFanartUrl(images);
const marqueeWidth = titleWidth - (isSmallScreen ? 85 : 160); const marqueeWidth = titleWidth - (isSmallScreen ? 85 : 160);
const continuing = status === 'continuing';
let bookFilesCountMessage = translate('BookFilesCountMessage'); let bookFilesCountMessage = translate('BookFilesCountMessage');
if (bookFileCount === 1) { if (bookFileCount === 1) {
@@ -236,16 +237,16 @@ class AuthorDetailsHeader extends Component {
<Label <Label
className={styles.detailsLabel} className={styles.detailsLabel}
title={continuing ? translate('ContinuingMoreBooksAreExpected') : translate('ContinuingNoAdditionalBooksAreExpected')} title={statusDetails.message}
size={sizes.LARGE} size={sizes.LARGE}
> >
<Icon <Icon
name={continuing ? icons.AUTHOR_CONTINUING : icons.AUTHOR_ENDED} name={statusDetails.icon}
size={17} size={17}
/> />
<span className={styles.qualityProfileName}> <span className={styles.qualityProfileName}>
{continuing ? 'Continuing' : 'Deceased'} {statusDetails.title}
</span> </span>
</Label> </Label>

View File

@@ -1,5 +1,6 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import { getAuthorStatusDetails } from 'Author/AuthorStatus';
import Icon from 'Components/Icon'; import Icon from 'Components/Icon';
import VirtualTableRowCell from 'Components/Table/Cells/TableRowCell'; import VirtualTableRowCell from 'Components/Table/Cells/TableRowCell';
import { icons } from 'Helpers/Props'; import { icons } from 'Helpers/Props';
@@ -15,6 +16,8 @@ function AuthorStatusCell(props) {
...otherProps ...otherProps
} = props; } = props;
const statusDetails = getAuthorStatusDetails(status);
return ( return (
<Component <Component
className={className} className={className}
@@ -28,8 +31,8 @@ function AuthorStatusCell(props) {
<Icon <Icon
className={styles.statusIcon} className={styles.statusIcon}
name={status === 'ended' ? icons.AUTHOR_ENDED : icons.AUTHOR_CONTINUING} name={statusDetails.icon}
title={status === 'ended' ? translate('StatusEndedDeceased') : translate('StatusEndedContinuing')} title={`${statusDetails.title}: ${statusDetails.message}`}
/> />
</Component> </Component>
); );

View File

@@ -1,12 +1,11 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import AuthorNameLink from 'Author/AuthorNameLink'; import AuthorNameLink from 'Author/AuthorNameLink';
import { getAuthorStatusDetails } from 'Author/AuthorStatus';
import Icon from 'Components/Icon'; import Icon from 'Components/Icon';
import MonitorToggleButton from 'Components/MonitorToggleButton'; import MonitorToggleButton from 'Components/MonitorToggleButton';
import VirtualTableRowCell from 'Components/Table/Cells/VirtualTableRowCell'; import VirtualTableRowCell from 'Components/Table/Cells/VirtualTableRowCell';
import VirtualTableSelectCell from 'Components/Table/Cells/VirtualTableSelectCell'; import VirtualTableSelectCell from 'Components/Table/Cells/VirtualTableSelectCell';
import { icons } from 'Helpers/Props';
import translate from 'Utilities/String/translate';
import BookshelfBook from './BookshelfBook'; import BookshelfBook from './BookshelfBook';
import styles from './BookshelfRow.css'; import styles from './BookshelfRow.css';
@@ -30,6 +29,8 @@ class BookshelfRow extends Component {
onBookMonitoredPress onBookMonitoredPress
} = this.props; } = this.props;
const statusDetails = getAuthorStatusDetails(status);
return ( return (
<> <>
<VirtualTableSelectCell <VirtualTableSelectCell
@@ -52,8 +53,8 @@ class BookshelfRow extends Component {
<VirtualTableRowCell className={styles.status}> <VirtualTableRowCell className={styles.status}>
<Icon <Icon
className={styles.statusIcon} className={styles.statusIcon}
name={status === 'ended' ? icons.AUTHOR_ENDED : icons.AUTHOR_CONTINUING} name={statusDetails.icon}
title={status === 'ended' ? translate('StatusEndedEnded') : translate('StatusEndedContinuing')} title={statusDetails.title}
/> />
</VirtualTableRowCell> </VirtualTableRowCell>