Skip to content

Commit 314f7ae

Browse files
authored
Merge pull request #173 from varun-raj/feat-august-release
Feat: August release
2 parents 7e48837 + 5c77473 commit 314f7ae

39 files changed

+3208
-433
lines changed

CONTRIBUTING.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,12 @@ You can find the API route here `pages/api/immich-proxy/[...path].ts`
2828
Since the `thumbnailPath` of Immich API doesnt give us a direct link to the image, I've created a proxy api that fetches the image and sends it back as a response.
2929

3030
**For Person's Thumbnail**
31-
You can find the API route here `pages/api/immich-proxy/thumbnail/[id].ts`
31+
You can find the API route here `pages/api/immich-proxy/thumbnail/[id].ts`
32+
33+
### Branching Strategy
34+
35+
- Always create a new branch for your changes
36+
- Always rebase your branch before creating a PR
37+
- Always squash your commits before merging
38+
- Always merge your branch into the `prerelease` branch
39+
- Always delete your branch after merging

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,26 @@ services:
4848
- .env
4949
```
5050
51-
Add the Immich API Key and immich url's to the env file (which you already have for the immich)
51+
Add the Immich API Key and immich url's to the env file (which you already have for the immich).
52+
You also need to add `DB_PORT` (Default 5432) and `DB_HOST`, which has to be set to the name of the immich database
53+
container (Default `immich_postgres`).
5254

5355
```bash
5456
IMMICH_API_KEY= # your_immich_api_key
5557
IMMICH_URL = "http://local-ip-of-immich:port" # Your immich instace ip address and port
5658
EXTERNAL_IMMICH_URL = "https://external-address" # External address of immich
5759
60+
DB_PORT = "5432"
61+
DB_HOST = "immich_postgres"
62+
5863
# Optional
5964
GOOGLE_MAPS_API_KEY= # Google Maps API Key
6065
GEMINI_API_KEY= # Gemini API Key
6166
```
6267
Refer here for obtaining Immich API Key: https://immich.app/docs/features/command-line-interface#obtain-the-api-key
6368

69+
> [!NOTE] When creating the API key, make sure you select all the permissions for the API key.
70+
6471
#### Method 2 - Portainer
6572

6673
If you're using portainer, run the docker using `docker run` and add the power tools to the same network as immich.
@@ -149,4 +156,4 @@ Google Gemini 1.5 Flash model is used for parsing your search query in "Find" pa
149156

150157
## Contributing
151158

152-
Feel free to contribute to this project, I'm open to any suggestions and improvements. Please read the [CONTRIBUTING.md](./CONTRIBUTING.md) for more details.
159+
Feel free to contribute to this project, I'm open to any suggestions and improvements. Please read the [CONTRIBUTING.md](./CONTRIBUTING.md) for more details.

bun.lockb

15.3 KB
Binary file not shown.

docs/VIRTUALIZED_ASSET_GRID.md

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# Virtualized Asset Grid Components
2+
3+
This document explains how to use the new React Window-based virtualized asset grid components for better performance with large datasets.
4+
5+
## Overview
6+
7+
The virtualized asset grid components provide significant performance improvements when displaying large numbers of assets by only rendering the items that are currently visible in the viewport. This is especially useful for photo galleries with thousands of images.
8+
9+
## Components
10+
11+
### 1. VirtualizedAssetGrid
12+
13+
A basic virtualized grid with fixed dimensions.
14+
15+
```tsx
16+
import VirtualizedAssetGrid from '@/components/shared/VirtualizedAssetGrid';
17+
18+
<VirtualizedAssetGrid
19+
assets={assets}
20+
selectable={true}
21+
onSelectionChange={handleSelectionChange}
22+
columnCount={5}
23+
itemSize={200}
24+
height={600}
25+
/>
26+
```
27+
28+
**Props:**
29+
- `assets`: Array of IAsset objects
30+
- `selectable`: Whether assets can be selected (default: false)
31+
- `onSelectionChange`: Callback when selection changes
32+
- `columnCount`: Number of columns (default: 5)
33+
- `itemSize`: Size of each item in pixels (default: 200)
34+
- `height`: Height of the grid container (default: 600)
35+
36+
### 2. ResponsiveVirtualizedAssetGrid
37+
38+
A responsive virtualized grid that automatically adjusts to container size.
39+
40+
```tsx
41+
import ResponsiveVirtualizedAssetGrid from '@/components/shared/ResponsiveVirtualizedAssetGrid';
42+
43+
<ResponsiveVirtualizedAssetGrid
44+
assets={assets}
45+
selectable={true}
46+
onSelectionChange={handleSelectionChange}
47+
targetItemSize={200}
48+
gap={8}
49+
minColumns={2}
50+
maxColumns={8}
51+
className="w-full h-full"
52+
/>
53+
```
54+
55+
**Props:**
56+
- `assets`: Array of IAsset objects
57+
- `selectable`: Whether assets can be selected (default: false)
58+
- `onSelectionChange`: Callback when selection changes
59+
- `targetItemSize`: Target size for each item (default: 200)
60+
- `gap`: Gap between items in pixels (default: 8)
61+
- `minColumns`: Minimum number of columns (default: 2)
62+
- `maxColumns`: Maximum number of columns (default: 8)
63+
- `className`: Additional CSS classes
64+
65+
## Features
66+
67+
### Selection
68+
Both components support asset selection with the following features:
69+
- Click to select/deselect individual assets
70+
- Shift+click for range selection
71+
- ESC key to clear all selections
72+
- Visual indicators for selected items
73+
74+
### Lightbox Integration
75+
Both components integrate with the existing lightbox for full-screen viewing:
76+
- Click on an asset to open in lightbox
77+
- Video support with duration display
78+
- Download functionality
79+
80+
### Performance Optimizations
81+
- Only renders visible items
82+
- Lazy loading of images
83+
- Efficient memory usage
84+
- Smooth scrolling performance
85+
86+
## Migration from AssetGrid
87+
88+
To migrate from the existing `AssetGrid` component:
89+
90+
### Before:
91+
```tsx
92+
import AssetGrid from '@/components/shared/AssetGrid';
93+
94+
<AssetGrid
95+
assets={assets}
96+
selectable={true}
97+
onSelectionChange={handleSelectionChange}
98+
/>
99+
```
100+
101+
### After:
102+
```tsx
103+
import ResponsiveVirtualizedAssetGrid from '@/components/shared/ResponsiveVirtualizedAssetGrid';
104+
105+
<div style={{ height: '600px', width: '100%' }}>
106+
<ResponsiveVirtualizedAssetGrid
107+
assets={assets}
108+
selectable={true}
109+
onSelectionChange={handleSelectionChange}
110+
targetItemSize={200}
111+
gap={8}
112+
minColumns={2}
113+
maxColumns={8}
114+
/>
115+
</div>
116+
```
117+
118+
**Important:** The virtualized components require a container with a defined height. Make sure to wrap them in a div with appropriate height styling.
119+
120+
## Custom Hook: useGridDimensions
121+
122+
The `useGridDimensions` hook can be used to calculate optimal grid dimensions:
123+
124+
```tsx
125+
import { useGridDimensions } from '@/hooks';
126+
127+
const gridDimensions = useGridDimensions({
128+
containerWidth: 800,
129+
containerHeight: 600,
130+
itemSize: 200,
131+
gap: 8,
132+
minColumns: 2,
133+
maxColumns: 8
134+
});
135+
```
136+
137+
## Example Usage
138+
139+
See `src/components/shared/AssetGridExample.tsx` for a complete example showing different configurations of the virtualized grid components.
140+
141+
## Performance Considerations
142+
143+
- Use `ResponsiveVirtualizedAssetGrid` for most use cases as it automatically adapts to container size
144+
- Set appropriate `targetItemSize` based on your design requirements
145+
- Consider using smaller `gap` values for dense layouts
146+
- The components work best with containers that have a defined height
147+
148+
## Browser Support
149+
150+
The components use modern browser APIs:
151+
- ResizeObserver (for responsive behavior)
152+
- IntersectionObserver (for lazy loading)
153+
- CSS Grid and Flexbox
154+
155+
For older browsers, consider using polyfills or the basic `VirtualizedAssetGrid` with fixed dimensions.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@radix-ui/react-alert-dialog": "^1.1.4",
2020
"@radix-ui/react-avatar": "^1.1.0",
2121
"@radix-ui/react-checkbox": "^1.1.2",
22+
"@radix-ui/react-context-menu": "^2.2.16",
2223
"@radix-ui/react-dialog": "^1.1.1",
2324
"@radix-ui/react-dropdown-menu": "^2.1.1",
2425
"@radix-ui/react-hover-card": "^1.1.1",
@@ -35,11 +36,12 @@
3536
"@remotion/cli": "4.0.232",
3637
"@remotion/eslint-plugin": "^4.0.232",
3738
"@tanstack/react-query": "^5.69.0",
38-
"@tanstack/react-table": "^8.20.1",
39+
"@tanstack/react-table": "^8.21.3",
3940
"@types/cookie": "^0.6.0",
4041
"@types/qs": "^6.9.15",
4142
"@types/react-autosuggest": "^10.1.11",
4243
"@types/react-calendar-heatmap": "^1.6.7",
44+
"@types/react-window": "^1.8.8",
4345
"@vis.gl/react-google-maps": "^1.4.2",
4446
"axios": "^1.7.4",
4547
"chrono-node": "^1.4.9",
@@ -66,6 +68,7 @@
6668
"react-hot-toast": "^2.5.1",
6769
"react-leaflet": "^4.2.1",
6870
"react-mentions": "^4.4.10",
71+
"react-window": "^1.8.11",
6972
"recharts": "^2.12.7",
7073
"remotion": "4.0.232",
7174
"sass": "^1.77.8",

0 commit comments

Comments
 (0)