Skip to content

Commit 5c28c0d

Browse files
author
Theodore Li
committed
Show rendered md by default
1 parent 8837f14 commit 5c28c0d

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export function FileViewer({
9898
file={file}
9999
workspaceId={workspaceId}
100100
canEdit={canEdit}
101-
previewMode={previewMode ?? (showPreview ? 'split' : 'editor')}
101+
previewMode={previewMode ?? (showPreview ? 'preview' : 'editor')}
102102
autoFocus={autoFocus}
103103
onDirtyChange={onDirtyChange}
104104
onSaveStatusChange={onSaveStatusChange}

apps/sim/app/workspace/[workspaceId]/files/files.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,8 @@ export function Files() {
521521
...(canPreview
522522
? [
523523
{
524-
label: showPreview ? 'Hide Preview' : 'Preview',
525-
icon: Eye,
524+
label: showPreview ? 'Edit' : 'Preview',
525+
icon: showPreview ? Pencil : Eye,
526526
onClick: handleTogglePreview,
527527
},
528528
]

apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-tabs/resource-tabs.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
useState,
99
} from 'react'
1010
import { Button, Tooltip } from '@/components/emcn'
11-
import { Columns3, Eye, PanelLeft, Rows3 } from '@/components/emcn/icons'
11+
import { Columns3, Eye, PanelLeft, Pencil, Rows3 } from '@/components/emcn/icons'
1212
import { cn } from '@/lib/core/utils/cn'
1313
import type { PreviewMode } from '@/app/workspace/[workspaceId]/files/components/file-viewer'
1414
import { AddResourceDropdown } from '@/app/workspace/[workspaceId]/home/components/mothership-view/components/add-resource-dropdown'
@@ -36,9 +36,9 @@ const EDGE_ZONE = 40
3636
const SCROLL_SPEED = 8
3737

3838
const PREVIEW_MODE_ICONS = {
39-
editor: Rows3,
40-
split: Columns3,
41-
preview: Eye,
39+
editor: Columns3,
40+
split: Eye,
41+
preview: Pencil,
4242
} satisfies Record<PreviewMode, (props: ComponentProps<typeof Eye>) => ReactNode>
4343

4444
/**

apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/mothership-view.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import { useCallback, useEffect, useState } from 'react'
44
import { cn } from '@/lib/core/utils/cn'
55
import { getFileExtension } from '@/lib/uploads/utils/file-utils'
66
import type { PreviewMode } from '@/app/workspace/[workspaceId]/files/components/file-viewer'
7-
import {
8-
PREVIEW_ONLY_EXTENSIONS,
9-
RICH_PREVIEWABLE_EXTENSIONS,
10-
} from '@/app/workspace/[workspaceId]/files/components/file-viewer'
7+
import { RICH_PREVIEWABLE_EXTENSIONS } from '@/app/workspace/[workspaceId]/files/components/file-viewer'
118
import type {
129
MothershipResource,
1310
MothershipResourceType,
@@ -49,12 +46,11 @@ export function MothershipView({
4946
}: MothershipViewProps) {
5047
const active = resources.find((r) => r.id === activeResourceId) ?? resources[0] ?? null
5148

52-
const [previewMode, setPreviewMode] = useState<PreviewMode>('split')
49+
const [previewMode, setPreviewMode] = useState<PreviewMode>('preview')
5350
const handleCyclePreview = useCallback(() => setPreviewMode((m) => PREVIEW_CYCLE[m]), [])
5451

5552
useEffect(() => {
56-
const ext = active?.type === 'file' ? getFileExtension(active.title) : ''
57-
setPreviewMode(PREVIEW_ONLY_EXTENSIONS.has(ext) ? 'preview' : 'split')
53+
setPreviewMode('preview')
5854
}, [active?.id])
5955

6056
const isActivePreviewable =

0 commit comments

Comments
 (0)