Skip to content

Commit

Permalink
fix(client): fix sidebar param
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroppy committed Jan 19, 2021
1 parent 74b6326 commit ffbca40
Show file tree
Hide file tree
Showing 23 changed files with 67 additions and 102 deletions.
23 changes: 4 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,22 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

# [2.0.0-alpha.6](https://github.com/hiroppy/fusuma/compare/v2.0.0-alpha.5...v2.0.0-alpha.6) (2021-01-19)


### Bug Fixes

* **cli:** validate the base path ([4d81a42](https://github.com/hiroppy/fusuma/commit/4d81a42a89f58fe225daebe6be677bcc2be4604f))




- **cli:** validate the base path ([4d81a42](https://github.com/hiroppy/fusuma/commit/4d81a42a89f58fe225daebe6be677bcc2be4604f))

# [2.0.0-alpha.5](https://github.com/hiroppy/fusuma/compare/v2.0.0-alpha.4...v2.0.0-alpha.5) (2021-01-19)


### Features

* **cli:** add basePath option ([1bbee94](https://github.com/hiroppy/fusuma/commit/1bbee94ab9f014df26cf9f4ae0f7f0130a7a5ce9))




- **cli:** add basePath option ([1bbee94](https://github.com/hiroppy/fusuma/commit/1bbee94ab9f014df26cf9f4ae0f7f0130a7a5ce9))

# [2.0.0-alpha.4](https://github.com/hiroppy/fusuma/compare/v2.0.0-alpha.3...v2.0.0-alpha.4) (2021-01-19)


### Bug Fixes

* **build:** modify screenshot logic ([735edfb](https://github.com/hiroppy/fusuma/commit/735edfb1bbb13bdbbda4ddab6e798fbc2a917663))
* some bugs ([3191dcc](https://github.com/hiroppy/fusuma/commit/3191dcc2a8e9c8aab360071d0756ce7141163ee4))




- **build:** modify screenshot logic ([735edfb](https://github.com/hiroppy/fusuma/commit/735edfb1bbb13bdbbda4ddab6e798fbc2a917663))
- some bugs ([3191dcc](https://github.com/hiroppy/fusuma/commit/3191dcc2a8e9c8aab360071d0756ce7141163ee4))

# [1.16.0](https://github.com/hiroppy/fusuma/compare/v1.15.2...v1.16.0) (2020-02-17)

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
"version": "1.1.2",
"private": true,
"description": "easily make slides with markdown",
"workspaces": ["packages/*"],
"workspaces": [
"packages/*"
],
"scripts": {
"test": "jest",
"fmt": "prettier --write **/*.{js,json,css,md}",
"fmt": "prettier --write packages/**/*.{js,json,css,md}",
"precommit": "pretty-quick --staged",
"build:samples": "node scripts/build-samples.js",
"deploy:samples": "npm run build:samples && node scripts/deploy-samples.js",
Expand Down
4 changes: 0 additions & 4 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @fusuma/client





# [1.16.0](https://github.com/hiroppy/fusuma/compare/v1.15.2...v1.16.0) (2020-02-17)

### Features
Expand Down
36 changes: 13 additions & 23 deletions packages/client/src/components/AppContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ export const AppContainer = ({ slides: originalSlides, hash }) => {
AddSidebarComponent(Sidebar);
};

const changeSidebarState = () => {
const isSidebar =
params.get('sidebar') === 'false' || !process.env.SIDEBAR || mode !== 'common' ? false : true;

updateOpenSidebarStatus(false);
updateSidebarStatus(isSidebar);
};

const setContentViewComponent = async () => {
if (mode === 'common') {
AddContentComponent(Base);
Expand Down Expand Up @@ -77,17 +69,17 @@ export const AppContainer = ({ slides: originalSlides, hash }) => {
const [mode, updateMode] = useState(initialMode); // common, view, host
const [slides, updateSlides] = useState(createdProps.slides);
const [contentsList, updateContentsList] = useState(createdProps.contentsList);
const [isSidebar, updateSidebarStatus] = useState(true);
const [isOpenSidebar, updateOpenSidebarStatus] = useState(false);
const [currentIndex, updateCurrentIndex] = useState(index);
const [SidebarComponent, AddSidebarComponent] = useState(null); // for lazyload
const [ContentComponent, AddContentComponent] = useState(mode === 'common' ? Base : undefined);
const [CommentsListComponent, AddCommentsListComponents] = useState(null); // for lazyload

useEffect(() => {
changeSidebarState();
const isSidebar =
params.get('sidebar') === 'false' || !process.env.SIDEBAR || mode !== 'common' ? false : true;

if (!SidebarComponent) {
if (isSidebar && !SidebarComponent) {
setSidebarComponent();
}

Expand Down Expand Up @@ -117,19 +109,17 @@ export const AppContainer = ({ slides: originalSlides, hash }) => {

return (
<>
{isSidebar && (
{SidebarComponent && (
<>
{SidebarComponent && (
<SidebarComponent
goTo={goTo}
isOpen={isOpenSidebar}
terminate={terminate}
contents={contentsList}
onStateChange={onSetSidebarOpen}
currentIndex={currentIndex}
runPresentationMode={onRunPresentationMode}
/>
)}
<SidebarComponent
goTo={goTo}
isOpen={isOpenSidebar}
terminate={terminate}
contents={contentsList}
onStateChange={onSetSidebarOpen}
currentIndex={currentIndex}
runPresentationMode={onRunPresentationMode}
/>
<MdMenu className="btn-sidebar" onClick={() => onSetSidebarOpen({ isOpen: true })} />
</>
)}
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/components/CommentsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '../../assets/style/commentsList.css';
const Ul = posed.ul({});
const Li = posed.li({
enter: { opacity: 1 },
exit: { opacity: 0 }
exit: { opacity: 0 },
});
const rf = new IntlRelativeFormat();
let ws;
Expand All @@ -29,7 +29,7 @@ export const CommentsList = memo(() => {
const convertedComments = fetchedComments.reverse().map((c) => {
return {
...c,
createdAt: rf.format(c.createdAt)
createdAt: rf.format(c.createdAt),
};
});

Expand Down
10 changes: 5 additions & 5 deletions packages/client/src/components/ContentView/Host.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
FaCaretRight,
FaCaretUp,
FaMicrophoneAlt,
FaMicrophoneAltSlash
FaMicrophoneAltSlash,
} from 'react-icons/fa';
import { MdZoomOutMap } from 'react-icons/md';
import { Controller as PresentationController } from '../../presentationMode/Controller'; // common and host
Expand Down Expand Up @@ -80,7 +80,7 @@ const Host = memo(({ slides, currentIndex, terminate, onChangeSlideIndex }) => {
title: `Moved to the ${num + 1} slide from the ${num} slide.`,
Slide: slides[num].slide,
color: '#3498db',
Icon: <FaCaretRight size="22" />
Icon: <FaCaretRight size="22" />,
});
}

Expand All @@ -103,7 +103,7 @@ const Host = memo(({ slides, currentIndex, terminate, onChangeSlideIndex }) => {
title: `Started from the ${currentIndex + 1} slide.`,
Slide: slides[currentIndex].slide,
color: '#6fba1c',
Icon: <FaCaretDown />
Icon: <FaCaretDown />,
});

if (usedAudio) {
Expand All @@ -125,7 +125,7 @@ const Host = memo(({ slides, currentIndex, terminate, onChangeSlideIndex }) => {
event: 'stopped',
title: `Stopped at the ${currentIndex + 1} slide.`,
color: '#e9546b',
Icon: <FaCaretUp />
Icon: <FaCaretUp />,
});

if (usedAudio) {
Expand Down Expand Up @@ -234,7 +234,7 @@ const Host = memo(({ slides, currentIndex, terminate, onChangeSlideIndex }) => {
{slides && (
<pre
dangerouslySetInnerHTML={{
__html: slides[currentIndex].fusumaProps.note
__html: slides[currentIndex].fusumaProps.note,
}}
/>
)}
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/components/ContentView/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const View = memo(({ slides, hash }) => {

return await webrtc.startCapturing({
video: {
displaySurface: 'monitor'
}
displaySurface: 'monitor',
},
});
} else {
throw new Error('Capturing has already run.');
Expand Down
6 changes: 3 additions & 3 deletions packages/client/src/components/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { MdFirstPage, MdLastPage, MdFullscreen, MdAirplay } from 'react-icons/md
const styles = {
sidebar: {
minWidth: 150,
zIndex: 1001
zIndex: 1001,
},
overlay: {
backgroundColor: 'rgba(0, 0, 0, .5)',
zIndex: 1000
}
zIndex: 1000,
},
};

const url = process.env.URL || window.location.href.split('#')[0];
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/presentationMode/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class Controller {
changePage(pageNum) {
const data = JSON.stringify({
date: Date.now(),
page: pageNum
page: pageNum,
});

if (this.apiType === 'presentation' && this.presentationConnection) {
Expand Down
8 changes: 4 additions & 4 deletions packages/client/src/setup/Mermaid.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import mermaid from 'mermaid';
export class Mermaid {
constructor() {
mermaid.initialize({
startOnLoad: false
startOnLoad: false,
});
}

Expand All @@ -20,7 +20,7 @@ export class Mermaid {
background: `url(${encodedString})`,
backgroundRepeat: 'no-repeat',
backgroundPosition: 'center',
margin: '0 auto'
margin: '0 auto',
});
}

Expand All @@ -29,7 +29,7 @@ export class Mermaid {

elms.forEach((elm) => {
Object.assign(elm.style, {
visibility: 'initial'
visibility: 'initial',
});

mermaid.init();
Expand Down Expand Up @@ -59,7 +59,7 @@ export class Mermaid {

mermaid.init();
Object.assign(elm.style, {
visibility: 'initial'
visibility: 'initial',
});

// this.encode(elm);
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/setup/webSlides.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export function setup({ showIndex = process.env.SHOW_INDEX }) {
const ws = new window.WebSlides({
loop: process.env.LOOP,
showIndex,
navigateOnScroll: false
navigateOnScroll: false,
});

return ws;
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/utils/createSlidesProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function createSlidesProps(slides, currentIndex) {
if (sectionTitle) {
acc.push({
title: sectionTitle,
index: i + 1
index: i + 1,
});
}
return acc;
Expand All @@ -25,7 +25,7 @@ export function createSlidesProps(slides, currentIndex) {

return {
slide: props.contents ? ToC({ list: res.contentsList }) : slide,
fusumaProps: props
fusumaProps: props,
};
});

Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/utils/fetchSlides.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function fetchSlides(dir) {
slides: context
.keys()
.sort()
.map((e) => context(e))
.map((e) => context(e)),
};
}

Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/utils/webrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class WebRTC {
this.finishedProcess = true;
this.url = URL.createObjectURL(
new Blob(recordedChunks, {
type: 'audio/webm'
type: 'audio/webm',
})
);
});
Expand Down
7 changes: 1 addition & 6 deletions packages/fusuma/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

# [2.0.0-alpha.6](https://github.com/hiroppy/fusuma/compare/v2.0.0-alpha.5...v2.0.0-alpha.6) (2021-01-19)


### Bug Fixes

* **cli:** validate the base path ([4d81a42](https://github.com/hiroppy/fusuma/commit/4d81a42a89f58fe225daebe6be677bcc2be4604f))




- **cli:** validate the base path ([4d81a42](https://github.com/hiroppy/fusuma/commit/4d81a42a89f58fe225daebe6be677bcc2be4604f))

# [2.0.0-alpha.5](https://github.com/hiroppy/fusuma/compare/v2.0.0-alpha.4...v2.0.0-alpha.5) (2021-01-19)

Expand Down
2 changes: 1 addition & 1 deletion packages/fusuma/src/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async function createOgImage(outputDirPath) {
height: 630,
});
const app = await fileServer(outputDirPath, port);
await page.goto(`http://localhost:${port}`, {
await page.goto(`http://localhost:${port}?sidebar=false`, {
waitUntil: ['load', 'networkidle2'],
});
await page.screenshot({ path: outputFilePath });
Expand Down
2 changes: 1 addition & 1 deletion packages/mdx-loader/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function mdxLoader(src) {
? [emoji, require('remark-math'), require('remark-html-katex') /* avoid warnings */, mdxPlugin]
: [emoji, mdxPlugin];
const result = mdx.sync(src, {
remarkPlugins
remarkPlugins,
});

cb(null, result);
Expand Down
Loading

0 comments on commit ffbca40

Please sign in to comment.