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