mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 18:13:31 +00:00
fix share date setting, notification, lint fix
This commit is contained in:
parent
53499e2579
commit
c21f7df7b2
3 changed files with 10 additions and 9 deletions
|
|
@ -846,12 +846,12 @@ export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
|
|||
rightIcon: (
|
||||
<Group ref={setRatingsRef as any}>
|
||||
<Rating
|
||||
value={rating}
|
||||
onChange={(e) => {
|
||||
handleUpdateRating(e);
|
||||
setRating(e);
|
||||
}}
|
||||
size="xs"
|
||||
value={rating}
|
||||
/>
|
||||
</Group>
|
||||
),
|
||||
|
|
@ -891,6 +891,7 @@ export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
|
|||
handleOpenItemDetails,
|
||||
handlePlay,
|
||||
handleUpdateRating,
|
||||
rating,
|
||||
]);
|
||||
|
||||
const mergedRef = useMergedRef(ref, clickOutsideRef);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { useForm } from '@mantine/form';
|
||||
import { closeModal, ContextModalProps } from '@mantine/modals';
|
||||
import dayjs from 'dayjs';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useShareItem } from '/@/renderer/features/sharing/mutations/share-item-mutation';
|
||||
|
|
@ -26,8 +27,7 @@ export const ShareItemContextModal = ({
|
|||
const shareItemMutation = useShareItem({});
|
||||
|
||||
// Uses the same default as Navidrome: 1 year
|
||||
const defaultDate = new Date();
|
||||
defaultDate.setFullYear(defaultDate.getFullYear() + 1);
|
||||
const defaultDate = dayjs().add(1, 'year').format('YYYY-MM-DD HH:mm:ss');
|
||||
|
||||
const form = useForm({
|
||||
initialValues: {
|
||||
|
|
@ -37,7 +37,7 @@ export const ShareItemContextModal = ({
|
|||
},
|
||||
validate: {
|
||||
expires: (value) =>
|
||||
value > new Date()
|
||||
dayjs(value).isAfter(dayjs())
|
||||
? null
|
||||
: t('form.shareItem.expireInvalid', {
|
||||
postProcess: 'sentenceCase',
|
||||
|
|
@ -51,7 +51,7 @@ export const ShareItemContextModal = ({
|
|||
body: {
|
||||
description: values.description,
|
||||
downloadable: values.allowDownloading,
|
||||
expires: values.expires.getTime(),
|
||||
expires: dayjs(values.expires).valueOf(),
|
||||
resourceIds: itemIds.join(),
|
||||
resourceType,
|
||||
},
|
||||
|
|
@ -105,7 +105,7 @@ export const ShareItemContextModal = ({
|
|||
postProcess: 'titleCase',
|
||||
})}
|
||||
minDate={new Date()}
|
||||
placeholder={defaultDate.toLocaleDateString()}
|
||||
placeholder={defaultDate}
|
||||
popoverProps={{ withinPortal: true }}
|
||||
valueFormat="MM/DD/YYYY HH:mm"
|
||||
{...form.getInputProps('expires')}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { NotificationsProps as MantineNotificationProps } from '@mantine/notifications';
|
||||
import type { NotificationData } from '@mantine/notifications';
|
||||
|
||||
import {
|
||||
cleanNotifications,
|
||||
|
|
@ -11,7 +11,7 @@ import clsx from 'clsx';
|
|||
|
||||
import styles from './toast.module.css';
|
||||
|
||||
interface NotificationProps extends MantineNotificationProps {
|
||||
interface NotificationProps extends Omit<NotificationData, 'message'> {
|
||||
message?: string;
|
||||
onClose?: () => void;
|
||||
type?: 'error' | 'info' | 'success' | 'warning';
|
||||
|
|
@ -26,7 +26,7 @@ const getTitle = (type: NotificationProps['type']) => {
|
|||
|
||||
const showToast = ({ message, onClose, type, ...props }: NotificationProps) => {
|
||||
return notifications.show({
|
||||
autoClose: props.autoClose,
|
||||
...props,
|
||||
classNames: {
|
||||
body: styles.body,
|
||||
closeButton: styles.closeButton,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue