-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathGuideRow.tsx
More file actions
106 lines (101 loc) · 3.13 KB
/
GuideRow.tsx
File metadata and controls
106 lines (101 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import { Button } from "@telegraph/button";
import { Stack } from "@telegraph/layout";
import { Tag } from "@telegraph/tag";
import { Tooltip } from "@telegraph/tooltip";
import { Text } from "@telegraph/typography";
import { CheckCircle2, CircleDashed, Eye, UserCircle2 } from "lucide-react";
import * as React from "react";
import { GuideHoverCard } from "./GuideHoverCard";
import {
AnnotatedGuide,
UnknownGuide,
isUnknownGuide,
} from "./useInspectGuideClientStore";
const Row = ({ children }: React.PropsWithChildren) => (
<Stack h="7" px="2" borderTop="px" justify="space-between" align="center">
{children}
</Stack>
);
type Props = {
guide: UnknownGuide | AnnotatedGuide;
orderIndex: number;
};
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"}>
{guide.key}
</Text>
</GuideHoverCard>
</Stack>
<Stack justify="flex-end">
<Stack gap="1">
{!isUnknownGuide(guide) && (
<>
<Tooltip
label={
guide.annotation.targetable.status
? "This user is being targeted"
: guide.annotation.targetable.message
}
>
<Button
px="1"
size="1"
variant="soft"
color={guide.annotation.targetable.status ? "green" : "red"}
leadingIcon={{ icon: UserCircle2, alt: "Target" }}
/>
</Tooltip>
<Tooltip
label={
guide.annotation.archived.status
? "User has already dismissed this guide"
: "User has not dismissed this guide"
}
>
<Button
px="1"
size="1"
variant="soft"
color={guide.annotation.archived.status ? "red" : "green"}
leadingIcon={{ icon: Eye, alt: "Not archived" }}
/>
</Tooltip>
</>
)}
<Tooltip
label={
isUnknownGuide(guide)
? "This guide has never been committed and published yet"
: !guide.active
? "This guide is not active"
: "This guide is active"
}
>
<Button
px="1"
size="1"
variant="soft"
color={guide.active ? "green" : "red"}
leadingIcon={
guide.active
? { icon: CheckCircle2, alt: "Active" }
: { icon: CircleDashed, alt: "Inactive" }
}
/>
</Tooltip>
</Stack>
</Stack>
</Row>
);
};