Skip to content

Commit

Permalink
Disable tracking by default
Browse files Browse the repository at this point in the history
  • Loading branch information
sistrall committed Dec 12, 2024
1 parent 1dead25 commit 4d56809
Show file tree
Hide file tree
Showing 6 changed files with 205 additions and 160 deletions.
1 change: 1 addition & 0 deletions docs/video-player.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ DatoCMS GraphQL API.
Compared to the `<MuxPlayer />`, **some prop default values are different** on `<VideoPlayer />`

- `disableCookies` is normally true, unless you explicitly set the prop to `false`
- `disableTracking` is normally true, unless you explicitly set it to `false`
- `preload` defaults to `metadata`, for an optimal UX experience together with saved bandwidth
- the video height and width, when available in the `data` props, are used to set `{ aspectRatio: "[width] / [height]"}` for the `<MuxPlayer />`'s `style`

Expand Down
142 changes: 83 additions & 59 deletions examples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 20 additions & 16 deletions examples/src/QuerySubscriptionExample/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import {
StructuredText,
renderMetaTags,
useQuerySubscription,
} from 'react-datocms';
import { Helmet } from 'react-helmet';
import './style.css';
} from "react-datocms";
import { Helmet } from "react-helmet";
import "./style.css";

const RESPONSIVE_IMAGE_FRAGMENT = `
aspectRatio
Expand Down Expand Up @@ -66,22 +66,22 @@ export default function QuerySubscriptionExample() {
const { status, error, data } = useQuerySubscription({
query,
variables: { first: 4 },
token: 'faeb9172e232a75339242faafb9e56de8c8f13b735f7090964',
token: "faeb9172e232a75339242faafb9e56de8c8f13b735f7090964",
});

const metaTags = data ? [...data.page.seo, ...data.site.favicon] : [];

const statusMessage = {
connecting: 'Connecting to DatoCMS...',
connected: 'Connected to DatoCMS, receiving live updates!',
closed: 'Connection closed',
connecting: "Connecting to DatoCMS...",
connected: "Connected to DatoCMS, receiving live updates!",
closed: "Connection closed",
};

return (
<div className="example" data-title="Full-blown example">
<Helmet>{renderMetaTags(metaTags)}</Helmet>
<div className="status">
{status === 'connected' && <div className="connected-badge" />}
{status === "connected" && <div className="connected-badge" />}
{statusMessage[status]}
</div>
{error && (
Expand All @@ -96,10 +96,12 @@ export default function QuerySubscriptionExample() {
<div className="blogPosts">
{data?.blogPosts.map((blogPost) => (
<article key={blogPost.id} className="blogPost">
<Image
className="blogPost-image"
data={blogPost.coverImage.responsiveImage}
/>
{blogPost.coverImage?.responsiveImage && (
<Image
className="blogPost-image"
data={blogPost.coverImage.responsiveImage}
/>
)}
<div className="blogPost-content">
<h6 className="blogPost-title">
<a
Expand All @@ -114,10 +116,12 @@ export default function QuerySubscriptionExample() {
<StructuredText data={blogPost.excerpt} />
</div>
<footer className="blogPost-author">
<Image
className="blogPost-author-image"
data={blogPost.author.avatar.responsiveImage}
/>
{blogPost.author?.avatar?.responsiveImage && (
<Image
className="blogPost-author-image"
data={blogPost.author.avatar.responsiveImage}
/>
)}
Written by {blogPost.author.name}
</footer>
</div>
Expand Down
Loading

0 comments on commit 4d56809

Please sign in to comment.