mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-05-19 05:45:01 -04:00
@@ -1,5 +1,5 @@
|
||||
import clsx from 'clsx';
|
||||
import { Columns, GridFour, MonitorPlay, Rows, type Icon } from '@phosphor-icons/react';
|
||||
import clsx from 'clsx';
|
||||
import {
|
||||
isValidElement,
|
||||
memo,
|
||||
@@ -25,13 +25,12 @@ import {
|
||||
type Object
|
||||
} from '@sd/client';
|
||||
import { ContextMenu, dialogManager, ModifierKeys, toast } from '@sd/ui';
|
||||
|
||||
import { Loader } from '~/components';
|
||||
import { useOperatingSystem } from '~/hooks';
|
||||
import { isNonEmpty } from '~/util';
|
||||
import { usePlatform } from '~/util/Platform';
|
||||
|
||||
import CreateDialog from '../../settings/library/tags/CreateDialog';
|
||||
import { useExplorerConfigStore } from '../config';
|
||||
import { useExplorerContext } from '../Context';
|
||||
import { QuickPreview } from '../QuickPreview';
|
||||
import { useQuickPreviewContext } from '../QuickPreview/Context';
|
||||
@@ -51,8 +50,6 @@ export const ViewItem = ({ data, children, ...props }: ViewItemProps) => {
|
||||
const explorer = useExplorerContext();
|
||||
const explorerView = useExplorerViewContext();
|
||||
|
||||
const explorerConfig = useExplorerConfigStore();
|
||||
|
||||
const navigate = useNavigate();
|
||||
const { library } = useLibraryContext();
|
||||
const { openFilePaths } = usePlatform();
|
||||
@@ -110,7 +107,7 @@ export const ViewItem = ({ data, children, ...props }: ViewItemProps) => {
|
||||
);
|
||||
|
||||
if (items.paths.length > 0 && !explorerView.isRenaming) {
|
||||
if (explorerConfig.openOnDoubleClick && openFilePaths) {
|
||||
if (explorer.settingsStore.openOnDoubleClick === 'openFile' && openFilePaths) {
|
||||
updateAccessTime
|
||||
.mutateAsync(items.paths.map(({ object_id }) => object_id!).filter(Boolean))
|
||||
.catch(console.error);
|
||||
@@ -123,7 +120,7 @@ export const ViewItem = ({ data, children, ...props }: ViewItemProps) => {
|
||||
} catch (error) {
|
||||
toast.error({ title: 'Failed to open file', body: `Error: ${error}.` });
|
||||
}
|
||||
} else if (!explorerConfig.openOnDoubleClick) {
|
||||
} else if (explorer.settingsStore.openOnDoubleClick === 'quickPreview') {
|
||||
if (data.type !== 'Location' && !(isPath(data) && data.item.is_dir)) {
|
||||
getQuickPreviewStore().itemIndex = itemIndex;
|
||||
getQuickPreviewStore().open = true;
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import { useSnapshot } from 'valtio';
|
||||
import { DoubleClickAction, valtioPersist } from '@sd/client';
|
||||
|
||||
export const explorerConfigStore = valtioPersist('explorer-config', {
|
||||
openOnDoubleClick: 'openFile' as DoubleClickAction
|
||||
});
|
||||
|
||||
export function useExplorerConfigStore() {
|
||||
return useSnapshot(explorerConfigStore);
|
||||
}
|
||||
|
||||
export function getExplorerConfigStore() {
|
||||
return explorerConfigStore;
|
||||
}
|
||||
Reference in New Issue
Block a user