Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing slide param names #5

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f971cd7
ignoring typescript
patrickpatrickpatrick Oct 6, 2020
fe78401
ignoring typescript
patrickpatrickpatrick Oct 6, 2020
dd7a3e9
ignoring typescript
patrickpatrickpatrick Oct 6, 2020
9fd1edd
ignoring typescript
patrickpatrickpatrick Oct 6, 2020
3373d59
changing the names of the params in other places that were needed
patrickpatrickpatrick Oct 6, 2020
6674040
updated package.json
patrickpatrickpatrick Oct 6, 2020
5506dfb
revert package.json
patrickpatrickpatrick Oct 6, 2020
34e120a
remove package lock\
patrickpatrickpatrick Oct 6, 2020
77b3252
seeing if this fixes anything...
patrickpatrickpatrick Oct 21, 2020
39562b4
seeing if this fixes it
patrickpatrickpatrick Oct 21, 2020
85a26c2
i do not know how else to get this to work
patrickpatrickpatrick Oct 21, 2020
8e1510a
ok does this work?
patrickpatrickpatrick Oct 21, 2020
a92ee84
changed css behaviour, fixed slides being broken w/ embedded tour
patrickpatrickpatrick Oct 21, 2020
02505e2
latest changes made
patrickpatrickpatrick Oct 21, 2020
4b5db3c
we dont need two full screen buttons in swappable viewer...
patrickpatrickpatrick Oct 21, 2020
537631c
fixed slideshow showing an empty box if no content
patrickpatrickpatrick Oct 23, 2020
c780c87
removing dist
patrickpatrickpatrick Dec 31, 2020
17849e3
remove lib
patrickpatrickpatrick Dec 31, 2020
f49e4ad
revert package
patrickpatrickpatrick Dec 31, 2020
23513a2
Fix build with the latest version of Node 12
pixeltrix Mar 14, 2021
e18116c
Merge pull request #1 from pixeltrix/fix-build-on-node-12
patrickpatrickpatrick Jul 19, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"@fesk/babel-config": "^1.3.0-next.2945936d",
"@fesk/eslint-config-standard": "^1.2.2",
"@fesk/scripts": "1.4.0-pr.b1c982eb",
"@storybook/react": "^5.3.10",
"@storybook/addon-knobs": "^5.2.4",
"@storybook/react": "^5.3.10",
"@types/enzyme": "^3.10.3",
"@types/jest": "^24.0.9",
"@types/react": "^16.9.9",
Expand All @@ -37,14 +37,13 @@
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react-hooks": "^2.1.2",
"jest": "^24.9.0",
"manifesto.js": "^4.0.0",
"react": "16.13.1",
"react-dom": "16.13.1",

"react-swipeable": "^5.5.1",
"react-test-renderer": "^16.10.2",
"sass-loader": "^8.0.0",
"ts-jest": "^24.1.0",
"manifesto.js": "^4.0.0",
"typescript": "^3.6.3"
},
"fesk": {
Expand All @@ -58,16 +57,17 @@
}
},
"peerDependencies": {
"manifesto": ">= 4.1",
"react": ">= 16.8",
"react-dom": ">= 16.8",
"manifesto": ">= 4.1"
"react-dom": ">= 16.8"
},
"dependencies": {
"canvas-panel-beta": "2.0.6",
"@reach/router": "^1.3.3",
"bezier-easing": "^2.1.0",
"canvas-panel-beta": "2.0.6",
"query-string": "^6.11.1",
"react-flip-move": "^3.0.2",
"react-swipeable": "^5.5.1"
"react-swipeable": "^5.5.1",
"style-loader": "^2.0.0"
}
}
30 changes: 15 additions & 15 deletions src/ui-components/CanvasNavigation/CanvasNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ const CanvasNavigation: React.FC<CanvasNavigationProps> = ({
if (addressable) {
const qParam = queryString.parse(window.location.hash);
if (
qParam.id &&
Array.isArray(qParam.id) &&
qParam.slideshow &&
Array.isArray(qParam.slideshow)
Array.isArray(qParam.slideshow) &&
qParam.slide &&
Array.isArray(qParam.slide)
) {
const indexOfQueryId = qParam.id.find(query => parseInt(query) === id);
const indexOfQueryId = qParam.slideshow.find(query => parseInt(query) === id);
if (indexOfQueryId) {
qParam.slideshow[parseInt(indexOfQueryId)] = currentIndex + '';
qParam.slide[parseInt(indexOfQueryId)] = currentIndex + '';
document.location.hash = queryString.stringify(qParam);
}
} else {
if (typeof qParam.id === 'string' && parseInt(qParam.id) !== id) {
if (typeof qParam.slideshow === 'string' && parseInt(qParam.slideshow) !== id) {
document.location.hash =
document.location.hash + `&${buildId(currentIndex)}`;
} else {
Expand All @@ -62,36 +62,36 @@ const CanvasNavigation: React.FC<CanvasNavigationProps> = ({
};

const buildId = (index: number | string) => {
return `id=${id}&slideshow=${index}`;
return `slideshow=${id}&slide=${index}`;
};

const getSlideByID = () => {
const qParam = queryString.parse(window.location.hash);
let slideshow: any;
if (
qParam.id &&
Array.isArray(qParam.id) &&
qParam.slideshow &&
Array.isArray(qParam.slideshow)
Array.isArray(qParam.slideshow) &&
qParam.slide &&
Array.isArray(qParam.slide)
) {
const indexOfQueryId = qParam.id.find(
const indexOfQueryId = qParam.slideshow.find(
(query: string) => parseInt(query) === id
);
if (indexOfQueryId)
slideshow = qParam.slideshow[parseInt(indexOfQueryId)];
slideshow = qParam.slide[parseInt(indexOfQueryId)];
if (!slideshow || slideshow < 0 || slideshow >= canvasList.length)
slideshow = '0';
} else {
slideshow = qParam.slideshow;
slideshow = qParam.slide;
}
if (!slideshow) slideshow = '0';
return parseInt(slideshow);
};

useEffect(() => {
if (addressable && hash) {
if (typeof hash.slideshow === 'string') {
let slideId = hash.slideshow;
if (typeof hash.slide === 'string') {
let slideId = hash.slide;
if (slideId) {
parseInt(slideId);
}
Expand Down
3 changes: 2 additions & 1 deletion src/ui-components/IFrameYouTube/IFrameYouTube.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const IFrameYouTube: React.FC<IFrameYouTubeProps> = ({
onDragStart();
}
};

return (
<div
style={{
Expand All @@ -41,7 +42,7 @@ export const IFrameYouTube: React.FC<IFrameYouTubeProps> = ({
<iframe
width="100%"
height="60%"
src={`${url}`}
src={`http://www.youtube.com/embed/${new URL(url).searchParams.get('v')}`}
frameBorder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
Expand Down
58 changes: 32 additions & 26 deletions src/ui-components/Slide/Slide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const Slide: React.FC<SlideProps> = ({
return (
<div
className={bem.modifiers(
behaviors.reduce((acc: any, next: any) => {
behaviors.filter((b:any) => b !== 'embedded-tour').reduce((acc: any, next: any) => {
acc[next] = true;
return acc;
}, {})
Expand Down Expand Up @@ -103,33 +103,39 @@ const Slide: React.FC<SlideProps> = ({
{(
// @ts-ignore
{ label, body, attributionLabel, attribution }
) =>
mobile ? (
<>
{open ? renderInfoPanel(label, attribution, body) : <></>}
<InfoButton bem={bem} onClick={setOpen} />
</>
) : (
<div
className={bem
.element('overlay')
.modifiers({ isMobile: mobile })}
>
<div className={bem.element('overlay-content')}>
{label ? (
<h3 className={bem.element('title')}>{label}</h3>
) : null}
{body ? <p className={bem.element('text')}>{body}</p> : null}
) => {
return (
mobile ? (
<>
{open ? renderInfoPanel(label, attribution, body) : <></>}
<InfoButton bem={bem} onClick={setOpen} />
</>
) : (
<div
className={bem
.element('overlay')
.modifiers({ isMobile: mobile })}
>
{
(label || body) &&
(<div className={bem.element('overlay-content')}>
{label ? (
<h3 className={bem.element('title')}>{label}</h3>
) : null}
{body ? <p className={bem.element('text')}>{body}</p> : null}
</div>)
}
<div className={bem.element('overlay-floating')}>
<p className={bem.element('required-statement')}>
{attributionLabel}
{attribution}
</p>
</div>
</div>
<div className={bem.element('overlay-floating')}>
<p className={bem.element('required-statement')}>
{attributionLabel}
{attribution}
</p>
</div>
</div>
)
)
}

}}
</CanvasDetail>
)}
</div>
Expand Down
9 changes: 9 additions & 0 deletions src/ui-components/Slideshow/SlideShow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const SlideShow: React.FC<SlideShowProps> = ({
renderPanel,
bem,
}) => {

const [innerWidth, setInnerWidth] = useState(0);
const [qualifiesForMobile, setQualifiesForMobile] = useState(false);
const [isMobileFullScreen, setIsMobileFullScreen] = useState(false);
Expand Down Expand Up @@ -100,13 +101,21 @@ const SlideShow: React.FC<SlideShowProps> = ({
isMobileFullScreen={isMobileFullScreen}
addressable={addressable}
id={id}
// @ts-ignore
manifest={manifest}
// @ts-ignore
previousRange={previousRange}
// @ts-ignore
nextRange={nextRange}
// @ts-ignore
fullscreenProps={fullscreenProps}
// @ts-ignore
exitFullscreen={setIsMobileFullScreen}
// @ts-ignore
canvas={canvas}
// @ts-ignore
manifestUri={manifestUri}
// @ts-ignore
{...rangeProps}
/>
) : (
Expand Down
8 changes: 6 additions & 2 deletions src/ui-components/SwappableViewer/SwappableViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const SwappableViewer: React.FC<SwappableViewerProps> = ({
const describers = getEmbeddedAnnotations(canvas).filter(
(object: any) => object.motivation === 'describing'
);

setEmbeddedTour(
(canvas &&
canvas.__jsonld &&
Expand Down Expand Up @@ -136,17 +137,20 @@ const SwappableViewer: React.FC<SwappableViewerProps> = ({
// }
};

const describers = getEmbeddedAnnotations(canvas).filter(
(object: any) => object.motivation === 'describing'
);

return (
<>
<FullscreenButton {...fullscreenProps} />
<div
className={bem
.element('viewport')
.modifiers({ interactive: isInteractive || !isZoomedOut })}
>
<FullscreenButton {...fullscreenProps} />
{embeddedTour ? (
<>
<FullscreenButton {...fullscreenProps} />
<PatchworkEmbed canvas={canvas} fitContainer={true} {...props} />
</>
) : (
Expand Down
Loading