Skip to content

Commit

Permalink
Upgrade dependencies and fix Type errors which are fixable
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjarling committed Mar 15, 2023
1 parent d0e7783 commit 30ee21c
Show file tree
Hide file tree
Showing 11 changed files with 783 additions and 834 deletions.
1 change: 0 additions & 1 deletion components/Hero/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const Hero: React.FC<HeroProps> = ({ collection }) => {
pagination={{
clickable: true,
}}
preloadImages={false}
slidesPerView={1}
speed={1000}
>
Expand Down
6 changes: 3 additions & 3 deletions components/Search/JumpTo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React, {
useRef,
useState,
} from "react";

import { IconSearch } from "@/components/Shared/SVG/Icons";
import SearchJumpToList from "@/components/Search/JumpToList";
import Swiper from "swiper";
Expand All @@ -23,12 +24,11 @@ const SearchJumpTo: React.FC<SearchProps> = ({ isSearchActive }) => {
const [showJumpTo, setShowJumpTo] = useState<boolean>(false);

React.useEffect(() => {
// @ts-ignore
const handleMouseDown = (e) => {
const handleMouseDown = (e: MouseEvent) => {
if (
showJumpTo &&
formRef.current &&
!formRef.current.contains(e.target)
!formRef.current.contains(e.target as Node)
) {
setShowJumpTo(false);
}
Expand Down
5 changes: 2 additions & 3 deletions components/Search/JumpToList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,9 @@ const SearchJumpToList: React.FC<SearchJumpToListProps> = ({
query: item.query,
}}
tabIndex={0}
data-testid={item.dataTestId}>

data-testid={item.dataTestId}
>
{searchValue} <Helper label={item.helperLabel} />

</Link>
</JumpItem>
))}
Expand Down
9 changes: 4 additions & 5 deletions components/SharedLink/SharedLink.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
WorkType,
} from "@nulib/dcapi-types";
import { render, screen } from "@/test-utils";

import { Manifest } from "@iiif/presentation-3";
import SharedLink from "./SharedLink";

Expand Down Expand Up @@ -207,7 +208,6 @@ const work: Work = {
box_name: [],
};

// @ts-ignore
const manifest = {
"@context": "http://iiif.io/api/presentation/3/context.json",
id: "https://dcapi.rdc-staging.library.northwestern.edu/api/v2/works/263625cc-6fd7-47ae-a725-394a483d28d2?as=iiif",
Expand Down Expand Up @@ -322,6 +322,7 @@ const manifest = {
id: "https://dcapi.rdc-staging.library.northwestern.edu/api/v2/works/263625cc-6fd7-47ae-a725-394a483d28d2",
type: "Dataset",
format: "application/json",
// @ts-ignore
label: {
none: ["Northwestern University Libraries Digital Collections API"],
},
Expand Down Expand Up @@ -371,8 +372,7 @@ const manifest = {
width: 300,
service: [
{
"@id":
"https://iiif.stack.rdc-staging.library.northwestern.edu/iiif/2/7ad42e60-a8b6-444d-b4cf-f53f9c2756f6",
id: "https://iiif.stack.rdc-staging.library.northwestern.edu/iiif/2/7ad42e60-a8b6-444d-b4cf-f53f9c2756f6",
"@type": "ImageService2",
profile: "http://iiif.io/api/image/2/level2.json",
},
Expand All @@ -398,8 +398,7 @@ const manifest = {
width: 6079,
service: [
{
"@id":
"https://iiif.stack.rdc-staging.library.northwestern.edu/iiif/2/7ad42e60-a8b6-444d-b4cf-f53f9c2756f6",
id: "https://iiif.stack.rdc-staging.library.northwestern.edu/iiif/2/7ad42e60-a8b6-444d-b4cf-f53f9c2756f6",
"@type": "ImageService2",
profile: "http://iiif.io/api/image/2/level2.json",
},
Expand Down
2 changes: 1 addition & 1 deletion components/Transition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Transition: React.FC<Props> = ({ children }) => {

return (
<div style={{ overflow: "hidden" }}>
<AnimatePresence initial={false} exitBeforeEnter>
<AnimatePresence initial={false} mode="wait">
<motion.div
key={asPath}
variants={variants}
Expand Down
1 change: 0 additions & 1 deletion components/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "swiper/css";
import "swiper/css/effect-fade";
import "swiper/css/lazy";
import "swiper/css/navigation";
import "swiper/css/pagination";
import Footer from "@/components/Footer/Footer";
Expand Down
13 changes: 7 additions & 6 deletions lib/homepage-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ const getHomePageCollections = async (
if (!work) return;
worksUpdated.push({
...work,
// @ts-ignore
representative_file_set: {
...work?.representative_file_set,
/** Format for nice UI display on the home page */
aspect_ratio: 1,
},
...(work?.representative_file_set && {
representative_file_set: {
...work?.representative_file_set,
/** Format for nice UI display on the home page */
aspect_ratio: 1,
},
}),
});
});

Expand Down
6 changes: 5 additions & 1 deletion lib/json-ld.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ describe("work structured data", () => {
expect(obj.contributor).toEqual('"Roberts, James S."');
expect(obj.dateCreated).toEqual("2021-03-16T15:52:00.377715Z");
expect(obj.description).toBeUndefined();
expect(obj.genre![0]).toEqual("Ima Genre1");

if (obj.genre) {
expect(obj.genre[0]).toEqual("Ima Genre1");
}

expect(obj.image).toEqual(
"https://iiif.stack.rdc-staging.library.northwestern.edu/iiif/2/93d75ffe-20d8-48ea-9206-8db9114f2731"
);
Expand Down
8 changes: 5 additions & 3 deletions lib/queries/aggs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Aggs } from "@/types/api/request";
import { FacetsInstance } from "@/types/components/facets";
import { SortOrder } from "@elastic/elasticsearch/api/types";
import { UrlFacets } from "@/types/context/filter-context";
import { facetRegex } from "@/lib/utils/facet-helpers";

Expand All @@ -14,6 +15,7 @@ export const buildAggs = (
) => {
const aggs: Aggs = {};
let cleanFilterValue: string;
const desc = "desc" as SortOrder;

/** Is user filtering using quotes for exact match? */
const quoteCount = (facetFilterValue?.match(/"/g) || []).length;
Expand Down Expand Up @@ -41,21 +43,22 @@ export const buildAggs = (
include: cleanFilterValue ? cleanFilterValue : undefined,

order: {
_count: "desc",
_count: desc,
},
size: 20,
};

/**
* Create a separate aggregation for user selected aggs (checkboxes)
*/

if (userFacetsValues) {
aggs.userFacets = {
terms: {
field: facet.field,
include: userFacetsValues,
order: {
_count: "desc",
_count: desc,
},
size: 20,
},
Expand All @@ -66,7 +69,6 @@ export const buildAggs = (
* Default agg values for the active Facet
*/
aggs[facet.id] = {
// @ts-ignore
terms,
};
});
Expand Down
Loading

0 comments on commit 30ee21c

Please sign in to comment.