chore: upgrade deps and remove unused file
This commit is contained in:
@@ -102,18 +102,18 @@ export const AttachedFilesButton: FunctionComponent<Props> = observer(
|
||||
|
||||
const deleteFile = async (file: SNFile) => {
|
||||
const shouldDelete = await confirmDialog({
|
||||
text: `Are you sure you want to permanently delete "${file.nameWithExt}"?`,
|
||||
text: `Are you sure you want to permanently delete "${file.name}"?`,
|
||||
confirmButtonStyle: 'danger',
|
||||
});
|
||||
if (shouldDelete) {
|
||||
const deletingToastId = addToast({
|
||||
type: ToastType.Loading,
|
||||
message: `Deleting file "${file.nameWithExt}"...`,
|
||||
message: `Deleting file "${file.name}"...`,
|
||||
});
|
||||
await application.deleteItem(file);
|
||||
addToast({
|
||||
type: ToastType.Success,
|
||||
message: `Deleted file "${file.nameWithExt}"`,
|
||||
message: `Deleted file "${file.name}"`,
|
||||
});
|
||||
dismissToast(deletingToastId);
|
||||
}
|
||||
@@ -160,8 +160,7 @@ export const AttachedFilesButton: FunctionComponent<Props> = observer(
|
||||
};
|
||||
|
||||
const renameFile = async (file: SNFile, fileName: string) => {
|
||||
const { name, ext } = parseFileName(fileName);
|
||||
await application.items.renameFile(file, name, ext);
|
||||
await application.items.renameFile(file, fileName);
|
||||
};
|
||||
|
||||
const handleFileAction = async (action: PopoverFileItemAction) => {
|
||||
|
||||
@@ -48,7 +48,7 @@ export const AttachedFilesPopover: FunctionComponent<Props> = observer(
|
||||
const filteredList =
|
||||
searchQuery.length > 0
|
||||
? filesList.filter(
|
||||
(file) => file.nameWithExt.toLowerCase().indexOf(searchQuery) !== -1
|
||||
(file) => file.name.toLowerCase().indexOf(searchQuery) !== -1
|
||||
)
|
||||
: filesList;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ export const PopoverFileItem: FunctionComponent<PopoverFileItemProps> = ({
|
||||
isAttachedToNote,
|
||||
handleFileAction,
|
||||
}) => {
|
||||
const [fileName, setFileName] = useState(file.nameWithExt);
|
||||
const [fileName, setFileName] = useState(file.name);
|
||||
const [isRenamingFile, setIsRenamingFile] = useState(false);
|
||||
const fileNameInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
@@ -99,7 +99,7 @@ export const PopoverFileItem: FunctionComponent<PopoverFileItemProps> = ({
|
||||
return (
|
||||
<div className="flex items-center justify-between p-3">
|
||||
<div className="flex items-center">
|
||||
{getIconForFileType(file.ext ?? '')}
|
||||
{getIconForFileType(file.name ?? '')}
|
||||
<div className="flex flex-col mx-4">
|
||||
{isRenamingFile ? (
|
||||
<input
|
||||
@@ -112,7 +112,7 @@ export const PopoverFileItem: FunctionComponent<PopoverFileItemProps> = ({
|
||||
onBlur={handleFileNameInputBlur}
|
||||
/>
|
||||
) : (
|
||||
<div className="text-sm mb-1">{file.nameWithExt}</div>
|
||||
<div className="text-sm mb-1">{file.name}</div>
|
||||
)}
|
||||
<div className="text-xs color-grey-0">
|
||||
{file.created_at.toLocaleString()} ·{' '}
|
||||
|
||||
Reference in New Issue
Block a user