Skip to content

Commit

Permalink
Merge pull request #803 from factly/fix/redundant-window-vars
Browse files Browse the repository at this point in the history
remove redundant window variable
  • Loading branch information
shreeharsha-factly authored Nov 8, 2022
2 parents 8f0a699 + 0d04cf9 commit a331be7
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 17 deletions.
1 change: 0 additions & 1 deletion studio/public/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ window.REACT_APP_KAVACH_PUBLIC_URL = 'http://127.0.0.1:4455/.factly/kavach/web';
window.REACT_APP_SACH_API_URL = 'https://sach-server.factly.in';
window.REACT_APP_IFRAMELY_URL = 'http://127.0.0.1:4455/.factly/dega/server/meta';
window.REACT_APP_ENABLE_IMGPROXY = true;
window.REACT_APP_IMG_URL_PROP = window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw';
8 changes: 4 additions & 4 deletions studio/src/components/Editor/UppyUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class UppyUploader {
this.nodes.wrapper.children[0].setAttribute('style', `${style.img} ${style[tune]}`);
}
});
this.nodes.wrapper.children[0].src = this.data.url?.[window.REACT_APP_IMG_URL_PROP];
this.nodes.wrapper.children[0].src = this.data.url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw'];
}
return this.nodes.wrapper;
}
Expand Down Expand Up @@ -281,7 +281,7 @@ class UppyUploader {
createDisplayList(data, query, total) {
function handleClick(imageDetails, obj) {
obj.data = imageDetails;
obj.nodes.wrapper.children[0].src = imageDetails.url?.[window.REACT_APP_IMG_URL_PROP];
obj.nodes.wrapper.children[0].src = imageDetails.url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw'];
obj.nodes.wrapper.children[2].style.display = 'none';
obj.nodes.wrapper.children[1].style.display = 'none';
}
Expand All @@ -296,7 +296,7 @@ class UppyUploader {
for (var i = 0; i < data.length; i++) {
(function (obj) {
const image = document.createElement('img');
image.src = data[i].url?.[window.REACT_APP_IMG_URL_PROP];
image.src = data[i].url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw'];
image.height = '154';
image.width = '154';
var imageDetails = data[i];
Expand Down Expand Up @@ -436,7 +436,7 @@ class UppyUploader {
this.data = res.data.nodes[0];
this.nodes.wrapper.children[2].style.display = 'none';
this.nodes.wrapper.children[1].style.display = 'none';
this.nodes.wrapper.children[0].src = this.data.url?.[window.REACT_APP_IMG_URL_PROP];
this.nodes.wrapper.children[0].src = this.data.url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw'];
})
.catch((error) => {
this.api.notifier.show({
Expand Down
2 changes: 1 addition & 1 deletion studio/src/components/GlobalNav/AccountMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const AccountMenu = () => {
{!loading && profile && profile.medium ? (
<Avatar
size="small"
src={profile.medium.url?.[window.REACT_APP_IMG_URL_PROP]}
src={profile.medium.url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw']}
title="Spaces"
style={{ fontSize: '1.25rem' }}
/>
Expand Down
4 changes: 2 additions & 2 deletions studio/src/components/GlobalNav/SpaceSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function SpaceSelector({ collapsed }) {
<img
alt="logo"
className="menu-logo"
src={details[selected]?.fav_icon?.url?.[window.REACT_APP_IMG_URL_PROP] || degaImg}
src={details[selected]?.fav_icon?.url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw'] || degaImg}
/>
) : (
<Select
Expand All @@ -39,7 +39,7 @@ function SpaceSelector({ collapsed }) {
shape="square"
src={
details[space].fav_icon
? details[space].fav_icon.url?.[window.REACT_APP_IMG_URL_PROP]
? details[space].fav_icon.url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw']
: degaImg
}
/>
Expand Down
4 changes: 2 additions & 2 deletions studio/src/components/MediaSelector/MediaList.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function MediaList({ onSelect, selected, onUnselect, profile = false }) {
}}
shape="square"
size={174}
src={item.url?.[window.REACT_APP_IMG_URL_PROP]}
src={item.url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw']}
style={{ opacity: '0.7', padding: '0.5rem', border: '2px solid #1890ff' }}
/>
<CheckCircleTwoTone
Expand All @@ -81,7 +81,7 @@ function MediaList({ onSelect, selected, onUnselect, profile = false }) {
onClick={() => onSelect(item)}
shape="square"
size={174}
src={item.url?.[window.REACT_APP_IMG_URL_PROP]}
src={item.url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw']}
style={{ padding: '0.5rem', border: '2px solid transparent' }}
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion studio/src/components/MediaSelector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function MediaSelector({
>
{medium ? (
<img
src={medium.url?.[window.REACT_APP_IMG_URL_PROP]}
src={medium.url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw']}
alt={medium.alt_text}
width="100%"
/>
Expand Down
4 changes: 2 additions & 2 deletions studio/src/components/PreviewSocialCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const getTwitterContainer = ({ medium, formData, siteAddress }) => {
className="social-twitter-preview-image idiot"
style={{
backgroundImage: `url(${
medium?.url?.[window.REACT_APP_IMG_URL_PROP]
medium?.url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw']
}?gravity:sm/resize:fill:800:418`,
}} // use ImgProxy url
></div>
Expand Down Expand Up @@ -205,7 +205,7 @@ const getFacebookContainer = ({ medium, formData, siteAddress }) => {
className="social-og-preview-image"
style={{
backgroundImage: `url(${
medium?.url?.[window.REACT_APP_IMG_URL_PROP]
medium?.url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw']
}?gravity:sm/resize:fill:1200:627)`,
}}
></div>
Expand Down
2 changes: 1 addition & 1 deletion studio/src/components/Template/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function Template({ format }) {
<img
style={{ cursor: 'pointer' }}
alt="example"
src={item.medium.url?.[window.REACT_APP_IMG_URL_PROP]}
src={item.medium.url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw']}
height="230"
onClick={() => handleAddPost(item)}
/>
Expand Down
2 changes: 1 addition & 1 deletion studio/src/pages/media/EditMedium.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function EditMedium() {
</Col>
<Col span={'12'}>
<img
src={media.url?.[window.REACT_APP_IMG_URL_PROP]}
src={media.url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw']}
alt={'space'}
style={{
maxHeight: '500px',
Expand Down
4 changes: 2 additions & 2 deletions studio/src/pages/media/components/MediumList.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ function MediumList({ data, filters, setFilters }) {
<img
alt="ALT"
src={
item.url?.[window.REACT_APP_IMG_URL_PROP]
item.url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw']
? `${
item.url?.[window.REACT_APP_IMG_URL_PROP]
item.url?.[window.REACT_APP_ENABLE_IMGPROXY ? 'proxy' : 'raw']
}?gravity:sm/resize:fill:220:220`
: ''
}
Expand Down

0 comments on commit a331be7

Please sign in to comment.