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
2 changes: 1 addition & 1 deletion homepage/src/components/Homepage.astro
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const [lastEdition, ...pastEditions] = allEditions
<T locale={locale} k={`general.${id}.description`} />
</p>

{lastEdition ? <LastEdition edition={lastEdition} locale={locale}/> : <EditionPlaceholder survey={survey} locale={locale}/>}
{lastEdition ? <LastEdition edition={lastEdition} locale={locale} survey={survey}/> : <EditionPlaceholder survey={survey} locale={locale}/>}

<div class="intro">
<T locale={locale} k={`general.${id}.intro`} md={true} />
Expand Down
11 changes: 7 additions & 4 deletions homepage/src/components/SurveyEdition.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import T from '@components/T'
import { statuses } from '@helpers/constants'
import TakeSurvey from '@components/TakeSurvey'
import { getLocaleSubset } from '@helpers/translator'
import { getLocaleSubset, getStringTranslator } from '@helpers/translator'
import { ResultsStatusEnum } from '@devographics/types'

const { survey, edition, locale, isLast } = Astro.props
Expand All @@ -11,6 +11,7 @@ const { background } = colors
const isOpen = status === statuses.open
const isPreview = status === statuses.preview
const mainLink = isOpen || isPreview ? questionsUrl : resultsUrl
const getString = getStringTranslator(locale)

let marker
if (isOpen) {
Expand All @@ -20,6 +21,7 @@ if (isOpen) {
} else if (isLast) {
marker = 'homepage.most_recent_survey'
}

---

<div class:list={['survey-edition', { 'survey-edition-last': isLast }]}>
Expand All @@ -34,7 +36,7 @@ if (isOpen) {

<h4 class="survey-edition-year">{year}</h4>

<a class="image-wrapper" href={mainLink}
<a class="image-wrapper" href={mainLink} aria-hidden="true"
><span class="image-inner" style={`background-image: url(${imageUrl})`}></span>
</a>
</div>
Expand All @@ -50,15 +52,15 @@ if (isOpen) {
) : (
<div class="survey-edition-actions survey-closed button-group">
{questionsUrl && (
<a href={questionsUrl} class="button">
<a href={questionsUrl} class="button" aria-label={`${getString('homepage.preview_questions').t} ${survey.name} ${year}`}>
<T
locale={locale}
k={isPreview ? 'homepage.preview_questions' : 'homepage.view_questions'}
/>
</a>
)}
{resultsUrl && edition.resultsStatus === ResultsStatusEnum.PUBLISHED ? (
<a href={resultsUrl} class="button">
<a href={resultsUrl} class="button" aria-label={`${getString('homepage.view_results').t} ${survey.name} ${year}`}>
<T locale={locale} k="homepage.view_results" />
</a>
) : (
Expand All @@ -68,6 +70,7 @@ if (isOpen) {
)}
</div>
)

}
</div>

Expand Down