-
Notifications
You must be signed in to change notification settings - Fork 310
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
[OPIK-759] implement side dialog component and log a trace dialog #1111
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
79 changes: 16 additions & 63 deletions
79
...nd/src/components/pages-shared/onboarding/FrameworkIntegrations/FrameworkIntegrations.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,69 +1,22 @@ | ||
import React, { useState } from "react"; | ||
import { FrameworkIntegration } from "./types"; | ||
import { Button } from "@/components/ui/button"; | ||
import { buildDocsUrl } from "@/lib/utils"; | ||
import { SquareArrowOutUpRight } from "lucide-react"; | ||
import ApiKeyCard from "../ApiKeyCard/ApiKeyCard"; | ||
import GoogleColabCard from "../GoogleColabCard/GoogleColabCard"; | ||
import IntegrationTemplate from "./IntegrationTemplate"; | ||
import usePluginsStore from "@/store/PluginsStore"; | ||
import FrameworkIntegrationsContent, { | ||
FrameworkIntegrationsContentProps, | ||
} from "./FrameworkIntegrationsContent"; | ||
|
||
type FrameworkIntegrationsProps = { | ||
integrationList: FrameworkIntegration[]; | ||
apiKey?: string; | ||
showColabLinks?: boolean; | ||
}; | ||
const FrameworkIntegrations: React.FC<FrameworkIntegrationsProps> = ({ | ||
integrationList, | ||
apiKey, | ||
showColabLinks, | ||
}) => { | ||
const [integrationIndex, setIntegrationIndex] = useState<number>(0); | ||
const integration = integrationList[integrationIndex]; | ||
export type FrameworkIntegrationsProps = Omit< | ||
FrameworkIntegrationsContentProps, | ||
"apiKey" | "showColabLinks" | ||
>; | ||
const FrameworkIntegrations: React.FC<FrameworkIntegrationsProps> = (props) => { | ||
const FrameworkIntegrations = usePluginsStore( | ||
(state) => state.FrameworkIntegrations, | ||
); | ||
|
||
return ( | ||
<div className="m-auto flex w-full max-w-[1250px] gap-6"> | ||
<div className="sticky top-20 flex w-[250px] shrink-0 flex-col gap-4 self-start"> | ||
<h4 className="comet-title-s">Select framework</h4> | ||
<ul className="flex flex-col gap-2"> | ||
{integrationList.map((item, index) => ( | ||
<li | ||
key={item.label} | ||
className="comet-body-s flex h-10 w-full cursor-pointer items-center gap-2 rounded-md pl-2 pr-4 text-foreground hover:bg-primary-foreground data-[status=active]:bg-primary-100" | ||
onClick={() => setIntegrationIndex(index)} | ||
data-status={index === integrationIndex ? "active" : "inactive"} | ||
> | ||
<img | ||
alt={item.label} | ||
src={item.logo} | ||
className="size-[32px] shrink-0" | ||
/> | ||
<div className="ml-1 truncate">{item.label}</div> | ||
</li> | ||
))} | ||
</ul> | ||
<Button className="w-fit pl-2" variant="ghost" asChild> | ||
<a | ||
href={buildDocsUrl("/tracing/integrations/overview")} | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
Explore all integrations | ||
<SquareArrowOutUpRight className="ml-2 size-4 shrink-0" /> | ||
</a> | ||
</Button> | ||
</div> | ||
<div className="flex min-w-[650px] flex-1 gap-6"> | ||
<div className="flex w-full flex-1 flex-col"> | ||
<IntegrationTemplate code={integration.code} apiKey={apiKey} /> | ||
</div> | ||
if (FrameworkIntegrations) { | ||
return <FrameworkIntegrations {...props} />; | ||
} | ||
|
||
<div className="sticky top-20 flex w-[250px] shrink-0 flex-col gap-6 self-start"> | ||
{apiKey && <ApiKeyCard apiKey={apiKey} />} | ||
{showColabLinks ? <GoogleColabCard link={integration.colab} /> : null} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
return <FrameworkIntegrationsContent {...props} />; | ||
}; | ||
|
||
export default FrameworkIntegrations; |
87 changes: 87 additions & 0 deletions
87
...components/pages-shared/onboarding/FrameworkIntegrations/FrameworkIntegrationsContent.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,87 @@ | ||
import React, { useState } from "react"; | ||
import { FrameworkIntegration } from "./types"; | ||
import { Button } from "@/components/ui/button"; | ||
import { buildDocsUrl } from "@/lib/utils"; | ||
import { SquareArrowOutUpRight } from "lucide-react"; | ||
import ApiKeyCard from "../ApiKeyCard/ApiKeyCard"; | ||
import GoogleColabCard from "../GoogleColabCard/GoogleColabCard"; | ||
import IntegrationTemplate from "./IntegrationTemplate"; | ||
import { QUICKSTART_INTEGRATIONS } from "./quickstart-integrations"; | ||
import { cn } from "@/lib/utils"; | ||
|
||
export type FrameworkIntegrationsContentProps = { | ||
integrationList?: FrameworkIntegration[]; | ||
apiKey?: string; | ||
showColabLinks?: boolean; | ||
stickyOffset?: number; | ||
}; | ||
const FrameworkIntegrationsContent: React.FC< | ||
FrameworkIntegrationsContentProps | ||
> = ({ | ||
integrationList = QUICKSTART_INTEGRATIONS, | ||
apiKey, | ||
showColabLinks, | ||
stickyOffset = 0, | ||
}) => { | ||
const [integrationIndex, setIntegrationIndex] = useState<number>(0); | ||
const integration = integrationList[integrationIndex]; | ||
|
||
const stickyOffsetStyle = `top-${stickyOffset}`; | ||
|
||
return ( | ||
<div className="m-auto flex w-full max-w-[1250px] gap-6"> | ||
<div | ||
className={cn( | ||
"sticky flex w-[250px] shrink-0 flex-col gap-4 self-start", | ||
stickyOffsetStyle, | ||
)} | ||
> | ||
<h4 className="comet-title-s">Select framework</h4> | ||
<ul className="flex flex-col gap-2"> | ||
{integrationList.map((item, index) => ( | ||
<li | ||
key={item.label} | ||
className="comet-body-s flex h-10 w-full cursor-pointer items-center gap-2 rounded-md pl-2 pr-4 text-foreground hover:bg-primary-foreground data-[status=active]:bg-primary-100" | ||
onClick={() => setIntegrationIndex(index)} | ||
data-status={index === integrationIndex ? "active" : "inactive"} | ||
> | ||
<img | ||
alt={item.label} | ||
src={item.logo} | ||
className="size-[32px] shrink-0" | ||
/> | ||
<div className="ml-1 truncate">{item.label}</div> | ||
</li> | ||
))} | ||
</ul> | ||
<Button className="w-fit pl-2" variant="ghost" asChild> | ||
<a | ||
href={buildDocsUrl("/tracing/integrations/overview")} | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
Explore all integrations | ||
<SquareArrowOutUpRight className="ml-2 size-4 shrink-0" /> | ||
</a> | ||
</Button> | ||
</div> | ||
<div className="flex min-w-[650px] flex-1 gap-6"> | ||
<div className="flex w-full flex-1 flex-col"> | ||
<IntegrationTemplate code={integration.code} apiKey={apiKey} /> | ||
</div> | ||
|
||
<div | ||
className={cn( | ||
"sticky flex w-[250px] shrink-0 flex-col gap-6 self-start", | ||
stickyOffsetStyle, | ||
)} | ||
> | ||
{apiKey && <ApiKeyCard apiKey={apiKey} />} | ||
{showColabLinks ? <GoogleColabCard link={integration.colab} /> : null} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FrameworkIntegrationsContent; |
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
24 changes: 24 additions & 0 deletions
24
apps/opik-frontend/src/components/shared/SideDialog/SideDialog.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,24 @@ | ||
import React from "react"; | ||
import { Sheet, SheetContent } from "@/components/ui/sheet"; | ||
|
||
type SideDialogProps = { | ||
open: boolean; | ||
setOpen: (open: boolean) => void; | ||
children: React.ReactNode; | ||
}; | ||
|
||
const SideDialog: React.FunctionComponent<SideDialogProps> = ({ | ||
open, | ||
setOpen, | ||
children, | ||
}) => { | ||
return ( | ||
<Sheet open={open} onOpenChange={setOpen}> | ||
<SheetContent className="w-[calc(100vw-60px)] sm:max-w-full xl:w-[calc(100vw-240px)]"> | ||
{children} | ||
</SheetContent> | ||
</Sheet> | ||
); | ||
}; | ||
|
||
export default SideDialog; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We already have a similar component
ResizableSidePanel
. This and existing ones are used for different purposes, so you can either: