mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-23 16:09:11 +00:00
refactor(shortcuts): improve readability of info element
This commit is contained in:
committed by
Carlos Valente
parent
7e7d35980a
commit
e7e4302100
@@ -0,0 +1,14 @@
|
|||||||
|
.kbd {
|
||||||
|
display: inline-block;
|
||||||
|
min-width: 1.5rem;
|
||||||
|
padding: 0.0625rem 0.375rem;
|
||||||
|
border-radius: 2px;
|
||||||
|
background-color: $gray-1100;
|
||||||
|
color: $ui-white;
|
||||||
|
box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: calc(1rem - 4px);
|
||||||
|
line-height: 1.5;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { PropsWithChildren } from 'react';
|
||||||
|
|
||||||
|
import style from './Kbd.module.scss';
|
||||||
|
|
||||||
|
export default function Kbd({ children }: PropsWithChildren) {
|
||||||
|
return <kbd className={style.kbd}>{children}</kbd>;
|
||||||
|
}
|
||||||
@@ -3,58 +3,94 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: 0.5rem;
|
padding: 1rem 1.5rem;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow-x: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.shortcutSection {
|
.shortcutSection {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
margin-top: 15vh;
|
width: min(100%, 48rem);
|
||||||
|
margin-top: clamp(1.5rem, 8vh, 5rem);
|
||||||
margin-inline: auto;
|
margin-inline: auto;
|
||||||
gap: 1rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.shortcuts {
|
.shortcuts {
|
||||||
font-size: calc(1rem - 3px);
|
display: grid;
|
||||||
border-collapse: separate;
|
gap: 0.875rem;
|
||||||
border-spacing: 4rem 0;
|
margin-top: 0.875rem;
|
||||||
|
}
|
||||||
|
|
||||||
tr {
|
.shortcutGroup {
|
||||||
white-space: nowrap;
|
h3 {
|
||||||
td:nth-child(odd) {
|
margin: 0 0 0.375rem;
|
||||||
text-align: left;
|
color: $ui-white;
|
||||||
}
|
font-size: calc(1rem - 3px);
|
||||||
td:nth-child(even) {
|
font-weight: 600;
|
||||||
text-align: right;
|
text-transform: uppercase;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.spacer {
|
.shortcutList {
|
||||||
height: 1rem;
|
display: grid;
|
||||||
|
gap: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shortcutRow {
|
||||||
|
min-height: 1.625rem;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(10rem, 1fr) minmax(0, auto);
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
font-size: calc(1rem - 3px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shortcutLabel {
|
||||||
|
min-width: 0;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shortcutKeys {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 0.25rem 0.5rem;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.keyCombo {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
gap: 0.25rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.separator {
|
||||||
|
color: $gray-500;
|
||||||
|
font-size: calc(1rem - 5px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.prompt {
|
.prompt {
|
||||||
margin-left: 4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.divider {
|
|
||||||
display: inline-block;
|
|
||||||
text-align: center;
|
|
||||||
width: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.kbd {
|
|
||||||
font-family: monospace;
|
|
||||||
white-space: nowrap;
|
|
||||||
font-size: calc(1rem - 2px);
|
|
||||||
padding: 0.125rem 0.5rem;
|
|
||||||
background-color: $gray-1200;
|
|
||||||
color: $ui-white;
|
color: $ui-white;
|
||||||
border-radius: 2px;
|
}
|
||||||
font-weight: 400;
|
|
||||||
box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.4);
|
@media (max-width: 680px) {
|
||||||
|
.entryEditor {
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shortcutSection {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shortcutRow {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shortcutKeys {
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { PropsWithChildren, memo } from 'react';
|
import { PropsWithChildren, memo } from 'react';
|
||||||
|
|
||||||
import * as Editor from '../../../common/components/editor-utils/EditorUtils';
|
import * as Editor from '../../../common/components/editor-utils/EditorUtils';
|
||||||
|
import Kbd from '../../../common/components/kbd/Kbd';
|
||||||
import { deviceAlt, deviceMod } from '../../../common/utils/deviceUtils';
|
import { deviceAlt, deviceMod } from '../../../common/utils/deviceUtils';
|
||||||
|
|
||||||
import style from './EventEditorEmpty.module.scss';
|
import style from './EventEditorEmpty.module.scss';
|
||||||
@@ -12,216 +13,124 @@ function EventEditorEmpty() {
|
|||||||
<div className={style.entryEditor} data-testid='editor-container'>
|
<div className={style.entryEditor} data-testid='editor-container'>
|
||||||
<div className={style.shortcutSection}>
|
<div className={style.shortcutSection}>
|
||||||
<Editor.Title className={style.prompt}>Rundown shortcuts</Editor.Title>
|
<Editor.Title className={style.prompt}>Rundown shortcuts</Editor.Title>
|
||||||
<table className={style.shortcuts}>
|
<div className={style.shortcuts}>
|
||||||
<tbody>
|
<ShortcutGroup title='Search'>
|
||||||
<tr>
|
<Shortcut label='Find in rundown'>
|
||||||
<td>Find in rundown</td>
|
<Combo keys={[deviceMod, 'F']} />
|
||||||
<td>
|
</Shortcut>
|
||||||
<Kbd>{deviceMod}</Kbd>
|
<Shortcut label='Open settings'>
|
||||||
<AuxKey>+</AuxKey>
|
<Combo keys={[deviceMod, ',']} />
|
||||||
<Kbd>F</Kbd>
|
</Shortcut>
|
||||||
</td>
|
</ShortcutGroup>
|
||||||
</tr>
|
|
||||||
<tr>
|
<ShortcutGroup title='Navigation'>
|
||||||
<td>Open Settings</td>
|
<Shortcut label='Select entry'>
|
||||||
<td>
|
<Combo keys={[deviceAlt, '↑']} />
|
||||||
<Kbd>{deviceMod}</Kbd>
|
<Separator />
|
||||||
<AuxKey>+</AuxKey>
|
<Combo keys={[deviceAlt, '↓']} />
|
||||||
<Kbd>,</Kbd>
|
</Shortcut>
|
||||||
</td>
|
<Shortcut label='Select group'>
|
||||||
</tr>
|
<Combo keys={[deviceAlt, 'Shift', '↑']} />
|
||||||
<tr className={style.spacer} />
|
<Separator />
|
||||||
<tr>
|
<Combo keys={[deviceAlt, 'Shift', '↓']} />
|
||||||
<td>Select entry</td>
|
</Shortcut>
|
||||||
<td>
|
<Shortcut label='Jump to top / bottom'>
|
||||||
<Kbd>{deviceAlt}</Kbd>
|
<Combo keys={['Home']} />
|
||||||
<AuxKey>+</AuxKey>
|
<Separator />
|
||||||
<Kbd>↑</Kbd>
|
<Combo keys={['End']} />
|
||||||
<AuxKey>/</AuxKey>
|
</Shortcut>
|
||||||
<Kbd>↓</Kbd>
|
<Shortcut label='Page up / down'>
|
||||||
</td>
|
<Combo keys={['PgUp']} />
|
||||||
</tr>
|
<Separator />
|
||||||
<tr>
|
<Combo keys={['PgDn']} />
|
||||||
<td>Select group</td>
|
</Shortcut>
|
||||||
<td>
|
<Shortcut label='Deselect entry'>
|
||||||
<Kbd>{deviceAlt}</Kbd>
|
<Combo keys={['Esc']} />
|
||||||
<AuxKey>+</AuxKey>
|
</Shortcut>
|
||||||
<Kbd>Shift</Kbd>
|
</ShortcutGroup>
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>↑</Kbd>
|
<ShortcutGroup title='Editing'>
|
||||||
<AuxKey>/</AuxKey>
|
<Shortcut label='Reorder selected entry'>
|
||||||
<Kbd>↓</Kbd>
|
<Combo keys={[deviceAlt, deviceMod, '↑']} />
|
||||||
</td>
|
<Separator />
|
||||||
</tr>
|
<Combo keys={[deviceAlt, deviceMod, '↓']} />
|
||||||
<tr>
|
</Shortcut>
|
||||||
<td>Jump to top / bottom</td>
|
<Shortcut label='Copy selected entry'>
|
||||||
<td>
|
<Combo keys={[deviceMod, 'C']} />
|
||||||
<Kbd>Home</Kbd>
|
</Shortcut>
|
||||||
<AuxKey>/</AuxKey>
|
<Shortcut label='Cut selected entry'>
|
||||||
<Kbd>End</Kbd>
|
<Combo keys={[deviceMod, 'X']} />
|
||||||
</td>
|
</Shortcut>
|
||||||
</tr>
|
<Shortcut label='Paste below'>
|
||||||
<tr>
|
<Combo keys={[deviceMod, 'V']} />
|
||||||
<td>Page up / down</td>
|
</Shortcut>
|
||||||
<td>
|
<Shortcut label='Paste above'>
|
||||||
<Kbd>PgUp</Kbd>
|
<Combo keys={[deviceMod, 'Shift', 'V']} />
|
||||||
<AuxKey>/</AuxKey>
|
</Shortcut>
|
||||||
<Kbd>PgDn</Kbd>
|
<Shortcut label='Clone selected entry'>
|
||||||
</td>
|
<Combo keys={[deviceMod, 'D']} />
|
||||||
</tr>
|
</Shortcut>
|
||||||
<tr>
|
<Shortcut label='Delete selected entry'>
|
||||||
<td>Deselect entry</td>
|
<Combo keys={[deviceAlt, 'Backspace']} />
|
||||||
<td>
|
</Shortcut>
|
||||||
<Kbd>Esc</Kbd>
|
</ShortcutGroup>
|
||||||
</td>
|
|
||||||
</tr>
|
<ShortcutGroup title='Insert'>
|
||||||
<tr className={style.spacer} />
|
<Shortcut label='Add event below / above'>
|
||||||
<tr>
|
<Combo keys={[deviceAlt, 'E']} />
|
||||||
<td>Reorder selected entry</td>
|
<Separator />
|
||||||
<td>
|
<Combo keys={[deviceAlt, 'Shift', 'E']} />
|
||||||
<Kbd>{deviceAlt}</Kbd>
|
</Shortcut>
|
||||||
<AuxKey>+</AuxKey>
|
<Shortcut label='Add group below / above'>
|
||||||
<Kbd>{deviceMod}</Kbd>
|
<Combo keys={[deviceAlt, 'G']} />
|
||||||
<AuxKey>+</AuxKey>
|
<Separator />
|
||||||
<Kbd>↑</Kbd>
|
<Combo keys={[deviceAlt, 'Shift', 'G']} />
|
||||||
<AuxKey>/</AuxKey>
|
</Shortcut>
|
||||||
<Kbd>↓</Kbd>
|
<Shortcut label='Add milestone below / above'>
|
||||||
</td>
|
<Combo keys={[deviceAlt, 'M']} />
|
||||||
</tr>
|
<Separator />
|
||||||
<tr>
|
<Combo keys={[deviceAlt, 'Shift', 'M']} />
|
||||||
<td>Copy selected entry</td>
|
</Shortcut>
|
||||||
<td>
|
<Shortcut label='Add delay below / above'>
|
||||||
<Kbd>{deviceMod}</Kbd>
|
<Combo keys={[deviceAlt, 'D']} />
|
||||||
<AuxKey>+</AuxKey>
|
<Separator />
|
||||||
<Kbd>C</Kbd>
|
<Combo keys={[deviceAlt, 'Shift', 'D']} />
|
||||||
</td>
|
</Shortcut>
|
||||||
</tr>
|
</ShortcutGroup>
|
||||||
<tr>
|
</div>
|
||||||
<td>Cut selected entry</td>
|
|
||||||
<td>
|
|
||||||
<Kbd>{deviceMod}</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>X</Kbd>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Paste above</td>
|
|
||||||
<td>
|
|
||||||
<Kbd>{deviceMod}</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>Shift</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>V</Kbd>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Paste below</td>
|
|
||||||
<td>
|
|
||||||
<Kbd>{deviceMod}</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>V</Kbd>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Clone selected entry</td>
|
|
||||||
<td>
|
|
||||||
<Kbd>{deviceMod}</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>D</Kbd>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Delete selected entry</td>
|
|
||||||
<td>
|
|
||||||
<Kbd>{deviceAlt}</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>Backspace</Kbd>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr className={style.spacer} />
|
|
||||||
<tr>
|
|
||||||
<td>Add event below</td>
|
|
||||||
<td>
|
|
||||||
<Kbd>{deviceAlt}</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>E</Kbd>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Add event above</td>
|
|
||||||
<td>
|
|
||||||
<Kbd>{deviceAlt}</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>Shift</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>E</Kbd>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Add group below</td>
|
|
||||||
<td>
|
|
||||||
<Kbd>{deviceAlt}</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>G</Kbd>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Add group above</td>
|
|
||||||
<td>
|
|
||||||
<Kbd>{deviceAlt}</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>Shift</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>G</Kbd>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Add milestone below</td>
|
|
||||||
<td>
|
|
||||||
<Kbd>{deviceAlt}</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>M</Kbd>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Add milestone above</td>
|
|
||||||
<td>
|
|
||||||
<Kbd>{deviceAlt}</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>Shift</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>M</Kbd>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Add delay below</td>
|
|
||||||
<td>
|
|
||||||
<Kbd>{deviceAlt}</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>D</Kbd>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Add delay above</td>
|
|
||||||
<td>
|
|
||||||
<Kbd>{deviceAlt}</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>Shift</Kbd>
|
|
||||||
<AuxKey>+</AuxKey>
|
|
||||||
<Kbd>D</Kbd>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function AuxKey({ children }: PropsWithChildren) {
|
function ShortcutGroup({ title, children }: PropsWithChildren<{ title: string }>) {
|
||||||
return <span className={style.divider}>{children}</span>;
|
return (
|
||||||
|
<section className={style.shortcutGroup}>
|
||||||
|
<h3>{title}</h3>
|
||||||
|
<div className={style.shortcutList}>{children}</div>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Kbd({ children }: PropsWithChildren) {
|
function Shortcut({ label, children }: PropsWithChildren<{ label: string }>) {
|
||||||
return <span className={style.kbd}>{children}</span>;
|
return (
|
||||||
|
<div className={style.shortcutRow}>
|
||||||
|
<span className={style.shortcutLabel}>{label}</span>
|
||||||
|
<span className={style.shortcutKeys}>{children}</span>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Combo({ keys }: { keys: string[] }) {
|
||||||
|
return (
|
||||||
|
<span className={style.keyCombo}>
|
||||||
|
{keys.map((key) => (
|
||||||
|
<Kbd key={key}>{key}</Kbd>
|
||||||
|
))}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Separator() {
|
||||||
|
return <span className={style.separator}>/</span>;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user