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

Disable tracking by default #107

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading