mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 20:05:06 +03:00
updated UI
This commit is contained in:
1 parent
b91e194f3f
commit
d757e23fd9
3 files changed
+23
-31
No files matched your search
@@ -1,4 +1,13 @@
|
||||
import { RotateCcw } from 'lucide-react'
|
||||
import { hotkeyToDisplayKeys } from 'state/shortcuts/hotkey-utils'
|
||||
import { SHORTCUT_DEFINITIONS } from 'state/shortcuts/registry'
|
||||
import {
|
||||
resetAllShortcuts,
|
||||
resetShortcut,
|
||||
setShortcutEnabled,
|
||||
useShortcutStateSnapshot,
|
||||
} from 'state/shortcuts/shortcut-state'
|
||||
import { SHORTCUT_CATEGORIES, ShortcutDefinition, ShortcutId } from 'state/shortcuts/types'
|
||||
import { Button, Card, CardContent, KeyboardShortcut, Switch } from 'ui'
|
||||
import {
|
||||
PageSection,
|
||||
@@ -9,28 +18,9 @@ import {
|
||||
PageSectionTitle,
|
||||
} from 'ui-patterns/PageSection'
|
||||
|
||||
import {
|
||||
SHORTCUT_CATEGORIES,
|
||||
SHORTCUT_DEFINITIONS,
|
||||
type ShortcutDefinition,
|
||||
type ShortcutId,
|
||||
} from 'state/shortcuts/registry'
|
||||
import {
|
||||
resetAllShortcuts,
|
||||
resetShortcut,
|
||||
setShortcutEnabled,
|
||||
useShortcutStateSnapshot,
|
||||
} from 'state/shortcuts/shortcut-state'
|
||||
import { hotkeyToDisplayKeys } from 'state/shortcuts/hotkey-utils'
|
||||
import { ShortcutRecorder } from './ShortcutRecorder'
|
||||
|
||||
function ShortcutRow({
|
||||
definition,
|
||||
isLast,
|
||||
}: {
|
||||
definition: ShortcutDefinition
|
||||
isLast: boolean
|
||||
}) {
|
||||
function ShortcutRow({ definition, isLast }: { definition: ShortcutDefinition; isLast: boolean }) {
|
||||
const snap = useShortcutStateSnapshot()
|
||||
const override = snap.overrides[definition.id]
|
||||
const effectiveHotkey = (override?.hotkey as string) ?? definition.defaultHotkey
|
||||
@@ -90,7 +80,12 @@ export function ShortcutSettings() {
|
||||
<div className="space-y-6">
|
||||
{hasOverrides && (
|
||||
<div className="flex justify-end">
|
||||
<Button type="default" size="tiny" icon={<RotateCcw size={14} />} onClick={resetAllShortcuts}>
|
||||
<Button
|
||||
type="default"
|
||||
size="tiny"
|
||||
icon={<RotateCcw size={14} />}
|
||||
onClick={resetAllShortcuts}
|
||||
>
|
||||
Reset all to defaults
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -8,12 +8,12 @@ import saveAs from 'file-saver'
|
||||
import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
|
||||
import { useHotKey } from 'hooks/ui/useHotKey'
|
||||
import { useShortcut } from 'hooks/ui/useShortcut'
|
||||
import { SHORTCUT_IDS } from 'state/shortcuts/registry'
|
||||
import { ChevronDown, Copy, Download, Settings } from 'lucide-react'
|
||||
import Link from 'next/link'
|
||||
import { usePathname } from 'next/navigation'
|
||||
import { useMemo } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
import { SHORTCUT_IDS } from 'state/shortcuts/registry'
|
||||
import {
|
||||
Button,
|
||||
copyToClipboard,
|
||||
@@ -93,14 +93,10 @@ export const DownloadResultsButton = ({
|
||||
})
|
||||
}
|
||||
|
||||
useShortcut(
|
||||
SHORTCUT_IDS.RESULTS_COPY_MARKDOWN,
|
||||
(e) => {
|
||||
e.preventDefault()
|
||||
copyAsMarkdown()
|
||||
},
|
||||
{ enabled: copyMarkdownEnabled ?? isEmpty }
|
||||
)
|
||||
useShortcut(SHORTCUT_IDS.RESULTS_COPY_MARKDOWN, (e) => {
|
||||
e.preventDefault()
|
||||
copyAsMarkdown()
|
||||
})
|
||||
|
||||
useHotKey(
|
||||
(e) => {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import useLatest from 'hooks/misc/useLatest'
|
||||
import { useEffect } from 'react'
|
||||
import { eventMatchesHotkey, parseHotkey } from 'state/shortcuts/hotkey-utils'
|
||||
import { SHORTCUT_DEFINITIONS, type ShortcutId } from 'state/shortcuts/registry'
|
||||
import { SHORTCUT_DEFINITIONS } from 'state/shortcuts/registry'
|
||||
import { useShortcutStateSnapshot } from 'state/shortcuts/shortcut-state'
|
||||
import { ShortcutId } from 'state/shortcuts/types'
|
||||
|
||||
/**
|
||||
* Subscribe to a registered shortcut by ID.
|
||||
|
||||
Reference in new issue
Block a user