Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
b546113
feat(files): add inline file viewer with text editing and create file…
waleedlatif1 Mar 9, 2026
4e2c770
improvement(files): add UX polish, PR review fixes, and context menu
waleedlatif1 Mar 9, 2026
999ff71
fix(files): propagate save errors and remove redundant sizeDiff
waleedlatif1 Mar 9, 2026
4860b11
fix(files): remove unused textareaRef
waleedlatif1 Mar 9, 2026
59afa54
fix(files): move Cmd+S to parent, add save error feedback, hide save …
waleedlatif1 Mar 9, 2026
bed055c
improvement(files): add save tooltip, deduplicate text-editable exten…
waleedlatif1 Mar 9, 2026
ad9bd5d
refactor: extract isMacPlatform to shared utility
waleedlatif1 Mar 9, 2026
493e30d
refactor(files): deduplicate delete modal, use shared formatFileSize
waleedlatif1 Mar 9, 2026
bfbb112
fix(files): fix a11y label lint error and remove mutation object from…
waleedlatif1 Mar 9, 2026
7d84bc6
fix(files): add isDirty guard on handleSave, return proper HTTP statu…
waleedlatif1 Mar 9, 2026
2ba0683
fix(files): reset isDirty/saveStatus on delete and discard, remove de…
waleedlatif1 Mar 9, 2026
6986b5b
fix(files): prevent concurrent saves on rapid Cmd+S, add YAML MIME types
waleedlatif1 Mar 9, 2026
076f984
refactor(files): reuse shared extension constants, parallelize cancel…
waleedlatif1 Mar 9, 2026
4de9bde
fix(files): guard handleCreate against duplicate calls while pending
waleedlatif1 Mar 9, 2026
53ec2bb
fix(files): show upload progress on the Upload button, not New file
waleedlatif1 Mar 9, 2026
749227c
fix(files): use ref-based guard for create pending state to avoid sta…
waleedlatif1 Mar 9, 2026
fd0081f
cleanup(files): use shared icon import, remove no-op props, wrap hand…
waleedlatif1 Mar 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: extract isMacPlatform to shared utility
Move isMacPlatform() from global-commands-provider.tsx to
lib/core/utils/platform.ts so it can be reused by files.tsx tooltip
without duplication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
  • Loading branch information
waleedlatif1 and claude committed Mar 9, 2026
commit ad9bd5d28079bff2ef809942de8a1c83a9e75e30
5 changes: 2 additions & 3 deletions apps/sim/app/workspace/[workspaceId]/files/files.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
Trash2,
} from '@/components/emcn'
import { cn } from '@/lib/core/utils/cn'
import { isMacPlatform } from '@/lib/core/utils/platform'
import { getFileExtension } from '@/lib/uploads/utils/file-utils'
import type { ResourceColumn, ResourceRow } from '@/app/workspace/[workspaceId]/components'
import {
Expand Down Expand Up @@ -440,9 +441,7 @@ export function Files() {
</Button>
</Tooltip.Trigger>
<Tooltip.Content side='bottom'>
{typeof navigator !== 'undefined' && /Mac|iPhone|iPad/i.test(navigator.platform)
? '\u2318S'
: 'Ctrl+S'}
{isMacPlatform() ? '\u2318S' : 'Ctrl+S'}
</Tooltip.Content>
</Tooltip.Root>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,10 @@ import {
} from 'react'
import { createLogger } from '@sim/logger'
import { useRouter } from 'next/navigation'
import { isMacPlatform } from '@/lib/core/utils/platform'

const logger = createLogger('GlobalCommands')

function isMacPlatform(): boolean {
if (typeof window === 'undefined') return false
return (
/Mac|iPhone|iPod|iPad/i.test(navigator.platform) ||
/Mac|iPhone|iPod|iPad/i.test(navigator.userAgent)
)
}

export interface ParsedShortcut {
key: string
mod?: boolean
Expand Down
11 changes: 11 additions & 0 deletions apps/sim/lib/core/utils/platform.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Detects whether the current platform is macOS/iOS.
* Returns false during SSR.
*/
export function isMacPlatform(): boolean {
if (typeof window === 'undefined') return false
return (
/Mac|iPhone|iPod|iPad/i.test(navigator.platform) ||
/Mac|iPhone|iPod|iPad/i.test(navigator.userAgent)
Comment thread
waleedlatif1 marked this conversation as resolved.
Outdated
)
}