Compare commits
No commits in common. "867a9c4e613ba9fa7083794cf9d2e03d4aaaf62b" and "cf1b7a792a5efbdfde041eacca75555a54db0662" have entirely different histories.
867a9c4e61
...
cf1b7a792a
@ -143,21 +143,11 @@ html.macos-vibrancy .main-layout {
|
|||||||
background: transparent !important;
|
background: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.macos-vibrancy .light-mode .ant-layout.main-content-layout,
|
html.macos-vibrancy .light-mode .ant-layout.main-content-layout {
|
||||||
html.macos-vibrancy
|
|
||||||
.light-mode
|
|
||||||
.dashboard-splitter.farmcontrol-splitter
|
|
||||||
> .ant-splitter-bar
|
|
||||||
.ant-splitter-bar-dragger:before {
|
|
||||||
background: rgba(255, 255, 255, 0.88) !important;
|
background: rgba(255, 255, 255, 0.88) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.macos-vibrancy .dark-mode .ant-layout.main-content-layout,
|
html.macos-vibrancy .dark-mode .ant-layout.main-content-layout {
|
||||||
html.macos-vibrancy
|
|
||||||
.dark-mode
|
|
||||||
.dashboard-splitter.farmcontrol-splitter
|
|
||||||
> .ant-splitter-bar
|
|
||||||
.ant-splitter-bar-dragger:before {
|
|
||||||
background: rgba(0, 0, 0, 0.88) !important;
|
background: rgba(0, 0, 0, 0.88) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,14 +3,25 @@ import PropTypes from 'prop-types'
|
|||||||
import CodeMirror from '@uiw/react-codemirror'
|
import CodeMirror from '@uiw/react-codemirror'
|
||||||
import { EditorView, Decoration, ViewPlugin } from '@codemirror/view'
|
import { EditorView, Decoration, ViewPlugin } from '@codemirror/view'
|
||||||
import { StateField } from '@codemirror/state'
|
import { StateField } from '@codemirror/state'
|
||||||
|
import { python } from '@codemirror/lang-python'
|
||||||
|
import { javascriptLang } from '../../../codemirror/javascriptLang'
|
||||||
|
import { json } from '@codemirror/lang-json'
|
||||||
|
import { css } from '@codemirror/lang-css'
|
||||||
|
import { html } from '@codemirror/lang-html'
|
||||||
|
import { markdown } from '@codemirror/lang-markdown'
|
||||||
|
import { sql } from '@codemirror/lang-sql'
|
||||||
|
import { java } from '@codemirror/lang-java'
|
||||||
|
import { cpp } from '@codemirror/lang-cpp'
|
||||||
|
import { rust } from '@codemirror/lang-rust'
|
||||||
|
import { go } from '@codemirror/lang-go'
|
||||||
|
import { php } from '@codemirror/lang-php'
|
||||||
|
import { yaml } from '@codemirror/lang-yaml'
|
||||||
|
import { xml } from '@codemirror/lang-xml'
|
||||||
import {
|
import {
|
||||||
farmControlDark,
|
farmControlDark,
|
||||||
farmControlLight
|
farmControlLight
|
||||||
} from '../../../codemirror/farmControlTheme'
|
} from '../../../codemirror/farmControlTheme'
|
||||||
import {
|
import { fcTemplateLang } from '../../../codemirror/fcTemplateLang'
|
||||||
getCodeLanguageExtension,
|
|
||||||
toEditorCode
|
|
||||||
} from './codeBlockEditorUtils'
|
|
||||||
import { useThemeContext } from '../context/ThemeContext'
|
import { useThemeContext } from '../context/ThemeContext'
|
||||||
import ScrollBox from './ScrollBox'
|
import ScrollBox from './ScrollBox'
|
||||||
import { Button, Modal, Typography, Card } from 'antd'
|
import { Button, Modal, Typography, Card } from 'antd'
|
||||||
@ -88,6 +99,64 @@ function createScrollBoxSyncExtension() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function toEditorCode(code, language = 'javascript') {
|
||||||
|
if (code == null) return ''
|
||||||
|
if (typeof code === 'object' && language === 'json') {
|
||||||
|
return JSON.stringify(code, null, 2)
|
||||||
|
}
|
||||||
|
return String(code)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCodeLanguageExtension(
|
||||||
|
language = 'javascript',
|
||||||
|
autoCompleteObject = null
|
||||||
|
) {
|
||||||
|
const lang = Array.isArray(language) ? language[0] : language
|
||||||
|
|
||||||
|
switch (String(lang || 'javascript').toLowerCase()) {
|
||||||
|
case 'javascript':
|
||||||
|
case 'js':
|
||||||
|
return javascriptLang({ autoCompleteObject })
|
||||||
|
case 'python':
|
||||||
|
case 'py':
|
||||||
|
return python()
|
||||||
|
case 'json':
|
||||||
|
return json()
|
||||||
|
case 'xml':
|
||||||
|
return xml()
|
||||||
|
case 'fctemplatelang':
|
||||||
|
case 'ejs':
|
||||||
|
return fcTemplateLang({ autoCompleteObject })
|
||||||
|
case 'html':
|
||||||
|
return html()
|
||||||
|
case 'css':
|
||||||
|
return css()
|
||||||
|
case 'markdown':
|
||||||
|
case 'md':
|
||||||
|
return markdown()
|
||||||
|
case 'sql':
|
||||||
|
return sql()
|
||||||
|
case 'java':
|
||||||
|
return java()
|
||||||
|
case 'cpp':
|
||||||
|
case 'c++':
|
||||||
|
case 'c':
|
||||||
|
return cpp()
|
||||||
|
case 'rust':
|
||||||
|
case 'rs':
|
||||||
|
return rust()
|
||||||
|
case 'go':
|
||||||
|
return go()
|
||||||
|
case 'php':
|
||||||
|
return php()
|
||||||
|
case 'yaml':
|
||||||
|
case 'yml':
|
||||||
|
return yaml()
|
||||||
|
default:
|
||||||
|
return javascriptLang({ autoCompleteObject })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function buildErrorLineDecorations(state, errorLineSet) {
|
function buildErrorLineDecorations(state, errorLineSet) {
|
||||||
if (!errorLineSet.size) {
|
if (!errorLineSet.size) {
|
||||||
return Decoration.none
|
return Decoration.none
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import { useThemeContext } from '../context/ThemeContext'
|
|||||||
import {
|
import {
|
||||||
getCodeLanguageExtension,
|
getCodeLanguageExtension,
|
||||||
toEditorCode
|
toEditorCode
|
||||||
} from './codeBlockEditorUtils'
|
} from './CodeBlockEditor'
|
||||||
|
|
||||||
export default function CodeDiffViewer({
|
export default function CodeDiffViewer({
|
||||||
oldCode = '',
|
oldCode = '',
|
||||||
|
|||||||
@ -268,6 +268,7 @@ const DashboardSidebarSplitter = ({ sidebar, children }) => {
|
|||||||
collapseSidebar,
|
collapseSidebar,
|
||||||
collapsedWidth,
|
collapsedWidth,
|
||||||
expandSidebar,
|
expandSidebar,
|
||||||
|
lockResizeFor,
|
||||||
lockResizeUntilPointerUp
|
lockResizeUntilPointerUp
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
|
|||||||
import { Button, Modal, Typography, theme, Flex } from 'antd'
|
import { Button, Modal, Typography, theme, Flex } from 'antd'
|
||||||
import { presentableDiff } from '@codemirror/merge'
|
import { presentableDiff } from '@codemirror/merge'
|
||||||
import CodeDiffViewer from './CodeDiffViewer'
|
import CodeDiffViewer from './CodeDiffViewer'
|
||||||
import { toEditorCode } from './codeBlockEditorUtils'
|
import { toEditorCode } from './CodeBlockEditor'
|
||||||
|
|
||||||
const { Link, Text } = Typography
|
const { Link, Text } = Typography
|
||||||
|
|
||||||
|
|||||||
@ -109,7 +109,7 @@ const NotesPanel = ({ _id, type }) => {
|
|||||||
subscribeToObjectTypeUpdatesRef.current = null
|
subscribeToObjectTypeUpdatesRef.current = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [_id, type, subscribeToObjectTypeUpdates, connected, handleReloadData])
|
}, [_id, subscribeToObjectTypeUpdates, connected, handleReloadData])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
|
|||||||
@ -55,8 +55,6 @@ const Tooltip = ({ children, title, content, listenParents = 0 }) => {
|
|||||||
const span = spanRef.current
|
const span = spanRef.current
|
||||||
if (!span || listenParents < 1) return
|
if (!span || listenParents < 1) return
|
||||||
|
|
||||||
const hoveredTargets = hoveredTargetsRef.current
|
|
||||||
|
|
||||||
const handleEnter = (event) => onMouseEnterRef.current(event)
|
const handleEnter = (event) => onMouseEnterRef.current(event)
|
||||||
const handleLeave = (event) => onMouseLeaveRef.current(event)
|
const handleLeave = (event) => onMouseLeaveRef.current(event)
|
||||||
|
|
||||||
@ -77,7 +75,7 @@ const Tooltip = ({ children, title, content, listenParents = 0 }) => {
|
|||||||
parent.removeEventListener('mouseenter', handleEnter)
|
parent.removeEventListener('mouseenter', handleEnter)
|
||||||
parent.removeEventListener('mouseleave', handleLeave)
|
parent.removeEventListener('mouseleave', handleLeave)
|
||||||
})
|
})
|
||||||
hoveredTargets.clear()
|
hoveredTargetsRef.current.clear()
|
||||||
}
|
}
|
||||||
}, [listenParents])
|
}, [listenParents])
|
||||||
|
|
||||||
|
|||||||
@ -1,73 +0,0 @@
|
|||||||
import { python } from '@codemirror/lang-python'
|
|
||||||
import { javascriptLang } from '../../../codemirror/javascriptLang'
|
|
||||||
import { json } from '@codemirror/lang-json'
|
|
||||||
import { css } from '@codemirror/lang-css'
|
|
||||||
import { html } from '@codemirror/lang-html'
|
|
||||||
import { markdown } from '@codemirror/lang-markdown'
|
|
||||||
import { sql } from '@codemirror/lang-sql'
|
|
||||||
import { java } from '@codemirror/lang-java'
|
|
||||||
import { cpp } from '@codemirror/lang-cpp'
|
|
||||||
import { rust } from '@codemirror/lang-rust'
|
|
||||||
import { go } from '@codemirror/lang-go'
|
|
||||||
import { php } from '@codemirror/lang-php'
|
|
||||||
import { yaml } from '@codemirror/lang-yaml'
|
|
||||||
import { xml } from '@codemirror/lang-xml'
|
|
||||||
import { fcTemplateLang } from '../../../codemirror/fcTemplateLang'
|
|
||||||
|
|
||||||
export function toEditorCode(code, language = 'javascript') {
|
|
||||||
if (code == null) return ''
|
|
||||||
if (typeof code === 'object' && language === 'json') {
|
|
||||||
return JSON.stringify(code, null, 2)
|
|
||||||
}
|
|
||||||
return String(code)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getCodeLanguageExtension(
|
|
||||||
language = 'javascript',
|
|
||||||
autoCompleteObject = null
|
|
||||||
) {
|
|
||||||
const lang = Array.isArray(language) ? language[0] : language
|
|
||||||
|
|
||||||
switch (String(lang || 'javascript').toLowerCase()) {
|
|
||||||
case 'javascript':
|
|
||||||
case 'js':
|
|
||||||
return javascriptLang({ autoCompleteObject })
|
|
||||||
case 'python':
|
|
||||||
case 'py':
|
|
||||||
return python()
|
|
||||||
case 'json':
|
|
||||||
return json()
|
|
||||||
case 'xml':
|
|
||||||
return xml()
|
|
||||||
case 'fctemplatelang':
|
|
||||||
case 'ejs':
|
|
||||||
return fcTemplateLang({ autoCompleteObject })
|
|
||||||
case 'html':
|
|
||||||
return html()
|
|
||||||
case 'css':
|
|
||||||
return css()
|
|
||||||
case 'markdown':
|
|
||||||
case 'md':
|
|
||||||
return markdown()
|
|
||||||
case 'sql':
|
|
||||||
return sql()
|
|
||||||
case 'java':
|
|
||||||
return java()
|
|
||||||
case 'cpp':
|
|
||||||
case 'c++':
|
|
||||||
case 'c':
|
|
||||||
return cpp()
|
|
||||||
case 'rust':
|
|
||||||
case 'rs':
|
|
||||||
return rust()
|
|
||||||
case 'go':
|
|
||||||
return go()
|
|
||||||
case 'php':
|
|
||||||
return php()
|
|
||||||
case 'yaml':
|
|
||||||
case 'yml':
|
|
||||||
return yaml()
|
|
||||||
default:
|
|
||||||
return javascriptLang({ autoCompleteObject })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -3,7 +3,8 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
useContext,
|
useContext,
|
||||||
useCallback,
|
useCallback,
|
||||||
useEffect
|
useEffect,
|
||||||
|
useEffectEvent
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import { useLocation } from 'react-router-dom'
|
import { useLocation } from 'react-router-dom'
|
||||||
import { notification, Drawer } from 'antd'
|
import { notification, Drawer } from 'antd'
|
||||||
@ -59,6 +60,11 @@ const NotificationProvider = ({ children }) => {
|
|||||||
}
|
}
|
||||||
}, [authenticated, fetchNotificationsApi, showError])
|
}, [authenticated, fetchNotificationsApi, showError])
|
||||||
|
|
||||||
|
const onFetchNotifications = useEffectEvent(() => {
|
||||||
|
if (!authenticated || !connected) return
|
||||||
|
fetchNotifications()
|
||||||
|
})
|
||||||
|
|
||||||
const markNotificationAsRead = useCallback(
|
const markNotificationAsRead = useCallback(
|
||||||
async (notificationId) => {
|
async (notificationId) => {
|
||||||
try {
|
try {
|
||||||
@ -115,15 +121,15 @@ const NotificationProvider = ({ children }) => {
|
|||||||
|
|
||||||
// Initial load / when we become authenticated and connected
|
// Initial load / when we become authenticated and connected
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!authenticated || !connected) return
|
onFetchNotifications()
|
||||||
fetchNotifications()
|
}, [authenticated, connected])
|
||||||
}, [authenticated, connected, fetchNotifications])
|
|
||||||
|
|
||||||
// Refresh when the notification center opens
|
// Refresh when the notification center opens
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!notificationCenterVisible || !authenticated || !connected) return
|
if (notificationCenterVisible) {
|
||||||
fetchNotifications()
|
onFetchNotifications()
|
||||||
}, [notificationCenterVisible, authenticated, connected, fetchNotifications])
|
}
|
||||||
|
}, [notificationCenterVisible])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setNotificationCenterVisible(false)
|
setNotificationCenterVisible(false)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user