summaryrefslogtreecommitdiff
path: root/src/components/Scotsoun.astro
blob: 594b8c90ae5a5403d7020590b90bfb438fbe03f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
import translate from '$i18n/translate';
import tSite from '$i18n/translations/site';
import tComponent from '$i18n/translations/components/scotsoun';
import type Scotsoun from '$types/Scotsoun';
import PayPalButtons from './PayPalButtons.astro';
import relativePath from '$lib/relativePath';
import { getLocaleFromPathOrThrow } from '$lib/getLocaleFromPath';

interface Props {
  scotsoun: Scotsoun;
}

const { scotsoun } = Astro.props;
const locale = getLocaleFromPathOrThrow(Astro.url.pathname);
const t = translate(locale);
---

<section class="section--full-width">
  <div class="product__header-block">
    <header>
      <h1>{scotsoun.title}</h1>
      <p class="italic">Scotsoun SSCD{scotsoun.scotsounId}</p>
      {scotsoun?.subtitle && <p class="italic">{scotsoun.subtitle}</p>}
      {scotsoun?.author && <p>{t(tSite, { key: 'by' }) + ' ' + scotsoun.author}</p>}
    </header>
    <div class="product__action-block">
      <img src={scotsoun.img.src} alt="" />
      <PayPalButtons
        successPageUrl={relativePath(Astro.url.pathname, `payment-success-confirmation`)}
        productDescription={`SSCD${scotsoun.scotsounId} | ${scotsoun.longName}`}
        shortDescription={`SSCD${scotsoun.scotsounId}`}
        totalPrice={scotsoun.price}
      />
    </div>
  </div>
</section>

<section>
  {scotsoun?.description && <p set:html={scotsoun.description[locale]} />}

  {
    scotsoun?.coverArtist && (
      <p>{t(tComponent, { key: 'cover-artist', coverArtist: scotsoun.coverArtist })}</p>
    )
  }

  {
    scotsoun?.releaseDate && (
      <p>{t(tComponent, { key: 'release-date', releaseDate: scotsoun.releaseDate })}</p>
    )
  }

  {
    scotsoun?.trackList && scotsoun.trackList.length > 1 && (
      <>
        <h2>Track list</h2>
        <ol>
          {scotsoun.trackList.map((track) => (
            <li>{track}</li>
          ))}
        </ol>
      </>
    )
  }
</section>