refactor: use useFileSelector hook for all file selection (#1905)
This commit is contained in:
@@ -71,7 +71,7 @@ const processTauriFiles = (files: string[]): SelectedFile[] => {
|
||||
export const useFileSelector = (appService: AppService | null, _: (key: string) => string) => {
|
||||
const selectFiles = async (options: FileSelectorOptions = {}) => {
|
||||
if (!appService) {
|
||||
return { files: [], error: 'App service is not available' };
|
||||
return { files: [] as SelectedFile[], error: 'App service is not available' };
|
||||
}
|
||||
try {
|
||||
if (isTauriAppPlatform()) {
|
||||
@@ -121,4 +121,9 @@ export const FILE_SELECTION_PRESETS = {
|
||||
extensions: ['ttf', 'otf', 'woff', 'woff2'],
|
||||
dialogTitle: _('Select Fonts'),
|
||||
},
|
||||
covers: {
|
||||
accept: '.png, .jpg, .jpeg, .gif',
|
||||
extensions: ['png', 'jpg', 'jpeg', 'gif'],
|
||||
dialogTitle: _('Select Image'),
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user