Reviewed-on: #433 Co-authored-by: miteruzo <miteruzo@naver.com>
このコミットはプルリクエスト #433 でマージされました。
このコミットが含まれているのは:
@@ -5,19 +5,13 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog'
|
||||
import {
|
||||
formatKeyBinding,
|
||||
SHORTCUT_DEFINITIONS,
|
||||
SHORTCUT_SCOPE_LABELS,
|
||||
} from '@/lib/keyboardShortcuts'
|
||||
import { formatKeyBinding, SHORTCUT_DEFINITIONS } from '@/lib/keyboardShortcuts'
|
||||
import { useUITranslation } from '@/lib/useUITranslation'
|
||||
|
||||
import type {
|
||||
KeyBinding,
|
||||
ShortcutActionId,
|
||||
ShortcutScope,
|
||||
} from '@/lib/keyboardShortcuts'
|
||||
import type { FC } from 'react'
|
||||
|
||||
import type { KeyBinding, ShortcutActionId, ShortcutScope } from '@/lib/keyboardShortcuts'
|
||||
|
||||
type Props = {
|
||||
open: boolean
|
||||
onOpenChange: (open: boolean) => void
|
||||
@@ -28,16 +22,10 @@ type Props = {
|
||||
}
|
||||
|
||||
|
||||
const ShortcutHelpDialog: FC<Props> = (
|
||||
{
|
||||
open,
|
||||
onOpenChange,
|
||||
activeScope,
|
||||
effectiveBindings,
|
||||
conflictActionIds,
|
||||
availableActionIds,
|
||||
},
|
||||
) => {
|
||||
const ShortcutHelpDialog: FC<Props> = props => {
|
||||
const { open, onOpenChange, activeScope, effectiveBindings,
|
||||
conflictActionIds, availableActionIds } = props
|
||||
const { label } = useUITranslation ('settings')
|
||||
const rows = SHORTCUT_DEFINITIONS
|
||||
.filter (definition =>
|
||||
definition.scope === 'global' || definition.scope === activeScope)
|
||||
@@ -45,11 +33,12 @@ const ShortcutHelpDialog: FC<Props> = (
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="max-w-3xl px-6 pb-6 pt-7">
|
||||
<DialogContent className="max-w-3xl px-6 pb-6 pt-7"
|
||||
closeLabel={label ('actions.close')}>
|
||||
<DialogHeader className="pl-8">
|
||||
<DialogTitle>キーボード・ショートカット</DialogTitle>
|
||||
<DialogTitle>{label ('shortcuts.title')}</DialogTitle>
|
||||
<DialogDescription>
|
||||
この画面で利用できるショートカットを表示します。
|
||||
{label ('shortcuts.description')}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
@@ -57,24 +46,28 @@ const ShortcutHelpDialog: FC<Props> = (
|
||||
<table className="w-full min-w-[40rem] table-fixed border-collapse text-sm">
|
||||
<thead className="border-b border-border">
|
||||
<tr>
|
||||
<th className="p-2 text-left">操作</th>
|
||||
<th className="p-2 text-left">適用範囲</th>
|
||||
<th className="p-2 text-left">キー</th>
|
||||
<th className="p-2 text-left">競合</th>
|
||||
<th className="p-2 text-left">{label ('shortcuts.operation')}</th>
|
||||
<th className="p-2 text-left">{label ('shortcuts.scope')}</th>
|
||||
<th className="p-2 text-left">{label ('shortcuts.key')}</th>
|
||||
<th className="p-2 text-left">{label ('shortcuts.conflict')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.map (row => (
|
||||
<tr key={row.id} className="border-b border-border/60 last:border-b-0">
|
||||
<td className="p-2">{row.label}</td>
|
||||
<td className="p-2">{SHORTCUT_SCOPE_LABELS[row.scope]}</td>
|
||||
<td className="p-2">{label (`shortcuts.actions.${row.id}`)}</td>
|
||||
<td className="p-2">{label (`shortcuts.scopes.${row.scope}`)}</td>
|
||||
<td className="p-2 font-mono">
|
||||
{formatKeyBinding (effectiveBindings[row.id])}
|
||||
{effectiveBindings[row.id] == null
|
||||
? label ('shortcuts.unassigned')
|
||||
: <span lang="en">{formatKeyBinding (effectiveBindings[row.id])}</span>}
|
||||
</td>
|
||||
<td className="p-2">
|
||||
{conflictActionIds.has (row.id)
|
||||
? <span className="text-red-600 dark:text-red-400">競合あり</span>
|
||||
: 'なし'}
|
||||
? <span className="text-red-600 dark:text-red-400">
|
||||
{label ('shortcuts.conflicting')}
|
||||
</span>
|
||||
: label ('shortcuts.none')}
|
||||
</td>
|
||||
</tr>))}
|
||||
</tbody>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする