---
import textArrowIcon from '@assets/icons/text-arrow.svg?raw'
import Default from '@astrojs/starlight/components/Footer.astro'
import { major, minor } from 'semver'
import ThemeSelect from './ThemeSelect.astro'
import { LocaleSelect } from './menu/LocaleSelector'

const version = import.meta.env.VERSION || '0.0.1'
const [maj, min] = [major(version), minor(version)]
const release = `${maj}.${min}`
// TODO: switch to SDK

const releaseLink = `https://github.com/daytonaio/daytona/releases/tag/v${release}.0`

const lang = Astro.props.lang ?? Astro.locals.starlightRoute.lang
---

<Default {...Astro.props as any}>
  <slot />
</Default>
<footer class="docs-footer__container">
  <div class="docs-footer__container__support-links">
    <p>
      <Fragment set:html={textArrowIcon} />{
        Astro.locals.t('footer.needHelp' as any)
      } -
      <a href="mailto:support@daytona.io"
        >{Astro.locals.t('footer.reachSupport' as any)}</a
      >
    </p>
    <p>
      <Fragment set:html={textArrowIcon} />{
        Astro.locals.t('footer.latestUpdates' as any)
      } - <a href="https://github.com/daytonaio/daytona/commits/main/"
        >{Astro.locals.t('footer.viewChangelog' as any)}</a
      >
    </p>
    <p>
      <Fragment set:html={textArrowIcon} />{
        Astro.locals.t('footer.dotfilesInsider' as any)
      } - <a href="https://www.daytona.io/dotfiles/"
        >{Astro.locals.t('footer.readBlog' as any)}</a
      >
    </p>
    <p>
      <Fragment set:html={textArrowIcon} />{
        Astro.locals.t('footer.LLMs' as any)
      } -
      <a href="https://www.daytona.io/docs/llms.txt">llms.txt</a> &
      <a href="https://www.daytona.io/docs/llms-full.txt">llms-full.txt</a>
    </p>
  </div>

  <div class="docs-footer__container__bottom">
    <div class="docs-footer__container__bottom-block">
      <div><p>© {new Date().getFullYear()} Daytona Platforms, Inc.</p></div>
      <div class="divider"></div>
    </div>

    <div class="footer-selects">
      <LocaleSelect client:load locale={lang} />
      <ThemeSelect />
    </div>
    <div class="menu-list">
      <a href="https://www.daytona.io/company/privacy-policy"
        >{Astro.locals.t('footer.privacyPolicy' as any)}</a
      >
      <a href="https://www.daytona.io/company/terms-of-service"
        >{Astro.locals.t('footer.termsOfService' as any)}</a
      >
    </div>
  </div>
</footer>

<style>
  .footer-selects {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;

    order: 2;
    margin-left: auto;
  }
</style>
