Skip to content

Commit

Permalink
feat: APPS-3093 finish LA Rebellion Filmmakers Detail page (#100)
Browse files Browse the repository at this point in the history
* feat: add styles and cypress tests

* feat: fix tests & indexing

* feat: placeholder index page

* fix: lint

* feat: rough index page

* feat: add links to index for crawling

* fix: update test

* chore: update package

* fix: image gql

* fix: style tweaks

* chore: remove extra comments

* feat: update links

* chore: fix typo

* fix: update cypress test

* chore: restore la-rebellion route for now

---------

Co-authored-by: Jess Divers <[email protected]>
  • Loading branch information
farosFreed and Jess Divers authored Jan 30, 2025
1 parent 1a52187 commit 83f953c
Show file tree
Hide file tree
Showing 7 changed files with 236 additions and 66 deletions.
7 changes: 7 additions & 0 deletions cypress/e2e/larebellionfilmmakers.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
describe('Filmmakers Detail Page', () => {
it('Visits the LA Rebellion Filmmaker Detail page', () => {
cy.visit('/collections/la-rebellion/filmmakers/test-person')

cy.percySnapshot('larebellionfilmmakersdetail', { widths: [768, 992, 1200] })
})
})
7 changes: 5 additions & 2 deletions gql/queries/FTVALARebellionFilmmakersDetail.gql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
query FTVALARebellionFilmmakersDetail($slug: [String!]) {
ftvaLARebellionIndividual: entry(section: "ftvaLARebellionIndividual", slug: $slug) {
id
title
typeHandle
sectionHandle
slug
Expand All @@ -25,8 +26,10 @@ query FTVALARebellionFilmmakersDetail($slug: [String!]) {
}

associatedFilms {
image {
...Image
... on associatedFilms_film_BlockType {
image {
...Image
}
}
titleGeneral
description
Expand Down
21 changes: 21 additions & 0 deletions gql/queries/FTVALARebellionFilmmakersList.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
query FTVALARebellionFilmmakersList {
entry(section: ["ftvaListingLaRebellionFilmmakers"]) {
id
typeHandle
sectionHandle
titleGeneral
summary
displaySummary
}
entries(section: ["ftvaLARebellionIndividual"], orderBy: "postDate DESC") {
id
to: uri
typeHandle
sectionHandle
title
richText
associatedFilms {
titleGeneral
}
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
"nuxt-graphql-request": "^7.0.5",
"sass": "^1.66.1",
"ucla-library-design-tokens": "^5.28.0",
"ucla-library-website-components": "3.43.7"
"ucla-library-website-components": "3.44.0"
},
"engines": {
"pnpm": "^9.12.1"
}
}
}
149 changes: 92 additions & 57 deletions pages/collections/la-rebellion/filmmakers/[slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// COMPONENT RE-IMPORTS
// TODO: remove when we have implemented component library as a module
// https://nuxt.com/docs/guide/directory-structure/components#library-authors
import { BlockTag, ButtonDropdown, CardMeta, DividerWayFinder, FlexibleMediaGalleryNewLightbox, NavBreadcrumb, ResponsiveImage, RichText, SectionScreeningDetails, SectionTeaserCard, SectionStaffSubjectLibrarian, SectionWrapper, TwoColLayoutWStickySideBar } from 'ucla-library-website-components'
import { BlockTag, ButtonDropdown, CardMeta, FlexibleMediaGalleryNewLightbox, NavBreadcrumb, ResponsiveImage, RichText, SectionStaffSubjectLibrarian, SectionWrapper, TwoColLayoutWStickySideBar } from 'ucla-library-website-components'
// HELPERS
import _get from 'lodash/get'
Expand Down Expand Up @@ -39,7 +39,7 @@ if (!data.value.ftvaLARebellionIndividual) {
}
// This is creating an index of the content for ES search
if (data.value.ftvaEvent && import.meta.prerender) {
if (data.value.ftvaLARebellionIndividual && import.meta.prerender) {
try {
// Call the composable to use the indexing function
const { indexContent } = useContentIndexer()
Expand All @@ -52,13 +52,10 @@ if (data.value.ftvaEvent && import.meta.prerender) {
}
const page = ref(_get(data.value, 'ftvaLARebellionIndividual', {}))
// TODO refactor for filmography data ? Delete if not needed
// const series = ref(_get(data.value, 'ftvaEventSeries', {}))
watch(data, (newVal, oldVal) => {
// console.log('In watch preview enabled, newVal, oldVal', newVal, oldVal)
page.value = _get(newVal, 'ftvaLARebellionIndividual', {})
// series.value = _get(newVal, 'ftvaEventSeries', {})
})
// Get data for Image or Carousel at top of page
Expand All @@ -77,13 +74,40 @@ const parsedCarouselData = computed(() => {
})
})
const parsedAssociatedFilms = computed(() => {
if (page.value.associatedFilms.length === 0) return []
return page.value.associatedFilms.map((obj) => {
// console.log('obj link', obj.filmLink)
const newFilmLink = ['/', obj.filmLink[0].uri].join('')
// console.log('newFilmLink', newFilmLink)
// console.log('new obj', {
// ...obj,
// filmLink: [
// {
// ...obj.filmLink[0],
// uri: newFilmLink
// }
// ]
// })
return {
...obj,
filmLink: [
{
...obj.filmLink[0],
uri: newFilmLink
}
]
}
})
})
useHead({
title: page.value ? page.value.title : '... loading',
meta: [
{
hid: 'description',
name: 'description',
content: removeTags(page.value.text)
content: removeTags(page.value.richText)
}
]
})
Expand All @@ -92,7 +116,7 @@ useHead({
<template>
<main
id="main"
class="page page-detail page-event-detail"
class="page page-detail page-filmmaker-detail"
>
<div class="one-column">
<NavBreadcrumb
Expand Down Expand Up @@ -138,69 +162,80 @@ useHead({
class="two-column"
>
<template #primaryTop>
<!-- <CardMeta
<CardMeta
data-test="text-block"
category="L.A. Rebellion"
:title="page?.title"
> -->
{{ page }}
>
<template #sharebutton>
<ButtonDropdown
data-test="share-button"
button-title="Share"
:has-icon="true"
:dropdown-list="socialList.dropdownList"
/>
</template>
</CardMeta>
<RichText :rich-text-content="page?.richText" />
</template>
</TwoColLayoutWStickySideBar>
<!-- TODO: add conditional render once vars exist
v-if="parsedFilmography && parsedFilmography.length > 0" -->
<SectionWrapper
v-if="parsedAssociatedFilms && parsedAssociatedFilms.length > 0"
section-title="Filmography"
theme="paleblue"
class="series-section-wrapper"
class="filmography-section-wrapper"
>
<!-- <SectionStaffSubjectLibrarian /> -->
<section-staff-subject-librarian
:items="page.associatedFilms"
:table-headers="['', 'Film', 'Role', 'Year']"
/>
</SectionWrapper>
</main>
</template>
<style lang="scss" scoped>
// PAGE STYLES - USE OLD STYLES
// .page-event-detail {
// position: relative;
// .two-column {
// .ftva.button-dropdown {
// margin-top: 30px;
// }
// .ftva.block-info {
// margin-top: 48px;
// }
// // SECTION SCREENING DETAILS
// // TODO when component is patched, remove styles?
// :deep(figure.responsive-video:not(:has(.video-embed))) {
// display: none;
// }
// }
// /* makes all EventSeries same height */
// :deep(.card) {
// min-height: 350px;
// }
// @media (max-width: 1200px) {
// :deep(.primary-column) {
// width: 65%;
// }
// }
// @media (max-width: 899px) {
// :deep(.primary-column) {
// width: inherit;
// }
// :deep(.block-tags) {
// padding-top: 30px;
// }
// }
// }
@import 'assets/styles/slug-pages.scss';
.page-filmmaker-detail {
position: relative;
.two-column {
.ftva.button-dropdown {
margin-top: 30px;
}
.ftva.block-info {
margin-top: 48px;
}
// when two-column div is not followed by a filmography section
&:last-child {
// add 8px of space between the last element in the two-column div and the footer
padding-bottom: 8px;
}
// fix button scrolling over header
:deep(.sharebutton-slot) {
position: relative;
z-index: 1;
}
}
// change filmography section title color
:deep(.section-header) {
// reduce space below title by 12px on desktop (was 40px)
@media #{$large} {
margin-bottom: 28px;
}
.section-title {
color: #2f2f2f;
}
font-weight: 800;
}
}
</style>
104 changes: 104 additions & 0 deletions pages/collections/la-rebellion/filmmakers/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<script setup>
// COMPONENTS
import { DividerGeneral, SectionWrapper, RichText } from 'ucla-library-website-components'
import { computed } from 'vue'
// HELPERS & UTILS
import _get from 'lodash/get'
import removeTags from '~/utils/removeTags'
// GQL
import FTVALARebellionFilmmakersList from '~/gql/queries/FTVALARebellionFilmmakersList.gql'
const { $graphql } = useNuxtApp()
const { data, error } = await useAsyncData('la-rebellion-filmmakers', async () => {
const data = await $graphql.default.request(FTVALARebellionFilmmakersList)
// console.log('data', data)
return data
})
if (error.value) {
throw createError({
...error.value, statusMessage: 'Page not found.' + error.value, fatal: true
})
}
if (!data.value.entries) {
// console.log('no data')
throw createError({
statusCode: 404,
statusMessage: 'Page Not Found',
fatal: true
})
}
// TODO This is creating an index of the content for ES search
if (data.value.entry && import.meta.prerender) {
try {
// Call the composable to use the indexing function
const { indexContent } = useContentIndexer()
// Index the event data using the composable during static build
await indexContent(data.value.entry, route.params.slug)
// TODO index entries as well?
// await indexContent(data.value.entries, route.params.slug)
// console.log('Article indexed successfully during static build')
} catch (error) {
console.error('FAILED TO INDEX ARTICLES during static build:', error)
}
}
const page = ref(_get(data.value, 'entry', {}))
const filmmakers = ref(_get(data.value, 'entries', []))
watch(data, (newVal, oldVal) => {
// console.log('In watch preview enabled, newVal, oldVal', newVal, oldVal)
page.value = _get(newVal, 'entry', {})
filmmakers.value = _get(newVal, 'entries', [])
})
const showSummary = computed(() => {
return page.value?.summary && page.value?.displaySummary === 'yes'
})
useHead({
title: page.value?.title || '... loading',
meta: [
{
hid: 'description',
name: 'description',
content: removeTags(page.value.summary)
}
]
})
</script>
<template>
<div
class="page page-filmmakers"
style="padding: 25px 100px;"
>
<section-wrapper section-title="LA Rebellion Filmmakers">
<template v-if="showSummary">
<RichText :rich-text-content="page.summary" />
</template>
<div
v-for="filmmaker in filmmakers"
:key="filmmaker?.id"
>
<NuxtLink :to="`/${filmmaker?.to}`">
{{ filmmaker?.title }}
</NuxtLink> <br>
<h4>to: <code>{{ filmmaker?.to }}</code></h4>
<h4>richText: <code>{{ filmmaker?.richText }}</code></h4>
<h4>associatedFilms: <code>{{ filmmaker?.associatedFilms }}</code></h4>
<divider-general />
</div>
</section-wrapper>
</div>
</template>
<style scoped>
@import 'assets/styles/listing-pages.scss';
</style>
Loading

1 comment on commit 83f953c

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.