-
Notifications
You must be signed in to change notification settings - Fork 563
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
CTA for embeddings and model evaluation #5110
Open
imanjra
wants to merge
3
commits into
release/v1.1.0
Choose a base branch
from
feat/panel-cta
base: release/v1.1.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+349
−246
Open
Changes from all commits
Commits
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
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
182 changes: 182 additions & 0 deletions
182
app/packages/components/src/components/PanelCTA/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,182 @@ | ||
import { constants } from "@fiftyone/utilities"; | ||
import { OpenInNew, West } from "@mui/icons-material"; | ||
import { | ||
Box, | ||
Button, | ||
Card, | ||
IconProps, | ||
Stack, | ||
Typography, | ||
TypographyProps, | ||
useTheme, | ||
} from "@mui/material"; | ||
import React, { FunctionComponent } from "react"; | ||
import MuiButton from "../MuiButton"; | ||
import MuiIconFont from "../MuiIconFont"; | ||
|
||
const { IS_APP_MODE_FIFTYONE, BOOK_A_DEMO_LINK, TRY_IN_BROWSER_LINK } = | ||
constants; | ||
|
||
export default function PanelCTA(props: PanelCTAProps) { | ||
const { | ||
demoLabel, | ||
demoDescription, | ||
demoCaption, | ||
Actions, | ||
caption, | ||
description, | ||
docCaption, | ||
docLink, | ||
icon: Icon, | ||
iconProps = {}, | ||
label, | ||
mode, | ||
name, | ||
onBack, | ||
} = props; | ||
const theme = useTheme(); | ||
const isDefault = mode === "default"; | ||
const computedLabel = IS_APP_MODE_FIFTYONE ? demoLabel || label : label; | ||
const computedDescription = IS_APP_MODE_FIFTYONE | ||
? demoDescription || description | ||
: description; | ||
const computedCaption = IS_APP_MODE_FIFTYONE | ||
? demoCaption || caption | ||
: caption; | ||
|
||
return ( | ||
<Stack spacing={1} sx={{ height: "100%", p: 2 }}> | ||
{isDefault && ( | ||
<Box> | ||
<Button onClick={onBack} startIcon={<West />} color="secondary"> | ||
Back to {name} | ||
</Button> | ||
</Box> | ||
)} | ||
<Card | ||
sx={{ | ||
position: "relative", | ||
height: "100%", | ||
display: "flex", | ||
justifyContent: "center", | ||
minHeight: 320, | ||
}} | ||
> | ||
<Stack sx={{ maxWidth: "85%" }}> | ||
<Stack | ||
spacing={1} | ||
sx={{ | ||
height: "100%", | ||
alignItems: "center", | ||
justifyContent: "space-between", | ||
py: 2, | ||
}} | ||
> | ||
<Stack | ||
sx={{ | ||
height: "100%", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
}} | ||
> | ||
{typeof Icon === "string" && ( | ||
<MuiIconFont | ||
sx={{ | ||
fontSize: 64, | ||
color: theme.palette.custom.primarySoft, | ||
marginBottom: 2, | ||
}} | ||
{...(iconProps as IconProps)} | ||
name={Icon} | ||
/> | ||
)} | ||
{Boolean(Icon) && typeof Icon !== "string" && Icon} | ||
<TypographyOrNode variant="h6">{computedLabel}</TypographyOrNode> | ||
<TypographyOrNode color="secondary"> | ||
{computedDescription} | ||
</TypographyOrNode> | ||
<TypographyOrNode sx={{ color: theme.palette.text.tertiary }}> | ||
{computedCaption} | ||
</TypographyOrNode> | ||
{!IS_APP_MODE_FIFTYONE && ( | ||
<Box pt={1}>{Actions && <Actions {...props} />}</Box> | ||
)} | ||
{IS_APP_MODE_FIFTYONE && ( | ||
<Stack direction="row" spacing={2} pt={2}> | ||
<MuiButton | ||
variant="contained" | ||
color="primary" | ||
href={BOOK_A_DEMO_LINK} | ||
target="_blank" | ||
> | ||
Book a demo | ||
</MuiButton> | ||
<MuiButton | ||
variant="contained" | ||
color="primary" | ||
href={TRY_IN_BROWSER_LINK} | ||
target="_blank" | ||
> | ||
Try in browser | ||
</MuiButton> | ||
</Stack> | ||
)} | ||
</Stack> | ||
{docLink && ( | ||
<Stack | ||
spacing={1} | ||
sx={{ alignItems: "center", justifyContent: "center" }} | ||
> | ||
{docCaption && ( | ||
<Typography color="secondary"> | ||
{docCaption || "Not ready to upgrade yet?"} | ||
</Typography> | ||
)} | ||
<MuiButton | ||
variant="outlined" | ||
endIcon={<OpenInNew sx={{ fontSize: "16px!important" }} />} | ||
href={docLink} | ||
target="_blank" | ||
> | ||
View documentation | ||
</MuiButton> | ||
</Stack> | ||
)} | ||
</Stack> | ||
</Stack> | ||
</Card> | ||
</Stack> | ||
); | ||
} | ||
|
||
function TypographyOrNode(props: TypographyProps) { | ||
const { children, ...otherProps } = props; | ||
|
||
if (typeof children === "string") { | ||
return <Typography {...otherProps}>{children}</Typography>; | ||
} | ||
|
||
if (React.isValidElement(children)) { | ||
return children; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
export type PanelCTAProps = { | ||
Actions?: FunctionComponent<any>; | ||
caption?: string | React.ReactNode; | ||
description?: string | React.ReactNode; | ||
docCaption?: string; | ||
docLink?: string; | ||
icon?: string | React.ReactNode; | ||
iconProps?: IconProps; | ||
label: string | React.ReactNode; | ||
mode?: "onboarding" | "default"; | ||
name: string; | ||
onBack: () => void; | ||
panelProps?: any; | ||
demoLabel?: string; | ||
demoDescription?: string; | ||
demoCaption?: string; | ||
}; | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { type AdaptiveMenuItemComponentPropsType } from "./AdaptiveMenu"; | ||
export { type PanelCTAProps } from "./PanelCTA"; |
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
55 changes: 0 additions & 55 deletions
55
...packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/EmptyOverview.tsx
This file was deleted.
Oops, something went wrong.
21 changes: 6 additions & 15 deletions
21
app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluate.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
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.
🛠️ Refactor suggestion
Improve type definitions for better type safety.
The type definitions could be improved in several ways:
📝 Committable suggestion