-
Notifications
You must be signed in to change notification settings - Fork 12
Styling issue in Quarkus Flow #442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@openworkflowspec/diagram-editor": minor | ||
| --- | ||
|
|
||
| Toast notification removed for side panel buttons |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ | |
|
|
||
| import * as React from "react"; | ||
| import { useI18n } from "@openworkflowspec/i18n"; | ||
| import { ClipboardPen, Download, ClipboardCheck, FileImage } from "lucide-react"; | ||
| import { ClipboardPen, Download, ClipboardCheck, FileImage, Import } from "lucide-react"; | ||
| import { useReactFlow, useStore } from "@xyflow/react"; | ||
| import { Button } from "@/components/ui/button"; | ||
| import { exportToMermaid } from "@/core"; | ||
|
|
@@ -26,12 +26,13 @@ import { exportDiagramAsPng } from "@/lib/exportPng"; | |
| import { sanitizeFilename } from "@/lib/utils"; | ||
| import { useDiagramEditorContext } from "@/store/DiagramEditorContext"; | ||
| import type { Specification } from "@openworkflowspec/sdk"; | ||
| import { toast } from "sonner"; | ||
|
|
||
| export function WorkflowActions({ model }: { model: Specification.Workflow }): React.JSX.Element { | ||
| const { t } = useI18n(); | ||
| const [isCopied, setIsCopied] = React.useState(false); | ||
| const [downloadedType, setDownloadedType] = React.useState<"mermaid" | "png" | null>(null); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering there is no need to show downloaded, it will simplify changes to this file, if you can make those updates to strip out that code |
||
| const copyTimeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null); | ||
| const downloadTimeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null); | ||
| const reactFlowInstance = useReactFlow(); | ||
| const diagramDomNode = useStore((s) => s.domNode); | ||
| const { isExporting, setIsExporting } = useDiagramEditorContext(); | ||
|
|
@@ -41,6 +42,10 @@ export function WorkflowActions({ model }: { model: Specification.Workflow }): R | |
| if (copyTimeoutRef.current) { | ||
| clearTimeout(copyTimeoutRef.current); | ||
| } | ||
|
|
||
| if (downloadTimeoutRef.current) { | ||
| clearTimeout(downloadTimeoutRef.current); | ||
| } | ||
| }; | ||
| }, []); | ||
|
|
||
|
|
@@ -59,9 +64,10 @@ export function WorkflowActions({ model }: { model: Specification.Workflow }): R | |
| copyTimeoutRef.current = null; | ||
| }, 2000); | ||
| } catch (error) { | ||
| toast.error(t("toast.clipboard.error"), { | ||
| description: error instanceof Error ? error.message : undefined, | ||
| }); | ||
| console.error( | ||
| "Failed to copy Mermaid code:", | ||
| error instanceof Error ? error.message : undefined, | ||
| ); | ||
| } | ||
| }; | ||
|
|
||
|
|
@@ -70,11 +76,21 @@ export function WorkflowActions({ model }: { model: Specification.Workflow }): R | |
| const mermaidCode = exportToMermaid(model); | ||
| const filename = `${sanitizeFilename(model.document?.name)}.mmd`; | ||
| downloadFile(mermaidCode, filename); | ||
| toast.success(t("toast.download.success")); | ||
| setDownloadedType("mermaid"); | ||
|
|
||
| if (downloadTimeoutRef.current) { | ||
| clearTimeout(downloadTimeoutRef.current); | ||
| } | ||
|
|
||
| downloadTimeoutRef.current = setTimeout(() => { | ||
| setDownloadedType(null); | ||
| downloadTimeoutRef.current = null; | ||
| }, 2000); | ||
| } catch (error) { | ||
| toast.error(t("toast.download.error"), { | ||
| description: error instanceof Error ? error.message : undefined, | ||
| }); | ||
| console.error( | ||
| "Failed to download Mermaid file:", | ||
| error instanceof Error ? error.message : undefined, | ||
| ); | ||
| } | ||
| }; | ||
|
|
||
|
|
@@ -86,11 +102,22 @@ export function WorkflowActions({ model }: { model: Specification.Workflow }): R | |
| `${sanitizeFilename(model.document?.name)}.png`, | ||
| diagramDomNode, | ||
| ); | ||
| toast.success(t("toast.download.success")); | ||
|
|
||
| setDownloadedType("png"); | ||
|
|
||
| if (downloadTimeoutRef.current) { | ||
| clearTimeout(downloadTimeoutRef.current); | ||
| } | ||
|
|
||
| downloadTimeoutRef.current = setTimeout(() => { | ||
| setDownloadedType(null); | ||
| downloadTimeoutRef.current = null; | ||
| }, 2000); | ||
| } catch (error) { | ||
| toast.error(t("toast.download.error"), { | ||
| description: error instanceof Error ? error.message : undefined, | ||
| }); | ||
| console.error( | ||
| "Failed to export diagram as PNG:", | ||
| error instanceof Error ? error.message : undefined, | ||
| ); | ||
| } finally { | ||
| setIsExporting(false); | ||
| } | ||
|
|
@@ -113,8 +140,10 @@ export function WorkflowActions({ model }: { model: Specification.Workflow }): R | |
| size="sm" | ||
| className="dec:cursor-pointer" | ||
| > | ||
| <Download /> | ||
| {t("sidebar.exportMermaid.download")} | ||
| {downloadedType === "mermaid" ? <Import /> : <Download />} | ||
| {downloadedType === "mermaid" | ||
| ? t("sidebar.export.downloaded") | ||
| : t("sidebar.exportMermaid.download")} | ||
| </Button> | ||
| <Button | ||
| onClick={handleExportPng} | ||
|
|
@@ -123,8 +152,12 @@ export function WorkflowActions({ model }: { model: Specification.Workflow }): R | |
| className="dec:cursor-pointer" | ||
| disabled={isExporting} | ||
| > | ||
| <FileImage /> | ||
| {t("sidebar.exportPng.download")} | ||
| {downloadedType === "png" ? <Import /> : <FileImage />} | ||
| {isExporting | ||
| ? t("sidebar.exportPng.downloading") | ||
| : downloadedType === "png" | ||
| ? t("sidebar.export.downloaded") | ||
| : t("sidebar.exportPng.download")} | ||
| </Button> | ||
| </> | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,15 +15,28 @@ | |
| */ | ||
|
|
||
| /* layer order (Priority: lowest -> highest) */ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ordering in this file was deliberate before so not sue why it changed? I would revert it and add your new block after import but it should be |
||
|
|
||
| @import 'tailwindcss' prefix(dec); | ||
| @import './components/ui/shadcn.css'; | ||
|
|
||
| @layer base { | ||
| .dec-root, | ||
| .dec-root *, | ||
| .dec-root::before, | ||
| .dec-root::after, | ||
| .dec-root::backdrop, | ||
| .dec-root *::before, | ||
| .dec-root *::after, | ||
| .dec-root *::backdrop { | ||
| --tw-border-style: solid; | ||
| } | ||
| } | ||
|
|
||
| @layer base, | ||
| side-panel, | ||
| react-flow-overrides, | ||
| custom-nodes, | ||
| custom-edge-labels, | ||
| sonner; | ||
|
|
||
| @import 'tailwindcss' prefix(dec); | ||
| @import './components/ui/shadcn.css'; | ||
| custom-edge-labels; | ||
|
|
||
| @custom-variant dark (&:where(.dec-root.dark, .dec-root.dark *)); | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also see further down this file there are toast tokens that are no longer used if you can remove please |
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesnt need to say downloaded, I think just flashing downloading is fine - its obvious when its downloaded in browser