Skip to content

Commit

Permalink
refactor: update Next.js images
Browse files Browse the repository at this point in the history
  • Loading branch information
gauthier-th committed Jun 15, 2024
1 parent 9ab5fa5 commit 63d8f55
Show file tree
Hide file tree
Showing 20 changed files with 3,614 additions and 3,696 deletions.
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"express-openapi-validator": "4.13.8",
"express-rate-limit": "6.7.0",
"express-session": "1.17.3",
"formik": "2.2.9",
"formik": "^2.4.6",
"gravatar-url": "3.1.0",
"intl": "1.2.5",
"lodash": "4.17.21",
Expand All @@ -77,7 +77,7 @@
"react-aria": "3.23.0",
"react-dom": "^18.3.1",
"react-intersection-observer": "9.4.3",
"react-intl": "6.2.10",
"react-intl": "^6.6.8",
"react-markdown": "8.0.5",
"react-popper-tooltip": "4.4.2",
"react-select": "5.7.0",
Expand Down Expand Up @@ -170,8 +170,6 @@
},
"resolutions": {
"sqlite3/node-gyp": "8.4.1",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"@types/express-session": "1.17.6"
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ app
try {
const descriptor = Object.getOwnPropertyDescriptor(req, 'ip');
if (descriptor?.writable === true) {
req.ip = getClientIp(req) ?? '';
(req as any).ip = getClientIp(req) ?? '';
}
} catch (e) {
logger.error('Failed to attach the ip to the request', {
Expand Down
7 changes: 4 additions & 3 deletions src/components/CollectionDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ const CollectionDetails = ({ collection }: CollectionDetailsProps) => {
<CachedImage
alt=""
src={`https://image.tmdb.org/t/p/w1920_and_h800_multi_faces/${data.backdropPath}`}
layout="fill"
objectFit="cover"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
fill
priority
/>
<div
Expand Down Expand Up @@ -228,7 +228,8 @@ const CollectionDetails = ({ collection }: CollectionDetailsProps) => {
: '/images/overseerr_poster_not_found.png'
}
alt=""
layout="responsive"
sizes="100vw"
style={{ width: '100%', height: 'auto' }}
width={600}
height={900}
priority
Expand Down
4 changes: 2 additions & 2 deletions src/components/Common/CachedImage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useSettings from '@app/hooks/useSettings';
import type { ImageLoader, ImageProps } from 'next/legacy/image';
import Image from 'next/legacy/image';
import type { ImageLoader, ImageProps } from 'next/image';
import Image from 'next/image';

const imageLoader: ImageLoader = ({ src }) => src;

Expand Down
4 changes: 2 additions & 2 deletions src/components/Common/ImageFader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ const ImageFader: ForwardRefRenderFunction<HTMLDivElement, ImageFaderProps> = (
className="absolute inset-0 h-full w-full"
alt=""
src={imageUrl}
layout="fill"
objectFit="cover"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
fill
{...overrides}
/>
<div
Expand Down
4 changes: 2 additions & 2 deletions src/components/Common/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
<CachedImage
alt=""
src={backdrop}
layout="fill"
objectFit="cover"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
fill
priority
/>
<div
Expand Down
4 changes: 2 additions & 2 deletions src/components/CompanyCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const CompanyCard = ({ image, url, name }: CompanyCardProps) => {
src={image}
alt={name}
className="relative z-40 h-full w-full"
layout="fill"
objectFit="contain"
style={{ width: '100%', height: '100%', objectFit: 'contain' }}
fill
/>
</div>
<div
Expand Down
7 changes: 6 additions & 1 deletion src/components/GenreCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ const GenreCard = ({ image, url, name, canExpand = false }: GenreCardProps) => {
role="link"
tabIndex={0}
>
<CachedImage src={image} alt="" layout="fill" objectFit="cover" />
<CachedImage
src={image}
alt=""
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
fill
/>
<div
className={`absolute inset-0 z-10 h-full w-full bg-gray-800 transition duration-300 ${
isHovered ? 'bg-opacity-10' : 'bg-opacity-30'
Expand Down
7 changes: 4 additions & 3 deletions src/components/IssueDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ const IssueDetails = () => {
<CachedImage
alt=""
src={`https://image.tmdb.org/t/p/w1920_and_h800_multi_faces/${data.backdropPath}`}
layout="fill"
objectFit="cover"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
fill
priority
/>
<div
Expand All @@ -232,7 +232,8 @@ const IssueDetails = () => {
: '/images/overseerr_poster_not_found.png'
}
alt=""
layout="responsive"
sizes="100vw"
style={{ width: '100%', height: 'auto' }}
width={600}
height={900}
priority
Expand Down
8 changes: 4 additions & 4 deletions src/components/IssueList/IssueItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ const IssueItem = ({ issue }: IssueItemProps) => {
<CachedImage
src={`https://image.tmdb.org/t/p/w1920_and_h800_multi_faces/${title.backdropPath}`}
alt=""
layout="fill"
objectFit="cover"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
fill
/>
<div
className="absolute inset-0"
Expand Down Expand Up @@ -142,10 +142,10 @@ const IssueItem = ({ issue }: IssueItemProps) => {
: '/images/overseerr_poster_not_found.png'
}
alt=""
layout="responsive"
sizes="100vw"
style={{ width: '100%', height: 'auto', objectFit: 'cover' }}
width={600}
height={900}
objectFit="cover"
/>
</Link>
<div className="flex flex-col justify-center overflow-hidden pl-2 xl:pl-4">
Expand Down
14 changes: 9 additions & 5 deletions src/components/MovieDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
<CachedImage
alt=""
src={`https://image.tmdb.org/t/p/w1920_and_h800_multi_faces/${data.backdropPath}`}
layout="fill"
objectFit="cover"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
fill
priority
/>
<div
Expand Down Expand Up @@ -340,7 +340,8 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
: '/images/overseerr_poster_not_found.png'
}
alt=""
layout="responsive"
sizes="100vw"
style={{ width: '100%', height: 'auto' }}
width={600}
height={900}
priority
Expand Down Expand Up @@ -527,8 +528,11 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
<CachedImage
src={`https://image.tmdb.org/t/p/w1440_and_h320_multi_faces/${data.collection.backdropPath}`}
alt=""
layout="fill"
objectFit="cover"
style={{
width: '100%',
height: '100%',
objectFit: 'cover',
}}
/>
<div
className="absolute inset-0"
Expand Down
7 changes: 5 additions & 2 deletions src/components/PersonCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ const PersonCard = ({
<CachedImage
src={`https://image.tmdb.org/t/p/w600_and_h900_bestv2${profilePath}`}
alt=""
layout="fill"
objectFit="cover"
style={{
width: '100%',
height: '100%',
objectFit: 'cover',
}}
/>
</div>
) : (
Expand Down
4 changes: 2 additions & 2 deletions src/components/PersonDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ const PersonDetails = () => {
<CachedImage
src={`https://image.tmdb.org/t/p/w600_and_h900_bestv2${data.profilePath}`}
alt=""
layout="fill"
objectFit="cover"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
fill
/>
</div>
)}
Expand Down
7 changes: 4 additions & 3 deletions src/components/RequestCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ const RequestCard = ({ request, onTitleData }: RequestCardProps) => {
<CachedImage
alt=""
src={`https://image.tmdb.org/t/p/w1920_and_h800_multi_faces/${title.backdropPath}`}
layout="fill"
objectFit="cover"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
fill
/>
<div
className="absolute inset-0"
Expand Down Expand Up @@ -582,7 +582,8 @@ const RequestCard = ({ request, onTitleData }: RequestCardProps) => {
: '/images/overseerr_poster_not_found.png'
}
alt=""
layout="responsive"
sizes="100vw"
style={{ width: '100%', height: 'auto' }}
width={600}
height={900}
/>
Expand Down
8 changes: 4 additions & 4 deletions src/components/RequestList/RequestItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ const RequestItem = ({ request, revalidateList }: RequestItemProps) => {
<CachedImage
src={`https://image.tmdb.org/t/p/w1920_and_h800_multi_faces/${title.backdropPath}`}
alt=""
layout="fill"
objectFit="cover"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
fill
/>
<div
className="absolute inset-0"
Expand Down Expand Up @@ -412,10 +412,10 @@ const RequestItem = ({ request, revalidateList }: RequestItemProps) => {
: '/images/overseerr_poster_not_found.png'
}
alt=""
layout="responsive"
sizes="100vw"
style={{ width: '100%', height: 'auto', objectFit: 'cover' }}
width={600}
height={900}
objectFit="cover"
/>
</Link>
<div className="flex flex-col justify-center overflow-hidden pl-2 xl:pl-4">
Expand Down
8 changes: 6 additions & 2 deletions src/components/RequestModal/CollectionRequestModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,14 @@ const CollectionRequestModal = ({
: '/images/overseerr_poster_not_found.png'
}
alt=""
layout="responsive"
sizes="100vw"
style={{
width: '100%',
height: 'auto',
objectFit: 'cover',
}}
width={600}
height={900}
objectFit="cover"
/>
</div>
<div className="flex flex-col justify-center pl-2">
Expand Down
16 changes: 10 additions & 6 deletions src/components/Selector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,11 @@ export const WatchProviderSelector = ({
<CachedImage
src={`https://image.tmdb.org/t/p/original${provider.logoPath}`}
alt=""
layout="responsive"
width="100%"
height="100%"
style={{
width: '100%',
height: '100%',
objectFit: 'contain',
}}
className="rounded-lg"
/>
{isActive && (
Expand Down Expand Up @@ -418,9 +420,11 @@ export const WatchProviderSelector = ({
<CachedImage
src={`https://image.tmdb.org/t/p/original${provider.logoPath}`}
alt=""
layout="responsive"
width="100%"
height="100%"
style={{
width: '100%',
height: '100%',
objectFit: 'cover',
}}
className="rounded-lg"
/>
{isActive && (
Expand Down
4 changes: 2 additions & 2 deletions src/components/TitleCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ const TitleCard = ({
? `https://image.tmdb.org/t/p/w300_and_h450_face${image}`
: `/images/overseerr_poster_not_found_logo_top.png`
}
layout="fill"
objectFit="cover"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
fill
/>
<div className="absolute left-0 right-0 flex items-center justify-between p-2">
<div
Expand Down
7 changes: 4 additions & 3 deletions src/components/TvDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
<CachedImage
alt=""
src={`https://image.tmdb.org/t/p/w1920_and_h800_multi_faces/${data.backdropPath}`}
layout="fill"
objectFit="cover"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
fill
priority
/>
<div
Expand Down Expand Up @@ -365,7 +365,8 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
: '/images/overseerr_poster_not_found.png'
}
alt=""
layout="responsive"
sizes="100vw"
style={{ width: '100%', height: 'auto' }}
width={600}
height={900}
priority
Expand Down
Loading

0 comments on commit 63d8f55

Please sign in to comment.