mirror of
https://github.com/supabase/supabase.git
synced 2026-07-03 08:04:21 +08:00
* allow creating branching without git * update branching modals * add account connections * edit branch * copy * update copy * enable branch modal changes * add gitless branching flag * update account connections * merge page * merge experiment * update merge * update pull requests empty state * use diff query * branch diffing * diff query * Clean up * refinements to gitless branching * branching merge and status * link * branch function diffing * update styling * refactor * remove hook * error handling * move * remove enable branching modal * re-add github linker * abstract away enable and disable * toggle fixes * update logic to lean on connection status * update form logic * sheet layout * gitless flag * style and workflow updates * fix side panel size * fix duplicate onerror * copy changes * refetch * merge mutation copy * remove import * add cost * allow connection details on create * initial queries * push button * merge cleanup * Fix TS issues * Fix TS issues * Couple of clean ups * Revert hardcode in useFlag * Fix TS * layout issues and github check * refactor * refactor to use new field * cleanup * style * failed merge * error positioning * refactoring merge * workflow refactor * hook move * clarification with github integration * replace branch dropdown button * update repo picker * updates * remove modal * fix small nits * change defaults * clean up * disable if not gitless and no connection * clean up * always show workflow run id * optimistic * fix branch query * fix issues * fetch edge diff * confirm merge * update edge functions key --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com> Co-authored-by: Alaister Young <a@alaisteryoung.com>
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { DiffEditor } from '@monaco-editor/react'
|
|
import { editor as monacoEditor } from 'monaco-editor'
|
|
|
|
interface DiffViewerProps {
|
|
/** Original/left hand side content (optional) */
|
|
original?: string
|
|
/** Modified/right hand side content */
|
|
modified: string | undefined
|
|
/** Language identifier understood by Monaco */
|
|
language: string
|
|
/** Height for the editor container */
|
|
height?: string | number
|
|
/** Whether to render diffs side-by-side */
|
|
sideBySide?: boolean
|
|
}
|
|
|
|
// Centralised set of options so all diff editors look the same
|
|
const DEFAULT_OPTIONS: monacoEditor.IStandaloneDiffEditorConstructionOptions = {
|
|
readOnly: true,
|
|
renderSideBySide: false,
|
|
minimap: { enabled: false },
|
|
wordWrap: 'on',
|
|
lineNumbers: 'on',
|
|
folding: false,
|
|
padding: { top: 16, bottom: 16 },
|
|
lineNumbersMinChars: 3,
|
|
fontSize: 13,
|
|
scrollBeyondLastLine: false,
|
|
}
|
|
|
|
export const DiffViewer = ({
|
|
original = '',
|
|
modified = '',
|
|
language,
|
|
height = '100%',
|
|
sideBySide = false,
|
|
}: DiffViewerProps) => (
|
|
<DiffEditor
|
|
theme="supabase"
|
|
language={language}
|
|
height={height}
|
|
original={original}
|
|
modified={modified}
|
|
options={{ ...DEFAULT_OPTIONS, renderSideBySide: sideBySide }}
|
|
/>
|
|
)
|
|
|
|
export default DiffViewer
|