Release/v0.2.31 (#188)

This commit is contained in:
Doh
2026-03-07 09:53:36 -05:00
committed by GitHub
parent b01c5dcd6a
commit 62b5ea41b3
21 changed files with 548 additions and 56 deletions

View File

@@ -14,7 +14,7 @@ import {
} from '@/components/ui/dropdown-menu'
import { updateLastNotificationReadTimestamp } from '@/app/actions/data';
import { d2t, getNow, t2d } from '@/lib/utils';
import { User, CoinTransaction } from '@/lib/types';
import { CoinTransaction } from '@/lib/types';
export default function NotificationBell() {
const t = useTranslations('NotificationBell');
@@ -121,7 +121,7 @@ export default function NotificationBell() {
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="p-0 w-80 md:w-96">
<NotificationDropdown
currentUser={currentUser as User | null} // Cast needed as as currentUser can be undefined
currentUser={currentUser ?? null}
unreadNotifications={unreadNotifications}
displayedReadNotifications={displayedReadNotifications}
habitsData={habitsData} // Pass necessary data down

View File

@@ -2,7 +2,7 @@ import React from 'react';
import { ScrollArea } from '@/components/ui/scroll-area';
import { Separator } from '@/components/ui/separator';
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
import { HabitsData, WishlistData, UserData, User, CoinTransaction } from '@/lib/types';
import { HabitsData, WishlistData, PublicUserData, PublicUser, CoinTransaction } from '@/lib/types';
import { t2d } from '@/lib/utils';
import Link from 'next/link';
import { DropdownMenuItem } from '@/components/ui/dropdown-menu';
@@ -16,12 +16,12 @@ import {
} from '@/components/ui/tooltip';
interface NotificationDropdownProps {
currentUser: User | null;
currentUser: PublicUser | null;
unreadNotifications: CoinTransaction[];
displayedReadNotifications: CoinTransaction[];
habitsData: HabitsData;
wishlistData: WishlistData;
usersData: UserData;
usersData: PublicUserData;
}
// Helper function to get the name of the related item
@@ -48,7 +48,7 @@ export default function NotificationDropdown({
const t = useTranslations('NotificationDropdown');
// Helper function to generate notification message, now using t
const getNotificationMessage = (tx: CoinTransaction, triggeringUser?: User, relatedItemName?: string): string => {
const getNotificationMessage = (tx: CoinTransaction, triggeringUser?: PublicUser, relatedItemName?: string): string => {
const username = triggeringUser?.username || t('defaultUsername');
const itemName = relatedItemName || t('defaultItemName');
switch (tx.type) {

View File

@@ -5,13 +5,13 @@ import { Input } from './ui/input';
import { Button } from './ui/button';
import { Label } from './ui/label';
import { User as UserIcon } from 'lucide-react';
import { User } from '@/lib/types';
import { SafeUser } from '@/lib/types';
import { toast } from '@/hooks/use-toast';
import { useState } from 'react';
import { useTranslations } from 'next-intl';
interface PasswordEntryFormProps {
user: User;
user: SafeUser;
onCancel: () => void;
onSubmit: (password: string) => Promise<void>;
error?: string;
@@ -24,7 +24,7 @@ export default function PasswordEntryForm({
error
}: PasswordEntryFormProps) {
const t = useTranslations('PasswordEntryForm');
const hasPassword = !!user.password;
const hasPassword = user.hasPassword ?? false;
const [password, setPassword] = useState('');
const handleSubmit = async (e: React.FormEvent) => {

View File

@@ -59,7 +59,7 @@ export default function UserForm({ userId, onCancel, onSuccess }: UserFormProps)
const [avatarPath, setAvatarPath] = useState(user?.avatarPath)
const [username, setUsername] = useState(user?.username || '');
const [password, setPassword] = useState<string | undefined>('');
const [disablePassword, setDisablePassword] = useState(user?.password === '' || serverSettings.isDemo);
const [disablePassword, setDisablePassword] = useState(user ? !user.hasPassword : serverSettings.isDemo);
const [error, setError] = useState('');
const [avatarFile, setAvatarFile] = useState<File | null>(null);
const [isAdmin, setIsAdmin] = useState(user?.isAdmin || false);
@@ -173,7 +173,7 @@ export default function UserForm({ userId, onCancel, onSuccess }: UserFormProps)
avatarPath,
permissions,
isAdmin,
password: disablePassword ? '' : (password || u.password) // use the correct password to update atom
hasPassword: disablePassword ? false : (password ? true : !!u.hasPassword)
} : u
),
}));

View File

@@ -14,7 +14,7 @@ import { signIn } from '@/app/actions/user';
import { useTranslations } from 'next-intl';
import { toast } from '@/hooks/use-toast';
import { Description } from '@radix-ui/react-dialog';
import { SafeUser, User } from '@/lib/types';
import { SafeUser } from '@/lib/types';
import { cn } from '@/lib/utils';
@@ -25,7 +25,7 @@ function UserCard({
showEdit,
isCurrentUser,
}: {
user: User,
user: SafeUser,
onSelect: () => void,
onEdit: () => void,
showEdit: boolean,
@@ -100,7 +100,7 @@ function UserSelectionView({
onEditUser,
onCreateUser,
}: {
users: User[],
users: SafeUser[],
currentUserFromHook?: SafeUser,
onUserSelect: (userId: string) => void,
onEditUser: (userId: string) => void,