bf4b03a4ce
fix replay select styling make meme a link Fix audio references get newest livestream claim in livestreamLink pin crackermilk fix livestream banner placement fix live page fix rebase fix rebase fix error nag fix darkmode blockquote style break word on livestream comment text fix dark mode snack fix live badge fix lint small fixes - word wrap, live badge wip Fix invisible snack in Odysee Light Theme Revert "wip" This reverts commitd17e477fe0
. Revert "small fixes - word wrap, live badge" This reverts commit0e431d4038
. fix blank pinned destiny fix badges and homepage again only get livestreams live for less than a day pinned hammy and olivia multi pin pin destiny updated pinned videos update tagline Update view.jsx pins updated destiny's video updated pinned videos removed destiny, added lie likes music pinned destiny and mason's woodshop removed hammy and olivia unpinned mason's woodshop removed pins added hammy and olivia pinned sam seder unpinned destiny and hammy and olivia Fix merge on ChannelThumbnails - sam seder, + hammy & olivia and passion for food update tagline (#6086) removed everyone, added kona and suba Theme color fixes (odysee) (#6089) * Cherry-pick master's 'base-theme.scss' * Non-functional cleanup (remove dups, re-order, etc.) * Dark: update positive Toast to --color-primary as well. This follows the intention of the refactoring, which I guess was (1) reduce the number of color names (2) reduce the number of customizations needed. The only issue I have with this is that the current Odysee primary color is pink, which can be intepreted as an error. The original (pre-refactoring color was green). For now, I follow the refactoring path. We can tweak this later. * Fix text color inside '--color-card-background-highlighted' Light: use base-theme (it was the same value anyway). Dark: use bright text. * Dark: add some contrast between the components The color for the background, header, card, placeholder, etc. is almost identical -- it looks like there are all in the same component. The almost-invisible border doesn't help. One would have to crank up the monitor's contrast setting to see separation of components. Brighten up the components a bit, somewhat following the same scale as lbry.tv's dark theme. Overall, I still think it's too dark. The Card's background color can still be brightened up further for better contrast, but I try not to make too drastic of a change for now. The original lbry.tv's gray theme is the most pleasant theme I've seen so far, but this is all subjective. changed pins removed kona and suba added destiny changed pins removed destiny pinned sgtducky changed pins removed sgtducky added hammy and olivia added chrissie mayr added the bite shot changed pins removed the bite shot added heads of tech changed pins removed hammy and olivia removed chrissie mayr changed pins removed heads of tech added crackermilk changed pins removed crackermilk added some ordinary gamer added passion for food changed pins removed some ordinary gamers removed passion for food added emmy hucker changed pins added game knights Update view.jsx Force rebuild changed pins removed emmy hucker changed pins removed game knights added crackermilk changed pins removed crackermilk added some ordinary gamer changed pins removed some ordinary gamers added passion for food added green renaissance changed pins removed passion for food removed green renaissance added expand love changed pins removed expand love added dr nora change tagline (#6122) there's so much room for activities comment out music changed pins removed dr nora added kona and suba changed pins removed kona and suba added destiny changed pins removed destiny added crackermilk changed pins removed crackermilk added someordinarygamers change tagline Drake, where's the door hole? changed pins unpinned someordinarygamers pinned kona and suba Add message for mature content changed pin changed pins removed creative model changed pins added bcpov added krish mohan added cigarvixen changed pins removed krish mohan added adrian logan bump fix footer change tagline just like the simulations changed pins removed: bcpov cigarvixen adrian logan added: someordinarygamers quick fix for reposts oops fix channel tabs changed pin removed someordinarygamers added kona and suba changed pins removed kona and suba added dirtyworkz added crackermilk
181 lines
6.3 KiB
JavaScript
181 lines
6.3 KiB
JavaScript
// @flow
|
|
import * as MODALS from 'constants/modal_types';
|
|
import { Lbry, THUMBNAIL_STATUSES } from 'lbry-redux';
|
|
import { DOMAIN } from 'config';
|
|
import * as React from 'react';
|
|
import { FormField } from 'component/common/form';
|
|
import FileSelector from 'component/common/file-selector';
|
|
import Button from 'component/button';
|
|
import ThumbnailMissingImage from './thumbnail-missing.png';
|
|
import ThumbnailBrokenImage from './thumbnail-broken.png';
|
|
|
|
type Props = {
|
|
filePath: ?string,
|
|
fileInfos: { [string]: FileListItem },
|
|
myClaimForUri: ?StreamClaim,
|
|
thumbnail: ?string,
|
|
formDisabled: boolean,
|
|
uploadThumbnailStatus: string,
|
|
thumbnailPath: ?string,
|
|
thumbnailError: ?string,
|
|
openModal: (id: string, {}) => void,
|
|
updatePublishForm: ({}) => void,
|
|
resetThumbnailStatus: () => void,
|
|
};
|
|
|
|
class SelectThumbnail extends React.PureComponent<Props> {
|
|
constructor() {
|
|
super();
|
|
(this: any).handleThumbnailChange = this.handleThumbnailChange.bind(this);
|
|
}
|
|
|
|
handleThumbnailChange(e: SyntheticInputEvent<*>) {
|
|
const { updatePublishForm } = this.props;
|
|
const newThumbnail = e.target.value.replace(' ', '');
|
|
|
|
updatePublishForm({
|
|
thumbnail: newThumbnail,
|
|
thumbnailError: newThumbnail.startsWith('data:image'),
|
|
});
|
|
}
|
|
|
|
render() {
|
|
const {
|
|
filePath,
|
|
fileInfos,
|
|
myClaimForUri,
|
|
thumbnail,
|
|
formDisabled,
|
|
uploadThumbnailStatus: status,
|
|
openModal,
|
|
updatePublishForm,
|
|
thumbnailPath,
|
|
thumbnailError,
|
|
resetThumbnailStatus,
|
|
} = this.props;
|
|
|
|
const accept = '.png, .jpg, .jpeg, .gif';
|
|
|
|
const outpoint = myClaimForUri ? `${myClaimForUri.txid}:${myClaimForUri.nout}` : undefined;
|
|
const fileInfo = outpoint ? fileInfos[outpoint] : undefined;
|
|
const downloadPath = fileInfo ? fileInfo.download_path : undefined;
|
|
|
|
const actualFilePath = filePath || downloadPath;
|
|
let isSupportedVideo = false;
|
|
if (typeof actualFilePath === 'string') {
|
|
isSupportedVideo = Lbry.getMediaType(null, actualFilePath) === 'video';
|
|
} else if (actualFilePath && actualFilePath.type) {
|
|
isSupportedVideo = actualFilePath.type.split('/')[0] === 'video';
|
|
}
|
|
|
|
let thumbnailSrc;
|
|
if (!thumbnail) {
|
|
thumbnailSrc = ThumbnailMissingImage;
|
|
} else if (thumbnailError) {
|
|
thumbnailSrc = ThumbnailBrokenImage;
|
|
} else {
|
|
thumbnailSrc = thumbnail;
|
|
}
|
|
|
|
/*
|
|
Note:
|
|
We are using backgroundImage instead of an <img /> to zoom if the selected thumbnail isn't
|
|
the proper aspect ratio. This is to avoid blackbars on the side of images and inconsistent thumbnails
|
|
We still need to render the image to see if there is an error loading the url
|
|
*/
|
|
|
|
return (
|
|
<div>
|
|
{status === THUMBNAIL_STATUSES.API_DOWN || status === THUMBNAIL_STATUSES.MANUAL ? (
|
|
<div className="column">
|
|
<div className="column__item thumbnail-preview" style={{ backgroundImage: `url(${thumbnailSrc})` }}>
|
|
<img
|
|
style={{ display: 'none' }}
|
|
src={thumbnailSrc}
|
|
alt={__('Thumbnail Preview')}
|
|
onError={(e) => {
|
|
updatePublishForm({ thumbnailError: true });
|
|
}}
|
|
/>
|
|
</div>
|
|
<div className="column__item">
|
|
<FormField
|
|
type="text"
|
|
name="content_thumbnail"
|
|
label="URL"
|
|
placeholder="https://images.fbi.gov/alien"
|
|
value={thumbnail}
|
|
disabled={formDisabled}
|
|
onChange={this.handleThumbnailChange}
|
|
/>
|
|
<div className="card__actions">
|
|
<Button
|
|
button="link"
|
|
label={__('Use thumbnail upload tool')}
|
|
onClick={() => updatePublishForm({ uploadThumbnailStatus: THUMBNAIL_STATUSES.READY })}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
) : (
|
|
<React.Fragment>
|
|
{status === THUMBNAIL_STATUSES.READY && (
|
|
<FileSelector
|
|
currentPath={thumbnailPath}
|
|
label={__('Thumbnail')}
|
|
placeholder={__('Thumbnails that entice a viewer to watch a video work best')}
|
|
accept={accept}
|
|
onFileChosen={(file) => openModal(MODALS.CONFIRM_THUMBNAIL_UPLOAD, { file })}
|
|
/>
|
|
)}
|
|
{status === THUMBNAIL_STATUSES.COMPLETE && thumbnail && (
|
|
<div className="column column--space-between">
|
|
<div
|
|
className="column__item thumbnail-preview"
|
|
// style={{ backgroundImage: `url(${thumbnail})` }}
|
|
>
|
|
{__('This will be visible in a few minutes.')}
|
|
</div>
|
|
<div className="column__item">
|
|
<p>{__('Upload complete.')}</p>
|
|
<div className="section__actions">
|
|
<Button button="link" label={__('New thumbnail')} onClick={resetThumbnailStatus} />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</React.Fragment>
|
|
)}
|
|
{status === THUMBNAIL_STATUSES.READY && (
|
|
<div className="section__actions">
|
|
<Button
|
|
button="link"
|
|
label={__('Enter a thumbnail URL')}
|
|
onClick={() => updatePublishForm({ uploadThumbnailStatus: THUMBNAIL_STATUSES.MANUAL })}
|
|
/>
|
|
{isSupportedVideo && IS_WEB && (
|
|
// Disabled on desktop until this is resolved
|
|
// https://github.com/electron/electron/issues/20750#issuecomment-709505902
|
|
<Button
|
|
button="link"
|
|
label={__('Take a snapshot from your video')}
|
|
onClick={() => openModal(MODALS.AUTO_GENERATE_THUMBNAIL, { filePath: actualFilePath })}
|
|
/>
|
|
)}
|
|
</div>
|
|
)}
|
|
|
|
{status === THUMBNAIL_STATUSES.IN_PROGRESS && <p>{__('Uploading thumbnail')}...</p>}
|
|
{status !== THUMBNAIL_STATUSES.COMPLETE && (
|
|
<p className="help">
|
|
{status === THUMBNAIL_STATUSES.API_DOWN
|
|
? __('Enter a URL for your thumbnail.')
|
|
: __('Upload your thumbnail to %domain%. Recommended size is 16:9.', { domain: DOMAIN })}
|
|
</p>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default SelectThumbnail;
|