Skip to content

Commit

Permalink
Merge pull request #1143 from culturecreates/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
sahalali authored Jun 6, 2024
2 parents 6a3672b + 5b5776e commit d680fba
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ REACT_APP_FEATURE_FLAG_IMAGE_CROP=true
REACT_APP_ENV="production"
REACT_APP_INVITE_URL=" https://cms.footlight.io/join?invitationId="
REACT_APP_ACCEPT_URL=" https://cms.footlight.io/accept?invitationId="
REACT_APP_CALENDAR_WIDGET_BASE_URL="https://s3.ca-central-1.amazonaws.com/cms-widget.footlight.io/index.html"
REACT_APP_CALENDAR_WIDGET_BASE_URL="https://listing-widget.footlight.io"
16 changes: 12 additions & 4 deletions src/components/ImageUpload/ImageUpload.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Outlined from '../Button/Outlined';
import { useTranslation } from 'react-i18next';
import ImageCrop from '../ImageCrop';
import { useOutletContext } from 'react-router-dom';
import { getWidthFromAspectRatio } from '../../utils/getWidthFromAspectRatio';

function ImageUpload(props) {
const {
Expand Down Expand Up @@ -48,6 +49,14 @@ function ImageUpload(props) {
},
});

let aspectRatio;
let width;

if (!isCalendarLogo && currentCalendarData?.imageConfig[0]?.thumbnail?.aspectRatio) {
aspectRatio = currentCalendarData.imageConfig[0]?.large.aspectRatio;
width = getWidthFromAspectRatio(aspectRatio, 48);
}

const normFile = (e) => {
if (Array.isArray(e)) {
return e;
Expand Down Expand Up @@ -139,11 +148,10 @@ function ImageUpload(props) {
<img
className="image-thumbnail"
style={{
aspectRatio: !isCalendarLogo
? currentCalendarData?.imageConfig[0]?.thumbnail?.aspectRatio.replace(/:/g, '/')
: '',
width: width ? `${width}px` : 'auto',
minWidth: width ? `${width}px` : 'none',
}}
src={file?.url ?? file?.thumbUrl}
src={imageUrl || (file?.url ?? file?.thumbUrl)}
/>
<a
className="image-name"
Expand Down
23 changes: 22 additions & 1 deletion src/components/ImageUpload/imageUpload.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,32 @@
gap: 8px;
}

.image-footer .image-contents {
display: flex;
align-items: center;
height: 100%;
width: 85%;
}

.image-footer .image-thumbnail {
width: auto;
min-width: none;
}

.image-footer .image-name {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
display: inline-block;
margin-left: 10px;
}

.image-footer .image-actions {
cursor: pointer;
}
.image-footer .image-name {
white-space: nowrap;
/* white-space: nowrap; */
cursor: pointer;
}
.image-footer .image-thumbnail {
Expand Down
21 changes: 21 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,24 @@ body.inheritCursors * {
justify-content: center;
}
}

@media screen and (max-width: 575px) {
.ant-input,
.ant-input-number,
.ant-select,
.ant-cascader,
.ant-time-picker,
.ant-calendar,
.ant-slider,
.ant-switch,
.ant-radio-button,
.ant-checkbox,
textarea[class^='ant-'],
input[class^='ant-'],
.text-editor .ql-container {
font-size: 16px !important;
}
.ant-form-item-label > label {
font-size: 16px !important;
}
}
4 changes: 2 additions & 2 deletions src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ function CreateNewPlace() {
id: place?.id,
name: place?.name,
image: place?.image,
uri: place?.derivedFrom?.uri,
uri: artsDataLinkChecker(place?.sameAs),
};
});
setSelectedContainsPlaces(
Expand Down Expand Up @@ -1004,7 +1004,7 @@ function CreateNewPlace() {
id: place?.id,
name: place?.name,
image: place?.image,
uri: place?.derivedFrom?.uri,
uri: artsDataLinkChecker(place?.sameAs),
};
});
setSelectedContainsPlaces(
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Dashboard/PlaceReadOnly/PlaceReadOnly.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function PlaceReadOnly() {
id: place?.id,
name: place?.name,
image: place?.image,
uri: place?.derivedFrom?.uri,
uri: artsDataLinkChecker(place?.sameAs),
};
});
setSelectedContainsPlaces(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ const WidgetSettings = () => {
const regexForHexCode = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;

const calendarContentLanguage = currentCalendarData?.contentLanguage;
const { eventDetailsUrlTemplate = '', listEventsUrlTemplate = '' } = currentCalendarData?.widgetSettings || {};
const calendarSlug = currentCalendarData?.slug;
const calendarName = currentCalendarData?.name[user?.interfaceLanguage?.toLowerCase()];
const calendarLogoUri = currentCalendarData?.logo?.original?.uri || '';
Expand Down Expand Up @@ -166,8 +165,6 @@ const WidgetSettings = () => {
urlCopy.searchParams.append('calendar', calendarSlug);
urlCopy.searchParams.append('calendarName', calendarName);
urlCopy.searchParams.append('logo', calendarLogoUri);
urlCopy.searchParams.append('eventUrl', eventDetailsUrlTemplate);
urlCopy.searchParams.append('searchEventsUrl', listEventsUrlTemplate);
urlCopy.searchParams.append('searchEventsFilters', searchEventsFilters);
urlCopy.searchParams.append('locale', locale?.key.toLowerCase());

Expand All @@ -180,8 +177,6 @@ const WidgetSettings = () => {
urlCopyMobile.searchParams.append('calendar', calendarSlug);
urlCopyMobile.searchParams.append('calendarName', calendarName);
urlCopyMobile.searchParams.append('logo', calendarLogoUri);
urlCopyMobile.searchParams.append('eventUrl', eventDetailsUrlTemplate);
urlCopyMobile.searchParams.append('searchEventsUrl', listEventsUrlTemplate);
urlCopyMobile.searchParams.append('searchEventsFilters', searchEventsFilters);
urlCopyMobile.searchParams.append('locale', locale?.key.toLowerCase());
urlCopyMobile.searchParams.append('height', '600');
Expand Down Expand Up @@ -331,8 +326,6 @@ const WidgetSettings = () => {
const limit = form.getFieldValue('limit') ?? 9;
const locale = form.getFieldValue('locale') ?? languageOptions[0].value;

urlCopy.searchParams.append('eventUrl', eventDetailsUrlTemplate);
urlCopy.searchParams.append('searchEventsUrl', listEventsUrlTemplate);
urlCopy.searchParams.append('logo', calendarLogoUri);
urlCopy.searchParams.append('locale', onLanguageSelect(locale)?.key.toLowerCase());
urlCopy.searchParams.append('limit', limit);
Expand All @@ -342,8 +335,6 @@ const WidgetSettings = () => {
urlCopy.searchParams.append('height', height);
setUrl(urlCopy);

urlCopyMobile.searchParams.append('eventUrl', eventDetailsUrlTemplate);
urlCopyMobile.searchParams.append('searchEventsUrl', listEventsUrlTemplate);
urlCopyMobile.searchParams.append('logo', calendarLogoUri);
urlCopyMobile.searchParams.append('locale', onLanguageSelect(locale)?.key.toLowerCase());
urlCopyMobile.searchParams.append('limit', limit);
Expand Down
4 changes: 4 additions & 0 deletions src/utils/getWidthFromAspectRatio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const getWidthFromAspectRatio = (aspectRatio = '1:1', fixedHeight) => {
const [width, height] = aspectRatio.split(':').map(Number);
return (fixedHeight * width) / height;
};

0 comments on commit d680fba

Please sign in to comment.