doctype html
html lang="#{I18n.locale || I18n.default_locale}" data-default-locale="#{I18n.default_locale}"
  head
    meta charset='utf8'
    meta name='viewport' content='width=device-width, initial-scale=1'
    = render('breadcrumbs_and_title')
    title
      = yield(:title)
    = favicon_link_tag('/favicon.png', type: 'image/png')
    = favicon_link_tag('/favicon.png', rel: 'apple-touch-icon', type: 'image/png')
    = action_cable_meta_tag
    = stylesheet_pack_tag('application', 'stylesheets', media: 'all', 'data-turbolinks-track': true, integrity: true, crossorigin: 'anonymous')
    = stylesheet_link_tag('application', media: 'all', 'data-turbolinks-track': true, integrity: true, crossorigin: 'anonymous')
    = javascript_pack_tag('application', 'data-turbolinks-track': true, defer: false, integrity: true, crossorigin: 'anonymous')
    = javascript_include_tag('application', 'data-turbolinks-track': true, integrity: true, crossorigin: 'anonymous')
    = yield(:head)
    = csrf_meta_tags
    meta name='sentry' data-enabled=SentryJavascript.active?.to_s data-release=SentryJavascript.release data-dsn=SentryJavascript.dsn data-environment=SentryJavascript.environment
    meta name='current-user' content=current_user&.to_page_context&.to_json
    meta name='current-contributor' content=current_contributor&.to_page_context&.to_json
  body
    - unless @embed_options[:hide_navbar]
      nav.navbar.bg-dark.navbar-expand-md.mb-4.py-1 role='navigation' data-bs-theme="dark"
        .container
          .navbar-brand
            i.fa-solid.fa-code
            = application_name
          button.navbar-toggler data-bs-target='#navbar-collapse' data-bs-toggle='collapse' type='button' aria-expanded='false' aria-label='Toggle navigation'
            span.navbar-toggler-icon
          #navbar-collapse.collapse.navbar-collapse
            = render('navigation', cached: true)
            ul.nav.navbar-nav.ms-auto
              = render('color_mode_selector', cached: true)
              = render('locale_selector', cached: true)
              li.nav-item.me-3 = link_to(t('shared.help.link'), '#modal-help', data: {'bs-toggle': 'modal'}, class: 'nav-link')
              = render('session')
    div data-controller=controller_name
      = render('flash')
      - if current_user.try(:admin?) or current_user.try(:teacher?) && !@embed_options[:hide_navbar]
        = yield(:breadcrumbs)
    - if (controller_name == "exercises" && action_name == "implement") || (controller_name == 'community_solutions' && action_name == 'edit')
      .container-fluid
        = yield
    - else
      .container
        = yield

    - template_variables = {execution_environment: @exercise.execution_environment} if action_name == 'implement'
    = render('shared/modal', classes: 'modal-lg', id: 'modal-help', template: 'application/help', template_variables: template_variables, title: t('shared.help.headline'))
