Skip to content

Commit

Permalink
fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
getoffdeez committed Jul 1, 2024
1 parent d887c13 commit 25ed0c1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion components/Live.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const Live = ({ canvasRef, undo, redo }: Props) => {
return (
<ContextMenu>
<ContextMenuTrigger
className="relative flex h-full w-full flex-1 items-center justify-center"
className="relative flex h-full w-full flex-1 items-center justify-center overflow-scroll"
id="canvas"
style={{
cursor: cursorState.mode === CursorMode.Chat ? "none" : "auto",
Expand Down
2 changes: 1 addition & 1 deletion components/card-base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const CardBase= () => {
<div className="flex flex-col gap-4 border-4 border-b-8 border-blue-500 shadow-lg p-4 bg-white rounded-md transform transition-transform duration-300 hover:scale-105 hover:shadow-2xl hover:rotate-2 min-w-56">
<Image src="/onchain-summer.png" alt={"Onchain Summer"} width={200} height={200}
/>
<h3 className="text-teal-900 text-center typewriter font-bold">OnChain Summer</h3>
<h3 className="text-teal-900 text-center typewriter font-bold">Onchain Summer</h3>
<Link href={'/onchain-summer'}>
<Button variant={'secondary'}>Let's Play</Button>
</Link>
Expand Down
6 changes: 4 additions & 2 deletions components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ export default function Header() {
<Button variant={'primary'}>Dashboard</Button>
</Link>
)}
<Hint side="left" label={"Login with email or Farcaster is enabled for allowlisted emails and FIDs"}>
<Info size={24} />
{!isLoggedIn && (
<Hint side="left" label={"Login with email or Farcaster is enabled for allowlisted emails and FIDs"}>
<Info size={24} />
</Hint>
)}
<DynamicWidget />
</div>
</div>
Expand Down
13 changes: 5 additions & 8 deletions lib/key-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,44 +93,41 @@ export const handleKeyDown = ({
syncShapeInStorage: (shape: fabric.Object) => void;
deleteShapeFromStorage: (id: string) => void;
}) => {
const activeElement = document.activeElement;
const isInputField = activeElement && (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA' || activeElement.isContentEditable);

if ((e.ctrlKey || e.metaKey) && e.key === 'c') {
e.preventDefault();
handleCopy(canvas);
}

// Check if the key pressed is ctrl/cmd + v (paste)
if ((e.ctrlKey || e.metaKey) && e.key === 'v') {
e.preventDefault();
handlePaste(canvas, syncShapeInStorage);
}

// Check if the key pressed is delete/backspace (delete)
if (e.key === 'Delete' || e.key === 'Backspace') {
if ((e.key === 'Delete' || e.key === 'Backspace') && !isInputField) {
e.preventDefault();
handleDelete(canvas, deleteShapeFromStorage);
}

// Check if the key pressed is ctrl/cmd + x (cut)
if ((e.ctrlKey || e.metaKey) && e.key === 'x') {
e.preventDefault();
handleCopy(canvas);
handleDelete(canvas, deleteShapeFromStorage);
}

// Check if the key pressed is ctrl/cmd + z (undo)
if ((e.ctrlKey || e.metaKey) && e.key === 'z') {
e.preventDefault();
undo();
}

// Check if the key pressed is ctrl/cmd + y (redo)
if ((e.ctrlKey || e.metaKey) && e.key === 'y') {
e.preventDefault();
redo();
}

// Prevent default for '?' key
if (e.key === '/' && !e.shiftKey) {
e.preventDefault();
}
};
};

0 comments on commit 25ed0c1

Please sign in to comment.