{"version":3,"file":"PublicationSection-CqjBiYYn.js","sources":["../../src/components/publication/PublicationSectionArticleList.vue","../../src/queries/GetPublicationSection.js","../../src/components/publication/PublicationSection.vue"],"sourcesContent":["<template>\n  <section>\n    <article\n      v-for=\"(publication, index) in data\"\n      :key=\"index\"\n      :class=\"[$style.article, 'space-48-64-above']\"\n    >\n      <router-link\n        class=\"aspect-container focus-outline\"\n        :to=\"{\n          name: 'PublicationPost',\n          params: {\n            slug: publication.slug,\n          },\n        }\"\n      >\n        <picture>\n          <img\n            :alt=\"publication.featuredImage.node.altText\"\n            :src=\"proxySource(publication.featuredImage.node.sourceUrl, 400)\"\n            :srcset=\"publication.imageSrcset\"\n            class=\"aspect-image\"\n            loading=\"lazy\"\n            sizes=\"(min-width: 960px) 470px, 100vw\"\n          />\n        </picture>\n      </router-link>\n      <div :class=\"$style.info\">\n        <header>\n          <h2 class=\"heading-4\">\n            <router-link\n              :to=\"{\n                name: 'PublicationPost',\n                params: {\n                  slug: publication.slug,\n                },\n              }\"\n            >\n              {{ publication.title }}\n            </router-link>\n          </h2>\n        </header>\n        <PublicationAuthors :data=\"publication\" :is-archive=\"true\"></PublicationAuthors>\n      </div>\n    </article>\n    <GuggenPagination\n      :current-page=\"page\"\n      :per-page=\"limit\"\n      :sub-type=\"subType\"\n      :sub-type-value=\"subTypeValue\"\n      :total-page-count=\"totalPageCount\"\n      post-type=\"publication\"\n    ></GuggenPagination>\n  </section>\n</template>\n\n<script setup lang=\"ts\">\nimport GuggenPagination from '@/components/GuggenPagination.vue';\nimport { Publication } from '@/types/publication.interface';\nimport PublicationAuthors from '@/components/publication/PublicationAuthors.vue';\nimport { useImageProxy } from '@/composables/Common.js';\n\ndefineProps<{\n  data: Array<Publication>;\n  page?: number;\n  subType?: string;\n  subTypeValue?: string;\n  totalPageCount?: number;\n}>();\n\nconst { proxySource } = useImageProxy();\n\nconst limit = 8;\n</script>\n\n<style lang=\"scss\" module>\n.article {\n  display: block;\n\n  &:first-of-type {\n    margin-top: 1rem;\n  }\n\n  > a {\n    background-color: $white;\n  }\n}\n.info {\n  margin-top: 1rem;\n\n  a {\n    &:focus,\n    &:hover {\n      text-decoration: underline;\n    }\n  }\n  h2 {\n    margin-top: 0;\n\n    a {\n      text-decoration: none;\n\n      &:focus {\n        color: $white;\n        text-decoration: none;\n      }\n    }\n  }\n}\n\n@media (min-width: $break-point) {\n  .article {\n    @include grid;\n    grid-column: 1 / span 8;\n    grid-template-columns: repeat(8, 1fr);\n\n    a {\n      grid-column: span 4;\n    }\n  }\n  .info {\n    grid-column: span 4;\n    margin-top: 0;\n  }\n}\n</style>\n","import gql from 'graphql-tag';\nimport { paginationQuery } from '@/queries/PaginationQuery';\n\nexport const publicationSectionQuery = gql`\n  query getPublications(\n    $author: String,\n    $filter: String,\n    $limit: Int,\n    $paged: Int,\n    $subject: String,\n    $subType: String,\n    $subTypeValue: String,\n    $type: String\n  ) {\n    publications(\n      first: $limit\n      where: { authorSlug: $author, paged: $paged, subjectSlug: $subject }\n    ) {\n      nodes {\n        excerpt\n        featuredImage {\n          node {\n            altText\n            sourceUrl\n          }\n        }\n        imageSrcset\n        publicationData {\n          authors {\n            author\n            type\n          }\n          fully_illustrated\n          hardcover\n          height\n          num_illustrations\n          num_pages\n          publication_year\n          purchase_url\n          softcover\n          width\n        }\n        publicationAuthors(first: 100) {\n          nodes {\n            name\n            publication_authorId\n            slug\n            sort\n          }\n        }\n        publicationSubjects {\n          nodes {\n            name\n            slug\n          }\n        }\n        slug\n        title\n      }\n    }\n    ${paginationQuery}\n  }\n`;\n","<template>\n  <section :class=\"[$style.container, 'container']\">\n    <header>\n      <nav>\n        <BackLink\n          component=\"PublicationSection\"\n          group=\"publication\"\n          label=\"Publications\"\n          path=\"/publications\"\n        ></BackLink>\n      </nav>\n      <h1 v-if=\"results.publications.nodes.length\" class=\"space-24-32-above\" v-html=\"getTitle\"></h1>\n    </header>\n    <PublicationSectionArticleList\n      v-if=\"results.publications.nodes.length\"\n      :data=\"results.publications.nodes\"\n      :page=\"page\"\n      :sub-type=\"subtype\"\n      :sub-type-value=\"getSubTypeValue\"\n      :total-page-count=\"pageCount\"\n      :class=\"[$style.list, 'space-24-32-above']\"\n    ></PublicationSectionArticleList>\n  </section>\n</template>\n\n<script setup lang=\"ts\">\nimport BackLink from '@/components/common/BackLink.vue';\nimport { computed, ref } from 'vue';\nimport { dataLoaded, useHandleError, useMetaData } from '@/composables/Common.js';\nimport PublicationSectionArticleList from '@/components/publication/PublicationSectionArticleList.vue';\nimport { publicationSectionQuery } from '@/queries/GetPublicationSection';\nimport { upperCaseWords } from '@/utils.js';\nimport { useQuery } from 'villus';\n\nconst props = withDefaults(\n  defineProps<{\n    page?: number;\n    slug?: string;\n    subtype?: string;\n  }>(),\n  { page: 1 },\n);\n\nconst { handleError } = useHandleError();\nconst { setMetaDescription, setMetaTitle } = useMetaData();\n\nconst limit = 8;\nconst results = ref({\n  publications: {\n    nodes: [],\n  },\n  totalCount: 0,\n});\n\nconst getSubTypeValue = computed(() => {\n  if (props.subtype) {\n    return props.slug;\n  }\n\n  return '';\n});\nconst getTitle = computed(() => {\n  if (props.subtype === 'publication_author') {\n    const pubauthor = results.value.publications.nodes[0].publicationAuthors.nodes.find(\n      (author) => author.slug === props.slug,\n    );\n\n    if (pubauthor) {\n      return `Publications Authored by ${upperCaseWords(pubauthor.name)}`;\n    }\n  }\n\n  if (props.subtype === 'publication_subject') {\n    const pubsubject = results.value.publications.nodes[0].publicationSubjects.nodes.find(\n      (subject) => subject.slug === props.slug,\n    );\n\n    if (pubsubject) {\n      return `Publications Tagged as ${upperCaseWords(pubsubject.name)}`;\n    }\n  }\n\n  return 'Publication Archive';\n});\nconst pageCount = computed(() => Math.ceil(results.value.totalCount / limit));\n\nconst queryVariables = {\n  author: props.subtype === 'publication_author' ? props.slug : null,\n  limit: limit,\n  paged: +props.page,\n  subject: props.subtype === 'publication_subject' ? props.slug : null,\n  subType: props.subtype,\n  subTypeValue: getSubTypeValue.value,\n  type: 'publication',\n};\nconst { data } = useQuery({\n  onData: (data) => {\n    if (Object.keys(data).length) {\n      if (data.publications.nodes.length) {\n        results.value.publications = data.publications;\n        results.value.totalCount = data.totalCount;\n        setMetaTitle(data.publications.title);\n        setMetaDescription(data.publications.excerpt);\n        dataLoaded();\n      }\n\n      if (data.publications.nodes.length === 0) {\n        handleError('PublicationSection', `Page ${props.page}, limit ${limit}`);\n      }\n    }\n  },\n  query: publicationSectionQuery,\n  skip: ({ paged }) => isNaN(paged),\n  variables: queryVariables,\n});\n\nif (isNaN(props.page)) {\n  handleError('PublicationSection', `Page ${props.page}, limit ${limit}`);\n}\n</script>\n\n<script lang=\"ts\">\nexport default {\n  beforeRoute(params, villusClient) {\n    return new Promise<void>((resolve, reject) => {\n      villusClient\n        .executeQuery({\n          query: publicationSectionQuery,\n          variables: {\n            author: params.subtype === 'publication_author' ? params.slug : null,\n            limit: 8,\n            paged: params.page ? +params.page : 1,\n            subject: params.subtype === 'publication_subject' ? params.slug : null,\n            subType: params.subtype,\n            subTypeValue: params.subtype ? params.slug : null,\n            type: 'publication',\n          },\n        })\n        .then(() => resolve())\n        .catch((err) => reject(err));\n    });\n  },\n};\n</script>\n\n<style lang=\"scss\" module>\n.list {\n  article:first-of-type {\n    margin-top: 0;\n  }\n}\n\n@media (min-width: $break-point) {\n  .container {\n    @include grid;\n\n    > header {\n      @include grid;\n      grid-column: span 12;\n\n      h1,\n      nav {\n        grid-column: span 12;\n      }\n    }\n\n    .list {\n      @include grid;\n      grid-column: span 12;\n      margin-top: 0;\n\n      > nav {\n        grid-column: span 12;\n      }\n    }\n  }\n}\n</style>\n"],"names":["limit","proxySource","useImageProxy","publicationSectionQuery","gql","paginationQuery","__default__","params","villusClient","resolve","reject","err","props","__props","handleError","useHandleError","setMetaDescription","setMetaTitle","useMetaData","results","ref","getSubTypeValue","computed","getTitle","pubauthor","author","upperCaseWords","pubsubject","subject","pageCount","queryVariables","useQuery","data","dataLoaded","paged"],"mappings":"8hBAwEMA,EAAQ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