import React from 'react'; import URILink from './URILink'; import { I18n } from '../locale'; import { getFromUri, titleCase, uriType, } from '../util/helpers'; export default ({ by, from, className = '', inline, }) => { if (!from) return null; const { uri, name } = from; const type = from?.type || uriType(uri); let link = null; switch (type) { case 'discover': link = ( ); break; case 'browse': let directory = ''; if (uri.indexOf('file://') > -1) { directory = decodeURIComponent(uri.substr(uri.lastIndexOf('/'), uri.length)); } link = ( ); break; case 'search': link = ( ); break; case 'radio': link = ; break; case 'queue-history': link = ; break; default: link = {name || titleCase(type)}; } if (inline) { return (
{link}
); } return (
{link}
); };