Code-split #6228
5 changed files with 20 additions and 12 deletions
|
@ -2,7 +2,7 @@
|
||||||
import type { Node } from 'react';
|
import type { Node } from 'react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReachTooltip from '@reach/tooltip';
|
import ReachTooltip from '@reach/tooltip';
|
||||||
import '@reach/tooltip/styles.css';
|
// import '@reach/tooltip/styles.css'; --> 'scss/third-party.scss'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
label: string | Node,
|
label: string | Node,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import Button from 'component/button';
|
||||||
import * as ICONS from 'constants/icons';
|
import * as ICONS from 'constants/icons';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import videojs from 'video.js/dist/video.min.js';
|
import videojs from 'video.js/dist/video.min.js';
|
||||||
import 'video.js/dist/alt/video-js-cdn.min.css';
|
// import 'video.js/dist/alt/video-js-cdn.min.css'; --> 'scss/third-party.scss'
|
||||||
import eventTracking from 'videojs-event-tracking';
|
import eventTracking from 'videojs-event-tracking';
|
||||||
import * as OVERLAY from './overlays';
|
import * as OVERLAY from './overlays';
|
||||||
import './plugins/videojs-mobile-ui/plugin';
|
import './plugins/videojs-mobile-ui/plugin';
|
||||||
|
|
|
@ -8,7 +8,7 @@ import classnames from 'classnames';
|
||||||
import Icon from 'component/common/icon';
|
import Icon from 'component/common/icon';
|
||||||
import { isURIValid, normalizeURI, parseURI } from 'lbry-redux';
|
import { isURIValid, normalizeURI, parseURI } from 'lbry-redux';
|
||||||
import { Combobox, ComboboxInput, ComboboxPopover, ComboboxList, ComboboxOption } from '@reach/combobox';
|
import { Combobox, ComboboxInput, ComboboxPopover, ComboboxList, ComboboxOption } from '@reach/combobox';
|
||||||
import '@reach/combobox/styles.css';
|
// import '@reach/combobox/styles.css'; --> 'scss/third-party.scss'
|
||||||
import useLighthouse from 'effects/use-lighthouse';
|
import useLighthouse from 'effects/use-lighthouse';
|
||||||
import { Form } from 'component/common/form';
|
import { Form } from 'component/common/form';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
|
21
ui/index.jsx
21
ui/index.jsx
|
@ -37,6 +37,9 @@ import {
|
||||||
import { X_LBRY_AUTH_TOKEN } from 'constants/token';
|
import { X_LBRY_AUTH_TOKEN } from 'constants/token';
|
||||||
import { LBRY_WEB_API, DEFAULT_LANGUAGE, LBRY_API_URL } from 'config';
|
import { LBRY_WEB_API, DEFAULT_LANGUAGE, LBRY_API_URL } from 'config';
|
||||||
|
|
||||||
|
// Import 3rd-party styles before ours for the current way we are code-splitting.
|
||||||
|
import 'scss/third-party.scss';
|
||||||
|
|
||||||
// Import our app styles
|
// Import our app styles
|
||||||
// If a style is not necessary for the initial page load, it should be removed from `all.scss`
|
// If a style is not necessary for the initial page load, it should be removed from `all.scss`
|
||||||
// and loaded dynamically in the component that consumes it
|
// and loaded dynamically in the component that consumes it
|
||||||
|
@ -73,7 +76,7 @@ Lbry.setDaemonConnectionString(proxyURL);
|
||||||
|
|
||||||
Lbry.setOverride(
|
Lbry.setOverride(
|
||||||
'publish',
|
'publish',
|
||||||
params =>
|
(params) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
apiPublishCallViaWeb(
|
apiPublishCallViaWeb(
|
||||||
apiCall,
|
apiCall,
|
||||||
|
@ -117,7 +120,7 @@ doAuthTokenRefresh();
|
||||||
// We keep a local variable for authToken because `ipcRenderer.send` does not
|
// We keep a local variable for authToken because `ipcRenderer.send` does not
|
||||||
// contain a response, so there is no way to know when it's been set
|
// contain a response, so there is no way to know when it's been set
|
||||||
let authToken;
|
let authToken;
|
||||||
Lbryio.setOverride('setAuthToken', authToken => {
|
Lbryio.setOverride('setAuthToken', (authToken) => {
|
||||||
setAuthToken(authToken);
|
setAuthToken(authToken);
|
||||||
return authToken;
|
return authToken;
|
||||||
});
|
});
|
||||||
|
@ -125,7 +128,7 @@ Lbryio.setOverride('setAuthToken', authToken => {
|
||||||
Lbryio.setOverride(
|
Lbryio.setOverride(
|
||||||
'getAuthToken',
|
'getAuthToken',
|
||||||
() =>
|
() =>
|
||||||
new Promise(resolve => {
|
new Promise((resolve) => {
|
||||||
const authTokenToReturn = authToken || getAuthToken();
|
const authTokenToReturn = authToken || getAuthToken();
|
||||||
resolve(authTokenToReturn);
|
resolve(authTokenToReturn);
|
||||||
})
|
})
|
||||||
|
@ -135,7 +138,7 @@ rewards.setCallback('claimFirstRewardSuccess', () => {
|
||||||
app.store.dispatch(doOpenModal(MODALS.FIRST_REWARD));
|
app.store.dispatch(doOpenModal(MODALS.FIRST_REWARD));
|
||||||
});
|
});
|
||||||
|
|
||||||
rewards.setCallback('claimRewardSuccess', reward => {
|
rewards.setCallback('claimRewardSuccess', (reward) => {
|
||||||
if (reward && reward.type === rewards.TYPE_REWARD_CODE) {
|
if (reward && reward.type === rewards.TYPE_REWARD_CODE) {
|
||||||
app.store.dispatch(doHideModal());
|
app.store.dispatch(doHideModal());
|
||||||
}
|
}
|
||||||
|
@ -195,11 +198,11 @@ ipcRenderer.on('devtools-is-opened', () => {
|
||||||
|
|
||||||
// Force exit mode for html5 fullscreen api
|
// Force exit mode for html5 fullscreen api
|
||||||
// See: https://github.com/electron/electron/issues/18188
|
// See: https://github.com/electron/electron/issues/18188
|
||||||
remote.getCurrentWindow().on('leave-full-screen', event => {
|
remote.getCurrentWindow().on('leave-full-screen', (event) => {
|
||||||
document.webkitExitFullscreen();
|
document.webkitExitFullscreen();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('click', event => {
|
document.addEventListener('click', (event) => {
|
||||||
let { target } = event;
|
let { target } = event;
|
||||||
|
|
||||||
while (target && target !== document) {
|
while (target && target !== document) {
|
||||||
|
@ -213,10 +216,10 @@ document.addEventListener('click', event => {
|
||||||
});
|
});
|
||||||
// @endif
|
// @endif
|
||||||
|
|
||||||
document.addEventListener('dragover', event => {
|
document.addEventListener('dragover', (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
document.addEventListener('drop', event => {
|
document.addEventListener('drop', (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -229,7 +232,7 @@ function AppWrapper() {
|
||||||
// @if TARGET='app'
|
// @if TARGET='app'
|
||||||
moment.locale(remote.app.getLocale());
|
moment.locale(remote.app.getLocale());
|
||||||
|
|
||||||
autoUpdater.on('error', error => {
|
autoUpdater.on('error', (error) => {
|
||||||
console.error(error.message); // eslint-disable-line no-console
|
console.error(error.message); // eslint-disable-line no-console
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
5
ui/scss/third-party.scss
Normal file
5
ui/scss/third-party.scss
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
@charset "utf-8";
|
||||||
|
|
||||||
|
@import '~@reach/combobox/styles.css';
|
||||||
|
@import '~@reach/tooltip/styles.css';
|
||||||
|
@import '~video.js/dist/alt/video-js-cdn.min.css';
|
Loading…
Add table
Reference in a new issue