Merge pull request #248 from immich-power-tools/feat/upgrade-nextjs

Feat/upgrade nextjs
This commit is contained in:
Varun Raj Manoharan authored and GitHub committed 2026-04-07 19:19:56 +05:30
commit 7a3a8713f1
14 files changed
+2200 -105

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
# Install dependencies only when needed
FROM oven/bun:1-alpine AS deps
WORKDIR /app
COPY package.json bun.lockb ./
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
# Rebuild the source code only when needed
+2014
View File
File diff suppressed because it is too large. Load diff
+31
View File
@@ -0,0 +1,31 @@
import { defineConfig } from "eslint/config";
import nextCoreWebVitals from "eslint-config-next/core-web-vitals";
import remotion from "@remotion/eslint-plugin";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default defineConfig([{
extends: [...nextCoreWebVitals],
plugins: {
"@remotion": remotion,
},
rules: {
"react-hooks/exhaustive-deps": "off",
"@next/next/no-img-element": "off",
},
}, {
files: ["remotion/*.{ts,tsx}"],
extends: [...compat.extends("plugin:@remotion/recommended")],
}]);
-3
View File
@@ -3,9 +3,6 @@
const nextConfig = {
reactStrictMode: false,
output: 'standalone',
experimental: {
instrumentationHook: true,
},
images: {
unoptimized: true,
},
+59 -56
View File
@@ -3,10 +3,10 @@
"version": "0.19.1",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start -p ${PORT:=3000} -H ${HOST:=0.0.0.0}",
"lint": "next lint",
"lint": "eslint .",
"db:generate": "drizzle-kit generate --config=drizzle.app.config.ts",
"db:migrate": "drizzle-kit migrate --config=drizzle.app.config.ts",
"db:studio": "drizzle-kit studio --config=drizzle.app.config.ts"
@@ -17,90 +17,93 @@
"url": "https://varunraj.in"
},
"dependencies": {
"@ai-sdk/openai": "^3.0.29",
"@ai-sdk/openai-compatible": "^2.0.30",
"@ai-sdk/react": "^3.0.88",
"@ai-sdk/openai": "^3.0.50",
"@ai-sdk/openai-compatible": "^2.0.38",
"@ai-sdk/react": "^3.0.148",
"@libsql/client": "^0.17.2",
"@radix-ui/react-accordion": "^1.2.1",
"@radix-ui/react-alert-dialog": "^1.1.4",
"@radix-ui/react-avatar": "^1.1.0",
"@radix-ui/react-checkbox": "^1.1.2",
"@radix-ui/react-accordion": "^1.2.12",
"@radix-ui/react-alert-dialog": "^1.1.15",
"@radix-ui/react-avatar": "^1.1.11",
"@radix-ui/react-checkbox": "^1.3.3",
"@radix-ui/react-context-menu": "^2.2.16",
"@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-hover-card": "^1.1.1",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-scroll-area": "^1.1.0",
"@radix-ui/react-select": "^2.1.1",
"@radix-ui/react-dialog": "^1.1.15",
"@radix-ui/react-dropdown-menu": "^2.1.16",
"@radix-ui/react-hover-card": "^1.1.15",
"@radix-ui/react-icons": "^1.3.2",
"@radix-ui/react-label": "^2.1.8",
"@radix-ui/react-popover": "^1.1.15",
"@radix-ui/react-scroll-area": "^1.2.10",
"@radix-ui/react-select": "^2.2.6",
"@radix-ui/react-slot": "^1.2.4",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-tabs": "^1.1.0",
"@radix-ui/react-toast": "^1.2.1",
"@radix-ui/react-tooltip": "^1.1.2",
"@radix-ui/react-switch": "^1.2.6",
"@radix-ui/react-tabs": "^1.1.13",
"@radix-ui/react-toast": "^1.2.15",
"@radix-ui/react-tooltip": "^1.2.8",
"@remotion/cli": "4.0.232",
"@remotion/eslint-plugin": "^4.0.232",
"@tanstack/react-query": "^5.69.0",
"@remotion/eslint-plugin": "^4.0.446",
"@tanstack/react-query": "^5.96.2",
"@tanstack/react-table": "^8.21.3",
"@types/cookie": "^0.6.0",
"@types/qs": "^6.9.15",
"@types/qs": "^6.15.0",
"@types/react-autosuggest": "^10.1.11",
"@types/react-calendar-heatmap": "^1.6.7",
"@types/react-calendar-heatmap": "^1.9.0",
"@types/react-window": "^1.8.8",
"ai": "^6.0.86",
"axios": "^1.7.4",
"ai": "^6.0.146",
"axios": "^1.14.0",
"chrono-node": "^1.4.9",
"class-variance-authority": "^0.7.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "1.0.0",
"compatibility": "^1.0.1",
"cookie": "^0.6.0",
"date-fns": "^3.6.0",
"date-fns-tz": "^3.2.0",
"drizzle-orm": "^0.45.1",
"jsonwebtoken": "^9.0.2",
"drizzle-orm": "^0.45.2",
"jsonwebtoken": "^9.0.3",
"leaflet": "^1.9.4",
"leaflet-defaulticon-compatibility": "0.1.2",
"leaflet.heat": "^0.2.0",
"lucide-react": "^0.428.0",
"next": "14.2.5",
"next": "15.5.14",
"next-themes": "^0.3.0",
"pg": "^8.12.0",
"qs": "^6.13.0",
"react": "^18",
"pg": "^8.20.0",
"qs": "^6.15.0",
"react": "19.2.4",
"react-autosuggest": "^10.1.0",
"react-day-picker": "9.0.8",
"react-dom": "^18",
"react-grid-gallery": "^1.0.1",
"react-hot-toast": "^2.5.1",
"react-dom": "19.2.4",
"react-hot-toast": "^2.6.0",
"react-leaflet": "^4.2.1",
"react-mentions": "^4.4.10",
"react-photo-album": "^3.5.1",
"react-window": "^1.8.11",
"recharts": "^2.12.7",
"recharts": "^2.15.4",
"remotion": "4.0.232",
"sass": "^1.77.8",
"tailwind-merge": "^2.5.2",
"sass": "^1.99.0",
"tailwind-merge": "^2.6.1",
"tailwindcss-animate": "^1.0.7",
"yet-another-react-lightbox": "^3.21.4",
"yet-another-react-lightbox": "^3.30.1",
"zod": "^4.3.6"
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "^5.68.0",
"@types/jsonwebtoken": "^9.0.6",
"@types/leaflet": "^1.9.15",
"@types/leaflet.heat": "^0.2.4",
"@types/node": "^20",
"@types/pg": "^8.11.6",
"@types/react": "^18",
"@types/react-dom": "^18",
"@tanstack/eslint-plugin-query": "^5.96.2",
"@types/jsonwebtoken": "^9.0.10",
"@types/leaflet": "^1.9.21",
"@types/leaflet.heat": "^0.2.5",
"@types/node": "^20.19.39",
"@types/pg": "^8.20.0",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"@types/react-mentions": "^4.4.1",
"autoprefixer": "^10.4.20",
"autoprefixer": "^10.4.27",
"drizzle-kit": "^0.31.10",
"eslint": "^8",
"eslint-config-next": "14.2.5",
"postcss": "^8.4.41",
"tailwindcss": "^3.4.10",
"typescript": "^5"
"eslint": "^9.39.4",
"eslint-config-next": "15.5.14",
"postcss": "^8.5.8",
"tailwindcss": "^3.4.19",
"typescript": "^5.9.3"
},
"overrides": {
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3"
}
}
+10 -3
View File
@@ -5,9 +5,16 @@ import 'leaflet.heat';
import { getAssetGeoHeatmap, IHeatMapParams } from '@/handlers/api/asset.handler';
import { Loader2 } from 'lucide-react';
// Fix for default markers in Leaflet
import 'leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.css';
import 'leaflet-defaulticon-compatibility';
// Fix default marker icons for bundlers that don't support ~ aliases
import markerIcon2x from 'leaflet/dist/images/marker-icon-2x.png';
import markerIcon from 'leaflet/dist/images/marker-icon.png';
import markerShadow from 'leaflet/dist/images/marker-shadow.png';
L.Icon.Default.mergeOptions({
iconUrl: markerIcon.src,
iconRetinaUrl: markerIcon2x.src,
shadowUrl: markerShadow.src,
});
interface LeafletHeatMapProps {
filters: IHeatMapParams;
+11 -2
View File
@@ -21,8 +21,17 @@ import { Button } from '@/components/ui/button'
import { toast } from '@/components/ui/use-toast'
import L from 'leaflet'
import 'leaflet/dist/leaflet.css'
import 'leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.css'
import 'leaflet-defaulticon-compatibility'
// Fix default marker icons for bundlers that don't support ~ aliases
import markerIcon2x from 'leaflet/dist/images/marker-icon-2x.png'
import markerIcon from 'leaflet/dist/images/marker-icon.png'
import markerShadow from 'leaflet/dist/images/marker-shadow.png'
L.Icon.Default.mergeOptions({
iconUrl: markerIcon.src,
iconRetinaUrl: markerIcon2x.src,
shadowUrl: markerShadow.src,
})
export interface IAssetDetail {
id: string
@@ -4,8 +4,16 @@
import "leaflet/dist/leaflet.css";
import L, { LatLngExpression } from 'leaflet';
import 'leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.webpack.css'; // Re-uses images from ~leaflet package
import 'leaflet-defaulticon-compatibility';
// Fix default marker icons for bundlers that don't support ~ aliases
import markerIcon2x from 'leaflet/dist/images/marker-icon-2x.png';
import markerIcon from 'leaflet/dist/images/marker-icon.png';
import markerShadow from 'leaflet/dist/images/marker-shadow.png';
L.Icon.Default.mergeOptions({
iconUrl: markerIcon.src,
iconRetinaUrl: markerIcon2x.src,
shadowUrl: markerShadow.src,
});
import { MapContainer, TileLayer, useMapEvents } from "react-leaflet";
import { useState } from "react";
@@ -28,7 +28,7 @@ export default function TagMissingLocationOSMSearchAndAdd(
) {
const { toast } = useToast();
const [searchedPlaces, setSearchedPlaces] = useState<IPlace[] | null>(null);
const searchTimer = useRef<NodeJS.Timeout>();
const searchTimer = useRef<NodeJS.Timeout>(undefined);
const [loading, setLoading] = useState(false);
const [submitting, setSubmitting] = useState(false);
const [selectedPlace, setSelectedPlace] = useState<IPlace | null>(null);
@@ -23,7 +23,7 @@ export default function TagMissingLocationSearchAndAdd(
) {
const { toast } = useToast();
const [searchedPlaces, setSearchedPlaces] = useState<IPlace[] | null>(null);
const searchTimer = useRef<NodeJS.Timeout>();
const searchTimer = useRef<NodeJS.Timeout>(undefined);
const [loading, setLoading] = useState(false);
const [submitting, setSubmitting] = useState(false);
const [selectedPlace, setSelectedPlace] = useState<IPlace | null>(null);
@@ -54,7 +54,7 @@ export function PersonMergeDropdown({
const [open, setOpen] = useState(false);
const [loading, setLoading] = useState(false);
const [similarLoading, setSimilarLoading] = useState(true);
const searchTimer = useRef<NodeJS.Timeout>();
const searchTimer = useRef<NodeJS.Timeout>(undefined);
const [selectedPeople, setSelectedPeople] = useState<IPerson[]>([]);
const [primaryPerson, setPrimaryPerson] = useState<IPerson>(person);
const [merging, setMerging] = useState(false);
+45 -22
View File
@@ -1,9 +1,11 @@
import "yet-another-react-lightbox/styles.css";
import "react-photo-album/rows.css";
import { IAsset } from '@/types/asset';
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useState, useCallback } from 'react'
import Lightbox from 'yet-another-react-lightbox';
import { Gallery } from "react-grid-gallery";
import { RowsPhotoAlbum } from "react-photo-album";
import type { Photo, RenderImageContext, RenderImageProps } from "react-photo-album";
import LazyGridImage from "../ui/lazy-grid-image";
import Download from "yet-another-react-lightbox/plugins/download";
import Video from "yet-another-react-lightbox/plugins/video";
@@ -16,6 +18,12 @@ import { toast } from '@/components/ui/use-toast';
const AssetInfoPanel = dynamic(() => import('@/components/asset-info/AssetInfoPanel'), { ssr: false });
export interface AssetPhoto extends Photo {
id: string;
isVideo: boolean;
duration?: string;
isSelected: boolean;
}
interface AssetGridProps {
assets: IAsset[];
@@ -99,7 +107,7 @@ const AssetGrid = forwardRef<AssetGridRef, AssetGridProps>(({ assets, isInternal
}), [assets, selectedIds, updateContext]);
const handleClick = (index: number, asset: IAsset, event: React.MouseEvent<HTMLElement>) => {
const handleClick = (index: number, asset: AssetPhoto, event: React.MouseEvent) => {
if (selectedIds.length > 0) {
handleSelect(index, asset, event);
} else {
@@ -107,7 +115,7 @@ const AssetGrid = forwardRef<AssetGridRef, AssetGridProps>(({ assets, isInternal
}
}
const handleSelect = (_idx: number, asset: IAsset, event: React.MouseEvent<HTMLElement>) => {
const handleSelect = (_idx: number, asset: AssetPhoto, event: React.MouseEvent) => {
event.stopPropagation();
const isPresent = selectedIds.includes(asset.id);
@@ -157,26 +165,17 @@ const AssetGrid = forwardRef<AssetGridRef, AssetGridProps>(({ assets, isInternal
}));
}, [assets]);
const images = useMemo(() => {
const images: AssetPhoto[] = useMemo(() => {
return assets.map((p) => ({
...p,
src: p.url as string,
original: p.previewUrl as string,
width: p.exifImageWidth / 10 as number,
height: p.exifImageHeight / 10 as number,
width: p.exifImageWidth as number,
height: p.exifImageHeight as number,
orientation: 1,
isSelected: selectedIds.includes(p.id),
isVideo: p.type === "VIDEO",
tags: [
{
title: "Immich Link",
value: (
<a href={exImmichUrl + "/photos/" + p.id} target="_blank" rel="noopener noreferrer">
Open in Immich
</a>
),
},
],
duration: p.duration != null ? String(p.duration) : undefined,
}));
}, [assets, selectedIds, exImmichUrl]);
@@ -193,6 +192,17 @@ const AssetGrid = forwardRef<AssetGridRef, AssetGridProps>(({ assets, isInternal
return () => window.removeEventListener("keydown", handleEsc);
}, [images]);
const renderImage = (props: RenderImageProps, context: RenderImageContext<AssetPhoto>) => {
return (
<LazyGridImage
imageProps={props}
photo={context.photo}
width={context.width}
height={context.height}
/>
);
};
const handleOpenInImmich = useCallback(() => {
if (currentAsset) {
window.open(exImmichUrl + "/photos/" + currentAsset.id, "_blank");
@@ -287,12 +297,25 @@ const AssetGrid = forwardRef<AssetGridRef, AssetGridProps>(({ assets, isInternal
},
}}
/>
<Gallery
images={images}
onClick={handleClick}
enableImageSelection={selectable}
thumbnailImageComponent={LazyGridImage}
onSelect={handleSelect}
<RowsPhotoAlbum
photos={images}
targetRowHeight={150}
rowConstraints={{ singleRowMaxHeight: 300 }}
onClick={({ index, event, photo }) => handleClick(index, photo, event)}
render={{
image: renderImage,
extras: (_, { photo }) => (
<a
href={exImmichUrl + "/photos/" + photo.id}
target="_blank"
rel="noopener noreferrer"
className="absolute bottom-1 left-1 bg-black/60 text-yellow-300 text-xs px-2 py-0.5 rounded"
onClick={(e) => e.stopPropagation()}
>
Open in Immich
</a>
),
}}
/>
</div>
);
+1 -1
View File
@@ -45,7 +45,7 @@ const Autocomplete = React.forwardRef<HTMLInputElement, AutocompleteProps>(
const [selectedIndex, setSelectedIndex] = React.useState(-1)
const containerRef = React.useRef<HTMLDivElement>(null)
const inputRef = React.useRef<HTMLInputElement>(null)
const debounceTimeout = React.useRef<NodeJS.Timeout>()
const debounceTimeout = React.useRef<NodeJS.Timeout>(undefined)
// Find the label for the current value
const currentLabel = React.useMemo(() => {
+15 -12
View File
@@ -2,16 +2,19 @@
import { humanizeDuration } from '@/helpers/string.helper'
import { PlayIcon } from '@radix-ui/react-icons'
import React, { useEffect } from 'react'
import { Image, ImageExtended, ThumbnailImageProps } from 'react-grid-gallery'
import type { RenderImageProps } from 'react-photo-album'
import type { AssetPhoto } from '../shared/AssetGrid'
interface LazyImageProps extends ThumbnailImageProps<ImageExtended<Image & { isVideo?: boolean, duration?: string }>> {}
interface LazyGridImageProps {
imageProps: RenderImageProps;
photo: AssetPhoto;
width: number;
height: number;
}
export default function LazyGridImage(
props: LazyImageProps
) {
export default function LazyGridImage({ imageProps, photo, width, height }: LazyGridImageProps) {
const [isVisible, setIsVisible] = React.useState(false)
const imageRef = React.useRef<HTMLImageElement>(null)
const imageRef = React.useRef<HTMLDivElement>(null)
const setupObserver = () => {
const observer = new IntersectionObserver((entries) => {
@@ -38,15 +41,15 @@ export default function LazyGridImage(
}, [])
if (!isVisible) return (
<div style={{ height: props.height }} ref={imageRef} />
<div style={{ height, width }} ref={imageRef} />
)
return (
<div>
<img {...props.imageProps} alt={props.imageProps.alt || ""} title="" />
{props.item.isVideo && <div className="absolute bottom-2 right-2 bg-black/50 p-1 rounded-full flex items-center gap-1">
<div style={{ position: 'relative', width, height }}>
<img {...imageProps} alt={imageProps.alt || ""} title="" style={{ ...imageProps.style, width, height, objectFit: 'cover' }} />
{photo.isVideo && <div className="absolute bottom-2 right-2 bg-black/50 p-1 rounded-full flex items-center gap-1">
<PlayIcon className="w-3 h-3 text-white" />
{!!props.item.duration && <span className="text-xs text-white">{humanizeDuration(props.item.duration)}</span>}
{!!photo.duration && <span className="text-xs text-white">{humanizeDuration(photo.duration)}</span>}
</div>}
</div>
)