Skip to content

Commit 4a792db

Browse files
committed
more clean up
1 parent 79146a6 commit 4a792db

3 files changed

Lines changed: 20 additions & 7 deletions

File tree

packages/react/src/modules/guide/components/Toolbar/V2/GuideHoverCard.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ export const GuideHoverCard = ({
2020
return <Stack align="center">{children}</Stack>;
2121
}
2222

23-
const { annotation: _, ...rest } = guide;
23+
// Prune out internal or legacy fields.
24+
const {
25+
annotation: _annotation,
26+
activation_location_rules: _activation_location_rules,
27+
priority: _priority,
28+
...rest
29+
} = guide;
2430

2531
return (
2632
<HoverCard.Root>

packages/react/src/modules/guide/components/Toolbar/V2/GuideRow.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import { CheckCircle2, CircleDashed, Eye, UserCircle2 } from "lucide-react";
77
import * as React from "react";
88

99
import { GuideHoverCard } from "./GuideHoverCard";
10-
import { AnnotatedGuide, UnknownGuide } from "./useInspectGuideClientStore";
10+
import {
11+
AnnotatedGuide,
12+
UnknownGuide,
13+
isUnknownGuide,
14+
} from "./useInspectGuideClientStore";
1115

1216
const Row = ({ children }: React.PropsWithChildren) => (
1317
<Stack h="7" px="2" borderTop="px" justify="space-between" align="center">
@@ -40,15 +44,14 @@ export const GuideRow = ({ guide, orderIndex }: Props) => {
4044

4145
<Stack justify="flex-end">
4246
<Stack gap="1">
43-
{guide.__typename === "Guide" && (
47+
{!isUnknownGuide(guide) && (
4448
<>
4549
<Tooltip
4650
label={
4751
guide.annotation.targetable.status
48-
? "This user is targeted"
52+
? "This user is being targeted"
4953
: guide.annotation.targetable.message
5054
}
51-
// enabled={!guide.annotation.targetable.status}
5255
>
5356
<Button
5457
px="1"
@@ -61,7 +64,7 @@ export const GuideRow = ({ guide, orderIndex }: Props) => {
6164
<Tooltip
6265
label={
6366
guide.annotation.archived.status
64-
? "User has already archived this guide"
67+
? "User has already dismissed this guide"
6568
: "User has not dismissed this guide"
6669
}
6770
>
@@ -77,7 +80,7 @@ export const GuideRow = ({ guide, orderIndex }: Props) => {
7780
)}
7881
<Tooltip
7982
label={
80-
guide.__typename === "UnknownGuide"
83+
isUnknownGuide(guide)
8184
? "This guide has never been committed and published yet"
8285
: !guide.active
8386
? "This guide is not active"

packages/react/src/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ type GuideAnnotation = AnnotatedStatuses & {
4141

4242
export type AnnotatedGuide = KnockGuide & {
4343
annotation: GuideAnnotation;
44+
45+
// Legacy fields, typed only to make tsc happy when we prune these out.
46+
activation_location_rules?: KnockGuide["activation_url_patterns"];
47+
priority?: number;
4448
};
4549

4650
// Exists and ordered in control but absent in switchboard (therefore not

0 commit comments

Comments
 (0)