-
Notifications
You must be signed in to change notification settings - Fork 14
feat: add GuideContextDetails to guide toolbar v2 #870
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
Changes from all commits
ce76367
77c1839
0aecaa4
39253e9
56dde68
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,8 @@ | ||
| --- | ||
| "@knocklabs/react": patch | ||
| "guide-example": patch | ||
| "@knocklabs/client": patch | ||
| "@knocklabs/react-core": patch | ||
| --- | ||
|
|
||
| [guides] add guide toolbar v2 poc |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| import { useGuideContext, useStore } from "@knocklabs/react-core"; | ||
| import { Box, Stack } from "@telegraph/layout"; | ||
| import { Text } from "@telegraph/typography"; | ||
| import { ChevronDown, ChevronRight } from "lucide-react"; | ||
| import * as React from "react"; | ||
|
|
||
| export const GuideContextDetails = () => { | ||
| const { client } = useGuideContext(); | ||
| const [isExpanded, setIsExpanded] = React.useState(false); | ||
|
|
||
| const defaultGroup = useStore(client.store, (state) => state.guideGroups[0]); | ||
| const displayInterval = defaultGroup?.display_interval ?? null; | ||
|
|
||
| return ( | ||
| <Stack direction="column" borderTop="px"> | ||
| <Stack | ||
| h="5" | ||
| px="2" | ||
| bg="gray-3" | ||
| align="center" | ||
| gap="1" | ||
| style={{ cursor: "pointer" }} | ||
| onClick={() => setIsExpanded((prev) => !prev)} | ||
| > | ||
| <Text as="span" size="0" weight="medium"> | ||
| Details | ||
| </Text> | ||
| {isExpanded ? <ChevronDown size={12} /> : <ChevronRight size={12} />} | ||
| </Stack> | ||
|
|
||
| {isExpanded && ( | ||
| <Stack direction="column"> | ||
| <Stack direction="column" gap="0_5" py="1" px="2" borderTop="px"> | ||
| <Text as="span" size="0" weight="medium"> | ||
| Throttle | ||
| </Text> | ||
| <Text as="code" size="0"> | ||
| {displayInterval === null ? "-" : `Every ${displayInterval}s`} | ||
| </Text> | ||
| </Stack> | ||
|
|
||
| <Stack direction="column" py="1" px="2" borderTop="px"> | ||
| <Text as="span" size="0" weight="medium"> | ||
| Target params | ||
| </Text> | ||
| <Stack direction="column" gap="0_5" mt="1"> | ||
| <Text as="span" size="0" color="gray"> | ||
| Tenant | ||
| </Text> | ||
| <Text as="code" size="0"> | ||
| {client.targetParams.tenant ? ( | ||
| <Box | ||
| rounded="2" | ||
| overflow="auto" | ||
| backgroundColor="gray-2" | ||
| border="px" | ||
| style={{ maxHeight: "200px" }} | ||
| > | ||
| <pre style={{ fontSize: "11px", margin: 0 }}> | ||
| <code>{client.targetParams.tenant}</code> | ||
| </pre> | ||
| </Box> | ||
| ) : ( | ||
| <Text as="code" size="0"> | ||
| - | ||
| </Text> | ||
| )} | ||
| </Text> | ||
| </Stack> | ||
|
|
||
| <Stack direction="column" gap="0_5"> | ||
| <Text as="span" size="0" color="gray"> | ||
| Data | ||
| </Text> | ||
| {client.targetParams.data ? ( | ||
| <Box | ||
| rounded="2" | ||
| overflow="auto" | ||
| backgroundColor="gray-2" | ||
| border="px" | ||
| style={{ maxHeight: "200px" }} | ||
| > | ||
| <pre style={{ fontSize: "11px", margin: 0 }}> | ||
| <code> | ||
| {JSON.stringify(client.targetParams.data, null, 2)} | ||
| </code> | ||
| </pre> | ||
| </Box> | ||
| ) : ( | ||
| <Text as="code" size="0"> | ||
| - | ||
| </Text> | ||
| )} | ||
| </Stack> | ||
| </Stack> | ||
| </Stack> | ||
| )} | ||
| </Stack> | ||
| ); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,20 +34,20 @@ type Props = { | |
| export const GuideRow = ({ guide, orderIndex }: Props) => { | ||
| return ( | ||
| <Row> | ||
| <Stack h="6" justify="flex-start" align="center" gap="2"> | ||
| <Tag | ||
| size="0" | ||
| variant="soft" | ||
| color={guide.bypass_global_group_limit ? "blue" : "default"} | ||
| > | ||
| {orderIndex + 1} | ||
| </Tag> | ||
| <GuideHoverCard guide={guide}> | ||
| <Text as="code" size="1" color={guide.active ? "black" : "disabled"}> | ||
| <GuideHoverCard guide={guide}> | ||
| <Stack h="6" justify="flex-start" align="center" gap="2"> | ||
| <Tag | ||
| size="0" | ||
| variant="soft" | ||
| color={guide.bypass_global_group_limit ? "blue" : "default"} | ||
| > | ||
| {orderIndex + 1} | ||
| </Tag> | ||
| <Text as="code" size="1"> | ||
|
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. Guide key text lost active/inactive color distinctionMedium Severity The
Contributor
Author
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. Nope, intentional. |
||
| {guide.key} | ||
| </Text> | ||
| </GuideHoverCard> | ||
| </Stack> | ||
| </Stack> | ||
| </GuideHoverCard> | ||
|
|
||
| <Stack justify="flex-end"> | ||
| {!isUnknownGuide(guide) && ( | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.