Skip to content

Commit 60dd3c0

Browse files
refactor: update existing asset references to new domain (#244)
1 parent f440ece commit 60dd3c0

File tree

7 files changed

+41
-39
lines changed

7 files changed

+41
-39
lines changed

uix-focal-point-input/uix.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
console.log(window.GCUIX);
22
const declaration = {
3-
extensionType: "field",
4-
fieldType: "JSON",
5-
name: "Asset Focal point",
6-
description: "",
7-
features: ["FieldRenderer", "TableRenderer"],
3+
extensionType: 'field',
4+
fieldType: 'JSON',
5+
name: 'Asset Focal point',
6+
description: '',
7+
features: ['FieldRenderer', 'TableRenderer'],
88
};
99

10-
const originalImage = document.getElementById("originalImage");
11-
const preview_1_1 = document.getElementById("preview-1-1");
12-
const preview_1_2 = document.getElementById("preview-1-2");
13-
const preview_2_1 = document.getElementById("preview-2-1");
14-
const coords = document.getElementById("coords");
15-
const expandButton = document.getElementById("expand");
10+
const originalImage = document.getElementById('originalImage');
11+
const preview_1_1 = document.getElementById('preview-1-1');
12+
const preview_1_2 = document.getElementById('preview-1-2');
13+
const preview_2_1 = document.getElementById('preview-2-1');
14+
const coords = document.getElementById('coords');
15+
const expandButton = document.getElementById('expand');
1616
let isExpanded = false;
1717

1818
function updateExpandButton() {
19-
expandButton.innerText = isExpanded ? "Collapse" : "Expand";
19+
expandButton.innerText = isExpanded ? 'Collapse' : 'Expand';
2020
}
2121

22-
document.addEventListener("DOMContentLoaded", () => {
22+
document.addEventListener('DOMContentLoaded', () => {
2323
try {
2424
window.GCUIX.init({
2525
declaration,
@@ -37,7 +37,7 @@ document.addEventListener("DOMContentLoaded", () => {
3737
},
3838
}).then((initialState) => {
3939
const { status, props } = initialState;
40-
if (status === "ok") {
40+
if (status === 'ok') {
4141
const {
4242
value,
4343
onChange,
@@ -51,45 +51,45 @@ document.addEventListener("DOMContentLoaded", () => {
5151
} = props;
5252

5353
if (isTableCell) {
54-
document.body.classList.add("isTableCell");
54+
document.body.classList.add('isTableCell');
5555
return;
5656
}
5757

58-
if (model.apiId !== "Asset") {
58+
if (model.apiId !== 'Asset') {
5959
throw new Error(
60-
"The Focal Point UI extension is meant to be used only on the Asset model",
60+
'The Focal Point UI extension is meant to be used only on the Asset model'
6161
);
6262
}
6363

6464
if (field.isLocalized === false) {
65-
throw new Error("Focal Point field must be localized");
65+
throw new Error('Focal Point field must be localized');
6666
}
6767

68-
expandButton.addEventListener("click", () => {
68+
expandButton.addEventListener('click', () => {
6969
expand(!isExpanded);
7070
if (!isExpanded) {
71-
document.body.classList.add("fullScreen");
71+
document.body.classList.add('fullScreen');
7272
} else {
73-
document.body.classList.remove("fullScreen");
73+
document.body.classList.remove('fullScreen');
7474
}
7575
});
7676

7777
form.subscribeToFieldState(
7878
`localization_${locale}.file`,
7979
({ value }) => {
8080
const currentUrl = value?.handle
81-
? `https://media.graphcms.com/${value.handle}`
82-
: "https://via.placeholder.com/900x675?text=This+is+a+placeholder+image";
81+
? `https://media.graphassets.com/${value.handle}`
82+
: 'https://via.placeholder.com/900x675?text=This+is+a+placeholder+image';
8383

8484
[originalImage, preview_1_1, preview_1_2, preview_2_1].forEach(
8585
(img) => {
86-
if (img.getAttribute("src") !== currentUrl) {
87-
img.setAttribute("src", currentUrl);
86+
if (img.getAttribute('src') !== currentUrl) {
87+
img.setAttribute('src', currentUrl);
8888
}
89-
},
89+
}
9090
);
9191
},
92-
{ value: true },
92+
{ value: true }
9393
);
9494

9595
makeFocalPoint(value || undefined, onChange, isReadOnly);

using-asset-upload/assets.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[
22
{
3-
"url": "https://media.graphcms.com/4XwHOQnTeii4YaCOsexQ"
3+
"url": "https://media.graphassets.com/4XwHOQnTeii4YaCOsexQ"
44
},
55
{
6-
"url": "https://media.graphcms.com/YwaUel0gShOU6zPmP966"
6+
"url": "https://media.graphassets.com/YwaUel0gShOU6zPmP966"
77
},
88
{
9-
"url": "https://media.graphcms.com/fGA5ZflbQQ2Kdsr8waSn"
9+
"url": "https://media.graphassets.com/fGA5ZflbQQ2Kdsr8waSn"
1010
}
1111
]

with-graphql-mesh/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ npm start
2626

2727
<details>
2828
<summary>Example query</summary>
29-
30-
Fetch products from GraphCMS, a cart from CartQL, and recent Space X launches in one request:
29+
30+
Fetch products from GraphCMS, a cart from CartQL, and recent Space X launches in one request:
3131

3232
```graphql
3333
{
@@ -94,7 +94,7 @@ npm start
9494
}
9595
],
9696
"image": {
97-
"url": "https://media.graphcms.com/1bKpf5ihQpyEeRWXn8cg"
97+
"url": "https://media.graphassets.com/1bKpf5ihQpyEeRWXn8cg"
9898
}
9999
},
100100
{
@@ -108,7 +108,7 @@ npm start
108108
}
109109
],
110110
"image": {
111-
"url": "https://media.graphcms.com/hmQEPi4NR4ygnMGvRmFB"
111+
"url": "https://media.graphassets.com/hmQEPi4NR4ygnMGvRmFB"
112112
}
113113
},
114114
{
@@ -122,7 +122,7 @@ npm start
122122
}
123123
],
124124
"image": {
125-
"url": "https://media.graphcms.com/DhwyUSxTTA6q9GjXBLsa"
125+
"url": "https://media.graphassets.com/DhwyUSxTTA6q9GjXBLsa"
126126
}
127127
}
128128
],
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
22
images: {
3-
domains: ['media.graphcms.com'],
3+
domains: ['media.graphassets.com'],
44
},
55
};

with-nextjs-image-loader/pages/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { GraphQLClient, gql } from 'graphql-request';
44
function GraphCMSImageLoader({ src, width }) {
55
const relativeSrc = (src) => src.split('/').pop();
66

7-
return `https://media.graphcms.com/resize=width:${width}/${relativeSrc(src)}`;
7+
return `https://media.graphassets.com/resize=width:${width}/${relativeSrc(
8+
src
9+
)}`;
810
}
911

1012
function IndexPage({ products }) {

with-nextjs-image/next.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
22
images: {
3-
domains: ['media.graphcms.com'],
3+
domains: ['media.graphassets.com'],
44
},
55
};

with-swr/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ NextAuth.js has a [REST API](https://next-auth.js.org/getting-started/rest-api)
1010

1111
[Demo](https://graphcms-with-swr.vercel.app/)
1212

13-
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FGraphCMS%2Fgraphcms-examples%2Ftree%2Fmaster%2Fwith-swr&env=GRAPHCMS_ENDPOINT,GRAPHCMS_TOKEN,NEXTAUTH_URL,NEXTAUTH_SECRET&demo-title=User%20Todo%20App%20Demo&demo-description=A%20todo%20app%20powered%20by%20Next.js%2C%20GraphQL%2C%20and%20useSWR&demo-url=https%3A%2F%2Fgraphcms-with-swr.vercel.app&demo-image=https%3A%2F%2Fmedia.graphcms.com%2FG8ESmbV9RfunqtEXx5hy) [![Clone project](https://graphcms.com/button)](https://app.graphcms.com/clone/0ff23f7a41ce4da69a366ab299cc24d8)
13+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FGraphCMS%2Fgraphcms-examples%2Ftree%2Fmaster%2Fwith-swr&env=GRAPHCMS_ENDPOINT,GRAPHCMS_TOKEN,NEXTAUTH_URL,NEXTAUTH_SECRET&demo-title=User%20Todo%20App%20Demo&demo-description=A%20todo%20app%20powered%20by%20Next.js%2C%20GraphQL%2C%20and%20useSWR&demo-url=https%3A%2F%2Fgraphcms-with-swr.vercel.app&demo-image=https%3A%2F%2Fmedia.graphassets.com%2FG8ESmbV9RfunqtEXx5hy) [![Clone project](https://graphcms.com/button)](https://app.graphcms.com/clone/0ff23f7a41ce4da69a366ab299cc24d8)
1414

1515
## How to Use
1616

0 commit comments

Comments
 (0)