Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release) #631

Merged
merged 4 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/[locale]/[...uriSegments]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ export async function generateStaticParams({

const sectionMap = {
events: EventPageTemplate,
// galleryItems: GalleryPageTemplate,
glossaryTerms: GlossaryPageTemplate,
news: NewsPageTemplate,
searchResults: SearchPageTemplate,
Expand Down
7 changes: 4 additions & 3 deletions components/EventTime/patterns/EventTimeLong.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PropTypes from "prop-types";
import { useDateString, useTimeString, useTimeZone } from "@/lib/utils";
import { useTimeString, useTimeZone } from "@/lib/utils";
import { makeDateString } from "@/helpers/dates";

export default function EventTimeLong({
startDate,
Expand All @@ -9,9 +10,9 @@ export default function EventTimeLong({
timezone,
isSameDay,
}) {
const localizedStartDate = useDateString(startDate);
const localizedStartDate = makeDateString(startDate);
const localizedStartTime = useTimeString(startTime);
const localizedEndDate = useDateString(endDate);
const localizedEndDate = makeDateString(endDate);
const localizedEndTime = useTimeString(endTime);
const localizedTimezone = useTimeZone(timezone);

Expand Down
9 changes: 5 additions & 4 deletions components/EventTime/patterns/EventTimeShort/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PropTypes from "prop-types";
import { makeDateObject, useGlobalData } from "@/lib/utils";
import { useGlobalData } from "@/lib/utils";
import { makeDateObject } from "@/helpers/dates";
import * as Styled from "./styles";
import { fallbackLng } from "@/lib/i18n/settings";

Expand All @@ -15,10 +16,10 @@ function renderShortDate({ month, day, year }) {

export default function EventTimeShort({ startDate, endDate, isSameDay }) {
const localeInfo = useGlobalData("localeInfo");
const lang = localeInfo?.language || fallbackLng;
const endDateObject = makeDateObject(endDate, lang, true);
const locale = localeInfo?.language || fallbackLng;
const endDateObject = makeDateObject(endDate, { locale, isShort: true });
const startDateObject = !isSameDay
? makeDateObject(startDate, lang, true)
? makeDateObject(startDate, { locale, isShort: true })
: null;

return (
Expand Down
15 changes: 3 additions & 12 deletions components/atomic/Tile/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import PropTypes from "prop-types";
import { useId } from "react";
import classNames from "classnames";
import {
ResponsiveImage,
Image,
MixedLink,
IconComposer,
} from "@rubin-epo/epo-react-lib";
import { Image, MixedLink, IconComposer } from "@rubin-epo/epo-react-lib";
import { mixedLinkShape } from "@/shapes/link";
import { useGlobalData } from "@/lib/utils";
import * as Styled from "./styles";
Expand Down Expand Up @@ -57,13 +52,9 @@ const Tile = ({
{finalImage && (
<div className="image">
{ratio ? (
<ResponsiveImage
role="presentation"
ratio={ratio}
image={finalImage}
/>
<Styled.ResponsiveImage aspectRatio={ratio} image={finalImage} />
) : (
<Image role="presentation" image={finalImage} />
<Image image={finalImage} />
)}
{isVideo && (
<Styled.PlayButton>
Expand Down
30 changes: 8 additions & 22 deletions components/atomic/Tile/styles.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable */
import styled from "styled-components";
import { MixedLink as BaseMixedLink } from "@rubin-epo/epo-react-lib";
import BaseMixedLink from "@rubin-epo/epo-react-lib/MixedLink";
import BaseResponsiveImage from "@rubin-epo/epo-react-lib/ResponsiveImage";
import SharePopupComponent from "@/layout/SharePopup";
import {
BREAK_PHABLET,
Expand All @@ -16,6 +17,10 @@ Media queries are done this way for special treatment at tablet level vs phone l
@media (min-width: ${BREAK_PHABLET_MIN}) and (max-width: ${BREAK_TABLET}) {}
*/

export const ResponsiveImage = styled(BaseResponsiveImage)`
height: 100%;
`;

export const ListItem = styled.li`
position: relative;
`;
Expand All @@ -36,6 +41,7 @@ export const MixedLink = styled(BaseMixedLink)`
/* set the grid areas for various bits */
.image {
grid-area: image;
overflow: hidden;
}

.pretitle {
Expand Down Expand Up @@ -210,10 +216,6 @@ export const MixedLink = styled(BaseMixedLink)`
grid-row-gap: 0px;
padding: 0px;

&& .image > div {
padding-top: 50%;
}

.pretitle {
padding: 0.5rem 0;
font-weight: normal;
Expand Down Expand Up @@ -296,10 +298,6 @@ export const MixedLink = styled(BaseMixedLink)`
grid-gap: 0;
padding: 0px;

&& .image > div {
padding-top: 50%;
}

.pretitle {
padding: 0.5rem 20px;
font-weight: normal;
Expand Down Expand Up @@ -330,13 +328,7 @@ export const MixedLink = styled(BaseMixedLink)`
"image title"
"image subtitle"
"image text"
"footer text";

.image {
> div {
padding-top: 100%;
}
}
"image text";

&& .footer {
display: none;
Expand Down Expand Up @@ -655,12 +647,6 @@ export const MixedLink = styled(BaseMixedLink)`
"image title"
"image text"
"image text";

.image {
> div {
padding-top: 100%;
}
}
}
}

Expand Down
13 changes: 7 additions & 6 deletions components/content-blocks/Callout/CalloutEntry/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@

import PropTypes from "prop-types";
import { useTranslation } from "react-i18next";
import { makeDateString, getSiteString, makeReleaseFeature } from "@/lib/utils";
import { getSiteString, makeReleaseFeature } from "@/lib/utils";
import { makeDateString } from "@/helpers/dates";
import * as Styled from "./styles";
import { Image } from "@rubin-epo/epo-react-lib";
import { useRelease } from "@/lib/api/noirlabReleases";
import { fallbackLng } from "@/lib/i18n/settings";

const getDateString = (newsDate, eventStart, eventEnd, lang) => {
const getDateString = (newsDate, eventStart, eventEnd, locale) => {
if (newsDate) {
return makeDateString(newsDate, lang);
return makeDateString(newsDate, { locale });
}

if (eventStart && eventEnd) {
return `${makeDateString(eventStart, lang)} - ${makeDateString(
return `${makeDateString(eventStart, { locale })} - ${makeDateString(
eventEnd,
lang
{ locale }
)}`;
}

if (eventEnd) {
return makeDateString(eventEnd, lang);
return makeDateString(eventEnd, { locale });
}
};

Expand Down
7 changes: 4 additions & 3 deletions components/content-blocks/GridBlock/NewsGrid.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import PropTypes from "prop-types";
import { useTranslation } from "react-i18next";
import {
makeDateString,
makeTruncatedString,
makeReleaseFeature,
normalizeItemData,
useGlobalData,
useList,
} from "@/lib/utils";

import { makeDateString } from "@/helpers/dates";
import { Grid } from "@rubin-epo/epo-react-lib";
import Tile from "@/atomic/Tile";
import Loader from "@/atomic/Loader";
Expand All @@ -16,7 +17,7 @@ import { fallbackLng } from "@/lib/i18n/settings";
const NewsGrid = ({ items = [], limit, listTypeId, sectionHandle, pageId }) => {
const { t } = useTranslation();
const localeInfo = useGlobalData("localeInfo");
const lang = localeInfo?.language || fallbackLng;
const locale = localeInfo?.language || fallbackLng;
// get manually-curated data first
let allItems = normalizeItemData(items);

Expand Down Expand Up @@ -70,7 +71,7 @@ const NewsGrid = ({ items = [], limit, listTypeId, sectionHandle, pageId }) => {
isFeature={i === 0}
link={uri}
pretitle={postType?.[0]?.title ? postType[0].title : " "}
subtitle={makeDateString(date || releaseDate, lang)}
subtitle={makeDateString(date || releaseDate, { locale })}
text={makeTruncatedString(subtitle || description, 30)}
title={title}
type="news"
Expand Down
2 changes: 1 addition & 1 deletion components/content-blocks/PublicationsList/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from "prop-types";
import { Container } from "@rubin-epo/epo-react-lib";
import { mixedLinkShape } from "@/shapes/link";
import { makeDateString } from "@/lib/utils";
import { makeDateString } from "@/helpers/dates";
import * as Styled from "./styles";

export default function PublicationsListBlock({
Expand Down
4 changes: 2 additions & 2 deletions components/content-blocks/Schedule/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import PropTypes from "prop-types";
import styled from "styled-components";
import { Container } from "@rubin-epo/epo-react-lib";
import { useDateString } from "@/lib/utils";
import { makeDateString } from "@/helpers/dates";

export default function ScheduleBlock({ date, description, scheduleRows }) {
const localizedDate = useDateString(date);
const localizedDate = makeDateString(date);
return (
<Container>
<Date>{localizedDate}</Date>
Expand Down
8 changes: 1 addition & 7 deletions components/content-blocks/SlideBlock/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ const SlideBlock = ({

// get manually-curated data first. This has some filtering for missing entries (deleted in craft)
let allItems = [];
if (dynamicComponent === "galleryItems") {
allItems = normalizeItemData(items, "galleryEntry");
} else if (dynamicComponent === "staffProfiles") {
if (dynamicComponent === "staffProfiles") {
allItems = normalizeItemData(items, "staffEntry");
truncate = 50;
}
Expand Down Expand Up @@ -74,10 +72,6 @@ const SlideBlock = ({
const makePretitle = (cat, type) => {
if (type === "slideshow") {
return t(`gallery.slideshow`);
} else if (type === "galleryItem") {
return cat?.[0]?.slug
? t(`gallery.${cat[0].slug}`)
: t(`gallery.gallery`);
}
return null;
};
Expand Down
1 change: 0 additions & 1 deletion components/dynamic/DataList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const DataList = ({
const listTypeMap = {
newsPosts: "news-post",
pressReleases: "press-release",
imageGalleryItems: "image",
videoGalleryItems: "video",
};
const listType = categories.find((c) => c.slug === listTypeMap[component]);
Expand Down
35 changes: 0 additions & 35 deletions components/dynamic/GalleryList/index.js

This file was deleted.

6 changes: 3 additions & 3 deletions components/dynamic/NewsList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { Grid } from "@rubin-epo/epo-react-lib";
import DataList from "@/dynamic/DataList";
import Tile from "@/atomic/Tile";
import {
makeDateString,
makeTruncatedString,
makeReleaseFeature,
useGlobalData,
} from "@/lib/utils";
import { makeDateString } from "@/helpers/dates";
import { fallbackLng } from "@/lib/i18n/settings";

const NewsList = ({
Expand All @@ -23,7 +23,7 @@ const NewsList = ({
}) => {
const { t } = useTranslation();
const localeInfo = useGlobalData("localeInfo");
const lang = localeInfo?.language || fallbackLng;
const locale = localeInfo?.language || fallbackLng;
const cols = initialLimit === 4 ? 4 : initialLimit === 3 ? 3 : 2;
const canShowFeatured = initialLimit > 4;

Expand Down Expand Up @@ -84,7 +84,7 @@ const NewsList = ({
? postType[0].title
: null
}
subtitle={makeDateString(date || releaseDate, lang)}
subtitle={makeDateString(date || releaseDate, { locale })}
text={makeTruncatedString(description || subtitle, 30)}
title={title}
titleTag={"h2"}
Expand Down
Loading
Loading