Skip to content
Open
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
29 changes: 22 additions & 7 deletions src/components/commons/AudioPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
});

audioInstance.value.addEventListener('pause', () => {
audioInstance.value.currentTime = 0;
progress.value = 0;
play.value = false;
if (animationFrameId) cancelAnimationFrame(animationFrameId);
});
Expand All @@ -85,7 +87,7 @@
</script>

<template>
<!-- Variante bouton circulaire -->
<!-- Circular button variant -->
<div
v-if="variant === 'button'"
class="audio-button-wrapper"
Expand All @@ -94,9 +96,13 @@
<div
class="audio-button"
:style="{
background: `conic-gradient(white ${
background: `
conic-gradient(#efefef ${progress * 360}deg, #afafaf ${
progress * 360
}deg, rgba(255,255,255,0.2) 0deg)`,
}deg)


`,
width: size + 'px',
height: size + 'px',
}"
Expand All @@ -108,24 +114,27 @@
:style="`font-size: ${size}px;`"
></i>
</div>

<div v-if="showCredits" class="tooltip">
<Credits :media="audio" link-color="link-light" />
</div>
</div>

<!-- Variante lecteur standard -->
<!-- Standard player variant -->
<div v-else class="audio-player-wrapper">
<div class="audio-player" data-testid="animal sound">
<button @click="toggleAudio" class="play-button" type="button">
<i :class="play ? 'bi bi-pause-fill' : 'bi bi-play-fill'"></i>
</button>

<div class="progress-bar" @click="seekAudio">
<div
class="progress-fill"
:style="{ width: progress * 100 + '%' }"
></div>
</div>
</div>

<Credits
v-if="showCredits"
class="small"
Expand All @@ -147,19 +156,25 @@
justify-content: center;
border-radius: 50%;
cursor: pointer;
transition: background 0.1s linear;
transition: filter 0.15s linear;
}

.audio-button:hover {
filter: brightness(1.1);
}

.audio-button i {
color: white;
z-index: 2;
text-shadow: 0 0 4px rgba(0, 0, 0, 0.7);
text-shadow: 0px 2px 6px rgba(0, 0, 0, 0.1);
}

/* Tooltip */
.tooltip {
position: absolute;
bottom: 110%;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.8);
color: white;
padding: 0.4rem 0.6rem;
Expand All @@ -176,6 +191,7 @@
opacity: 1;
}

/* Player variant */
.audio-player-wrapper {
margin-top: 0.5rem;
width: 100%;
Expand Down Expand Up @@ -220,7 +236,6 @@
background: #e9ecef;
border-radius: 0.25rem;
overflow: hidden;
position: relative;
cursor: pointer;
}

Expand Down
8 changes: 6 additions & 2 deletions src/components/commons/FullScreenImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,16 @@
/* Transitions for fullscreen */
.fullscreen-enter-active,
.fullscreen-leave-active {
transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
transition:
opacity 0.3s ease,
backdrop-filter 0.3s ease;
}

.fullscreen-enter-active .fullscreenImage,
.fullscreen-leave-active .fullscreenImage {
transition: transform 0.3s ease, opacity 0.3s ease;
transition:
transform 0.3s ease,
opacity 0.3s ease;
}

.fullscreen-enter-from,
Expand Down
13 changes: 1 addition & 12 deletions src/components/core/taxonList/TaxonList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,6 @@
const speciesList = computed(() => searchResult.value.taxons);
const datasets = computed(() => searchResult.value.datasets);

const classNames = computed(() => {
const row_cols_lg = nbTaxonPerLine.value;
const row_cols_md = row_cols_lg === 1 ? 1 : Math.round(row_cols_lg / 2);
const row_cols_sm = Math.round(row_cols_md / 2);
return `row row-cols-${row_cols_sm} row-cols-lg-${row_cols_lg} row-cols-md-${row_cols_md} row-gap-4`;
});

function onScroll(event) {
taxonManager.onScroll(event);
}
Expand Down Expand Up @@ -159,11 +152,7 @@
class="taxon-list-scroll-wrapper"
:class="{ 'pt-0': !filtersOnList }"
>
<div
id="taxon-list-content"
:class="classNames"
@scroll="onScroll"
>
<div id="taxon-list-content" class="row g-3" @scroll="onScroll">
<TaxonListMessages
:loading-error="loadingError"
:loading-observations="loadingObservations"
Expand Down
232 changes: 232 additions & 0 deletions src/components/core/taxonList/TaxonNewDetailed.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
<script setup lang="ts">
import Credits from '@/components/commons/Credits.vue';
import { Media } from '@/lib/models';
import ParameterStore from '@/lib/parameterStore';
import { computed } from 'vue';

const { nbTaxonPerLine } = ParameterStore.getInstance();
const colClasses = computed(() => {
const lg = Math.floor(12 / nbTaxonPerLine.value);
const md = Math.floor(12 / Math.ceil(nbTaxonPerLine.value / 2));

return ['col-12', `col-md-${md}`, `col-lg-${lg}`];
});
const props = defineProps<{
picture: Media;
audio: Media;
vernacularName: string;
acceptedScientificName: string;
urlDetailPage: string;
nbObservations: number;
lastSeenDate: Date;
}>();
</script>
<template>
<div :class="[...colClasses, 'detailed']" data-testid="Taxon detailed view">
<div class="image-container">
<div>
<BPopover :delay="{ show: 0, hide: 0 }" :close-on-hide="true">
<template #target>
<div class="warning-btn">
<i class="bi bi-exclamation-triangle-fill"></i>
</div>
</template>
Danger
</BPopover>
</div>
<FullScreenImage
:media="props.picture"
:alt="props.picture?.urlSource"
>
<img
:src="props.picture?.url"
:alt="props.picture?.urlSource"
/>
</FullScreenImage>
<AudioPlayer
v-if="props.audio?.url"
:audio="props.audio"
variant="button"
:size="45"
class="audio-overlay"
></AudioPlayer>
</div>
<div class="names">
<strong>{{ props.vernacularName }}</strong>
<em>{{ props.acceptedScientificName }}</em>
</div>
<div class="statistics-wrapper">
<div class="statistics">
<span
>Vu dernièrement le
<strong>{{
props.lastSeenDate.toLocaleDateString()
}}</strong></span
>
</div>
<div class="statistics">
<span
>Observé
<strong>{{ props.nbObservations }}</strong> fois</span
>
</div>
</div>
<div class="description">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsam quae
unde magni non, doloremque rem vitae, laudantium repellendus id eius
corporis nesciunt ad dolore? Id nemo qui cum harum adipisci.
</div>
<div class="credits">
<div class="credits-header">
<h5>Credits</h5>
</div>
<div v-if="props.audio" class="subcredits">
<i class="bi bi-music-note-beamed"></i>
<Credits :media="props.audio" link-color="link-dark"></Credits>
</div>
<div v-if="props.picture" class="subcredits">
<i class="bi bi-camera"></i>
<Credits
:media="props.picture"
link-color="link-dark"
></Credits>
</div>
</div>
</div>
</template>
<style scoped>
.detailed {
container-name: detailed;
container-type: inline-size;
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);
display: flex;
justify-content: start;
flex-direction: column;
border-radius: 5px;
}

.image-container {
margin-top: 1em;
position: relative;
display: flex;
justify-content: center;
margin-bottom: 1em;
}

.audio-overlay {
position: absolute;
bottom: 0px;
left: 50%;
transform: translateX(-50%) translateY(50%);
z-index: 2;
}
.warning-btn {
position: absolute;
top: 0px;
left: 50%;
transform: translateX(-50%) translateY(-40%);
z-index: 2;
background-color: #f44336;
color: white;
border: 1px solid #fff;
border-radius: 50%;
width: 30px;
height: 30px;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}

img {
display: flex;
width: 150px;
height: 150px;
aspect-ratio: 1;
object-fit: cover;
border-radius: 50%;
box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.1);
}
.credits {
padding: 1em;
}

.credits-header {
display: flex;
align-items: center;
gap: 0.5em;
color: #666;

i {
font-size: 1.1rem;
}

strong {
font-size: 1.2rem;
font-weight: 600;
}
}

.subcredits {
display: flex;
align-items: center;
gap: 0.5em;
font-size: 0.85rem;
color: #666;
margin-left: 1em;

i {
color: #888;
font-size: 1rem;
}
}
.statistics-wrapper {
display: flex;
flex-direction: row;
justify-content: space-between;
margin-top: 1em;
column-gap: 0.5em;
}
.statistics {
display: flex;
flex-direction: column;
color: #666;
text-align: center;
background-color: rgba(239, 239, 239, 0.5);
padding: 1em;
border-radius: 5px;
strong {
color: #444;
}
width: 50%;
font-size: 0.9rem;
}
.names {
text-align: center;
display: flex;
flex-direction: column;
strong {
font-size: 1.2em;
}
em {
color: #888;
}
}
.description {
padding: 1em;
color: #666;
font-size: 0.8rem;
text-align: center;
border-radius: 5px;
margin-top: 1em;
}
@container detailed (width < 275px) {
.statistics-wrapper {
flex-direction: column;
row-gap: 0.5em;
}
.statistics {
width: 100%;
}
}
</style>
Loading
Loading