refactor: repartition server-side and client-side code
@@ -1,5 +1,5 @@
|
||||
import type { LogEntry } from '~/lib/stores/logs';
|
||||
import { logStore } from '~/lib/stores/logs';
|
||||
import type { LogEntry } from '~/stores/logs';
|
||||
import { logStore } from '~/stores/logs';
|
||||
|
||||
export interface Notification {
|
||||
id: string;
|
||||
@@ -34,7 +34,7 @@ type SectionProps = {
|
||||
};
|
||||
|
||||
/**
|
||||
* 构筑一个运行在 node 环境下的,editor 的 bridge。
|
||||
* 构筑一个无头的 editor 的 bridge。
|
||||
* 所有操作编辑器的方法,都需要经由此 bridge 进行广播。
|
||||
* 其内部所保存的 pages 与 sections 均为虚拟数据,与 editor 所需的实际数据有一定差异。
|
||||
*/
|
||||
@@ -2,7 +2,7 @@ import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
||||
import classNames from 'classnames';
|
||||
import { motion } from 'framer-motion';
|
||||
import { useMemo } from 'react';
|
||||
import { useAuth } from '~/lib/hooks/useAuth';
|
||||
import { useAuth } from '~/.client/hooks/useAuth';
|
||||
import type { TabType } from './types';
|
||||
|
||||
interface AvatarDropdownProps {
|
||||
@@ -3,22 +3,24 @@ import * as RadixDialog from '@radix-ui/react-dialog';
|
||||
import classNames from 'classnames';
|
||||
import { AnimatePresence, motion, type Variants } from 'framer-motion';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { TabTile } from '~/components/@settings/core/TabTile';
|
||||
import DebugTab from '~/components/@settings/tabs/debug/DebugTab';
|
||||
import { EventLogsTab } from '~/components/@settings/tabs/event-logs/EventLogsTab';
|
||||
import NotificationsTab from '~/components/@settings/tabs/notifications/NotificationsTab';
|
||||
import SettingsTab from '~/components/@settings/tabs/settings/SettingsTab';
|
||||
import TaskManagerTab from '~/components/@settings/tabs/task-manager/TaskManagerTab';
|
||||
import BackgroundRays from '~/components/ui/BackgroundRays';
|
||||
import { useDebugStatus } from '~/lib/hooks/useDebugStatus';
|
||||
import { useNotifications } from '~/lib/hooks/useNotifications';
|
||||
import { profileStore } from '~/lib/stores/profile';
|
||||
import { resetTabConfiguration, tabConfigurationStore } from '~/lib/stores/settings';
|
||||
import { logger } from '~/utils/logger';
|
||||
import { TabTile } from '~/.client/components/@settings/core/TabTile';
|
||||
import DebugTab from '~/.client/components/@settings/tabs/debug/DebugTab';
|
||||
import { EventLogsTab } from '~/.client/components/@settings/tabs/event-logs/EventLogsTab';
|
||||
import NotificationsTab from '~/.client/components/@settings/tabs/notifications/NotificationsTab';
|
||||
import SettingsTab from '~/.client/components/@settings/tabs/settings/SettingsTab';
|
||||
import TaskManagerTab from '~/.client/components/@settings/tabs/task-manager/TaskManagerTab';
|
||||
import BackgroundRays from '~/.client/components/ui/BackgroundRays';
|
||||
import { useDebugStatus } from '~/.client/hooks/useDebugStatus';
|
||||
import { useNotifications } from '~/.client/hooks/useNotifications';
|
||||
import { profileStore } from '~/.client/stores/profile';
|
||||
import { resetTabConfiguration, tabConfigurationStore } from '~/.client/stores/settings';
|
||||
import { createScopedLogger } from '~/utils/logger';
|
||||
import { AvatarDropdown } from './AvatarDropdown';
|
||||
import { DEFAULT_TAB_CONFIG, TAB_DESCRIPTIONS } from './constants';
|
||||
import type { Profile, TabType, TabVisibilityConfig } from './types';
|
||||
|
||||
const logger = createScopedLogger('ControlPanel');
|
||||
|
||||
interface ControlPanelProps {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
@@ -83,8 +85,8 @@ export const ControlPanel = ({ open, onClose }: ControlPanelProps) => {
|
||||
};
|
||||
|
||||
// Process tabs in priority order
|
||||
tabConfiguration.developerTabs?.forEach((tab) => processTab(tab as BaseTabConfig));
|
||||
tabConfiguration.userTabs.forEach((tab) => processTab(tab as BaseTabConfig));
|
||||
tabConfiguration.developerTabs?.forEach((tab: any) => processTab(tab as BaseTabConfig));
|
||||
tabConfiguration.userTabs.forEach((tab: any) => processTab(tab as BaseTabConfig));
|
||||
DEFAULT_TAB_CONFIG.forEach((tab) => processTab(tab as BaseTabConfig));
|
||||
|
||||
return devTabs.sort((a, b) => a.order - b.order);
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as Tooltip from '@radix-ui/react-tooltip';
|
||||
import classNames from 'classnames';
|
||||
import { motion } from 'framer-motion';
|
||||
import { TAB_ICONS, TAB_LABELS } from '~/components/@settings/core/constants';
|
||||
import type { TabVisibilityConfig } from '~/components/@settings/core/types';
|
||||
import { TAB_ICONS, TAB_LABELS } from '~/.client/components/@settings/core/constants';
|
||||
import type { TabVisibilityConfig } from '~/.client/components/@settings/core/types';
|
||||
|
||||
interface TabTileProps {
|
||||
tab: TabVisibilityConfig;
|
||||
@@ -3,12 +3,12 @@ import classNames from 'classnames';
|
||||
import { jsPDF } from 'jspdf';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import { Badge } from '~/components/ui/Badge';
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '~/components/ui/Collapsible';
|
||||
import { Dialog, DialogRoot, DialogTitle } from '~/components/ui/Dialog';
|
||||
import { Progress } from '~/components/ui/Progress';
|
||||
import { ScrollArea } from '~/components/ui/ScrollArea';
|
||||
import { type LogEntry, logStore } from '~/lib/stores/logs';
|
||||
import { Badge } from '~/.client/components/ui/Badge';
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '~/.client/components/ui/Collapsible';
|
||||
import { Dialog, DialogRoot, DialogTitle } from '~/.client/components/ui/Dialog';
|
||||
import { Progress } from '~/.client/components/ui/Progress';
|
||||
import { ScrollArea } from '~/.client/components/ui/ScrollArea';
|
||||
import { type LogEntry, logStore } from '~/stores/logs';
|
||||
|
||||
interface SystemInfo {
|
||||
os: string;
|
||||
@@ -5,9 +5,9 @@ import { motion } from 'framer-motion';
|
||||
import { jsPDF } from 'jspdf';
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import { Dialog, DialogRoot, DialogTitle } from '~/components/ui/Dialog';
|
||||
import { Switch } from '~/components/ui/Switch';
|
||||
import { type LogEntry, logStore } from '~/lib/stores/logs';
|
||||
import { Dialog, DialogRoot, DialogTitle } from '~/.client/components/ui/Dialog';
|
||||
import { Switch } from '~/.client/components/ui/Switch';
|
||||
import { type LogEntry, logStore } from '~/stores/logs';
|
||||
|
||||
interface SelectOption {
|
||||
value: string;
|
||||
@@ -4,7 +4,7 @@ import classNames from 'classnames';
|
||||
import { formatDistanceToNow } from 'date-fns';
|
||||
import { motion } from 'framer-motion';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { logStore } from '~/lib/stores/logs';
|
||||
import { logStore } from '~/stores/logs';
|
||||
|
||||
interface NotificationDetails {
|
||||
type?: string;
|
||||
@@ -2,9 +2,9 @@ import classNames from 'classnames';
|
||||
import { motion } from 'framer-motion';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import type { UserProfile } from '~/components/@settings/core/types';
|
||||
import { Switch } from '~/components/ui/Switch';
|
||||
import { isMac } from '~/utils/os';
|
||||
import type { UserProfile } from '~/.client/components/@settings/core/types';
|
||||
import { Switch } from '~/.client/components/ui/Switch';
|
||||
import { isMac } from '~/.client/utils/os';
|
||||
|
||||
// Helper to get modifier key symbols/text
|
||||
const getModifierSymbol = (modifier: string): string => {
|
||||
@@ -15,7 +15,7 @@ import * as React from 'react';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { Line } from 'react-chartjs-2';
|
||||
import { toast } from 'sonner';
|
||||
import { tabConfigurationStore } from '~/lib/stores/settings';
|
||||
import { tabConfigurationStore } from '~/.client/stores/settings';
|
||||
|
||||
// Register ChartJS components
|
||||
ChartJS.register(CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend);
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DEFAULT_TAB_CONFIG } from '~/components/@settings/core/constants';
|
||||
import type { TabType, TabVisibilityConfig } from '~/components/@settings/core/types';
|
||||
import { DEFAULT_TAB_CONFIG } from '~/.client/components/@settings/core/constants';
|
||||
import type { TabType, TabVisibilityConfig } from '~/.client/components/@settings/core/types';
|
||||
|
||||
export const getVisibleTabs = (
|
||||
tabConfiguration: { userTabs: TabVisibilityConfig[]; developerTabs?: TabVisibilityConfig[] },
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useNavigate } from '@remix-run/react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Button } from '~/components/ui/Button';
|
||||
import { useAuth } from '~/lib/hooks/useAuth';
|
||||
import { Button } from '~/.client/components/ui/Button';
|
||||
import { useAuth } from '~/.client/hooks/useAuth';
|
||||
|
||||
export function SignInButton({ className, children = '登录' }: { className?: string; children?: React.ReactNode }) {
|
||||
const { signIn, isAuthenticated } = useAuth();
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useAuth } from '~/lib/hooks/useAuth';
|
||||
import { useAuth } from '~/.client/hooks/useAuth';
|
||||
|
||||
export function UserProfile({ className }: { className?: string }) {
|
||||
const { isAuthenticated, userInfo, isLoading } = useAuth();
|
||||
@@ -4,9 +4,9 @@ import { AnimatePresence, motion } from 'framer-motion';
|
||||
import { computed } from 'nanostores';
|
||||
import { memo, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { type BundledLanguage, type BundledTheme, createHighlighter, type HighlighterGeneric } from 'shiki';
|
||||
import type { ActionState } from '~/lib/runtime/action-runner';
|
||||
import { webBuilderStore } from '~/lib/stores/web-builder';
|
||||
import { cubicEasingFn } from '~/utils/easings';
|
||||
import type { ActionState } from '~/.client/runtime/action-runner';
|
||||
import { webBuilderStore } from '~/.client/stores/web-builder';
|
||||
import { cubicEasingFn } from '~/.client/utils/easings';
|
||||
|
||||
const highlighterOptions = {
|
||||
langs: ['shell'],
|
||||
@@ -1,7 +1,7 @@
|
||||
import { memo } from 'react';
|
||||
import Popover from '~/components/ui/Popover';
|
||||
import Tooltip from '~/components/ui/Tooltip';
|
||||
import type { ParsedUIMessage } from '~/lib/stores/ai-state';
|
||||
import Popover from '~/.client/components/ui/Popover';
|
||||
import Tooltip from '~/.client/components/ui/Tooltip';
|
||||
import type { ParsedUIMessage } from '~/.client/stores/ai-state';
|
||||
import { Markdown } from './Markdown';
|
||||
|
||||
export const AssistantMessage = memo(({ message }: { message: ParsedUIMessage }) => {
|
||||
@@ -5,10 +5,10 @@ import classNames from 'classnames';
|
||||
import { useAnimate } from 'framer-motion';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { ClientOnly } from 'remix-utils/client-only';
|
||||
import { useShortcuts, useSnapScroll } from '~/lib/hooks';
|
||||
import { useChatMessage } from '~/lib/hooks/useChatMessage';
|
||||
import { aiState, setChatId, setChatStarted } from '~/lib/stores/ai-state';
|
||||
import { webBuilderStore } from '~/lib/stores/web-builder';
|
||||
import { useShortcuts, useSnapScroll } from '~/.client/hooks';
|
||||
import { useChatMessage } from '~/.client/hooks/useChatMessage';
|
||||
import { aiState, setChatId, setChatStarted } from '~/.client/stores/ai-state';
|
||||
import { webBuilderStore } from '~/.client/stores/web-builder';
|
||||
import type { ChatMessage, ChatWithMessages } from '~/types/chat';
|
||||
import { renderLogger } from '~/utils/logger';
|
||||
import { Menu } from '../sidebar/Menu.client';
|
||||
@@ -2,7 +2,7 @@ import { useStore } from '@nanostores/react';
|
||||
import classNames from 'classnames';
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { webBuilderStore } from '~/lib/stores/web-builder';
|
||||
import { webBuilderStore } from '~/.client/stores/web-builder';
|
||||
|
||||
interface Props {
|
||||
postMessage: (message: string) => void;
|
||||
@@ -2,8 +2,8 @@ import { useStore } from '@nanostores/react';
|
||||
import classNames from 'classnames';
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { ClientOnly } from 'remix-utils/client-only';
|
||||
import { useAuth, usePromptEnhancer } from '~/lib/hooks';
|
||||
import { aiState } from '~/lib/stores/ai-state';
|
||||
import { useAuth, usePromptEnhancer } from '~/.client/hooks';
|
||||
import { aiState } from '~/.client/stores/ai-state';
|
||||
import { IconButton } from '../ui/IconButton';
|
||||
import { SendButton } from './SendButton.client';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
import React, { useState } from 'react';
|
||||
import { cubicEasingFn } from '~/.client/utils/easings';
|
||||
import type { ElementInfoMetadata } from '~/types/message';
|
||||
import { cubicEasingFn } from '~/utils/easings';
|
||||
import { ElementPreview } from './ElementPreview';
|
||||
|
||||
interface ElementEditPreviewProps {
|
||||
@@ -4,11 +4,11 @@ import classNames from 'classnames';
|
||||
import type { ForwardedRef } from 'react';
|
||||
import { Fragment, forwardRef, memo, useEffect, useMemo, useRef } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import WithTooltip from '~/components/ui/Tooltip';
|
||||
import { useAuth } from '~/lib/hooks/useAuth';
|
||||
import { useChatOperate } from '~/lib/hooks/useChatOperate';
|
||||
import { useSnapScroll } from '~/lib/hooks/useSnapScroll';
|
||||
import { aiState, type ParsedUIMessage } from '~/lib/stores/ai-state';
|
||||
import WithTooltip from '~/.client/components/ui/Tooltip';
|
||||
import { useAuth } from '~/.client/hooks/useAuth';
|
||||
import { useChatOperate } from '~/.client/hooks/useChatOperate';
|
||||
import { useSnapScroll } from '~/.client/hooks/useSnapScroll';
|
||||
import { aiState, type ParsedUIMessage } from '~/.client/stores/ai-state';
|
||||
import { AssistantMessage } from './AssistantMessage';
|
||||
import styles from './Messages.module.scss';
|
||||
import { UserMessage } from './UserMessage';
|
||||
@@ -1,7 +1,7 @@
|
||||
import classNames from 'classnames';
|
||||
import type { KeyboardEvent } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import type { ModelInfo } from '~/lib/modules/llm/types';
|
||||
import type { ModelInfo } from '~/.server/modules/llm/types';
|
||||
import type { ProviderInfo } from '~/types/model';
|
||||
|
||||
interface ModelSelectorProps {
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as Tooltip from '@radix-ui/react-tooltip';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useChatDeployment } from '~/lib/hooks/useChatDeployment';
|
||||
import { useChatDeployment } from '~/.client/hooks/useChatDeployment';
|
||||
import { DeploymentPlatformEnum } from '~/types/deployment';
|
||||
|
||||
export function NetlifyDeploymentLink() {
|
||||
@@ -1,8 +1,8 @@
|
||||
import classNames from 'classnames';
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { cubicEasingFn } from '~/.client/utils/easings';
|
||||
import type { ProgressAnnotation } from '~/types/message';
|
||||
import { cubicEasingFn } from '~/utils/easings';
|
||||
|
||||
export default function ProgressCompilation({ data }: { data?: ProgressAnnotation[] }) {
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
@@ -1,5 +1,5 @@
|
||||
import classNames from 'classnames';
|
||||
import { IconButton } from '~/components/ui/IconButton';
|
||||
import { IconButton } from '~/.client/components/ui/IconButton';
|
||||
|
||||
export const SpeechRecognitionButton = ({
|
||||
isListening,
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { FileUIPart } from 'ai';
|
||||
import { MODEL_REGEX, PROVIDER_REGEX } from '~/.client/utils/constants';
|
||||
import type { UPageUIMessage } from '~/types/message';
|
||||
import { MODEL_REGEX, PROVIDER_REGEX } from '~/utils/constants';
|
||||
import { ElementEditPreview } from './ElementEditPreview';
|
||||
import { Markdown } from './Markdown';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as Tooltip from '@radix-ui/react-tooltip';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useChatDeployment } from '~/lib/hooks/useChatDeployment';
|
||||
import { useChatDeployment } from '~/.client/hooks/useChatDeployment';
|
||||
import { DeploymentPlatformEnum } from '~/types/deployment';
|
||||
|
||||
export function VercelDeploymentLink() {
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as Tooltip from '@radix-ui/react-tooltip';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useChatDeployment } from '~/lib/hooks/useChatDeployment';
|
||||
import { useChatDeployment } from '~/.client/hooks/useChatDeployment';
|
||||
import { DeploymentPlatformEnum } from '~/types/deployment';
|
||||
|
||||
export function _1PanelDeploymentLink() {
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IconButton } from '~/components/ui/IconButton';
|
||||
import WithTooltip from '~/components/ui/Tooltip';
|
||||
import { IconButton } from '~/.client/components/ui/IconButton';
|
||||
import WithTooltip from '~/.client/components/ui/Tooltip';
|
||||
|
||||
export const ExportChatButton = ({ exportChat }: { exportChat?: () => void }) => {
|
||||
return (
|
||||
@@ -2,7 +2,7 @@ import * as RadixDialog from '@radix-ui/react-dialog';
|
||||
import classNames from 'classnames';
|
||||
import { motion, type Transition, type Variants } from 'framer-motion';
|
||||
import { memo } from 'react';
|
||||
import { useChatUsage } from '~/lib/hooks/useChatUsage';
|
||||
import { useChatUsage } from '~/.client/hooks/useChatUsage';
|
||||
import { DialogDescription, DialogTitle } from '../../ui/Dialog';
|
||||
import { IconButton } from '../../ui/IconButton';
|
||||
import { ChatUsageVisualization } from './ChatUsageVisualization';
|
||||
@@ -14,8 +14,8 @@ import {
|
||||
import classNames from 'classnames';
|
||||
import { useMemo } from 'react';
|
||||
import { Doughnut, Line, Pie } from 'react-chartjs-2';
|
||||
import type { ChatUsageStats } from '~/lib/hooks/useChatUsage';
|
||||
import { themeStore } from '~/lib/stores/theme';
|
||||
import type { ChatUsageStats } from '~/.client/hooks/useChatUsage';
|
||||
import { themeStore } from '~/stores/theme';
|
||||
|
||||
ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend, ArcElement, PointElement, LineElement);
|
||||
|
||||
@@ -4,7 +4,7 @@ import classNames from 'classnames';
|
||||
import { motion, type Transition, type Variants } from 'framer-motion';
|
||||
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import { type DeploymentRecord, useDeploymentRecords } from '~/lib/hooks/useDeploymentRecords';
|
||||
import { type DeploymentRecord, useDeploymentRecords } from '~/.client/hooks/useDeploymentRecords';
|
||||
import { DeploymentPlatformEnum, DeploymentStatusEnum } from '~/types/deployment';
|
||||
import { ConfirmationDialog, DialogDescription, DialogTitle } from '../../ui/Dialog';
|
||||
import { IconButton } from '../../ui/IconButton';
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useRef } from 'react';
|
||||
import { sendChatMessageStore } from '~/lib/stores/chat-message';
|
||||
import { sendChatMessageStore } from '~/.client/stores/chat-message';
|
||||
import { DefaultEditor } from './editors/DefaultEditor';
|
||||
import type { EditorProps } from './editors/EditorProps';
|
||||
import { IconEditor } from './editors/IconEditor';
|
||||
@@ -1,10 +1,10 @@
|
||||
import { memo, useCallback, useEffect, useRef } from 'react';
|
||||
import { useChatHistory } from '~/lib/persistence';
|
||||
import { useChatHistory } from '~/.client/persistence';
|
||||
import { isValidContent } from '~/.client/utils/html-parse';
|
||||
import { throttleWithTrailing } from '~/.client/utils/throttle';
|
||||
import type { Section } from '~/types/actions';
|
||||
import type { DocumentProperties, Editor } from '~/types/editor';
|
||||
import { isValidContent } from '~/utils/html-parse';
|
||||
import { logger } from '~/utils/logger';
|
||||
import { throttleWithTrailing } from '~/utils/throttle';
|
||||
import { EditorComponent } from './EditorComponent';
|
||||
|
||||
export interface ScrollPosition {
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { RefObject } from 'react';
|
||||
import { createRef, useCallback, useEffect, useRef } from 'react';
|
||||
import { useEditorCommands } from '~/lib/hooks';
|
||||
import { useEditorCommands } from '~/.client/hooks';
|
||||
import type { DocumentProperties, Editor } from '~/types/editor';
|
||||
import { EditorController } from './EditorController';
|
||||
import { EditorRender } from './EditorRender';
|
||||
@@ -1,6 +1,6 @@
|
||||
import { executeScript } from '~/.client/utils/execute-scripts';
|
||||
import { isScriptContent } from '~/.client/utils/html-parse';
|
||||
import type { Editor, EditorControllerProps } from '~/types/editor';
|
||||
import { executeScript } from '~/utils/execute-scripts';
|
||||
import { isScriptContent } from '~/utils/html-parse';
|
||||
|
||||
export class EditorController implements Editor {
|
||||
private props: EditorControllerProps;
|
||||
@@ -1,9 +1,9 @@
|
||||
import { motion, type Variants } from 'framer-motion';
|
||||
import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
||||
import Frame from 'react-frame-component';
|
||||
import { executeScripts } from '~/.client/utils/execute-scripts';
|
||||
import { isMac } from '~/.client/utils/os';
|
||||
import type { DocumentProperties } from '~/types/editor';
|
||||
import { executeScripts } from '~/utils/execute-scripts';
|
||||
import { isMac } from '~/utils/os';
|
||||
import { EditorOverlay } from './EditorOverlay';
|
||||
|
||||
export interface PageRenderRef {
|
||||
|
Before Width: | Height: | Size: 227 B After Width: | Height: | Size: 227 B |
|
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 421 B |
|
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 287 B |
|
Before Width: | Height: | Size: 601 B After Width: | Height: | Size: 601 B |
@@ -1,10 +1,10 @@
|
||||
import { useStore } from '@nanostores/react';
|
||||
import { TooltipProvider } from '@radix-ui/react-tooltip';
|
||||
import { useEffect } from 'react';
|
||||
import WithTooltip from '~/components/ui/Tooltip';
|
||||
import { useEditChatDescription } from '~/lib/hooks';
|
||||
import { useChatHistory } from '~/lib/hooks/useChatHistory';
|
||||
import { webBuilderStore } from '~/lib/stores/web-builder';
|
||||
import WithTooltip from '~/.client/components/ui/Tooltip';
|
||||
import { useEditChatDescription } from '~/.client/hooks';
|
||||
import { useChatHistory } from '~/.client/hooks/useChatHistory';
|
||||
import { webBuilderStore } from '~/.client/stores/web-builder';
|
||||
|
||||
export function ChatDescription() {
|
||||
const { getChatLatestDescription } = useChatHistory();
|
||||
@@ -2,9 +2,9 @@ import { useStore } from '@nanostores/react';
|
||||
import * as Dialog from '@radix-ui/react-dialog';
|
||||
import { motion } from 'framer-motion';
|
||||
import { useEffect, useState } from 'react';
|
||||
import _1PanelConnection from '~/components/header/connections/_1PanelConnection';
|
||||
import { useChatDeployment } from '~/lib/hooks/useChatDeployment';
|
||||
import { _1PanelConnectionStore } from '~/lib/stores/1panel';
|
||||
import _1PanelConnection from '~/.client/components/header/connections/_1PanelConnection';
|
||||
import { useChatDeployment } from '~/.client/hooks/useChatDeployment';
|
||||
import { _1PanelConnectionStore } from '~/.client/stores/1panel';
|
||||
import { DeploymentPlatformEnum } from '~/types/deployment';
|
||||
|
||||
interface DeployTo1PanelDialogProps {
|
||||
@@ -2,11 +2,11 @@ import { useStore } from '@nanostores/react';
|
||||
import * as Dialog from '@radix-ui/react-dialog';
|
||||
import { motion } from 'framer-motion';
|
||||
import React, { Suspense, useEffect, useState } from 'react';
|
||||
import { useChatDeployment } from '~/lib/hooks/useChatDeployment';
|
||||
import { netlifyConnection } from '~/lib/stores/netlify';
|
||||
import { useChatDeployment } from '~/.client/hooks/useChatDeployment';
|
||||
import { netlifyConnection } from '~/.client/stores/netlify';
|
||||
import { DeploymentPlatformEnum } from '~/types/deployment';
|
||||
|
||||
const NetlifyConnection = React.lazy(() => import('~/components/header/connections/NetlifyConnection'));
|
||||
const NetlifyConnection = React.lazy(() => import('~/.client/components/header/connections/NetlifyConnection'));
|
||||
|
||||
interface DeployToNetlifyDialogProps {
|
||||
isOpen: boolean;
|
||||
@@ -2,9 +2,9 @@ import { useStore } from '@nanostores/react';
|
||||
import * as Dialog from '@radix-ui/react-dialog';
|
||||
import { motion } from 'framer-motion';
|
||||
import { useEffect, useState } from 'react';
|
||||
import VercelConnection from '~/components/header/connections/VercelConnection';
|
||||
import { useChatDeployment } from '~/lib/hooks/useChatDeployment';
|
||||
import { vercelConnection } from '~/lib/stores/vercel';
|
||||
import VercelConnection from '~/.client/components/header/connections/VercelConnection';
|
||||
import { useChatDeployment } from '~/.client/hooks/useChatDeployment';
|
||||
import { vercelConnection } from '~/.client/stores/vercel';
|
||||
import { DeploymentPlatformEnum } from '~/types/deployment';
|
||||
|
||||
interface DeployToVercelDialogProps {
|
||||
@@ -2,9 +2,9 @@ import { useStore } from '@nanostores/react';
|
||||
import classNames from 'classnames';
|
||||
import { useMemo } from 'react';
|
||||
import { ClientOnly } from 'remix-utils/client-only';
|
||||
import { useAuth } from '~/lib/hooks';
|
||||
import { aiState } from '~/lib/stores/ai-state';
|
||||
import { themeStore } from '~/lib/stores/theme';
|
||||
import { useAuth } from '~/.client/hooks';
|
||||
import { aiState } from '~/.client/stores/ai-state';
|
||||
import { themeStore } from '~/stores/theme';
|
||||
import { HistorySwitch } from '../sidebar/HistorySwitch';
|
||||
import { ThemeSwitch } from '../ui/ThemeSwitch';
|
||||
import { ChatDescription } from './ChatDescription.client';
|
||||
@@ -4,11 +4,11 @@ import classNames from 'classnames';
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { toast } from 'sonner';
|
||||
import { NetlifyDeploymentLink } from '~/components/chat/NetlifyDeploymentLink.client';
|
||||
import useViewport from '~/lib/hooks';
|
||||
import { setLocalStorage } from '~/lib/persistence';
|
||||
import { aiState, setShowChat } from '~/lib/stores/ai-state';
|
||||
import { webBuilderStore } from '~/lib/stores/web-builder';
|
||||
import { NetlifyDeploymentLink } from '~/.client/components/chat/NetlifyDeploymentLink.client';
|
||||
import useViewport from '~/.client/hooks';
|
||||
import { setLocalStorage } from '~/.client/persistence';
|
||||
import { aiState, setShowChat } from '~/.client/stores/ai-state';
|
||||
import { webBuilderStore } from '~/.client/stores/web-builder';
|
||||
import type { _1PanelDeployResponse } from '~/types/1panel';
|
||||
import { DeploymentPlatformEnum } from '~/types/deployment';
|
||||
import type { ApiResponse } from '~/types/global';
|
||||
@@ -2,12 +2,12 @@ import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
||||
import classNames from 'classnames';
|
||||
import { motion } from 'framer-motion';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { ChatUsageDialog } from '~/components/chat/usage/ChatUsageDialog';
|
||||
import { DeploymentRecordsDialog } from '~/components/chat/usage/DeploymentRecordsDialog';
|
||||
import { Button } from '~/components/ui/Button';
|
||||
import { ConfirmationDialog } from '~/components/ui/Dialog';
|
||||
import { useAuth } from '~/lib/hooks/useAuth';
|
||||
import { useChatUsage } from '~/lib/hooks/useChatUsage';
|
||||
import { ChatUsageDialog } from '~/.client/components/chat/usage/ChatUsageDialog';
|
||||
import { DeploymentRecordsDialog } from '~/.client/components/chat/usage/DeploymentRecordsDialog';
|
||||
import { Button } from '~/.client/components/ui/Button';
|
||||
import { ConfirmationDialog } from '~/.client/components/ui/Dialog';
|
||||
import { useAuth } from '~/.client/hooks/useAuth';
|
||||
import { useChatUsage } from '~/.client/hooks/useChatUsage';
|
||||
|
||||
interface MinimalAvatarDropdownProps {}
|
||||
|
||||
@@ -2,9 +2,9 @@ import classNames from 'classnames';
|
||||
import Cookies from 'js-cookie';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import { Button } from '~/components/ui/Button';
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '~/components/ui/Collapsible';
|
||||
import { logStore } from '~/lib/stores/logs';
|
||||
import { Button } from '~/.client/components/ui/Button';
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '~/.client/components/ui/Collapsible';
|
||||
import { logStore } from '~/stores/logs';
|
||||
import ConnectionBorder from './components/ConnectionBorder';
|
||||
|
||||
interface GitHubUserResponse {
|
||||
@@ -5,10 +5,15 @@ import { formatDistanceToNow } from 'date-fns';
|
||||
import { zhCN } from 'date-fns/locale/zh-CN';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import { Badge } from '~/components/ui/Badge';
|
||||
import { Button } from '~/components/ui/Button';
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '~/components/ui/Collapsible';
|
||||
import { fetchNetlifyStats, isFetchingStats, netlifyConnection, updateNetlifyConnection } from '~/lib/stores/netlify';
|
||||
import { Badge } from '~/.client/components/ui/Badge';
|
||||
import { Button } from '~/.client/components/ui/Button';
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '~/.client/components/ui/Collapsible';
|
||||
import {
|
||||
fetchNetlifyStats,
|
||||
isFetchingStats,
|
||||
netlifyConnection,
|
||||
updateNetlifyConnection,
|
||||
} from '~/.client/stores/netlify';
|
||||
import type { ConnectionSettings } from '~/root';
|
||||
import type { ApiResponse } from '~/types/global';
|
||||
import type { NetlifyBuild, NetlifyDeploy, NetlifySite } from '~/types/netlify';
|
||||
@@ -3,9 +3,9 @@ import { useFetcher, useRouteLoaderData } from '@remix-run/react';
|
||||
import classNames from 'classnames';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import { logStore } from '~/lib/stores/logs';
|
||||
import { fetchVercelStats, isFetchingStats, updateVercelConnection, vercelConnection } from '~/lib/stores/vercel';
|
||||
import { fetchVercelStats, isFetchingStats, updateVercelConnection, vercelConnection } from '~/.client/stores/vercel';
|
||||
import type { ConnectionSettings } from '~/root';
|
||||
import { logStore } from '~/stores/logs';
|
||||
import { logger } from '~/utils/logger';
|
||||
import ConnectionBorder from './components/ConnectionBorder';
|
||||
|
||||
@@ -6,11 +6,16 @@ import { zhCN } from 'date-fns/locale/zh-CN';
|
||||
import { motion } from 'framer-motion';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import { Badge } from '~/components/ui/Badge';
|
||||
import { Button } from '~/components/ui/Button';
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '~/components/ui/Collapsible';
|
||||
import { _1PanelConnectionStore, fetch1PanelStats, isFetchingStats, update1PanelConnection } from '~/lib/stores/1panel';
|
||||
import { getChatId } from '~/lib/stores/ai-state';
|
||||
import { Badge } from '~/.client/components/ui/Badge';
|
||||
import { Button } from '~/.client/components/ui/Button';
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '~/.client/components/ui/Collapsible';
|
||||
import {
|
||||
_1PanelConnectionStore,
|
||||
fetch1PanelStats,
|
||||
isFetchingStats,
|
||||
update1PanelConnection,
|
||||
} from '~/.client/stores/1panel';
|
||||
import { getChatId } from '~/.client/stores/ai-state';
|
||||
import type { ConnectionSettings } from '~/root';
|
||||
import type { _1PanelWebsite } from '~/types/1panel';
|
||||
import type { ApiResponse } from '~/types/global';
|
||||
@@ -4,14 +4,14 @@ import classNames from 'classnames';
|
||||
import { motion } from 'framer-motion';
|
||||
import React, { Suspense, useEffect, useState } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import { getLocalStorage } from '~/lib/persistence';
|
||||
import { logStore } from '~/lib/stores/logs';
|
||||
import { webBuilderStore } from '~/lib/stores/web-builder';
|
||||
import { getLocalStorage } from '~/.client/persistence';
|
||||
import { webBuilderStore } from '~/.client/stores/web-builder';
|
||||
import { formatSize } from '~/.client/utils/format';
|
||||
import { logStore } from '~/stores/logs';
|
||||
import type { GitHubUserResponse } from '~/types/github';
|
||||
import { formatSize } from '~/utils/format';
|
||||
import { logger } from '~/utils/logger';
|
||||
|
||||
const GitHubConnection = React.lazy(() => import('~/components/header/connections/GithubConnection'));
|
||||
const GitHubConnection = React.lazy(() => import('~/.client/components/header/connections/GithubConnection'));
|
||||
|
||||
interface PushToGitHubDialogProps {
|
||||
isOpen: boolean;
|
||||
@@ -1,10 +1,10 @@
|
||||
import { useParams } from '@remix-run/react';
|
||||
import classNames from 'classnames';
|
||||
import { type ForwardedRef, forwardRef, useCallback } from 'react';
|
||||
import { Checkbox } from '~/components/ui/Checkbox';
|
||||
import WithTooltip from '~/components/ui/Tooltip';
|
||||
import { useEditChatDescription } from '~/lib/hooks';
|
||||
import type { ServerChatItem } from '~/lib/hooks/useChatEntries';
|
||||
import { Checkbox } from '~/.client/components/ui/Checkbox';
|
||||
import WithTooltip from '~/.client/components/ui/Tooltip';
|
||||
import { useEditChatDescription } from '~/.client/hooks';
|
||||
import type { ServerChatItem } from '~/.client/hooks/useChatEntries';
|
||||
|
||||
interface HistoryItemProps {
|
||||
item: ServerChatItem;
|
||||
@@ -1,6 +1,6 @@
|
||||
import { memo, useEffect, useState } from 'react';
|
||||
import { IconButton } from '~/components/ui/IconButton';
|
||||
import { toggleSidebar } from '~/lib/stores/sidebar';
|
||||
import { IconButton } from '~/.client/components/ui/IconButton';
|
||||
import { toggleSidebar } from '~/.client/stores/sidebar';
|
||||
|
||||
interface HistorySwitchProps {
|
||||
className?: string;
|
||||
@@ -3,15 +3,15 @@ import classNames from 'classnames';
|
||||
import { motion, type Variants } from 'framer-motion';
|
||||
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import { ControlPanel } from '~/components/@settings/core/ControlPanel';
|
||||
import { Dialog, DialogButton, DialogDescription, DialogRoot, DialogTitle } from '~/components/ui/Dialog';
|
||||
import { SettingsButton } from '~/components/ui/SettingsButton';
|
||||
import { useAuth } from '~/lib/hooks';
|
||||
import { type ServerChatItem, useChatEntries } from '~/lib/hooks/useChatEntries';
|
||||
import { useChatOperate } from '~/lib/hooks/useChatOperate';
|
||||
import { aiState } from '~/lib/stores/ai-state';
|
||||
import { sidebarStore } from '~/lib/stores/sidebar';
|
||||
import { cubicEasingFn } from '~/utils/easings';
|
||||
import { ControlPanel } from '~/.client/components/@settings/core/ControlPanel';
|
||||
import { Dialog, DialogButton, DialogDescription, DialogRoot, DialogTitle } from '~/.client/components/ui/Dialog';
|
||||
import { SettingsButton } from '~/.client/components/ui/SettingsButton';
|
||||
import { useAuth } from '~/.client/hooks';
|
||||
import { type ServerChatItem, useChatEntries } from '~/.client/hooks/useChatEntries';
|
||||
import { useChatOperate } from '~/.client/hooks/useChatOperate';
|
||||
import { aiState } from '~/.client/stores/ai-state';
|
||||
import { sidebarStore } from '~/.client/stores/sidebar';
|
||||
import { cubicEasingFn } from '~/.client/utils/easings';
|
||||
import WithTooltip from '../ui/Tooltip';
|
||||
import { binDates } from './date-binning';
|
||||
import { HistoryItem } from './HistoryItem.client';
|
||||
@@ -1,6 +1,6 @@
|
||||
import { format, isAfter, isThisWeek, isThisYear, isToday, isYesterday, subDays } from 'date-fns';
|
||||
import { zhCN } from 'date-fns/locale/zh-CN';
|
||||
import type { ServerChatItem } from '~/lib/hooks/useChatEntries';
|
||||
import type { ServerChatItem } from '~/.client/hooks/useChatEntries';
|
||||
|
||||
type Bin = { category: string; items: ServerChatItem[] };
|
||||
|
||||
@@ -3,7 +3,7 @@ import classNames from 'classnames';
|
||||
import { motion, type Variants } from 'framer-motion';
|
||||
import React, { memo, type ReactNode, useEffect, useMemo, useState } from 'react';
|
||||
import { List, type RowComponentProps } from 'react-window';
|
||||
import { cubicEasingFn } from '~/utils/easings';
|
||||
import { cubicEasingFn } from '~/.client/utils/easings';
|
||||
import { Button } from './Button';
|
||||
import { Checkbox } from './Checkbox';
|
||||
import { IconButton } from './IconButton';
|
||||