diff --git a/packages/client/assets/style/host.css b/packages/client/assets/style/host.css index 3d3039e93..64d634437 100644 --- a/packages/client/assets/style/host.css +++ b/packages/client/assets/style/host.css @@ -5,6 +5,7 @@ display: grid; padding: 0 20px; height: 100vh; + min-width: 720px; grid-template-rows: 1fr 50px; grid-template-columns: 1fr 480px; grid-template-areas: @@ -21,6 +22,7 @@ grid-area: left; margin: 20px 0; color: var(--color-white); + width: calc(100vw - 480px - 20px * 2); & > .host-note { & pre { diff --git a/packages/client/src/components/AppContainer.js b/packages/client/src/components/AppContainer.js index 0384b7806..8584642b8 100644 --- a/packages/client/src/components/AppContainer.js +++ b/packages/client/src/components/AppContainer.js @@ -26,6 +26,7 @@ export class AppContainer extends React.Component { this.params = parsedUrl.searchParams; this.ContentComponent = null; + this.isLive = this.params.get('isLive'); this.routeMode(); } @@ -118,8 +119,8 @@ export class AppContainer extends React.Component { } if (this.mode === 'host') { - this.setState({ opened: false }); - } else if (process.env.IS_LIVE) { + this.setState({ opened: false, CommentsListComponent: null }); + } else if (process.env.IS_LIVE && this.isLive !== 'false') { this.setupLive(); } } diff --git a/packages/client/src/components/CommentsList.js b/packages/client/src/components/CommentsList.js index fa15fba30..f645ef817 100644 --- a/packages/client/src/components/CommentsList.js +++ b/packages/client/src/components/CommentsList.js @@ -26,8 +26,6 @@ export class CommentsList extends React.Component { this.ws.onmessage = ({ data }) => { const comments = JSON.parse(data); - console.log(comments); - if (Array.isArray(comments) && comments.length !== 0) { if (comments[0].message === 'Rate limit exceeded') { // TODO: implement diff --git a/packages/client/src/components/ContentView/Host.js b/packages/client/src/components/ContentView/Host.js index 0a851086d..0502c0474 100644 --- a/packages/client/src/components/ContentView/Host.js +++ b/packages/client/src/components/ContentView/Host.js @@ -78,7 +78,7 @@ export default class Host extends React.PureComponent { const { origin, pathname } = new URL(window.location); this.slides = props.slides; // TODO: separate from current reference - this.slideUrl = `${origin}/${pathname}?sidebar=false#slide=`; + this.slideUrl = `${origin}/${pathname}?sidebar=false&isLive=false#slide=`; this.presentationController = new PresentationController(); this.presentationApiId = null; diff --git a/packages/fusuma/src/tasks.js b/packages/fusuma/src/tasks.js index 46cb06350..f539fadf2 100644 --- a/packages/fusuma/src/tasks.js +++ b/packages/fusuma/src/tasks.js @@ -72,10 +72,7 @@ async function pdfProcess(basePath, { input: i, output: o }) { const spinner = loader('Exporting as PDF...').start(); try { - const pack = '@fusuma/task-pdf'; - // for debug - // const pack = join(__dirname, '../../task-pdf'); - + const pack = process.env.FUSUMA_DEBUG ? join(__dirname, '../../task-pdf') : '@fusuma/task-pdf'; const pdf = await lazyloadModule(pack, (type) => { if (type === 'fallback') { spinner.color = 'yellow'; @@ -93,12 +90,6 @@ async function pdfProcess(basePath, { input: i, output: o }) { } async function live(basePath, { keyword, internal, port, dir }) { - if (!keyword) { - console.warn( - 'Twitter mode is disabled. If you want to enable, you must specify an searched keyword' - ); - } - await buildProcess(basePath, { server: { port, @@ -110,10 +101,9 @@ async function live(basePath, { keyword, internal, port, dir }) { const spinner = loader('Setup live mode...').start(); try { - const pack = '@fusuma/task-live'; - // for debug - // const pack = join(__dirname, '../../task-live'); - + const pack = process.env.FUSUMA_DEBUG + ? join(__dirname, '../../task-live') + : '@fusuma/task-live'; const liveServer = await lazyloadModule(pack, (type) => { if (type === 'fallback') { spinner.color = 'yellow'; diff --git a/packages/task-live/src/index.js b/packages/task-live/src/index.js index 084d9ca03..f8f2b28fa 100644 --- a/packages/task-live/src/index.js +++ b/packages/task-live/src/index.js @@ -38,6 +38,10 @@ function setupServer({ port = 3000, keyword, interval = 6000, dir = 'dist' }) { console.info('Twitter mode is enabled.'); } + } else { + console.warn( + 'Twitter mode is disabled. If you want to enable, you must specify an searched keyword' + ); } const app = express(); diff --git a/samples/intro/package.json b/samples/intro/package.json index a4352c6dc..63d5ccdc6 100644 --- a/samples/intro/package.json +++ b/samples/intro/package.json @@ -6,9 +6,9 @@ "scripts": { "start": "node ../../packages/fusuma/src/cli.js start", "build": "node ../../packages/fusuma/src/cli.js build", - "pdf": "node ../../packages/fusuma/src/cli.js pdf", - "live": "node ../../packages/fusuma/src/cli.js live -w '#javascript'", - "live:local": "node ../../packages/fusuma/src/cli.js live" + "pdf": "FUSUMA_DEBUG=true node ../../packages/fusuma/src/cli.js pdf", + "live": "FUSUMA_DEBUG=true node ../../packages/fusuma/src/cli.js live -w '#javascript'", + "live:local": "FUSUMA_DEBUG=true node ../../packages/fusuma/src/cli.js live" }, "author": "hiroppy (https://hiroppy.me)", "license": "MIT",