Skip to content

Commit

Permalink
fix: fixed build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Matteo Biasi committed Mar 15, 2023
1 parent 8bbe898 commit ab059b8
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 28 deletions.
11 changes: 10 additions & 1 deletion databrowser/src/components/map/MapBase.vue
Expand Up @@ -40,10 +40,19 @@ import 'vue3-openlayers/dist/vue3-openlayers.css';
// Add OpenLayers Map
getCurrentInstance()?.appContext.app.use(OpenLayersMap);
interface Marker {
position: Position;
}
interface Position {
lat: number;
lng: number;
}
withDefaults(
defineProps<{
center?: Array<number>;
markers: Array<number>;
markers: Array<Marker>;
projection?: string;
zoom?: number;
rotation?: number;
Expand Down
Expand Up @@ -84,9 +84,9 @@ import QuickViewCardOverviewContentText from './QuickViewCardOverviewContentText
import TagCustom from '../tag/TagCustom.vue';
interface Section {
icon: string;
icon?: string;
content: Array<any>;
fullwidthContent: Array<any>;
fullwidthContent?: Array<any>;
}
withDefaults(
Expand Down
28 changes: 18 additions & 10 deletions databrowser/src/components/quickview/QuickViewOpeningHoursView.vue
Expand Up @@ -30,6 +30,7 @@ interface ScheduleTime {
interface ScheduleData {
OperationScheduleTime: Array<ScheduleTime>;
OperationscheduleName: Record<string, unknown>;
Start: string;
Stop: string;
}
Expand All @@ -43,19 +44,23 @@ const props = withDefaults(
}
);
const getTimeValue = (schedule: ScheduleTime, key: keyof ScheduleTime) => {
return schedule[key];
};
const operationSchedule = computed(() => {
let foundHours = false;
const timing = props.scheduleData ? [...props.scheduleData] : [];
const days = [
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
'Sunday',
'Monday' as keyof ScheduleTime,
'Tuesday' as keyof ScheduleTime,
'Wednesday' as keyof ScheduleTime,
'Thursday' as keyof ScheduleTime,
'Friday' as keyof ScheduleTime,
'Saturday' as keyof ScheduleTime,
'Sunday' as keyof ScheduleTime,
];
const parsedData = [];
Expand All @@ -74,12 +79,12 @@ const operationSchedule = computed(() => {
State: schedule.State,
Timecode: schedule.Timecode,
Day: d.slice(0, 3).toUpperCase(),
Open: schedule[d],
Open: getTimeValue(schedule, d),
});
}
operationScheduleTime.push(daysHours);
}
time.OperationScheduleTime = operationScheduleTime;
time.OperationScheduleTime = operationScheduleTime[0];
parsedData.push({
...time,
OperationScheduleTime: operationScheduleTime,
Expand All @@ -103,7 +108,10 @@ const operationScheduleSections = computed(() => {
content: [
{
title: getTextValue(
getValueOfLocale(currentLocale, schedule.OperationscheduleName)
getValueOfLocale(
'currentLocale',
schedule.OperationscheduleName
) as string
),
text: schedule.TimePeriodRange,
},
Expand Down
Expand Up @@ -38,7 +38,6 @@ const recordInformationSections = computed(() => {
const isSourceActive = props.active;
const isODHActive = props.odhActive;
// FIXME: change based on dataset
const isSuedtirolInfoActive = false;
return [
{
Expand Down Expand Up @@ -76,7 +75,7 @@ const recordInformationSections = computed(() => {
];
});
const getTagActiveInfoObject = ({ active }) => {
const getTagActiveInfoObject = ({ active }: { active: boolean }) => {
return {
size: 'md',
type: active ? 'blue' : 'red',
Expand Down
48 changes: 35 additions & 13 deletions databrowser/src/domain/datasets/quickView/QuickView.vue
Expand Up @@ -25,7 +25,7 @@
>
<img
:src="mainImage.url"
:alt="mainImage.desc"
:alt="mainImage.desc as string || ''"
class="w-full"
@error="onMainImageError"
/>
Expand Down Expand Up @@ -86,6 +86,11 @@ import { getValueOfLocale } from '../../../components/quickview/QuickViewUtils';
import ComponentRenderer from '../../../components/componentRenderer/ComponentRenderer.vue';
import { usePropertyMapping } from '../../api';
interface GalleryImage {
ImageUrl: string;
ImageDesc: Record<string, unknown>;
}
const { isError, isSuccess, error, data } = useApiReadForCurrentDataset();
const forcePlaceholderImage = ref(false);
Expand All @@ -96,15 +101,28 @@ const currentLocale = locale.value;
const { mapWithIndex } = usePropertyMapping();
const title = computed(() => {
return getValueOfLocale(currentLocale, data.value.Detail)?.Title || '/';
return (
(
getValueOfLocale(
currentLocale,
(data.value as Record<string, unknown>).Detail as Record<
string,
unknown
>
) as Record<string, unknown>
)?.Title || '/'
);
});
const id = computed(() => {
return data.value.Id;
return (data.value as Record<string, unknown>).Id;
});
const hasImage = computed(() => {
return imageGallery.value?.ImageUrl?.length > 0;
return (
imageGallery.value?.length > 0 &&
imageGallery.value?.[0].ImageUrl?.length > 0
);
});
const mainImage = computed(() => {
Expand All @@ -119,21 +137,25 @@ const mainImage = computed(() => {
url: firstImage.ImageUrl,
desc: getValueOfLocale(currentLocale, firstImage.ImageDesc),
}
: {
url: 'https://via.placeholder.com/700x350?text=Missing+image', // NOTE: this is a demo image to preview the gallery functionality on datasets without a gallery. It should be removed for the final release.
desc: 'Placeholder image',
};
: null;
});
const imageGallery = computed(() => {
return (
data.value[odhActivityPoiConfig.views?.quick?.topGallery?.fields.gallery] ||
[]
);
return ((data.value as Record<string, unknown>)[
odhActivityPoiConfig.views?.quick?.topGallery?.fields.gallery as string
] || []) as GalleryImage[];
});
const logoUrl = computed(() => {
return getValueOfLocale(currentLocale, data.value.ContactInfos)?.LogoUrl;
return (
getValueOfLocale(
currentLocale,
(data.value as Record<string, unknown>).ContactInfos as Record<
string,
unknown
>
) as Record<string, unknown>
)?.LogoUrl;
});
const onMainImageError = () => {
Expand Down

0 comments on commit ab059b8

Please sign in to comment.