mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-24 21:07:41 +02:00
refactor song path replacement
- path replacement during runtime instead of during API normalization - fix Navidrome API path not appending libraryPath which caused inconsistency between ND and Subsonic paths
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { ItemDetailListCellProps } from './types';
|
||||
import { resolveSongPath } from '/@/renderer/utils/resolve-song-path';
|
||||
|
||||
export const PathColumn = ({ song }: ItemDetailListCellProps) => song.path ?? <> </>;
|
||||
export const PathColumn = ({ song }: ItemDetailListCellProps) =>
|
||||
resolveSongPath(song.path) ?? <> </>;
|
||||
|
||||
@@ -4,15 +4,17 @@ import {
|
||||
ItemTableListInnerColumn,
|
||||
TableColumnTextContainer,
|
||||
} from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
|
||||
import { resolveSongPath } from '/@/renderer/utils/resolve-song-path';
|
||||
|
||||
export const PathColumn = (props: ItemTableListInnerColumn) => {
|
||||
const rowItem = props.getRowItem?.(props.rowIndex) ?? (props.data as any[])[props.rowIndex];
|
||||
const row: string | undefined = (rowItem as any)?.[props.columns[props.columnIndex].id];
|
||||
const resolvedPath = typeof row === 'string' ? resolveSongPath(row) : null;
|
||||
|
||||
if (typeof row === 'string' && row) {
|
||||
if (resolvedPath) {
|
||||
return (
|
||||
<TableColumnTextContainer {...props}>
|
||||
<span>{row}</span>
|
||||
<span>{resolvedPath}</span>
|
||||
</TableColumnTextContainer>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user