Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

add hook

Arpit Bhalla56b5e37fa5fb
diff --git a/studio/pages/project/[ref]/sql/index.tsx b/studio/pages/project/[ref]/sql/index.tsx
index 8551dfd97c4..6b48869468c 100644
--- a/studio/pages/project/[ref]/sql/index.tsx
+++ b/studio/pages/project/[ref]/sql/index.tsx
@@ -62,32 +62,31 @@ const PageLayout = observer(() => {
})
const SqlEditor = observer(() => {
- const { meta } = useStore()
+ const { meta, ui } = useStore()
+ const { isDarkTheme } = ui
const sqlEditorStore: any = useSqlStore()
const monaco = useMonaco()
const [theme, setTheme] = useState(localStorage.getItem('theme'))
useEffect(() => {
if (monaco) {
- const darkTheme = theme ? (theme === 'dark' ? true : false) : true
-
monaco.editor.defineTheme('supabase', {
- base: darkTheme ? 'vs-dark' : 'vs', // can also be hc-black
+ base: isDarkTheme ? 'vs-dark' : 'vs', // can also be hc-black
inherit: true, // can also be false to completely replace the builtin rules
rules: [
- { token: '', background: darkTheme ? '1f1f1f' : 'f0f0f0' },
+ { token: '', background: isDarkTheme ? '1f1f1f' : 'f0f0f0' },
{ token: 'string.sql', foreground: '24b47e' },
{ token: 'comment', foreground: '666666' },
// { token: 'predefined.sql', foreground: 'D4D4D4' },
],
colors: {
- 'editor.background': darkTheme ? '#1f1f1f' : '#f0f0f0',
+ 'editor.background': isDarkTheme ? '#1f1f1f' : '#f0f0f0',
// 'editorGutter.background': '#30313f',
// 'editorLineNumber.foreground': '#555671',
},
})
}
- }, [theme, monaco])
+ }, [monaco, isDarkTheme])
useEffect(() => {
if (monaco) {