mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
Remove setLabsEnhanceCodeLiveFile
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useShallow } from 'zustand/react/shallow';
|
||||
|
||||
import type { LiveFileId, LiveFileMetadata } from '~/common/livefile/liveFile.types';
|
||||
import { useLiveFileStore } from '~/common/livefile/store-live-file';
|
||||
import { useShallow } from 'zustand/react/shallow';
|
||||
|
||||
export function useLiveFileMetadata(liveFileId: LiveFileId | undefined): LiveFileMetadata | null {
|
||||
return useLiveFileStore(useShallow((store) =>
|
||||
|
||||
@@ -10,9 +10,6 @@ import { persist } from 'zustand/middleware';
|
||||
// - Chat Mode: Follow-Ups; moved to Chat Advanced UI
|
||||
interface UXLabsStore {
|
||||
|
||||
labsEnhanceCodeLiveFile: boolean;
|
||||
setLabsEnhanceCodeLiveFile: (labsEnhanceCodeLiveFile: boolean) => void;
|
||||
|
||||
labsHighPerformance: boolean;
|
||||
setLabsHighPerformance: (labsHighPerformance: boolean) => void;
|
||||
|
||||
@@ -31,9 +28,6 @@ export const useUXLabsStore = create<UXLabsStore>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
|
||||
labsEnhanceCodeLiveFile: false,
|
||||
setLabsEnhanceCodeLiveFile: (labsEnhanceCodeLiveFile: boolean) => set({ labsEnhanceCodeLiveFile }),
|
||||
|
||||
labsHighPerformance: false,
|
||||
setLabsHighPerformance: (labsHighPerformance: boolean) => set({ labsHighPerformance }),
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { fileSave } from 'browser-fs-access';
|
||||
import { useShallow } from 'zustand/react/shallow';
|
||||
|
||||
import { Box, ListDivider, ListItemDecorator, MenuItem } from '@mui/joy';
|
||||
import CheckRoundedIcon from '@mui/icons-material/CheckRounded';
|
||||
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
|
||||
import UnfoldLessIcon from '@mui/icons-material/UnfoldLess';
|
||||
import UnfoldMoreIcon from '@mui/icons-material/UnfoldMore';
|
||||
@@ -11,9 +9,7 @@ import SaveAsOutlinedIcon from '@mui/icons-material/SaveAsOutlined';
|
||||
|
||||
import { CloseablePopup } from '~/common/components/CloseablePopup';
|
||||
import { copyToClipboard } from '~/common/util/clipboardUtils';
|
||||
import { isLiveFileSupported } from '~/common/livefile/store-live-file';
|
||||
import { reverseLookupMdTitle, reverseLookupMimeType } from '~/common/attachment-drafts/attachment.mimetypes';
|
||||
import { useUXLabsStore } from '~/common/stores/store-ux-labs';
|
||||
|
||||
import { getCodeCollapseManager } from './codeCollapseManager';
|
||||
|
||||
@@ -31,12 +27,7 @@ export function EnhancedRenderCodeMenu(props: {
|
||||
}) {
|
||||
|
||||
// state
|
||||
const { labsEnhanceCodeLiveFile, setLabsEnhanceCodeLiveFile } = useUXLabsStore(useShallow(state => ({
|
||||
// labsEnhanceCodeBlocks: state.labsEnhanceCodeBlocks,
|
||||
// setLabsEnhanceCodeBlocks: state.setLabsEnhanceCodeBlocks,
|
||||
labsEnhanceCodeLiveFile: state.labsEnhanceCodeLiveFile,
|
||||
setLabsEnhanceCodeLiveFile: state.setLabsEnhanceCodeLiveFile,
|
||||
})));
|
||||
// const { showPromisedOverlay } = useOverlayComponents();
|
||||
|
||||
|
||||
// handlers
|
||||
@@ -100,13 +91,6 @@ export function EnhancedRenderCodeMenu(props: {
|
||||
// ).then(() => setLabsEnhanceCodeBlocks(false)).catch(() => null /* ignore closure */);
|
||||
// }, [labsEnhanceCodeBlocks, setLabsEnhanceCodeBlocks, showPromisedOverlay]);
|
||||
|
||||
const toggleEnhanceCodeLiveFile = React.useCallback(() => {
|
||||
setLabsEnhanceCodeLiveFile(!labsEnhanceCodeLiveFile);
|
||||
}, [labsEnhanceCodeLiveFile, setLabsEnhanceCodeLiveFile]);
|
||||
|
||||
const liveFileSupported = isLiveFileSupported();
|
||||
|
||||
|
||||
return (
|
||||
<CloseablePopup
|
||||
menu anchorEl={props.anchor} onClose={props.onClose}
|
||||
@@ -138,13 +122,6 @@ export function EnhancedRenderCodeMenu(props: {
|
||||
Save As ...
|
||||
</MenuItem>
|
||||
|
||||
<ListDivider />
|
||||
|
||||
<MenuItem onClick={toggleEnhanceCodeLiveFile} disabled={!liveFileSupported}>
|
||||
<ListItemDecorator>{(labsEnhanceCodeLiveFile && liveFileSupported) && <CheckRoundedIcon />}</ListItemDecorator>
|
||||
{liveFileSupported ? 'LiveFile Patch' : 'LiveFile - No Browser Support'}
|
||||
</MenuItem>
|
||||
|
||||
</CloseablePopup>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { fileOpen } from 'browser-fs-access';
|
||||
import { Box, Button, ColorPaletteProp, Sheet } from '@mui/joy';
|
||||
|
||||
import { useUXLabsStore } from '~/common/stores/store-ux-labs';
|
||||
import { Box, Button, ColorPaletteProp, Sheet } from '@mui/joy';
|
||||
|
||||
// Workspace
|
||||
import type { DWorkspaceId } from '~/common/stores/workspace/workspace.types';
|
||||
@@ -26,7 +25,7 @@ export function useLiveFilePatch(title: string, code: string, isPartial: boolean
|
||||
const [liveFileId, setLiveFileId] = React.useState<LiveFileId | null>(null);
|
||||
|
||||
// external state
|
||||
const isEnabled = useUXLabsStore((state) => state.labsEnhanceCodeLiveFile && isLiveFileSupported());
|
||||
const isEnabled = isLiveFileSupported();
|
||||
|
||||
|
||||
const { status, patchState, targetOverwriteWithPatch } = usePatchingWorkflow(liveFileId, code);
|
||||
|
||||
Reference in New Issue
Block a user