-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update keyboard shortcuts display (#3316)
* remove repeated code * refactor: remove useless code * feat: sort input parameters in GenericNode renderInputParameter * refactor: remove unused code in GenericNode component * refactor: add NodeName component for displaying and editing node names * refactor: add NodeDescription component for displaying and editing node descriptions * fix import and add autofocus on nodeName * feat: add NodeStatus component for displaying and managing node status * [autofix.ci] apply automated fixes * refactor: remove unused code in GenericNode component * fix bugs on minimize * [autofix.ci] apply automated fixes * refactor: remove unused code and handle count in GenericNodeToolbar component * refactor: Add useShortcuts hook for handling keyboard shortcuts in nodeToolbarComponent * refactor: Add keyboard shortcuts handling to nodeToolbarComponent need to test * refactor: Update FreezeAllVertices function in NodeToolbarComponent * feat: Add getNodeLength function to calculate the length of a node's template fields * refactor: Update RenderIcons component to use navigator.platform for detecting macOS * refactor: Add ShortcutDisplay component to nodeToolbarComponent * refactor: Update nodeToolbarComponent to remove RenderIcons and add ShortcutDisplay * refactor: Improve keyboard shortcuts handling in nodeToolbarComponent * [autofix.ci] apply automated fixes * refactor: Add OptionIcon to nodeIconsLucide * feat: Add SHORTCUT_KEYS constant * feat: Add SHORTCUT_KEYS constant * refactor: Add RenderKey component for rendering keyboard shortcuts * refactor: Update RenderIcons component to use RenderKey for rendering keyboard shortcuts * update shortcut page to use shortcut icons * [autofix.ci] apply automated fixes * Update Astra link in README.md (#3314) * Update link in README.md * Update README.md * Update getting-started-installation.md * Update README.KR.md * Update README.ja.md * refactor: Simplify NodeToolbarComponent's save flow logic * [autofix.ci] apply automated fixes * feat: Google Drive Search Component (#3319) * feat: Google Drive Search Component feat: Google Drive Search Component Ability to search Google Drive and get back the relevant Doc id or Doc urls * Updated Google Drive Search.py * feat: Add support for metadata filtering and namespaces for the Upstash Vector component (#3254) * feat: add metadata filtering and namespace support for the upstash vector component * docs: add upstash vector to the vectorstores doc * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> * ci: Update pytest configuration and add pytest-flakefinder. (#3330) * chore: Refactor NodeToolbarComponent to simplify code structure * [autofix.ci] apply automated fixes * refactor: Simplify NodeToolbarComponent's save flow logic * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Alex Leventer <3254549+alexleventer@users.noreply.github.com> Co-authored-by: Edwin Jose <edwin.jose@datastax.com> Co-authored-by: ytkimirti <yusuftaha9@gmail.com> Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
- Loading branch information
1 parent
7fe6c53
commit 0e2f277
Showing
10 changed files
with
115 additions
and
85 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/frontend/src/components/renderIconComponent/components/renderKey/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import ForwardedIconComponent from "@/components/genericIconComponent"; | ||
import { IS_MAC } from "@/constants/constants"; | ||
import { cn } from "@/utils/utils"; | ||
|
||
export default function RenderKey({ | ||
value, | ||
tableRender, | ||
}: { | ||
value: string; | ||
tableRender?: boolean; | ||
}): JSX.Element { | ||
const check = value.toLowerCase().trim(); | ||
return ( | ||
<div> | ||
{check === "shift" ? ( | ||
<ForwardedIconComponent | ||
name="ArrowBigUp" | ||
className={cn(tableRender ? "h-5 w-5" : "h-4 w-4")} | ||
/> | ||
) : check === "ctrl" && IS_MAC ? ( | ||
<span>⌃</span> | ||
) : check === "alt" && IS_MAC ? ( | ||
<ForwardedIconComponent | ||
name="OptionIcon" | ||
className={cn(tableRender ? "h-4 w-4" : "h-3 w-3")} | ||
/> | ||
) : check === "cmd" ? ( | ||
<ForwardedIconComponent | ||
name="Command" | ||
className={cn(tableRender ? "h-4 w-4" : "h-3 w-3")} | ||
/> | ||
) : ( | ||
<span>{value}</span> | ||
)} | ||
</div> | ||
); | ||
} |
59 changes: 17 additions & 42 deletions
59
src/frontend/src/components/renderIconComponent/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,27 @@ | ||
import ForwardedIconComponent from "../genericIconComponent"; | ||
import { IS_MAC } from "@/constants/constants"; | ||
import { addPlusSignes, cn, sortShortcuts } from "@/utils/utils"; | ||
import RenderKey from "./components/renderKey"; | ||
|
||
export default function RenderIcons({ | ||
isMac = navigator.platform.toUpperCase().includes("MAC"), | ||
hasShift, | ||
filteredShortcut, | ||
shortcutWPlus, | ||
tableRender = false, | ||
}: { | ||
isMac?: boolean; | ||
hasShift: boolean; | ||
filteredShortcut: string[]; | ||
shortcutWPlus: string[]; | ||
tableRender?: boolean; | ||
}): JSX.Element { | ||
return hasShift ? ( | ||
<span className="flex items-center justify-center gap-0.5 text-xs"> | ||
{isMac ? ( | ||
<ForwardedIconComponent name="Command" className="h-3 w-3" /> | ||
) : ( | ||
filteredShortcut[0] | ||
const shortcutList = addPlusSignes([...filteredShortcut].sort(sortShortcuts)); | ||
return ( | ||
<span | ||
className={cn( | ||
"flex items-center gap-0.5", | ||
tableRender ? "justify-start" : "justify-center text-xs", | ||
)} | ||
<ForwardedIconComponent name="ArrowBigUp" className="h-4 w-4" /> | ||
{filteredShortcut.map((key, idx) => { | ||
if (idx > 0) { | ||
return key.toUpperCase(); | ||
} | ||
return null; | ||
})} | ||
</span> | ||
) : ( | ||
<span className="flex items-center justify-center gap-0.5 text-xs"> | ||
{shortcutWPlus[0].toLowerCase() === "space" ? ( | ||
"Space" | ||
) : shortcutWPlus[0].length <= 1 ? ( | ||
shortcutWPlus[0] | ||
) : isMac ? ( | ||
<ForwardedIconComponent name="Command" className="h-3 w-3" /> | ||
) : ( | ||
<span className="flex items-center">{shortcutWPlus[0]}</span> | ||
)} | ||
{shortcutWPlus.map((key, idx) => { | ||
if (idx > 0) { | ||
return ( | ||
<span key={idx} className="flex items-center"> | ||
{key.toUpperCase()} | ||
</span> | ||
); | ||
} | ||
return null; | ||
})} | ||
> | ||
{shortcutList.map((key, index) => ( | ||
<span key={index}> | ||
<RenderKey value={key} tableRender={tableRender} /> | ||
</span> | ||
))} | ||
</span> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/frontend/src/pages/SettingsPage/pages/ShortcutsPage/CellRenderWrapper/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import RenderIcons from "@/components/renderIconComponent"; | ||
import { CustomCellRendererProps } from "ag-grid-react"; | ||
|
||
export default function CellRenderShortcuts(params: CustomCellRendererProps) { | ||
const shortcut = params.value; | ||
const splitShortcut = shortcut?.split("+"); | ||
return <RenderIcons filteredShortcut={splitShortcut} tableRender />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters