Skip to content

Commit 3614c26

Browse files
committed
fix: minor design fixes and navigation fixes
Signed-off-by: Varun Raj <mailme@varunraj.in>
1 parent d3fd120 commit 3614c26

File tree

3 files changed

+33
-15
lines changed

3 files changed

+33
-15
lines changed

src/components/albums/potential-albums/PotentialDateItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export default function PotentialDateItem({ record, onSelect }: IProps) {
1515
onClick={() => onSelect(record.date)}
1616
key={record.date}
1717
className={
18-
cn("flex gap-1 flex-col p-2 py-1 rounded-lg hover:dark:bg-zinc-800 hover:bg-zinc-100 px-4",
19-
startDate === record.date ? "bg-zinc-100" : "")
18+
cn("flex gap-1 flex-col p-2 py-1 rounded-lg hover:dark:bg-zinc-800 border border-transparent hover:bg-zinc-100 px-4",
19+
startDate === record.date ? "bg-zinc-100 dark:bg-zinc-800 border-gray-300 dark:border-zinc-700" : "")
2020
}
2121
>
2222
<p className="font-mono text-sm">{record.date}</p>

src/components/people/PersonItem.tsx

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,44 @@ import Link from "next/link";
1010
import { ENV } from "@/config/environment";
1111
import { ArrowUpRight } from "lucide-react";
1212
import { useConfig } from "@/contexts/ConfigContext";
13+
import { useToast } from "../ui/use-toast";
1314

1415
interface IProps {
1516
person: IPerson;
1617
}
1718
export default function PersonItem({ person }: IProps) {
1819
const { immichURL } = useConfig();
20+
const { toast } = useToast();
1921
const [editMode, setEditMode] = useState(false);
2022
const [loading, setLoading] = useState(false);
2123
const [formData, setFormData] = useState(person);
2224

2325
const handleEdit = () => {
24-
setLoading(true);
25-
return updatePerson(person.id, {
26-
name: formData.name,
27-
})
28-
.then(() => {
29-
setEditMode(!editMode);
26+
if (formData.name && formData.name !== person.name) {
27+
setLoading(true);
28+
return updatePerson(person.id, {
29+
name: formData.name,
3030
})
31-
.catch(() => {})
32-
.finally(() => {
33-
setLoading(false);
34-
});
31+
.then(() => {
32+
setEditMode(!editMode);
33+
toast({
34+
title: "Success",
35+
description: "Person updated successfully",
36+
});
37+
})
38+
.catch(() => {
39+
toast({
40+
title: "Error",
41+
description: "Failed to update person",
42+
variant: "destructive",
43+
});
44+
})
45+
.finally(() => {
46+
setLoading(false);
47+
});
48+
} else {
49+
setEditMode(!editMode);
50+
}
3551
};
3652

3753
const handleHide = (hidden: boolean) => {
@@ -76,7 +92,7 @@ export default function PersonItem({ person }: IProps) {
7692

7793
<div className="absolute top-2 left-2 group-hover:block hidden">
7894
<Link
79-
className="bg-green-300 block rounded-lg px-2 py-1 text-sm"
95+
className="bg-green-300 block rounded-lg px-2 py-1 text-sm dark:text-gray-900"
8096
href={`${immichURL}/people/${person.id}`}
8197
target="_blank"
8298
>

src/pages/_app.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@ import type { AppProps } from "next/app";
44
import { ThemeProvider } from "next-themes";
55
import { ENV } from "@/config/environment";
66
import ConfigContext from "@/contexts/ConfigContext";
7+
import { useRef } from "react";
78

89
interface AppPropsWithProps extends AppProps {
910
props: {
1011
immichURL: string;
1112
};
1213
}
1314
const App = ({ Component, pageProps, ...props }: AppPropsWithProps) => {
14-
console.log("App -> pageProps", props);
15+
const intialData = useRef(props.props);
16+
1517
return (
16-
<ConfigContext.Provider value={props.props}>
18+
<ConfigContext.Provider value={intialData.current}>
1719
<ThemeProvider attribute="class" storageKey="theme">
1820
<RootLayout>
1921
<Component {...pageProps} />

0 commit comments

Comments
 (0)