Skip to content

Commit

Permalink
final bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Katie George committed Nov 22, 2024
1 parent b9ef771 commit 77cfd01
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 17 deletions.
3 changes: 2 additions & 1 deletion pages/keyboard-shortcut-hackathon/add-new-shortcut.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function AddNewShortcut({ customItems, setCustomItems }: any) {
{ label: 'D', value: '4' },
{ label: 'E', value: '5' },
{ label: 'F', value: '6' },
{ label: 'X', value: '7' },
]}
/>
</SpaceBetween>
Expand All @@ -73,7 +74,7 @@ function AddNewShortcut({ customItems, setCustomItems }: any) {
...customItems,
{
name: shortcutName || `${actions[0].label} + ${actions[1]?.label} + ${actions[2]?.label}`,
shortcut: `${keyCombo.key1.label} ${keyCombo.key2.label}`,
shortcut: `${keyCombo.key1.label} + ${keyCombo.key2.label}`,
actions: actions,
status: 'Enabled',
},
Expand Down
24 changes: 19 additions & 5 deletions pages/keyboard-shortcut-hackathon/app-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function CustomAppLayout({
keyPressed = {};
}

if (keyPressed.Control1 === true && (keyPressed.q0 || keyPressed.x0f) === true) {
if (keyPressed.Control1 === true && (keyPressed.q0 || keyPressed.x0) === true) {
// Check for spacebar press
event.preventDefault(); // Prevent default spacebar behavior
if (activeDrawerId !== null) {
Expand All @@ -83,16 +83,16 @@ export default function CustomAppLayout({
keyPressed = {};
}

if (keyPressed.Control1 === true && keyPressed.e0 === true) {
if (keyPressed.Control1 === true && keyPressed.f0 === true) {
// Check for spacebar press
event.preventDefault(); // Prevent default spacebar behavior
setNavigationOpen(!navigationOpen);
setNavigationOpen(false);
if (activeDrawerId !== null) {
setActiveDrawerId(null);
} else if (activeDrawerId === null) {
setActiveDrawerId('help-panel');
}
setSplitPanelOpen(!splitPanelOpen);
setSplitPanelOpen(false);

keyPressed = {};
}
Expand Down Expand Up @@ -248,7 +248,21 @@ export default function CustomAppLayout({
content: <Drawer header={<h2>Amazon Q</h2>}>This is Amazon Q</Drawer>,
id: 'amazon-q',
trigger: {
iconName: 'settings',
iconSvg: (
<svg
viewBox="0 0 16 16"
data-analytics-type="widgetDetail"
data-analytics="ChatExperienceEntry"
data-analytics-render="true"
data-analytics-processed="true"
>
<path
d="m14.22,3.41L8.87.32c-.24-.14-.55-.21-.87-.21s-.63.07-.87.21L1.78,3.41c-.48.27-.87.95-.87,1.5v6.18c0,.55.39,1.22.87,1.5l5.36,3.09c.24.14.55.21.87.21s.63-.07.87-.21l5.36-3.09c.48-.28.87-.95.87-1.5v-6.18c0-.55-.39-1.23-.87-1.5Zm-6.22,10.47l-5.09-2.94v-5.88l5.09-2.94,5.09,2.94v4.72l-3.09-1.78v-.74c0-.26-.14-.49-.36-.62l-1.28-.74c-.11-.06-.24-.1-.36-.1s-.25.03-.36.1l-1.28.74c-.22.13-.36.37-.36.62v1.48c0,.26.14.49.36.62l1.28.74c.11.06.24.1.36.1s.25-.03.36-.1l.64-.37,3.09,1.78-4.09,2.36Z"
fill="currentColor"
strokeWidth="0"
></path>
</svg>
),
},
},
]}
Expand Down
12 changes: 11 additions & 1 deletion pages/keyboard-shortcut-hackathon/shortcut-page.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,17 @@ export default function ShortcutPage() {
<CustomAppLayout
setSplitPanelOpen={setSplitPanelOpen}
splitPanelOpen={splitPanelOpen}
header={<Header actions={<Button variant="primary">Save</Button>}>Keyboard shortcuts</Header>}
header={
<Header
actions={
<Button variant="primary" href="#/light/keyboard-shortcut-hackathon/demo">
Save
</Button>
}
>
Keyboard shortcuts
</Header>
}
customItems={customItems}
setCustomItems={setCustomItems}
>
Expand Down
20 changes: 10 additions & 10 deletions pages/keyboard-shortcut-hackathon/shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,52 @@
export const shortcuts = [
{
name: 'Toggle navigation',
shortcut: 'N',
shortcut: 'Control + N',
status: 'Enabled',
},
{
name: 'Toggle split panel',
shortcut: 'S',
shortcut: 'Control + S',
status: 'Enabled',
},
{
name: 'Toggle help panel',
shortcut: 'H',
shortcut: 'Control + H',
status: 'Enabled',
},
{
name: 'Toggle Amazon Q',
shortcut: 'Q',
shortcut: 'Control + Q',
status: 'Enabled',
},
{
name: 'Toggle dark mode',
shortcut: '^ + D',
shortcut: 'Control + D',
status: 'Enabled',
},
{
name: 'Toggle compact mode',
shortcut: '^ + C',
shortcut: 'Control + C',
status: 'Enabled',
},
{
name: 'Toggle visual refresh',
shortcut: '^ + V',
shortcut: 'Control + V',
status: 'Enabled',
},
{
name: 'Toggle motion disabled',
shortcut: '^ + M',
shortcut: 'Control + M',
status: 'Enabled',
},
{
name: 'RTL direction',
shortcut: '^ + R',
shortcut: 'Control + R',
status: 'Enabled',
},
{
name: 'LTR direction',
shortcut: '^ + L',
shortcut: 'Control + L',
status: 'Enabled',
},
];

0 comments on commit 77cfd01

Please sign in to comment.