import React from 'react';
import type {Source} from '~/lib/convert-state';
export const SourceLabel: React.FC<{
readonly src: Source;
}> = ({src}) => {
if (src.type === 'file') {
return From file input;
}
const url = new URL(src.url);
const origin = url.origin
.replace(/^https?:\/\//, '')
.replace(/^http:\/\//, '');
return (
From{' '}
{origin}
);
};